-
Notifications
You must be signed in to change notification settings - Fork 155
fix(metrics): Support multiple addMetric() call with the same metric name #390
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
Conversation
@@ -10,7 +10,7 @@ | |||
"commit": "commit", | |||
"test": "jest --group=unit --detectOpenHandles --coverage --verbose", | |||
"test:e2e": "jest --group=e2e", | |||
"watch": "jest --watch", | |||
"watch": "jest --group=unit --watch ", |
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.
Not practical to run e2e test in the watch mode so I filtered this.
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.
good point !
"Timestamp": 1592234975665, | ||
"CloudWatchMetrics": [ | ||
{ | ||
"Name": "bookingConfirmation", | ||
"Unit": "Count" | ||
"Namespace": "exampleApplication", | ||
"Dimensions": [ | ||
[ | ||
"service" | ||
] | ||
], | ||
"Metrics": [ | ||
{ | ||
"Name": "bookingConfirmation", | ||
"Unit": "Count" | ||
} | ||
] |
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 shifting indentation. The current version misses one more indentation under "_aws"
@heitorlessa Ping, in case you want to port this to other languages. |
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.
Suggestion to improve error thrown and docs section name
@@ -10,7 +10,7 @@ | |||
"commit": "commit", | |||
"test": "jest --group=unit --detectOpenHandles --coverage --verbose", | |||
"test:e2e": "jest --group=e2e", | |||
"watch": "jest --watch", | |||
"watch": "jest --group=unit --watch ", |
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.
good point !
Co-authored-by: Heitor Lessa <[email protected]>
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.
Fantastic!
Co-authored-by: Sara Gerion <[email protected]>
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.
Nice 🚀🚀🚀
Description of your changes
Currently, adding metrics with the same name will override the existing value. For example,
Will emit only one EMF metric with value "1" (the 2nd call override the first one).
This is not the correct behavior. This PR implements the change to emit two values in array like this:
How to verify this change
Run test for metrics package. I have added test cases in
Metrics.test.ts
and refactor the test for middy to reflect this changeRelated issues, RFCs
#384
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
Breaking change checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.