Show / Hide Table of Contents

Class MetricProps

Properties for a metric.

Inheritance
object
MetricProps
Implements
IMetricProps
ICommonMetricOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.CloudWatch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class MetricProps : IMetricProps, ICommonMetricOptions
Syntax (vb)
Public Class MetricProps Implements IMetricProps, ICommonMetricOptions
Remarks

ExampleMetadata: infused

Examples
// Create a metric
            var metric = new Metric(new MetricProps {
                Namespace = "AWS/EC2",
                MetricName = "CPUUtilization",
                Statistic = "Average",
                Period = Duration.Minutes(5)
            });

            // Create an anomaly detection alarm
            var alarm = new AnomalyDetectionAlarm(this, "AnomalyAlarm", new AnomalyDetectionAlarmProps {
                Metric = metric,
                EvaluationPeriods = 1,

                // Number of standard deviations for the band (default: 2)
                StdDevs = 2,
                // Alarm outside on either side of the band, or just below or above it (default: outside)
                ComparisonOperator = ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
                AlarmDescription = "Alarm when metric is outside the expected band"
            });

Synopsis

Constructors

MetricProps()

Properties for a metric.

Properties

Account

Account which this metric comes from.

Color

The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The Color class has a set of standard colors that can be used here.

DimensionsMap

Dimensions of the metric.

Label

Label for this metric when added to a Graph in a Dashboard.

MetricName

Name of the metric.

Namespace

Namespace of the metric.

Period

The period over which the specified statistic is applied.

Region

Region which this metric comes from.

StackAccount

Account of the stack this metric is attached to.

StackRegion

Region of the stack this metric is attached to.

Statistic

What function to use for aggregating.

Unit

Unit used to filter the metric stream.

Constructors

MetricProps()

Properties for a metric.

public MetricProps()
Remarks

ExampleMetadata: infused

Examples
// Create a metric
            var metric = new Metric(new MetricProps {
                Namespace = "AWS/EC2",
                MetricName = "CPUUtilization",
                Statistic = "Average",
                Period = Duration.Minutes(5)
            });

            // Create an anomaly detection alarm
            var alarm = new AnomalyDetectionAlarm(this, "AnomalyAlarm", new AnomalyDetectionAlarmProps {
                Metric = metric,
                EvaluationPeriods = 1,

                // Number of standard deviations for the band (default: 2)
                StdDevs = 2,
                // Alarm outside on either side of the band, or just below or above it (default: outside)
                ComparisonOperator = ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
                AlarmDescription = "Alarm when metric is outside the expected band"
            });

Properties

Account

Account which this metric comes from.

public string? Account { get; set; }
Property Value

string

Remarks

Default: - Deployment account.

Color

The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The Color class has a set of standard colors that can be used here.

public string? Color { get; set; }
Property Value

string

Remarks

Default: - Automatic color

DimensionsMap

Dimensions of the metric.

public IDictionary<string, string>? DimensionsMap { get; set; }
Property Value

IDictionary<string, string>

Remarks

Default: - No dimensions.

Label

Label for this metric when added to a Graph in a Dashboard.

public string? Label { get; set; }
Property Value

string

Remarks

You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:

[max: ${MAX}] MyMetric

As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend.

Default: - No label

MetricName

Name of the metric.

public string MetricName { get; set; }
Property Value

string

Remarks

ExampleMetadata: infused

Namespace

Namespace of the metric.

public string Namespace { get; set; }
Property Value

string

Remarks

ExampleMetadata: infused

Period

The period over which the specified statistic is applied.

public Duration? Period { get; set; }
Property Value

Duration

Remarks

Default: Duration.minutes(5)

Region

Region which this metric comes from.

public string? Region { get; set; }
Property Value

string

Remarks

Default: - Deployment region.

StackAccount

Account of the stack this metric is attached to.

public string? StackAccount { get; set; }
Property Value

string

Remarks

Default: - Deployment account.

StackRegion

Region of the stack this metric is attached to.

public string? StackRegion { get; set; }
Property Value

string

Remarks

Default: - Deployment region.

Statistic

What function to use for aggregating.

public string? Statistic { get; set; }
Property Value

string

Remarks

Use the aws_cloudwatch.Stats helper class to construct valid input strings.

Can be one of the following:

    Default: Average

    Unit

    Unit used to filter the metric stream.

    public Unit? Unit { get; set; }
    Property Value

    Unit?

    Remarks

    Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units.

    The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases.

    CloudWatch does not honor this property for graphs.

    Default: - All metric datums in the given metric stream

    Implements

    IMetricProps
    ICommonMetricOptions
    Back to top Generated by DocFX