-
Notifications
You must be signed in to change notification settings - Fork 518
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
fix(aws-sdk): calc propagation fields count before context inject #738
Conversation
@@ -64,7 +64,7 @@ export const injectPropagationContext = ( | |||
attributesMap?: SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap | |||
): SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap => { | |||
const attributes = attributesMap ?? {}; | |||
if (Object.keys(attributes).length < MAX_MESSAGE_ATTRIBUTES) { | |||
if (Object.keys(attributes).length + propagation.fields().length <= MAX_MESSAGE_ATTRIBUTES) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add a simple unit test for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## main #738 +/- ##
=======================================
Coverage 94.90% 94.90%
=======================================
Files 13 13
Lines 707 707
Branches 142 142
=======================================
Hits 671 671
Misses 36 36 |
Which problem is this PR solving?
Background: As described here, SQS/SNS services limited up to 10 message metadata attributes.
The instrumentation is checking if there are enough available attributes before adding more metadata attributes.
Before this pr, it ignored how many fields are going be added by applied propagators.
After this pr, it will check how many fields are going be added, to make sure not setting more than 10 message metadata attributes.