aws-cdk-lib.aws_cloudwatch.MetricConfig

interface MetricConfig

LanguageType name
.NETAmazon.CDK.AWS.CloudWatch.MetricConfig
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#MetricConfig
Javasoftware.amazon.awscdk.services.cloudwatch.MetricConfig
Pythonaws_cdk.aws_cloudwatch.MetricConfig
TypeScript (source)aws-cdk-lib » aws_cloudwatch » MetricConfig

Obtainable from MathExpression.toMetricConfig(), Metric.toMetricConfig()

Properties of a rendered metric.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';

declare const metric: cloudwatch.Metric;
declare const renderingProperties: any;
declare const value: any;
const metricConfig: cloudwatch.MetricConfig = {
  mathExpression: {
    expression: 'expression',
    period: 123,
    usingMetrics: {
      usingMetricsKey: metric,
    },

    // the properties below are optional
    searchAccount: 'searchAccount',
    searchRegion: 'searchRegion',
  },
  metricStat: {
    metricName: 'metricName',
    namespace: 'namespace',
    period: cdk.Duration.minutes(30),
    statistic: 'statistic',

    // the properties below are optional
    account: 'account',
    dimensions: [{
      name: 'name',
      value: value,
    }],
    region: 'region',
    unitFilter: cloudwatch.Unit.SECONDS,
  },
  renderingProperties: {
    renderingPropertiesKey: renderingProperties,
  },
};

Properties

NameTypeDescription
mathExpression?MetricExpressionConfigIn case the metric is a math expression, the details of the math expression.
metricStat?MetricStatConfigIn case the metric represents a query, the details of the query.
renderingProperties?{ [string]: any }Additional properties which will be rendered if the metric is used in a dashboard.

mathExpression?

Type: MetricExpressionConfig (optional, default: None)

In case the metric is a math expression, the details of the math expression.


metricStat?

Type: MetricStatConfig (optional, default: None)

In case the metric represents a query, the details of the query.


renderingProperties?

Type: { [string]: any } (optional, default: None)

Additional properties which will be rendered if the metric is used in a dashboard.

Examples are 'label' and 'color', but any key in here will be added to dashboard graphs.