fix(metrics): align addDimensions boundary check#5209
fix(metrics): align addDimensions boundary check#5209toby-bridges wants to merge 1 commit intoaws-powertools:mainfrom
Conversation
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
|
|
Apologies, I made a mistake in the proposed solution section of the issue. I think we should mirror the behaviour of |
| ); | ||
| }); | ||
|
|
||
| it('allows adding a dimension set when it reaches the limit exactly', () => { |
There was a problem hiding this comment.
Let's have a test that calls both addDimension and addDimesions to ensure they behave in the same way. E.g., add 29 dimensions and then check that we throw when we try to add another dimension using both APIs.
|
Hi @toby-bridges, do you need any help with this PR, e.g., clarifications on the comments I made? |



Summary
Changes
addDimensions()to accept a dimension set when the final total reachesMAX_DIMENSION_COUNT, matching the existingaddDimension()boundary behavior28 + 1case from the issue so the two APIs stay alignedIssue number: closes #5204
Validation
npx @biomejs/biome check packages/metrics/src/Metrics.ts packages/metrics/tests/unit/dimensions.test.tsnpx vitest --run packages/metrics/tests/unit/dimensions.test.ts -t "allows adding a dimension set when it reaches the limit exactly"npm run build --workspace @aws-lambda-powertools/commons --workspace @aws-lambda-powertools/testing-utils --workspace @aws-lambda-powertools/metricsnpm test --workspace @aws-lambda-powertools/metricsBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.