LoadTestRunClient.GetServerMetricsConfigAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetServerMetricsConfigAsync(String, RequestContext) |
[Protocol Method] Get associated server metrics configuration for the given test run.
|
GetServerMetricsConfigAsync(String, CancellationToken) |
Get associated server metrics configuration for the given test run. |
GetServerMetricsConfigAsync(String, RequestContext)
- Source:
- LoadTestRunClient.cs
- Source:
- LoadTestRunClient.cs
[Protocol Method] Get associated server metrics configuration for the given test run.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetServerMetricsConfigAsync(String, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> GetServerMetricsConfigAsync(string testRunId, Azure.RequestContext context = default);
public virtual System.Threading.Tasks.Task<Azure.Response> GetServerMetricsConfigAsync(string testRunId, Azure.RequestContext context);
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 (testRunId As String, Optional context As RequestContext = Nothing) As Task(Of Response)
Public Overridable Function GetServerMetricsConfigAsync (testRunId As String, context As RequestContext) As Task(Of Response)
Parameters
- testRunId
- String
Unique name for the load test run, 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.
Exceptions
testRunId
is null.
testRunId
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 and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
LoadTestRunClient client = new LoadTestRunClient(endpoint, credential);
Response response = await client.GetServerMetricsConfigAsync("<testRunId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call GetServerMetricsConfigAsync with all parameters and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
LoadTestRunClient client = new LoadTestRunClient(endpoint, credential);
Response response = await client.GetServerMetricsConfigAsync("<testRunId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("testRunId").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 TestRunServerMetricConfig
:
{
testRunId: string, # Optional. Test run 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
GetServerMetricsConfigAsync(String, CancellationToken)
- Source:
- LoadTestRunClient.cs
Get associated server metrics configuration for the given test run.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Developer.LoadTesting.TestRunServerMetricsConfiguration>> GetServerMetricsConfigAsync(string testRunId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetServerMetricsConfigAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Developer.LoadTesting.TestRunServerMetricsConfiguration>>
override this.GetServerMetricsConfigAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Developer.LoadTesting.TestRunServerMetricsConfiguration>>
Public Overridable Function GetServerMetricsConfigAsync (testRunId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of TestRunServerMetricsConfiguration))
Parameters
- testRunId
- String
Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
testRunId
is null.
testRunId
is an empty string, and was expected to be non-empty.