Skip to content

fix(metrics): align addDimensions() boundary check with addDimension()#5236

Open
blut-agent wants to merge 1 commit into
aws-powertools:mainfrom
blut-agent:fix/dimension-boundary-consistency
Open

fix(metrics): align addDimensions() boundary check with addDimension()#5236
blut-agent wants to merge 1 commit into
aws-powertools:mainfrom
blut-agent:fix/dimension-boundary-consistency

Conversation

@blut-agent
Copy link
Copy Markdown

Summary

Changes

This PR fixes an inconsistency between addDimension() and addDimensions() boundary checks in the Metrics utility.

The addDimensions() method used >= for the dimension count comparison while addDimension() used <=. This caused addDimensions() to reject the 29th dimension while addDimension() would allow it, since MAX_DIMENSION_COUNT is 29.

Changed >= to > in addDimensions() to match the behavior of addDimension().

Issue number: closes #5204


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.

Closes aws-powertools#5204

The addDimensions() method used >= for the dimension count check while
addDimension() used <=, causing addDimensions() to reject the 29th
dimension while addDimension() would allow it. Changed >= to > to
match the behavior of addDimension().
@sonarqubecloud
Copy link
Copy Markdown

@svozza
Copy link
Copy Markdown
Contributor

svozza commented May 11, 2026

Apologies, the linked issue for this bug was incorrect, this current fix would cap the number of dimensions at 28 when the behaviour we want is to allow 29. I have updated the issue. Please note that all PRs must always have tests where possible. We need to test that this behaviour is now consistent across both methods.

Finally, please note that any repeat of the behaviour you displayed in #5212 will result in this PR being closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS PR between 0-9 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: addDimensions() is one dimension more restrictive than addDimension() at the boundary

2 participants