public final class MetricsQueryAsyncClient extends Object
Instantiating an asynchronous Metrics query Client
MetricsQueryAsyncClient metricsQueryAsyncClient = new MetricsQueryClientBuilder() .credential(tokenCredential) .buildAsyncClient();
Modifier and Type | Method and Description |
---|---|
com.azure.core.http.rest.PagedFlux<MetricDefinition> |
listMetricDefinitions(String resourceUri)
Lists all the metrics definitions created for the resource URI.
|
com.azure.core.http.rest.PagedFlux<MetricDefinition> |
listMetricDefinitions(String resourceUri,
String metricsNamespace)
Lists all the metrics definitions created for the resource URI.
|
com.azure.core.http.rest.PagedFlux<MetricNamespace> |
listMetricNamespaces(String resourceUri,
OffsetDateTime startTime)
Lists all the metrics namespaces created for the resource URI.
|
Mono<MetricsQueryResult> |
query(String resourceUri,
List<String> metricsNames)
Returns all the Azure Monitor metrics requested for the resource.
|
Mono<com.azure.core.http.rest.Response<MetricsQueryResult>> |
queryWithResponse(String resourceUri,
List<String> metricsNames,
MetricsQueryOptions options)
Returns all the Azure Monitor metrics requested for the resource.
|
public Mono<MetricsQueryResult> query(String resourceUri, List<String> metricsNames)
Query metrics for an Azure resource
Mono<MetricsQueryResult> response = metricsQueryAsyncClient .query("{resource-id}", Arrays.asList("{metric-1}", "{metric-2}")); response.subscribe(result -> { for (MetricResult metricResult : result.getMetrics()) { System.out.println("Metric name " + metricResult.getMetricName()); metricResult.getTimeSeries().stream() .flatMap(timeSeriesElement -> timeSeriesElement.getValues().stream()) .forEach(metricValue -> System.out.println("Time stamp: " + metricValue.getTimeStamp() + "; Total: " + metricValue.getTotal())); } });
resourceUri
- The resource URI for which the metrics is requested.metricsNames
- The names of the metrics to query.public Mono<com.azure.core.http.rest.Response<MetricsQueryResult>> queryWithResponse(String resourceUri, List<String> metricsNames, MetricsQueryOptions options)
resourceUri
- The resource URI for which the metrics is requested.metricsNames
- The names of the metrics to query.options
- Options to filter the query.public com.azure.core.http.rest.PagedFlux<MetricNamespace> listMetricNamespaces(String resourceUri, OffsetDateTime startTime)
resourceUri
- The resource URI for which the metrics namespaces are listed.startTime
- The returned list of metrics namespaces are created after the specified start time.paged collection
of metrics namespaces.public com.azure.core.http.rest.PagedFlux<MetricDefinition> listMetricDefinitions(String resourceUri)
resourceUri
- The resource URI for which the metrics definitions are listed.paged collection
of metrics definitions.public com.azure.core.http.rest.PagedFlux<MetricDefinition> listMetricDefinitions(String resourceUri, String metricsNamespace)
resourceUri
- The resource URI for which the metrics definitions are listed.metricsNamespace
- The metrics namespace to which the listed metrics definitions belong.paged collection
of metrics definitions.Copyright © 2021 Microsoft Corporation. All rights reserved.