fix(triple): preserve otel traceparent in TripleInvoker#3285
Open
nanjiek wants to merge 12 commits intoapache:developfrom
Open
fix(triple): preserve otel traceparent in TripleInvoker#3285nanjiek wants to merge 12 commits intoapache:developfrom
nanjiek wants to merge 12 commits intoapache:developfrom
Conversation
|
1 task
Alanxtl
approved these changes
Apr 8, 2026
Comment on lines
-207
to
-215
| // retrieve users passed-in attachment | ||
| attaRaw := ctx.Value(constant.AttachmentKey) | ||
| if attaRaw != nil { | ||
| if userAtta, ok := attaRaw.(map[string]any); ok { | ||
| for key, val := range userAtta { | ||
| invocation.SetAttachment(key, val) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Description
Fixes #3240
This change fixes the traceparent corruption in Triple client calls.
Although OtelClientTrace correctly creates a client span and injects a fresh traceparent, the old TripleInvoker logic could overwrite it with the upstream traceparent from context attachments, and then append that value into the outgoing header. This caused downstream spans to attach to the wrong parent and also leaked trace headers across repeated Triple calls on the same base context.
The fix removes user attachment backfill from context during Triple invocation, rebuilds outgoing headers from a cloned copy and overwrites keys instead of appending, and deep-copies outgoing context metadata to avoid cross-call header mutation. With this change, each downstream Triple call carries the traceparent of the current client span, and sibling calls no longer interfere with each other.
Checklist
develop