aws / aws/aws-cdk

CDK:Alarm constructor statistic prop doesn't use Cfn extendedStatistic for IQM

Open
#28,812 3 comments 0 reactions 0 assignees View on GitHub
bug effort/medium p2 package/tools
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When creating an alarm with IQM, eg
```
new Alarm(..., {
...,
metric: new Metric({
...,
statistic: Stats.IQM,
}),
})
```

### Expected Behavior

```
"ExtendedStatistic": "IQM",
```

### Current Behavior

```
"Statistic": "IQM",
```
which is not valid

### Reproduction Steps

```
import { Stack, type StackProps } from "aws-cdk-lib";
import { Alarm, ComparisonOperator, Metric, Stats } from "aws-cdk-lib/aws-cloudwatch";
import { Construct } from "constructs";

export class TestStack extends Stack {
constructor(scope: Construct, props?: StackProps) {
super(scope, "test-stack", props);

new Alarm(this, "MockAlarm", {
evaluationPeriods: 1,
threshold: 0,
comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
metric: new Metric({
namespace: "MOCK",
metricName: "TEST",
statistic: Stats.IQM,
}),
});
}
}

```

### Possible Solution

_No response_

### Additional Information/Context

This used to work on cdk 2.45.0

### CDK CLI Version

2.122.0 (build 7e77e02)

### Framework Version

_No response_

### Node.js Version

v20.9.0

### OS

Ubuntu 23.10

### Language

TypeScript

### Language Version

5.3.3

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the provided TypeScript reproduction and inspect the synthesized CloudFormation for MockAlarm. Trace how Metric statistic is mapped into the alarm properties, then verify that Stats.IQM produces ExtendedStatistic rather than Statistic. Done means the reproduction synthesizes valid output with "ExtendedStatistic": "IQM" and includes regression coverage if the relevant test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.