-
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
docs(cloudwatch): explain when period
of each metric in usingMetrics
for MathExpression
is ignored
#30986
base: main
Are you sure you want to change the base?
docs(cloudwatch): explain when 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.
* The `period` of each Metric object is ignored and instead overridden by | ||
* the `period` of this math expression object. Even if the `period` of the | ||
* math expression is not specified, it is overridden by its default value. |
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.
haha i find this comment you've added to be confusing too :). Your PR description makes more sense than this, it might be helpful to even add an example or something here -- its not clear to me when and how i would know if my period
is being overwritten.
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've rewritten it, what do you think?
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 example is awesome! thanks so much
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),
}); |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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? |
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.
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