Interface AlarmProps
- All Superinterfaces:
CreateAlarmOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AlarmProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:32.397Z")
@Stability(Stable)
public interface AlarmProps
extends software.amazon.jsii.JsiiSerializable, CreateAlarmOptions
Properties for Alarms.
Example:
LogGroup logGroup;
MetricFilter mf = MetricFilter.Builder.create(this, "MetricFilter")
.logGroup(logGroup)
.metricNamespace("MyApp")
.metricName("Latency")
.filterPattern(FilterPattern.exists("$.latency"))
.metricValue("$.latency")
.dimensions(Map.of(
"ErrorCode", "$.errorCode"))
.unit(Unit.MILLISECONDS)
.build();
//expose a metric from the metric filter
Metric metric = mf.metric();
//you can use the metric to create a new alarm
//you can use the metric to create a new alarm
Alarm.Builder.create(this, "alarm from metric filter")
.metric(metric)
.threshold(100)
.evaluationPeriods(2)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forAlarmPropsstatic final classAn implementation forAlarmProps -
Method Summary
Modifier and TypeMethodDescriptionstatic AlarmProps.Builderbuilder()The metric to add the alarm on.Methods inherited from interface software.amazon.awscdk.services.cloudwatch.CreateAlarmOptions
getActionsEnabled, getAlarmDescription, getAlarmName, getComparisonOperator, getDatapointsToAlarm, getEvaluateLowSampleCountPercentile, getEvaluationPeriods, getThreshold, getTreatMissingDataMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getMetric
The metric to add the alarm on.Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
-
builder
- Returns:
- a
AlarmProps.BuilderofAlarmProps
-