Skip to content
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

Bug: dimension value not being validated for empty strings or None #5526

Closed
dreamorosi opened this issue Nov 8, 2024 · 2 comments · Fixed by #5542
Closed

Bug: dimension value not being validated for empty strings or None #5526

dreamorosi opened this issue Nov 8, 2024 · 2 comments · Fixed by #5542
Assignees
Labels
bug Something isn't working metrics

Comments

@dreamorosi
Copy link
Contributor

Expected Behaviour

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

Current Behaviour

Currently the utility doesn't validate the input and generates an EMF blob with the invalid dimension.

Code snippet

metrics = Metrics()
metrics.add_dimension("my_dim","") # THIS
metrics.add_metrics(...)
metrics.flush..

Possible Solution

We should: 1/ validate the input when adding a dimension, 2/ emit a warning if invalid, and 3/ don't add the dimension to the EMF blob

Steps to Reproduce

  1. Run the code above
  2. Observe that the EMF blob emitted has an empty dimension
  3. Verify that the processed metric in CloudWatch does not include any dimensions

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.8

Packaging format used

PyPi

Debugging logs

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Nov 12, 2024
Copy link
Contributor

This is now released under 3.3.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Nov 14, 2024
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
Projects
None yet
2 participants