This repository was archived by the owner on Oct 31, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/plugin-aws-sdk/src/services Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ export const END_SPAN_FUNCTION = Symbol(
3131 "opentelemetry.plugin.aws-sdk.sqs.end_span"
3232) ;
3333
34+ // https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html
35+ const SQS_MAX_MESSAGE_ATTRIBUTES = 10 ;
36+
3437const contextSetterFunc = (
3538 messageAttributes : AWS . SQS . MessageBodyAttributeMap ,
3639 key : string ,
@@ -95,8 +98,13 @@ export class SqsServiceExtension implements ServiceExtension {
9598
9699 const params : Record < string , any > = ( request as any ) . params ;
97100 const attributes = params . MessageAttributes || { } ;
98- propagation . inject ( attributes , contextSetterFunc ) ;
99- params . MessageAttributes = attributes ;
101+ if ( attributes . length < SQS_MAX_MESSAGE_ATTRIBUTES ) {
102+ propagation . inject ( attributes , contextSetterFunc ) ;
103+ params . MessageAttributes = attributes ;
104+ } else {
105+ // TODO: in this case we are not setting the context propagtion for consumers
106+ // how to log the issue?
107+ }
100108 }
101109 break ;
102110 }
You can’t perform that action at this time.
0 commit comments