Creates an instance of MetricsAdvisorClient.
Example usage:
import { MetricsAdvisorClient, MetricsAdvisorKeyCredential } from "@azure/ai-metrics-advisor";
const client = new MetricsAdvisorClient(
"<service endpoint>",
new MetricsAdvisorKeyCredential("<subscription key>", "<api key>")
);
Url to an Azure Metrics Advisor service endpoint
Used to authenticate requests to the service.
Url to service endpoint
Creates a metric feedback.
content of the feedback
The options parameter
Gets the root causes of an incident.
Anomaly detection configuration id
Incident id
The options parameter
Retrieves enriched metric series data for a detection configuration
Anomaly detection configuration id
The start of time range to query metric enriched series data
The end of time range to query metric enriched series data
Series to retrieve their data
The options parameter.
Retrives a metric feedback for the given feedback id.
Id of the feedback to retrieve
The options parameter
Gets the time series data for a metric
Metric id
The start of the time range to retrieve series data
The end of the time range to retrieve series data
A list of time series to retrieve their data
The optiosn parameter
Returns an async iterable iterator to list alerts for an alert configuration.
.byPage()
returns an async iterable iterator to list the alerts in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey)
);
const alerts = client.listAlertsForAlertConfiguration(alertConfigId,
startTime, endTime, timeMode
);
let i = 1;
for await (const alert of alerts) {
console.log(`alert ${i++}:`);
console.log(alert);
}
Example using iter.next()
:
let iter = client.listAlertsForAlertConfiguration(alertConfigId, startTime, endTime, timeMode);
let result = await iter.next();
while (!result.done) {
console.log(` alert - ${result.value.id}`);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listAlertsForAlertConfiguration(alertConfigId, startTime, endTime, timeMode)
.byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.alerts) {
console.log(`-- page ${i++}`);
for (const alert of page.value.alerts) {
console.log(`${alert}`);
}
}
page = await pages.next();
}
anomaly alerting configuration unique id
The start of time range to query alert items for alerting configuration
The end of time range to query alert items for alerting configuration
Query time mode - "AnomalyTime" | "CreatedTime" | "ModifiedTime"
The options parameter.
Returns an async iterable iterator to list anamolies associated with an alert
.byPage()
returns an async iterable iterator to list the anomalies in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const anamolyList = client.listAnomaliesForAlert(alertConfigId, alertId);
let i = 1;
for await (const anamoly of anamolyList){
console.log(`anamoly ${i++}:`);
console.log(anamoly);
}
Example using iter.next()
:
let iter = client.listAnomaliesForAlert(alertConfigId, alertId);
let result = await iter.next();
while (!result.done) {
console.log(` anamoly - ${result.value.metricId}, ${result.value.detectionConfigurationId} `);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listAnomaliesForAlert(alertConfigId, alertId).byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.anomalies) {
console.log(`-- page ${i++}`);
for (const anomaly of page.value.anomalies) {
console.log(`${anomaly}`);
}
}
page = await pages.next();
}
Anomaly alert configuration id
Alert id
The options parameter.
Returns an async iterable iterator to list anomalies for a detection configuration.
.byPage()
returns an async iterable iterator to list the anomalies in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const anomalies = client.listAnomaliesForDetectionConfiguration(detectionConfigId, startTime, endTime);
let i = 1;
for await (const anomaly of anomalies) {
console.log(`anomaly ${i++}:`);
console.log(anomaly);
}
Example using iter.next()
:
let iter = client.listAnomaliesForDetectionConfiguration(detectionConfigId, startTime, endTime);
let result = await iter.next();
while (!result.done) {
console.log(` anomaly - ${result.value.severity} ${result.value.status}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listAnomaliesForDetectionConfiguration(detectionConfigId, startTime, endTime)
.byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.anomalies) {
console.log(`-- page ${i++}`);
for (const anomaly of page.value.anomalies) {
console.dir(anomaly);
}
}
page = await pages.next();
}
Anomaly detection configuration id
The start of time range to query anomalies
The end of time range to query anomalies
The options parameter.
Returns an async iterable iterator to list dimension values for a detection configuration.
.byPage()
returns an async iterable iterator to list the dimension values in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const dimensionValues = client
.listDimensionValuesForDetectionConfiguration(detectionConfigId, startTime, endTime, dimensionName);
let i = 1;
for await (const dv of dimensionValues) {
console.log(`dimension value ${i++}: ${dv}`);
Example using iter.next()
:
let iter = client
.listDimensionValuesForDetectionConfiguration(detectionConfigId, startTime, endTime, dimensionName);
let result = await iter.next();
while (!result.done) {
console.log(` dimension value - '${result.value}'`);
result = await iter.next();
}
Example using byPage()
:
const pages = client
.listDimensionValuesForDetectionConfiguration(
detectionConfigId,
startTime,
endTime,
dimensionName
)
.byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.dimensionValues) {
console.log(`-- page ${i++}`);
for (const dv of page.value.dimensionValues) {
console.log(` dimension value - '${result.value}'`);
}
}
page = await pages.next();
}
Anomaly detection configuration id
The start of time range to query anomalies
The end of time range to query anomalies
The options parameter.
Returns an async iterable iterator to list incidents associated with an alert
.byPage()
returns an async iterable iterator to list the incidents in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const incidentList = client.listIncidentsForAlert(alertConfigId, alertId);
let i = 1;
for await (const incident of incidentList){
console.log(`incident ${i++}:`);
console.log(incident);
}
Example using iter.next()
:
let iter = client.listIncidentsForAlert(alertConfigId, alertId);
let result = await iter.next();
while (!result.done) {
console.log(` incident - ${result.value.id}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listIncidentsForAlert(alertConfigId, alertId).byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.incidents) {
console.log(`-- page ${i++}`);
for (const incident of page.value.incidents) {
console.dir(incident);
}
}
page = await pages.next();
}
Anomaly alert configuration id
Alert id
The options parameter.
Returns an async iterable iterator to list incidents for an anomaly detection configuration.
.byPage()
returns an async iterable iterator to list the incidents in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const incidentList = client
.listIncidentsForDetectionConfiguration(detectionConfigId, startTime, endTime);
let i = 1;
for await (const incident of incidentList){
console.log(`incident ${i++}:`);
console.log(incident);
}
Example using iter.next()
:
let iter = client.listIncidentsForDetectionConfiguration(detectionConfigId, startTime, endTime);
let result = await iter.next();
while (!result.done) {
console.log(` incident - ${result.value.id}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listIncidentsForDetectionConfiguration(detectionConfigId, startTime, endTime)
.byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.incidents) {
console.log(`-- page ${i++}`);
for (const incident of page.value.incidents) {
console.dir(incident);
}
}
page = await pages.next();
}
Anomaly detection configuration id
The start of time range to query for incidents
The end of time range to query for incidents
The options parameter.
Returns an async iterable iterator to list all the values for a metric dimension.
.byPage()
returns an async iterable iterator to list the values in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const values = client.listMetricDimensionValues(metricId, dimensionName);
let i = 1;
for await (const v of values){
console.log(`dimension value ${i++}:`);
console.log(v);
}
Example using iter.next()
:
let iter = client.listMetricDimensionValues(metricId, dimensionName);
let result = await iter.next();
while (!result.done) {
console.log(` dimension value - ${result.value}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listMetricDimensionValues(metricId, dimensionName).byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.dimensionValues) {
console.log(`-- page ${i++}`);
for (const dv of page.value.dimensionValues) {
console.dir(dv);
}
}
page = await pages.next();
}
Anomaly detection configuration id
Name of the dimension to list value
The options parameter.
Returns an async iterable iterator to list incidents for an anomaly detection configuration.
.byPage()
returns an async iterable iterator to list the incidents in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const statusList = client.listMetricEnrichmentStatus(metricId, startTime, endTime);
let i = 1;
for await (const status of statusList){
console.log(`enrichment status ${i++}:`);
console.log(status);
}
Example using iter.next()
:
let iter = client.listMetricEnrichmentStatus(metricId, startTime, endTime);
let result = await iter.next();
while (!result.done) {
console.log(` enrichment status - ${result.value.status} ${result.value.message}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listMetricEnrichmentStatus(metricId, startTime, endTime)
.byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.statusList) {
console.log(`-- page ${i++}`);
for (const status of page.value.statusList) {
console.dir(status);
}
}
page = await pages.next();
}
Metric id
The start of time range to query for enrichment status
The end of time range to query for enrichment status
The options parameter.
Returns an async iterable iterator to list feedbacks for a metric.
.byPage()
returns an async iterable iterator to list the feedbacks in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const feedbacks = client.listMetricFeedbacks(metricId);
let i = 1;
for await (const f of feedbacks){
console.log(`feedback ${i++}:`);
console.log(f);
}
Example using iter.next()
:
let iter = client.listMetricFeedbacks(metricId);
let result = await iter.next();
while (!result.done) {
console.log(` feedback - ${result.value.id}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listMetricFeedbacks(metricId)
.byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.feedbacks) {
console.log(`-- page ${i++}`);
for (const f of page.value.feedbacks) {
console.dir(f);
}
}
page = await pages.next();
}
Metric id
The options parameter
Returns an async iterable iterator to list series definitions (dimension combinations) for a metric.
.byPage()
returns an async iterable iterator to list the series definitions in pages.
Example using for await
syntax:
const client = new MetricsAdvisorClient(endpoint,
new MetricsAdvisorKeyCredential(subscriptionKey, apiKey));
const definitions = client.listMetricSeriesDefinitions(metricId, activeSince);
let i = 1;
for await (const definition of definitions){
console.log(`definition ${i++}:`);
console.log(definition);
}
Example using iter.next()
:
let iter = client.listMetricSeriesDefinitions(metricId, activeSince);
let result = await iter.next();
while (!result.done) {
console.log(` definition - ${result.value.metricId} ${result.value.dimension}`);
console.dir(result.value);
result = await iter.next();
}
Example using byPage()
:
const pages = client.listMetricSeriesDefinitions(metricId, activeSince).byPage({ maxPageSize: 10 });
let page = await pages.next();
let i = 1;
while (!page.done) {
if (page.value.definitions) {
console.log(`-- page ${i++}`);
for (const definition of page.value.definitions) {
console.dir(definition);
}
}
page = await pages.next();
}
Metric id
Definitions of series ingested after this time are returned
The options parameter.
Generated using TypeDoc
Client class for interacting with Azure Metrics Advisor Service to query alerts/incidents/anomalies, diagnose incidents, provide metric feedback