Open
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
- 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