aws / aws/aws-cdk

cloudwatch: `MetricFilter.metric()` does not use dimensions

Open
#34,643 5 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudwatch bug p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The `Metric` returned from `MetricFilter.metric()` uses the namespace and name from the filter, but not the dimensions.

Not really a problem since you can override the dimensions manually, either by passing them when calling `MetricFilter.metric()` or by just creating the metric from scratch, but it seems reasonable to expect all of the filter properties would be passed to the metric.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

x

### Current Behavior

x

### Reproduction Steps

x

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

v22.14.0

### AWS CDK CLI version

2.1018.0

### Node.js Version

v22.14.0

### OS

linux

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Open the implementation of MetricFilter.metric() and inspect how it builds the returned Metric; the issue identifies the missing dimensions as the target behavior. Check the surrounding CloudWatch metric tests, if present, and verify that the filter's dimensions are reflected in the resulting metric without breaking manual overrides.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.