Skip to content

Conversation

@jj22ee
Copy link
Contributor

@jj22ee jj22ee commented Jul 8, 2025

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.

@jj22ee jj22ee requested a review from a team as a code owner July 8, 2025 23:16
@jj22ee jj22ee changed the title Update default OTEL_PROPAGATORS setting to be 'tracecontext,baggage,xray' Update default OTEL_PROPAGATORS setting to be 'baggage,xray,tracecontext' Jul 9, 2025
mxiamxia
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.
@jj22ee jj22ee merged commit e5b50a9 into aws-observability:main Jul 10, 2025
9 checks passed
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants