-
Notifications
You must be signed in to change notification settings - Fork 162
improv(metrics): Added runtime validations for the metrics utility functions #4181
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
improv(metrics): Added runtime validations for the metrics utility functions #4181
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.
Great work on this PR Swopnil!
Left 3 minor comments but other than it's almost good to go!
Regarding the discussion we were having about other Powertools for AWS runtimes in the linked issue, did you see if they are implementing the same check you brought up?
49d3454
to
f673c07
Compare
Yes, I looked into the Python and .NET and the metric name constraint validation is missing. I tested the python version and the metrics were getting silently dropped there as well. I will create the issues for this in their repos. |
5affe3b
to
91b7682
Compare
91b7682
to
4ed8433
Compare
|
Thank you for the work on this PR @swopnildangol - great work and turnaround :) |
@aws-powertools/lambda-typescript No related issues found. Please ensure 'pending-release' label is applied before releasing. |
Summary
This PR adds runtime validations for the metrics utility functions. It ensures that metrics and dimensions meet the required constraints before they are added, providing better error handling and feedback to users. This was done to prevent potential issues that could have come up due to invalid data being passed to Cloudwatch.
Changes
isStringUndefinedNullEmpty
in the commons package to validate string inputsMIN_METRIC_NAME_LENGTH
andMAX_METRIC_NAME_LENGTH
)Issue number:
#4135
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.