# TreatMissingData

Specify how missing data points are treated during alarm evaluation.

- Source: [`aws-cloudwatch/lib/alarm.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm.ts#L123)

## Example

```ts
import * as cdk from 'aws-cdk-lib';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';

const fn = new lambda.Function(this, 'MyFunction', {
   runtime: lambda.Runtime.NODEJS_LATEST,
   handler: 'index.handler',
   code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
   timeout: Duration.minutes(5),
});

if (fn.timeout) {
   new cloudwatch.Alarm(this, `MyAlarm`, {
      metric: fn.metricDuration().with({
         statistic: 'Maximum',
      }),
      evaluationPeriods: 1,
      datapointsToAlarm: 1,
      threshold: fn.timeout.toMilliseconds(),
      treatMissingData: cloudwatch.TreatMissingData.IGNORE,
      alarmName: 'My Lambda Timeout',
   });
}
```

## Members

| Member | Description |
| --- | --- |
| `BREACHING` | Missing data points are treated as breaching the threshold. |
| `NOT_BREACHING` | Missing data points are treated as being within the threshold. |
| `IGNORE` | The current alarm state is maintained. |
| `MISSING` | The alarm does not consider missing data points when evaluating whether to change state. |

## Referenced by

- [`AnomalyDetectionAlarmProps`](/v2/docs/aws-cdk-lib.aws_cloudwatch.AnomalyDetectionAlarmProps).treatMissingData
- [`CreateAlarmOptions`](/v2/docs/aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions).treatMissingData
