aws_cloudwatch: Stat helper does not support lower bounds, or fixed values.
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
There are valid statistics that cannot be created with the Stats helper
* Range stats with open upper limits, TM(%1:) Trimmed Mean, excluding the lowest 1 percent
* Range stats with fixed values, TM(1:2) Trimmed Mean excluding values less than 1 or greater than 2.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html
### Use Case
Defining stats such as `PR(1:)`, `TC(1:2)`, `TC(1:)`, `TC(1%:)`
### Proposed Solution
I don't think mixing percent and fixed values is allowed, so I recommend an interface like this
```
TC({abovePercent: 10}) // TC(10%:)
TC({abovePrecent: 10, belowPercent: 90}) // TC(10%:90%)
TC({belowPercent: 90}) // TC(:90%)
TC({above: 10}) // TC(10:)
TC({above: 10, below: 90}) // TC(10:90)
TC({below: 90}) // TC(:90)
```
Which can be implemented as function overloads
```
function TC(lower: number, upper?: number)
function TC(range: PercentRange)
function TC(range: FixedRange)
```
Other options
* a `fixed` function on the stat to switch to fixed mode
* allow `undefined` for the lower bound, which mean unbounded.
```
TC.fixed(10, 90)
TC.fixed(undefined, 90)
```
* Allow `Infinity` as unbounded
```
TC(10, Infinity)
TC(-Infinity, 90)
```
### Other Information
_No response_
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.133.0
### Environment details (OS name and version, etc.)
NA
Contributor guide
Research direction
Start by locating the aws_cloudwatch Stats helper and compare its current interface with the AWS CloudWatch statistics definitions linked in the issue. Decide how fixed and percentage bounds should be represented, then add coverage for PR(1:), TC(1:2), TC(1:), and TC(1%:) so the supported forms and completed behavior are clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100