Skip to content

aws_cloudwatch: Stat helper does not support lower bounds, or fixed values. #29622

Open
@everett1992

Description

@everett1992

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudwatchRelated to Amazon CloudWatcheffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions