Skip to content

fix(metrics): skip empty string dimension values #3319

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

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

arnabrahman
Copy link
Contributor

Summary

When adding a dimension to my metrics, I should get a warning if the dimension value is invalid aka an empty string ("") or undefined/null, and the dimension should not be added to the EMF blobs emitted by the utility.

Changes

  • Check for empty, undefined & null values for dimension and if found log warning
  • Skip invalid value dimensions to EMF, do this for addDimension & addDimensions
  • Unit test the fix

Issue number: #3302


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.

@boring-cyborg boring-cyborg bot added metrics This item relates to the Metrics Utility tests PRs that add or change tests labels Nov 14, 2024
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Nov 14, 2024
@arnabrahman arnabrahman marked this pull request as ready for review November 14, 2024 16:01
@arnabrahman arnabrahman requested a review from a team November 14, 2024 16:01
@arnabrahman arnabrahman requested a review from a team as a code owner November 14, 2024 16:01
@arnabrahman arnabrahman changed the title fix: skip empty dimension values for addDimension & addDimensions fix(metric): skip empty dimension values for addDimension & addDimensions Nov 14, 2024
@dreamorosi dreamorosi changed the title fix(metric): skip empty dimension values for addDimension & addDimensions fix(metrics): skip empty dimension values for addDimension & addDimensions Nov 18, 2024
@github-actions github-actions bot added the bug Something isn't working label Nov 18, 2024
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you for the revisions @arnabrahman!

The friends at the Python version told me they already merged the change and used a slightly different wording in the warning log, which you can see here and is this:

The dimension {name} doesn't meet the requirements and won't be added. Ensure the dimension name and value are non empty strings"

As last step before merging, could you please change to this?

I'll merge right after, sorry I missed the change on their part and didn't point it out in my first review of your PR.

@arnabrahman
Copy link
Contributor Author

It's ok, i have updated the warning message.

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the feedback, let's merge it!

@dreamorosi dreamorosi changed the title fix(metrics): skip empty dimension values for addDimension & addDimensions fix(metrics): skip empty string dimension values Nov 19, 2024
@dreamorosi dreamorosi merged commit 924d49d into aws-powertools:main Nov 19, 2024
27 checks passed
@arnabrahman arnabrahman deleted the 3302-empty-dimension-bug branch November 19, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working metrics This item relates to the Metrics Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants