-
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): period
of each metric in usingMetrics
for MathExpression
is ignored
#30986
fix(cloudwatch): period
of each metric in usingMetrics
for MathExpression
is ignored
#30986
Conversation
period
of each metric in usingMetrics
for MathExpression
is ignored
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.
In addition to this, what if we added a warning annotation anytime we find ourselves overwriting a different value? it's a little sinister to override a value and not tell the user when we do it.
period
of each metric in usingMetrics
for MathExpression
is ignoredperiod
of each metric in usingMetrics
for MathExpression
is ignored
Pull request has been modified.
fix for rosetta
13f3459
to
b8b2ae0
Compare
Thanks for your review.
I added: 712e937 I have two questions:
It is correct usage to not specify a value for period (in 712e937#diff-289bad9fd897ab7808c177ad955a23faf18615ff8434f82b50fa0aeb54985de6R941 for example: new MathExpression({
expression: 'm1',
label: 'AlbErrors',
usingMetrics: {
m1: metrics.custom('HTTPCode_ELB_500_Count', {
period: Duration.minutes(5), // <- This is equal to the default value for `period`. So it is the same as not having specified.
statistic: 'Sum',
label: 'HTTPCode_ELB_500_Count',
}),
},
period: Duration.minutes(3),
}); |
Hi, @kaizencc Have you had a chance to look at the comment? |
Could you please take a look at the comment? Do you have any good ideas to share? |
@kaizencc Could you take a look at it again? |
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.
hi @go-to-k :). sorry for the super long delay. to answer your questions:
- i think the title should be now a fix. i'll leave it to you to update.
- i think this is ok. it's better than nothing.
happy to approve once you update! i think the change to default.ts-fixture
is unnecessary but i might be wrong.
@@ -2,6 +2,7 @@ | |||
import { Construct } from 'constructs'; | |||
import { Stack, Duration } from 'aws-cdk-lib'; | |||
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; | |||
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; |
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 think this is unnecessary?
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.
* Example: | ||
* | ||
* ```ts | ||
* declare const metrics: elbv2.IApplicationLoadBalancerMetrics; |
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.
here
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.
got it! thanks :)
period
of each metric in usingMetrics
for MathExpression
is ignoredperiod
of each metric in usingMetrics
for MathExpression
is ignored
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
Exemption Request: This PR could be covered by unit tests. |
I also changed the PR title to |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
@Mergifyio refresh |
✅ Pull request refreshed |
@Mergifyio update |
✅ Branch has been successfully updated |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #30986 +/- ##
==========================================
+ Coverage 78.66% 78.67% +0.01%
==========================================
Files 107 107
Lines 7237 7237
Branches 1329 1329
==========================================
+ Hits 5693 5694 +1
+ Misses 1358 1357 -1
Partials 186 186
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #.
Reason for this change
The
usingMetrics
property (Record<string, IMetric>
) inMathExpressionProps
has Metric objects with aperiod
.On the other hand, in the
MathExpression
construct, theperiod
of each metric in theusingMetrics
is ignored and instead overridden by theperiod
of theMathExpression
. Even if theperiod
of theMathExpression
is not specified, it is overridden by its default value.https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts#L606-L608
However the statement is not written in the JSDoc.
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts#L566
Description of changes
The current documentation could be confusing to users, so add this description. Also added warnings in the situation.
Description of how you validated changes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license