Skip to content

Conversation

sdangol
Copy link

@sdangol sdangol commented Jul 28, 2025

Please provide the issue number

Issue number: Closes #931

Summary

This PR adds runtime validation for the metric name. It ensures that the metric name meets the required length 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 metric name being passed to Cloudwatch.

Changes

Please provide a summary of what's being changed

User experience

Please share what the user experience looks like before and after this change

Before this, for the users who were passing in an invalid metric name (a string of more than 255 characters), the metrics would get silently dropped. But, now the users will get an error.

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

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.

Copy link

boring-cyborg bot commented Jul 28, 2025

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #dotnet channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 28, 2025
@boring-cyborg boring-cyborg bot added area/metrics Core metrics utility tests labels Jul 28, 2025
@github-actions github-actions bot added the feature New features or minor changes label Jul 28, 2025
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.39%. Comparing base (6d45601) to head (31bfd9c).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #943   +/-   ##
========================================
  Coverage    77.38%   77.39%           
========================================
  Files          271      271           
  Lines        10870    10874    +4     
  Branches      1281     1282    +1     
========================================
+ Hits          8412     8416    +4     
  Misses        2041     2041           
  Partials       417      417           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copy link
Contributor

@hjgraca hjgraca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Amazing Thank you!!

@hjgraca hjgraca merged commit dd6d208 into aws-powertools:develop Jul 28, 2025
10 checks passed
Copy link

boring-cyborg bot commented Jul 28, 2025

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@hjgraca hjgraca mentioned this pull request Jul 29, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Core metrics utility feature New features or minor changes size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: Add runtime validation for the metric name
3 participants