Interface MetricProps
- All Superinterfaces:
CommonMetricOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
MetricProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:34.636Z")
@Stability(Stable)
public interface MetricProps
extends software.amazon.jsii.JsiiSerializable, CommonMetricOptions
Properties for a metric.
Example:
// Create a metric
Metric metric = Metric.Builder.create()
.namespace("AWS/EC2")
.metricName("CPUUtilization")
.statistic("Average")
.period(Duration.hours(1))
.build();
// Create an anomaly detection alarm
AnomalyDetectionAlarm alarm = AnomalyDetectionAlarm.Builder.create(this, "AnomalyAlarm")
.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")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forMetricPropsstatic final classAn implementation forMetricProps -
Method Summary
Modifier and TypeMethodDescriptionstatic MetricProps.Builderbuilder()Name of the metric.Namespace of the metric.Methods inherited from interface software.amazon.awscdk.services.cloudwatch.CommonMetricOptions
getAccount, getColor, getDimensionsMap, getId, getLabel, getPeriod, getRegion, getStackAccount, getStackRegion, getStatistic, getUnit, getVisibleMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getMetricName
Name of the metric. -
getNamespace
Namespace of the metric. -
builder
- Returns:
- a
MetricProps.BuilderofMetricProps
-