Interface AlarmProps

All Superinterfaces:
CreateAlarmOptions, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AlarmProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:58.456Z") @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();
 
  • Method Details

    • getMetric

      @Stability(Stable) @NotNull IMetric 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

      @Stability(Stable) static AlarmProps.Builder builder()
      Returns:
      a AlarmProps.Builder of AlarmProps