-
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
feat(cloudwatch): parse all metrics statistics and support long format #23095
Conversation
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.
6ac61a4
to
1314195
Compare
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
This is ready for review |
Hi @rigwild! Heads up, that enum you modified in your previous PR was exposed by accident, and was never supposed to be public! 🫣 I've moved your new enum values to a class with factory functions in this PR here: #23172 Thanks for updating the parsing logic as well, but I'm unclear on whether this changes any output. Is it just for completeness of the internal typing? |
See quote
The current parser was supposed to throw on parsing error, but that's not the case. This specific PR only does internal stuff, a future change has to be implemented to make it actually throw and be useful |
Your new factories would solve this, but most code is currently passing raw strings, so this may still be useful to detect errors early before deploying stacks |
I'm pretty sure we used to do validation, and then the So the question is: how valuable is validation, and is it going to get in the way of future additions to CloudWatch? I think we're going to have to resign ourselves to the validation only ever being able to be, at best, a I wouldn't be opposed to adding validation like that, but I'm going to have to ask to make that the feature and main focus of the change. Changes the parsing logic may or may not be a part of it, but that does not deliver value by itself. |
That makes sense. That's why I didn't add the error throw! 😁 I can add this warning. I don't know if there is a logging system/lib? How to log it? |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
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.
Looks like this is not using Annotations.of(construct).addWarning(...):
. Please use this kind of warning instead of a console log statement. With this you can also write a test for the warning showing up or not.
Pull request has been modified.
Oh ok, when rix0rrr@ said:
I thought it meant that the console warning was ok 😁 Updated |
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.
Just one small requested change so that the warning is grammatically correct with or without the label.
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
Pull request has been modified.
@Mergifyio update |
❌ Base branch update has failedrefusing to allow a GitHub App to create or update workflow |
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.
Soooo... do you want to write all of our READMEs? This one is fantastic!
Thank you for your contribution!
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). |
Description
Previous PR added support for missing statistics #23074
This PR implements a proper parsing of all these statistics.
ts99
TS(10%:90%)
|TS(10:90)
TS(:90)
|TS(:90%)
TS(10:)
|TS(10%:)
TS(:90%)
, can be translated to "short" formatts90
(stat.asSingleStatStr
)Note
I noticed that the following code expected the parsing to throw if it failed, but it actually will not fail in any case (it just return
GenericStatistic
if no format matched).I will not change this behavior here as I'm not willing to spend more effort testing if this breaks stuff elsewhere.
aws-cdk/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts
Lines 295 to 296 in 47943d2
Followup work
As is, this PR does not change any customer-facing logic. To make use of it, make the parsing throw if no format is recognized.
At the end of the parser function, just replace
with
You can see all tested inputs here: https://regexr.com/7351s
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license