-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudwatch: Add CDK support for 'Persistent Time Range' feature already present on CW Dashboards UI #26216
Comments
Makes sense to me though I am not sure if we should call it |
Thanks for the response. Well I called it start because that's what it's referred to in the CW Widget Json.. Sure, let me try and get a PR up soon once I have the environment setup. |
Is there any update on this? 👀 Also: you can also provide |
Ill get back with an update this weekend, I had trouble setting up the dev environment locally. |
Issues with Dev-env, posted here |
Posted another update highlighting my latest blocker - here |
I believe this work has been done here |
|
Describe the feature
Hello,
I recently read about this feature for persisting time ranges for Cloudwatch dashboard widgets, where you can pick specific time periods for different widgets and not have it be overriden regardless of the Dashboard period.
Specifically, I’m talking about "Persist time range" mentioned in here - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/edit_graph_dashboard.html
I've come to understand this was a fairly recent addition to the UI.
I wanted to make use of this feature for the Cloudwatch dashboards I create using CDK.
I tried looking at documentation, I checked out for example the GraphWidget class since that’s what we’re using but I couldn't seem to find much there - https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.GraphWidget.html
I looked at the source code on the CW Dashboards UI for a persisted time range widget, here is a sample:
And I observed the only part that was additionally present, that wasn't there in 'normal' widgets was the
"start": "-P50D"
part which was helping the widget maintain the persisted time range of 50 days I wanted it to.I was able to find a 'hacky' workaround(described below) to add this 'start' field to my dashboard widgets in my CDK Code, but it would be very helpful to everyone if CDK provides an out-of-the-box function for defining the
start
field for dashboard widgets, to support persisted-time-range functionality not just through UI but also through CDK.Use Case
To support persisted-time-range functionality not just through UI but also through CDK, it would be very helpful to everyone if CDK provides an out-of-the-box function for defining the
start
field for dashboard widgets.Proposed Solution
Firstly, I'd like to describe the hacky workaround I used to achieve this effect through CDK, to help understand my proposed solution.
I extended the GraphWidget class that CDK provides, and basically augmented it with a 'start' field. Here's the class:
and then it was just a matter of using an instance of the CustomGraphWidget class I wrote above to populate my CW dashboard in CDK.
My proposal is to have an additional field added to the GraphWidget class,
start
that lets the user define the start period if they'd like.Other Information
No response
Acknowledgements
CDK version used
V2
Environment details (OS name and version, etc.)
MacOS Montery - 12.6.6
The text was updated successfully, but these errors were encountered: