From d38c812f9f856da141ff8253bb51746d1b452276 Mon Sep 17 00:00:00 2001 From: KarishmaGhiya Date: Tue, 5 Oct 2021 11:04:44 -0700 Subject: [PATCH] fix sample on readme (#18022) --- sdk/monitor/monitor-query/README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sdk/monitor/monitor-query/README.md b/sdk/monitor/monitor-query/README.md index 3edc1919e0dd..6ee98f76c15c 100644 --- a/sdk/monitor/monitor-query/README.md +++ b/sdk/monitor/monitor-query/README.md @@ -551,23 +551,27 @@ export async function main() { const metricsQueryClient = new MetricsQueryClient(tokenCredential); if (!metricsResourceId) { - throw new Error("METRICS_RESOURCE_ID must be set in the environment for this sample"); + throw new Error( + "METRICS_RESOURCE_ID for an Azure Metrics Advisor subscription must be set in the environment for this sample" + ); } - console.log(`Picking an example metric to query: ${firstMetricName}`); + console.log(`Picking an example metric to query: MatchedEventCount`); const metricsResponse = await metricsQueryClient.queryResource( metricsResourceId, - { duration: Durations.fiveMinutes }, + ["MatchedEventCount"], { - metricNames: ["MatchedEventCount"], - interval: "PT1M", - aggregations: [AggregationType.Count] + timespan: { + duration: Durations.fiveMinutes + }, + granularity: "PT1M", + aggregations: ["Count"] } ); console.log( - `Query cost: ${metricsResponse.cost}, interval: ${metricsResponse.interval}, time span: ${metricsResponse.timespan}` + `Query cost: ${metricsResponse.cost}, granularity: ${metricsResponse.granularity}, time span: ${metricsResponse.timespan}` ); const metrics: Metric[] = metricsResponse.metrics;