Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MetricsAdvisorClient

Package version

Client class for interacting with Azure Metrics Advisor Service to query alerts/incidents/anomalies, diagnose incidents, provide metric feedback

Hierarchy

  • MetricsAdvisorClient

Index

Constructors

constructor

Properties

endpointUrl

endpointUrl: string

Url to service endpoint

Methods

createFeedback

getFeedback

getIncidentRootCauses

getMetricEnrichedSeriesData

getMetricSeriesData

listAlerts

  • 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.listAlerts(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.listAlerts(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.listAlerts(alertConfigId, startTime, endTime, timeMode)
      .byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
     if (page.value) {
       console.log(`-- page ${i++}`);
       for (const alert of page.value) {
         console.log(`${alert}`);
       }
     }
     page = await pages.next();
    }
    

    Parameters

    • alertConfigId: string

      Anomaly alerting configuration unique id

    • startTime: Date | string

      The start of time range to query alert items for alerting configuration

    • endTime: Date | string

      The end of time range to query alert items for alerting configuration

    • timeMode: AlertQueryTimeMode

      Query time mode - "AnomalyTime" | "CreatedTime" | "ModifiedTime"

    • Default value options: ListAlertsOptions = {}

      The options parameter.

    Returns PagedAsyncIterableIterator<AnomalyAlert, AlertsPageResponse>

listAnomalies

  • 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.listAnomalies({alertConfigId, id: alertId});
    let i = 1;
    for await (const anamoly of anamolyList){
     console.log(`anamoly ${i++}:`);
     console.log(anamoly);
    }

    Example using iter.next():

    let iter = client.listAnomalies({alertConfigId, id: 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.listAnomalies({alertConfigId, id: alertId}).byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
     if (page.value) {
       console.log(`-- page ${i++}`);
       for (const anomaly of page.value) {
         console.log(`${anomaly}`);
       }
     }
     page = await pages.next();
    }
    

    Parameters

    Returns PagedAsyncIterableIterator<DataPointAnomaly, AnomaliesPageResponse>

  • 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.listAnomalies(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.listAnomalies(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.listAnomalies(detectionConfigId, startTime, endTime)
      .byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
     if (page.value) {
       console.log(`-- page ${i++}`);
       for (const anomaly of page.value) {
         console.dir(anomaly);
       }
     }
     page = await pages.next();
    }
    

    Parameters

    • detectionConfigId: string

      Anomaly detection configuration id

    • startTime: Date | string

      The start of time range to query anomalies

    • endTime: Date | string

      The end of time range to query anomalies

    • Optional options: ListAnomaliesForDetectionConfigurationOptions

      The options parameter.

    Returns PagedAsyncIterableIterator<DataPointAnomaly, AnomaliesPageResponse>

listAnomalyDimensionValues

  • Returns an async iterable iterator to list dimension values of anomalies detected by 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
      .listAnomalyDimensionValues(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
      .listAnomalyDimensionValues(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
      .listAnomalyDimensionValues(
        detectionConfigId,
        startTime,
        endTime,
        dimensionName
      )
      .byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
      if (page.value) {
        console.log(`-- page ${i++}`);
        for (const dv of page.value) {
          console.log(` dimension value - '${result.value}'`);
        }
      }
      page = await pages.next();
    }

    Parameters

    • detectionConfigId: string

      Anomaly detection configuration id

    • startTime: Date | string

      The start of time range to query anomalies

    • endTime: Date | string

      The end of time range to query anomalies

    • dimensionName: string

      Name of the dimension for anomaly detection config

    • Default value options: ListAnomalyDimensionValuesOptions = {}

      The options parameter.

    Returns PagedAsyncIterableIterator<string, DimensionValuesPageResponse>

listFeedback

  • 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.listFeedback(metricId);
    let i = 1;
    for await (const f of feedbacks){
     console.log(`feedback ${i++}:`);
     console.log(f);
    }

    Example using iter.next():

    let iter = client.listFeedback(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.listFeedback(metricId)
      .byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
     if (page.value) {
       console.log(`-- page ${i++}`);
       for (const f of page.value) {
         console.dir(f);
       }
     }
     page = await pages.next();
    }

    Parameters

    • metricId: string

      Metric id

    • Default value options: ListFeedbackOptions = {}

      The options parameter

    Returns PagedAsyncIterableIterator<MetricFeedbackUnion, MetricFeedbackPageResponse>

listIncidents

  • 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.listIncidents(anomalyAlert);
    let i = 1;
    for await (const incident of incidentList){
      console.log(`incident ${i++}:`);
      console.log(incident);
    }

    Example using iter.next():

    let iter = client.listIncidents(anomalyAlert);
    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.listIncidents(anomalyAlert).byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
     if (page.value) {
       console.log(`-- page ${i++}`);
       for (const incident of page.value) {
         console.dir(incident);
       }
     }
     page = await pages.next();
    }

    Parameters

    Returns PagedAsyncIterableIterator<AnomalyIncident, IncidentsPageResponse>

  • 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
      .listIncidents(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.listIncidents(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.listIncidents(detectionConfigId, startTime, endTime)
      .byPage({ maxPageSize: 10 });
    let page = await pages.next();
    let i = 1;
    while (!page.done) {
     if (page.value) {
       console.log(`-- page ${i++}`);
       for (const incident of page.value) {
         console.dir(incident);
       }
     }
     page = await pages.next();
    }

    Parameters

    • detectionConfigId: string

      Anomaly detection configuration id

    • startTime: Date | string

      The start of time range to query for incidents

    • endTime: Date | string

      The end of time range to query for incidents

    • Optional options: ListIncidentsForDetectionConfigurationOptions

      The options parameter.

    Returns PagedAsyncIterableIterator<AnomalyIncident, IncidentsPageResponse>

listMetricDimensionValues

  • 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) {
        console.log(`-- page ${i++}`);
        for (const dv of page.value) {
          console.dir(dv);
        }
      }
      page = await pages.next();
    }

    Parameters

    • metricId: string

      Anomaly detection configuration id

    • dimensionName: string

      Name of the dimension to list value

    • Default value options: ListMetricDimensionValuesOptions = {}

      The options parameter.

    Returns PagedAsyncIterableIterator<string, DimensionValuesPageResponse>

listMetricEnrichmentStatus

  • 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) {
       console.log(`-- page ${i++}`);
       for (const status of page.value) {
         console.dir(status);
       }
     }
     page = await pages.next();
    }

    Parameters

    • metricId: string

      Metric id

    • startTime: Date | string

      The start of time range to query for enrichment status

    • endTime: Date | string

      The end of time range to query for enrichment status

    • Default value options: ListMetricEnrichmentStatusOptions = {}

      The options parameter.

    Returns PagedAsyncIterableIterator<EnrichmentStatus, MetricEnrichmentStatusPageResponse>

listMetricSeriesDefinitions

  • 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) {
        console.log(`-- page ${i++}`);
        for (const definition of page.value) {
          console.dir(definition);
        }
      }
      page = await pages.next();
    }

    Parameters

    • metricId: string

      Metric id

    • activeSince: Date | string

      Definitions of series ingested after this time are returned

    • Default value options: ListMetricSeriesDefinitionsOptions = {}

      The options parameter.

    Returns PagedAsyncIterableIterator<MetricSeriesDefinition, MetricSeriesPageResponse>

Generated using TypeDoc