Override xray trace header insteand of appending #10766
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug description
It is a bug fix that OTel propagator should always call
putHeader()
method to override the trace header in AWS request instead of appending a trace header on existing http header values. The methodappendMethod()
worked before because AWS java SDK only keeps the last value in http header value list.But recently AWS Java SDK fixed the http header values chunked problem, now all the values in http header are retained, it causes AWS service may receive 2 trace header values for a trace header key, then breaks trace context propagation.
Details regarding AWS request may have trace header not from OpenTelemetry
case 1:
it is an AWS design that in AWS Lambda environment, the AWS SDK will automatically inject a trace header to outgoing requests without OTel SDK needed. If customer instruments his Lambda function by OTel, OTel should override the trace header from AWS SDK one.
case 2:
User makes mistake that he instruments the application by 2 different SDKs
Solution
override existing trace header instead of appending value on it.