Condividi tramite


LoadTestAdministrationClient.GetServerMetricsConfig Method

Definition

Overloads

Name Description
GetServerMetricsConfig(String, CancellationToken)

List server metrics configuration for the given test.

GetServerMetricsConfig(String, RequestContext)

[Protocol Method] List server metrics configuration for the given test.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.

GetServerMetricsConfig(String, CancellationToken)

Source:
LoadTestAdministrationClient.cs

List server metrics configuration for the given test.

public virtual Azure.Response<Azure.Developer.LoadTesting.TestServerMetricsConfiguration> GetServerMetricsConfig(string testId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetServerMetricsConfig : string * System.Threading.CancellationToken -> Azure.Response<Azure.Developer.LoadTesting.TestServerMetricsConfiguration>
override this.GetServerMetricsConfig : string * System.Threading.CancellationToken -> Azure.Response<Azure.Developer.LoadTesting.TestServerMetricsConfiguration>
Public Overridable Function GetServerMetricsConfig (testId As String, Optional cancellationToken As CancellationToken = Nothing) As Response(Of TestServerMetricsConfiguration)

Parameters

testId
String

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

cancellationToken
CancellationToken

The cancellation token that can be used to cancel the operation.

Returns

Exceptions

testId is null.

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

Service returned a non-success status code.

Applies to

GetServerMetricsConfig(String, RequestContext)

Source:
LoadTestAdministrationClient.cs
Source:
LoadTestAdministrationClient.cs

[Protocol Method] List server metrics configuration for the given test.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Response GetServerMetricsConfig(string testId, Azure.RequestContext context = default);
public virtual Azure.Response GetServerMetricsConfig(string testId, Azure.RequestContext context);
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
Public Overridable Function GetServerMetricsConfig (testId As String, context As RequestContext) As 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 options, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

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 GetServerMetricsConfig and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential);

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

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

This sample shows how to call GetServerMetricsConfig with all parameters and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
LoadTestAdministrationClient 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("<key>").GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").GetProperty("metricNamespace").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").GetProperty("displayDescription").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").GetProperty("aggregation").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("metrics").GetProperty("<key>").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