Skip to content

Commit 3db92d8

Browse files
committed
reorder propagators
1 parent d03902f commit 3db92d8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def _configure(self, **kwargs):
7373
os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "http/protobuf")
7474

7575
if os.environ.get(OTEL_PROPAGATORS, None) is None:
76-
os.environ.setdefault(OTEL_PROPAGATORS, "tracecontext,baggage,xray")
76+
# xray is set after baggage in case xray propagator depends on the result of the baggage header extraction.
77+
os.environ.setdefault(OTEL_PROPAGATORS, "baggage,xray,tracecontext")
7778
# We need to explicitly reload the opentelemetry.propagate module here
7879
# because this module initializes the default propagators when it loads very early in the chain.
7980
# Without reloading the OTEL_PROPAGATOR config from this distro won't take any effect.

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ def validate_distro_environ():
12621262
tc.assertEqual(
12631263
"base2_exponential_bucket_histogram", os.environ.get("OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION")
12641264
)
1265-
tc.assertEqual("tracecontext,baggage,xray", os.environ.get("OTEL_PROPAGATORS"))
1265+
tc.assertEqual("baggage,xray,tracecontext", os.environ.get("OTEL_PROPAGATORS"))
12661266
tc.assertEqual("xray", os.environ.get("OTEL_PYTHON_ID_GENERATOR"))
12671267

12681268
# Not set

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelemetry_distro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_configure_sets_default_values(self, mock_super_configure, mock_apply_pa
7575

7676
# Check that default values are set
7777
self.assertEqual(os.environ.get("OTEL_EXPORTER_OTLP_PROTOCOL"), "http/protobuf")
78-
self.assertEqual(os.environ.get("OTEL_PROPAGATORS"), "tracecontext,baggage,xray")
78+
self.assertEqual(os.environ.get("OTEL_PROPAGATORS"), "baggage,xray,tracecontext")
7979
self.assertEqual(os.environ.get("OTEL_PYTHON_ID_GENERATOR"), "xray")
8080
self.assertEqual(
8181
os.environ.get("OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION"),
@@ -270,7 +270,7 @@ def test_otel_propagators_added_when_not_user_defined(self, mock_super_configure
270270

271271
self.assertTrue(isinstance(propagators, CompositePropagator))
272272

273-
expected_propagators = ["TraceContextTextMapPropagator", "W3CBaggagePropagator", "AwsXRayPropagator"]
273+
expected_propagators = ["W3CBaggagePropagator", "AwsXRayPropagator", "TraceContextTextMapPropagator"]
274274
individual_propagators = propagators._propagators
275275
self.assertEqual(3, len(individual_propagators))
276276
actual_propagators = []

0 commit comments

Comments
 (0)