You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like the W3C context propagation uses a new spanID as the parent.
Did a small test app that received a request and forwarded it again to itself just to see what headers are propagated.
So the flow is postman -> app (/forward) -> app (/hello) and response all the way back in the chain
Test 1 - Sent traceparent header to app
Sent the header traceparent: Some(00-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-0000000000000000-01)
The printout is like
Got request for '/forward' with w3c header [Some(00-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-0000000000000000-01)] and parsed/generated context traceId[bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb], spanId[b4e99c809b29b7fa], parentSpanId[0000000000000000]
Got request for '/hello' with w3c header [Some(00-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB-A4B5DFB07D82F430-01)] and parsed/generated context traceId[], spanId[230e25c602c0b2bc], parentSpanId[]
We see from the printout that the W3C propagation has read the headers and created a new local spanID (b4e99c809b29b7fa) as expected.
Trace and parent span identifiers are set in the local context.
However when the request is sent to the next part (/hello) we can see that the header is an odd parentSpanID (A4B5DFB07D82F430). This should have been 'b4e99c809b29b7fa'
The "empty" trace/span ids in the log is due to #985
Test 2 - No headers are sent to the app
The printout is like
Got request for '/forward' with w3c header [None] and parsed/generated context traceId[1aaf4ba3617d76f2441f0fc3879a1a3f], spanId[b16fd11b8393437c], parentSpanId[]
Got request for '/hello' with w3c header [Some(00-1AAF4BA3617D76F2441F0FC3879A1A3F-45B2C2A25AE39FB3-00)] and parsed/generated context traceId[], spanId[a547524af1953855], parentSpanId[]
Same situation, we see a new context is created with trace/span identifiers. But again when the context is propagated we see the sent parentId is '45B2C2A25AE39FB3' but the span that sent the request was 'b16fd11b8393437c'
Conclusion
I'm assuming a new spanID has been created before passing the context down to the writer operation
The code simply writes the header as:
I'm guessing the parent.id is a newly created spanID and not the current one doing the actual HTTP request.
This is the difference between B3 and W3C propagation, the sending side in B3 allocates a new SpanId and sends over.
W3C only sends the parentID and lets the receiving end deal with creating the new SpanID.
Guessing this leaks into the propagation by allocating a new SpanId before providing the context to the writer operation.
The text was updated successfully, but these errors were encountered:
pnerg
added a commit
to pnerg/Kamon
that referenced
this issue
Apr 7, 2021
Looks like the W3C context propagation uses a new spanID as the parent.
Did a small test app that received a request and forwarded it again to itself just to see what headers are propagated.
So the flow is
postman -> app (/forward) -> app (/hello)
and response all the way back in the chainTest 1 - Sent traceparent header to app
Sent the header
traceparent: Some(00-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-0000000000000000-01)
The printout is like
We see from the printout that the W3C propagation has read the headers and created a new local spanID (b4e99c809b29b7fa) as expected.
Trace and parent span identifiers are set in the local context.
However when the request is sent to the next part (/hello) we can see that the header is an odd parentSpanID (A4B5DFB07D82F430). This should have been 'b4e99c809b29b7fa'
The "empty" trace/span ids in the log is due to #985
Test 2 - No headers are sent to the app
The printout is like
Same situation, we see a new context is created with trace/span identifiers. But again when the context is propagated we see the sent parentId is '45B2C2A25AE39FB3' but the span that sent the request was 'b16fd11b8393437c'
Conclusion
I'm assuming a new spanID has been created before passing the context down to the
writer operation
The code simply writes the header as:
I'm guessing the
parent.id
is a newly created spanID and not the current one doing the actual HTTP request.This is the difference between B3 and W3C propagation, the sending side in B3 allocates a new SpanId and sends over.
W3C only sends the parentID and lets the receiving end deal with creating the new SpanID.
Guessing this leaks into the propagation by allocating a new SpanId before providing the context to the writer operation.
The text was updated successfully, but these errors were encountered: