From dcdc211647c1c8bc7ec13c348f87cbf8d0d61755 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Mon, 4 Oct 2021 15:19:00 -0700 Subject: [PATCH 1/4] fix sample on readme --- sdk/monitor/monitor-query/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/monitor/monitor-query/README.md b/sdk/monitor/monitor-query/README.md index 3edc1919e0dd..6b0cb237676a 100644 --- a/sdk/monitor/monitor-query/README.md +++ b/sdk/monitor/monitor-query/README.md @@ -551,10 +551,12 @@ 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, From f5f53dc8611395bf81682db2f0e6a82a9d0138d7 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Mon, 4 Oct 2021 15:37:07 -0700 Subject: [PATCH 2/4] update samples --- sdk/monitor/monitor-query/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sdk/monitor/monitor-query/README.md b/sdk/monitor/monitor-query/README.md index 6b0cb237676a..86beba363a5a 100644 --- a/sdk/monitor/monitor-query/README.md +++ b/sdk/monitor/monitor-query/README.md @@ -541,7 +541,7 @@ QueryMetricsResult ```ts import { DefaultAzureCredential } from "@azure/identity"; -import { Durations, Metric, MetricsQueryClient } from "@azure/monitor-query"; +import { Durations, Metric, MetricsQueryClient } from "../src/index"; import * as dotenv from "dotenv"; dotenv.config(); @@ -560,16 +560,18 @@ export async function main() { 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}, interval: ${metricsResponse.granularity}, time span: ${metricsResponse.timespan}` ); const metrics: Metric[] = metricsResponse.metrics; From a9ae06363fc41eaa6f4895e0c8331b17e4f60ecd Mon Sep 17 00:00:00 2001 From: KarishmaGhiya Date: Mon, 4 Oct 2021 17:51:31 -0700 Subject: [PATCH 3/4] Update sdk/monitor/monitor-query/README.md --- sdk/monitor/monitor-query/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/monitor-query/README.md b/sdk/monitor/monitor-query/README.md index 86beba363a5a..e8332136757e 100644 --- a/sdk/monitor/monitor-query/README.md +++ b/sdk/monitor/monitor-query/README.md @@ -541,7 +541,7 @@ QueryMetricsResult ```ts import { DefaultAzureCredential } from "@azure/identity"; -import { Durations, Metric, MetricsQueryClient } from "../src/index"; +import { Durations, Metric, MetricsQueryClient } from "@azure/monitor-query"; import * as dotenv from "dotenv"; dotenv.config(); From 20af4e923b266f899b5aef3ec50b6ecee0981156 Mon Sep 17 00:00:00 2001 From: KarishmaGhiya Date: Tue, 5 Oct 2021 10:52:32 -0700 Subject: [PATCH 4/4] Update sdk/monitor/monitor-query/README.md Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> --- sdk/monitor/monitor-query/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/monitor-query/README.md b/sdk/monitor/monitor-query/README.md index e8332136757e..6ee98f76c15c 100644 --- a/sdk/monitor/monitor-query/README.md +++ b/sdk/monitor/monitor-query/README.md @@ -571,7 +571,7 @@ export async function main() { ); console.log( - `Query cost: ${metricsResponse.cost}, interval: ${metricsResponse.granularity}, time span: ${metricsResponse.timespan}` + `Query cost: ${metricsResponse.cost}, granularity: ${metricsResponse.granularity}, time span: ${metricsResponse.timespan}` ); const metrics: Metric[] = metricsResponse.metrics;