-
Notifications
You must be signed in to change notification settings - Fork 1
NH-2313 Bugfixes: propagator gets tracestate from carrier; from_header usage fix #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NH-2313 Bugfixes: propagator gets tracestate from carrier; from_header usage fix #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_header
accepts 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'
inject
as 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_PROPAGATORS
so thattracecontext
must always precedesolarwinds_propagator
.tracecontext
maps toTraceContextTextMapPropagator
which 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