Partager via


LoadTestAdministrationClient.GetServerMetricsConfigAsync Méthode

Définition

Répertorier la configuration des métriques de serveur pour le test donné.

public virtual System.Threading.Tasks.Task<Azure.Response> GetServerMetricsConfigAsync (string testId, Azure.RequestContext context = default);
abstract member GetServerMetricsConfigAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetServerMetricsConfigAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetServerMetricsConfigAsync (testId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Paramètres

testId
String

Le nom unique du test de charge doit contenir uniquement des caractères alphabétiques, numériques, de soulignement ou de traits d’union en minuscules.

context
RequestContext

Contexte de la demande, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

Réponse retournée par le service. Les détails du schéma du corps de la réponse se trouvent dans la section Remarques ci-dessous.

Exceptions

testId a la valeur null.

testId est une chaîne vide et devait être non vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler GetServerMetricsConfigAsync avec les paramètres requis et analyser le résultat.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new LoadTestAdministrationClient(endpoint, credential);

Response response = await client.GetServerMetricsConfigAsync("<testId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("testId").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("metricNamespace").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("displayDescription").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("aggregation").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<test>").GetProperty("resourceType").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString());
Console.WriteLine(result.GetProperty("lastModifiedBy").ToString());

Remarques

Vous trouverez ci-dessous le schéma JSON pour la charge utile de réponse.

Corps de réponse :

Schéma pour TestServerMetricConfig:

{
  testId: string, # Optional. Test identifier
  metrics: Dictionary<string, ResourceMetric>, # Optional. Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id).
  createdDateTime: string (ISO 8601 Format), # Optional. The creation datetime(ISO 8601 literal format).
  createdBy: string, # Optional. The user that created.
  lastModifiedDateTime: string (ISO 8601 Format), # Optional. The last Modified datetime(ISO 8601 literal format).
  lastModifiedBy: string, # Optional. The user that last modified.
}

S’applique à