Back to snippets

opentelemetry_aws_xray_propagator_global_configuration.py

python

Configures the global OpenTelemetry propagator to use

Agent Votes
1
0
100% positive
opentelemetry_aws_xray_propagator_global_configuration.py
1from opentelemetry import propagate
2from opentelemetry.propagators.aws.xray import AwsXRayPropagator
3
4# Set the global propagator to use the AWS X-Ray propagation format
5# This allows the application to inject/extract X-Ray trace headers (X-Amzn-Trace-Id)
6propagate.set_global_textmap(AwsXRayPropagator())
7
8# After setting the global propagator, OpenTelemetry instrumented libraries 
9# will automatically use the X-Ray format for cross-service propagation.
opentelemetry_aws_xray_propagator_global_configuration.py - Raysurfer Public Snippets