Skip to content

(aws-cloudwatch): Sort visible metrics first in widgets #36079

@jackrein

Description

@jackrein

Describe the feature

Change the behavior of how metrics are sorted in CloudWatch Dashboard Widgets so that visible metrics appear first.

Use Case

Using multiple MathExpressions in the same widget leads to difficult to decipher graphs, because the colors of visible metrics are very similar. See the screenshot for an example: in view, there are 3 visible metrics, but because there are many hidden metrics between the visible ones, the automatic colors chosen aren't easily distinguishable.

Image

Proposed Solution

Before rendering the dashboard json of a widget, sort the metrics by visible first. This would make CloudWatch's automatic color scheme work much better for the metrics that actually appear in the widget.

Other Information

Note: I do know that defining the colors manually is possible, but this is not a good solution for a few reasons. Namely, I don't always know how many metrics will be in a widget and I would prefer not to re-implement the automatic color generation how CloudWatch does it

I've created a sample dashboard in this repository to demonstrate this behavior.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS CDK Library version (aws-cdk-lib)

[email protected]

AWS CDK CLI version

2.1031.2 (build 779352d)

Environment details (OS name and version, etc.)

Amazon Linux 2

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