generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 15
Update default OTEL_PROPAGATORS setting to be 'baggage,xray,tracecontext'
#210
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
Merged
Conversation
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
…pagator last in list
mxiamxia
reviewed
Jul 8, 2025
mxiamxia
reviewed
Jul 8, 2025
aws-distro-opentelemetry-node-autoinstrumentation/test/aws-opentelemetry-configurator.test.ts
Show resolved
Hide resolved
OTEL_PROPAGATORS setting to be 'tracecontext,baggage,xray'OTEL_PROPAGATORS setting to be 'baggage,xray,tracecontext'
mxiamxia
previously approved these changes
Jul 9, 2025
srprash
added a commit
to aws-observability/aws-otel-python-instrumentation
that referenced
this pull request
Jul 9, 2025
## Issue The [`OTEL_PROPAGATORS` configured in the ADOT](https://github.com/aws-observability/aws-otel-python-instrumentation/blob/af71c4a100f0ae9c8d378db8487988344485b0c3/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py#L73) do not actually take effect. The configured propagators are still `tracecontext` and `baggage` which are the default ones configured by OTel SDK. This causes ADOT to ignore the `x-amzn-trace-id` trace header causing broken traces if there is only XRay format trace being propagated. ## Root Cause - The [`opentelemetry.propagate` module](https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-api/src/opentelemetry/propagate/__init__.py) has [the logic to load the propagators](https://github.com/open-telemetry/opentelemetry-python/blob/0a2df97a72561552fb72e41c6fd092578a5f43e9/opentelemetry-api/src/opentelemetry/propagate/__init__.py#L124-L163) configured via the `OTEL_PROPAGATORS` env variable. If the env variable is not set, then it sets up the default propagators. - This module is loaded and run very early in the OTel startup logic even before the ADOT distro code is run which sets the `OTEL_PROPAGATORS` env variable. This point is too late to modify the OTEL_PROPAGATORS env variable. ## Solution Set the `OTEL_PROPAGATORS` env variable in ADOT distro **and** reload the `opentelemetry.propagate` module (using [importlib.reload](https://docs.python.org/3/library/importlib.html#importlib.reload)) which will force it to reinitialize the intended propagators. ## Related Note With this fix, the ADOT configured propagators will take effect, which currently does not include `baggage` and will break some existing functionality that depends on baggage. So I'm also also updating the propagators set by the ADOT to: - include `baggage` - drop the B3 propagators as [ADOT JS did](aws-observability/aws-otel-js-instrumentation@82e563c#diff-02388c43665de519f206132ad186755c563709c77f6de9f919a4e70fc51abc25) - reorder to `baggage, xray, tracecontext`. This will be the order we follow for other ADOT SDKs too ([JS already in progress](aws-observability/aws-otel-js-instrumentation#210)). By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
mxiamxia
approved these changes
Jul 10, 2025
blairhyy-amazon
pushed a commit
to blairhyy-amazon/aws-otel-js-instrumentation
that referenced
this pull request
Jul 11, 2025
…ontext'` (aws-observability#210) *Issue #, if available:* *Description of changes:* - Update default `OTEL_PROPAGATORS` setting to be `'baggage,xray,tracecontext'` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
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.
Issue #, if available:
Description of changes:
OTEL_PROPAGATORSsetting to be'baggage,xray,tracecontext'By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.