LoadTestAdministrationClient.GetServerMetricsConfig メソッド

定義

指定されたテストのサーバー メトリック構成を一覧表示します。

public virtual Azure.Response GetServerMetricsConfig (string testId, Azure.RequestContext context = default);
abstract member GetServerMetricsConfig : string * Azure.RequestContext -> Azure.Response
override this.GetServerMetricsConfig : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetServerMetricsConfig (testId As String, Optional context As RequestContext = Nothing) As Response

パラメーター

testId
String

ロード テストの一意の名前には、小文字のアルファベット、数字、アンダースコア、またはハイフン文字のみを含める必要があります。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

サービスから返された応答。 応答本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

testId が null です。

testId は空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターを使用して GetServerMetricsConfig を呼び出し、結果を解析する方法を示します。

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

Response response = client.GetServerMetricsConfig("<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());

注釈

応答ペイロードの JSON スキーマを次に示します。

応答本文:

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.
}

適用対象