TreatMissingData

class aws_cdk.aws_cloudwatch.TreatMissingData(value)

Bases: Enum

Specify how missing data points are treated during alarm evaluation.

ExampleMetadata:

infused

Example:

import aws_cdk.core as cdk
import aws_cdk.aws_cloudwatch as cloudwatch


fn = lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_16_X,
    handler="index.handler",
    code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler")),
    timeout=cdk.Duration.minutes(5)
)

if fn.timeout:
    cloudwatch.Alarm(self, "MyAlarm",
        metric=fn.metric_duration().with(
            statistic="Maximum"
        ),
        evaluation_periods=1,
        datapoints_to_alarm=1,
        threshold=fn.timeout.to_milliseconds(),
        treat_missing_data=cloudwatch.TreatMissingData.IGNORE,
        alarm_name="My Lambda Timeout"
    )

Attributes

BREACHING

Missing data points are treated as breaching the threshold.

IGNORE

The current alarm state is maintained.

MISSING

The alarm does not consider missing data points when evaluating whether to change state.

NOT_BREACHING

Missing data points are treated as being within the threshold.