Megosztás a következőn keresztül:


LoadTestAdministrationClient.GetServerMetricsConfigAsync Method

Definition

List server metrics configuration for the given test.

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)

Parameters

testId
String

Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service. Details of the response body schema are in the Remarks section below.

Exceptions

testId is null.

testId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetServerMetricsConfigAsync with required parameters and parse the result.

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());

Remarks

Below is the JSON schema for the response payload.

Response Body:

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

Applies to