-
Notifications
You must be signed in to change notification settings - Fork 165
fix(metrics): emit warning when default dimensions are overwritten #4222
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(metrics): emit warning when default dimensions are overwritten #4222
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.
Thanks for the PR! I've added a few minor comments
…Record check Adds a unit test to ensure setDefaultDimensions logs a warning and returns early when passed a non-object value (e.g., a string), validating the runtime isRecord guard.
…turn on invalid input
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 a lot for the contribution and for making the changes @uttam282005. Really appreciate it.
|
Great work @uttam282005! This will be included in today's release. |
Hi @uttam282005, we were trying to do a release today but our e2e tests were failing. We realized that there were duplicate logs being generated. This seems to be because of the |
Thanks for flagging this @sdangol, and apologies for the oversight. I’d be happy to work on a fix. |
Absolutely no need to apologise! This is why we have E2E tests because it's very hard to know how all the pieces in a module interact when you're working on a specific piece of the code base. |
…ws-powertools#4222) Co-authored-by: Swopnil Dangol <[email protected]>
…ws-powertools#4222) Co-authored-by: Swopnil Dangol <[email protected]>
Summary
Adds warning messages to the Metrics
setDefaultDimensions
method when overwriting existing default dimensions, ensuring consistency and parity withaddDimension
/addDimensions
methods.Changes
This pull request improves the robustness of the
setDefaultDimensions
method in the Metrics utility by:undefined
,null
, and invalid values for default dimensions.setDefaultDimensions()
method in the Metrics utility to emit a warning when a default dimension is being overwritten.setDefaultDimensions(undefined)
results in immediate return, with no warning emitted and only default dimensions applied.This PR addresses #4134 by improving input validation and error reporting for the
setDefaultDimensions
method in the Metrics module, to prevent invalid dimension names/values from being set.Issue number: #4134
Tests Added
The following tests were added:
setDefaultDimensions Update
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.