Bug: dimension value not being validated for empty strings #3302
Labels
bug
Something isn't working
confirmed
The scope is clear, ready for implementation
good-first-issue
Something that is suitable for those who want to start contributing
help-wanted
We would really appreciate some support from community for this one
metrics
This item relates to the Metrics Utility
Expected Behavior
When adding a dimension to my metrics, I should get a warning if the dimension value is invalid aka an empty string (
""
) orundefined
/null
, and the dimension should not be added to the EMF blobs emitted by the utility.Current Behavior
Currently the utility doesn't validate the input but only enforces types. In practice this means it's unlikely customers can pass
undefined
ornull
unless they're suppressing the warning, but can pass an empty string and generate an EMF blob that will have the invalid dimension.Code snippet
Steps to Reproduce
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
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
The text was updated successfully, but these errors were encountered: