cloudwatch: `M` shadows both minutes and months, impossible to define relative minutes in `start` param for a GraphWidget or Dashboard
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Impossible to specify relative minutes in cloudwatch GraphWidget and Dashboard.
I first noticed this by realizing the docs have an issue...
per: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-cloudwatch/lib/dashboard.ts#L48
```
You can specify start without specifying end to specify a relative time range that ends with the current time. In this case, the value of start must begin with -P, and you can use M, H, D, W and M as abbreviations for minutes, hours, days, weeks and months.
```
How can `M` be both minutes and months?
After a little investigating in the UI and several CDK deployments I believe it is impossible to specify a relative minutes, given that use `M` for the start string always results in months when I deploy a dashboard through CDK.
In addition, when manually modifying the `start` param from the relative calendar dropdown, selecting minutes results in a string like `PT3M` but selecting months results in a string like `PT2160H`.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
The first issue is that `M` should not be valid for both minutes and months. The second issue is that it is impossible to have a relative duration in minutes through CDK currently.
### Current Behavior
Deploy a dashboard with a `start` param of anything with `M`, it defaults to months and there is no way to specify minutes. No errors it just silently gives you months
### Reproduction Steps
Deploy a dashboard with a `start` param of anything with `M`, it defaults to months and there is no way to specify minutes.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.1003.0 (build b242c23)
### Framework Version
_No response_
### Node.js Version
N/A
### OS
N/A
### Language
Python, TypeScript, .NET, Java, Go
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the documentation around packages/aws-cdk-lib/aws-cloudwatch/lib/dashboard.ts:48, then trace how the start parameter is handled for GraphWidget and Dashboard. Reproduce the deployed behavior using a relative start containing M and compare it with the PT3M and PT2160H forms reported from the CloudWatch UI. Done means relative minutes can be specified without being silently interpreted as months.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100