-
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
fix(cloudwatch): MathExpression period of <5 minutes is not respected #13078
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1ea5c2e
fix(aws-cloudwatch): respect the period of MathExpressions #9156
e23dbc1
Merge branch 'master' into math-expression-period
otaviomacedo 94504f8
Merge branch 'master' into math-expression-period
otaviomacedo 9760237
Merge branch 'master' into math-expression-period
otaviomacedo 0626a61
Merge branch 'master' into math-expression-period
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I omitted this originally because what would happen is the expression period would be propagated down to the queried metrics.
Have we confirmed this is really necessary? Does it actually solve the problem it says it's addressing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean... I know I suggested this fix in the linked bug report.
But I'm very much interested in WHY this change is necessary.
It might also be because of the
period
field in the enclosing graph, for example.Looking for someone to do a slightly deeper dive and experimenting a bit with the combinations and telling us WHAT EXACTLY the behavior of CloudWatch is (and by extension, what the construct library needs to produce).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I can create a minimal stack with a graph widget and deploy to my AWS account to see the difference between the two cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you define a metric using
MathExpression
, CDK will generate a new invisible metric for each component of the expression. For example, let's say you want to create a widget with three metrics for a DynamoDB table: one for ConsumedReadCapacityUnits, one for ConsumedWriteCapacityUnits and one for the sum of the other two. The generated CloudFormation template will have five metrics altogether:Metric 5 is the sum of metrics 3 and 4.
As it is now, if you specify a period in a
MathExpression
, that period is not being respected in the aggregate metric, but it is already being propagated down to its components. Note that this only affects the components of the math expression. Their visible counterparts remain unchanged. In the example above, only metrics 3 and 4 have the period changed. Since they are invisible, there is no noticeable effect in the final widget, which shows data at a default interval for the aggregate metric. For DynamoDB tables, for example, this default is 10 minutes.This change solves the problem by overriding the period in the aggregate metric and not changing anything else in the final CloudFormation template. I also deployed stacks with different combinations of periods and overrides and the result is as expected.