cvictory opened a new pull request, #3315:
URL: https://github.com/apache/dubbo-go/pull/3315

   ## Bug
   
   - **Symptom**: When using `otelClientTrace` filter + Triple protocol, the 
client-side `traceparent` header gets corrupted, causing downstream spans to 
reference wrong parents in tracing systems (Jaeger, etc.)
   - **Root Cause 1**: `parseAttachments()` copies stale upstream `traceparent` 
from `ctx.Value(constant.AttachmentKey)` into the invocation, overwriting the 
correct value injected by the OTEL client filter
   - **Root Cause 2**: `mergeAttachmentToOutgoing()` uses 
`AppendToOutgoingContext()` which mutates a shared `http.Header` pointer. 
Serial RPCs from the same parent context accumulate `traceparent` values, and 
`http.Header.Get()` returns the stale first entry
   
   ## Fix
   
   1. **`parseAttachments()`**: Skip `traceparent` and `tracestate` keys when 
copying ctx attachments to invocation, preserving OTEL-injected values
   2. **`mergeAttachmentToOutgoing()`**: Reset outgoing headers with 
`NewOutgoingContext(ctx, http.Header{})` before appending, giving each RPC its 
own isolated header
   
   ## Verification
   
   - 2 new regression tests added:
     - `TestParseAttachments_TraceparentNotOverwritten` — verifies OTEL 
traceparent is preserved, upstream stale value rejected, normal user keys still 
copied
     - `TestMergeAttachmentToOutgoing_HeaderIsolation` — verifies serial RPCs 
get independent headers with no traceparent accumulation
   - All existing tests pass unchanged (`go test ./protocol/triple/ -v 
-count=1` — PASS, 4.533s)
   - Validation ladder: stopping point at full-package test (change is 
internal, no exported API changes)
   - Residual risk: untested with non-W3C propagators (B3, Jaeger); 
`tracePropagationKeys` may need extension
   
   Closes #3240


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to