NH-2313 Bugfixes: propagator gets tracestate from carrier; from_header usage fix#16
Conversation
cheempz
left a comment
There was a problem hiding this comment.
LGTM, thanks for the writeup and detailed test results @tammy-baylis-swi! I left a couple minor questions on the test results page, the main curiosity is whether the "last touched" tracestate value should be on the leftmost side. If it's something the OTel Python code isn't actually doing correctly we can just note that down and move on, no need to try addressing an upstream issue at this point.
Thanks Lin! I reply-commented on Confluence. tl;dr I think it's because #15 is separate from this one and I'll do another test after merging both. |
|
Also mentioned on Confluence. After merging I think tracestate |
Here are my two cents re. the problem #2 @tammy-baylis-swi @cheempz I'm writing it based on the Java OpenTelemetry agent/API so thing may be different for Python.
|
|
Asked a question in the OpenTelemetry API repo: open-telemetry/opentelemetry-java#4463 |
BTW in Java the |
|
BTW in the spec it mentions that the value(s) to be injected should be retrieved from the span context, which is exactly what we are doing: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md#inject |
|
Thank you for those answers and for posting the question to OTel @jiwen624 ! |
Bugfixes:
(1)
OTel Python
TraceState.from_headeraccepts a list of header strings, not a single header string. Using the latter results in quiet dropping of input values! 😦(2)
SW Propagator should get and update tracestate header from the carrier before (re-)injection, not the span context. This is because the current span context's tracestate doesn't change during the loop through of all propagators'
injectas part ofCompositePropagator.inject. Currently, tracestate header injected by a first propagator (e.g.tracecontext) is being completely overwritten by a later propagator (e.g.solarwinds_propagator). To capture tracestate header changes made by a first propagator in the composite, later propagators should update that and re-inject.In another PR (https://github.com/appoptics/opentelemetry-python-testbed/pull/22), we are restricting
OTEL_PROPAGATORSso thattracecontextmust always precedesolarwinds_propagator.tracecontextmaps toTraceContextTextMapPropagatorwhich injects tracestate into the carrier: https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-api/src/opentelemetry/trace/propagation/tracecontext.py#L89-L109 Therefore, tracestate should always be available in the carrier for SW Propagator to use.Manual test results on the upper half of the table on this doc: https://swicloud.atlassian.net/wiki/spaces/NIT/pages/2909569037/2022-04-27+to+28+propagators+combinations+testing
Customer documentation draft updated here: https://swicloud.atlassian.net/wiki/spaces/NIT/pages/2867726621/NH+Python+Troubleshooting#Customizing-OTel-Propagators