OpenTelemetry Python - AWS X-Ray Propagator
- class opentelemetry.propagators.aws.AwsXRayLambdaPropagator[source]
Bases:
AwsXRayPropagatorImplementation of the AWS X-Ray Trace Header propagation protocol but with special handling for Lambda’s
_X_AMZN_TRACE_IDenvironment variable.- extract(carrier, context=None, getter=<opentelemetry.propagators.textmap.DefaultGetter object>)[source]
Create a Context from values in the carrier.
The extract function should retrieve values from the carrier object using getter, and use values to populate a Context value and return it.
- Parameters:
getter (
Getter[TypeVar(CarrierT)]) – a function that can retrieve zero or more values from the carrier. In the case that the value does not exist, return an empty list.carrier (
TypeVar(CarrierT)) – and object which contains values that are used to construct a Context. This object must be paired with an appropriate getter which understands how to extract a value from it.context (
Context|None) – an optional Context to use. Defaults to root context if not set.
- Return type:
- Returns:
A Context with configuration found in the carrier.
- class opentelemetry.propagators.aws.AwsXRayPropagator[source]
Bases:
TextMapPropagatorPropagator for the AWS X-Ray Trace Header propagation protocol.
See: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader
- extract(carrier, context=None, getter=<opentelemetry.propagators.textmap.DefaultGetter object>)[source]
Create a Context from values in the carrier.
The extract function should retrieve values from the carrier object using getter, and use values to populate a Context value and return it.
- Parameters:
getter (
Getter[TypeVar(CarrierT)]) – a function that can retrieve zero or more values from the carrier. In the case that the value does not exist, return an empty list.carrier (
TypeVar(CarrierT)) – and object which contains values that are used to construct a Context. This object must be paired with an appropriate getter which understands how to extract a value from it.context (
Context|None) – an optional Context to use. Defaults to root context if not set.
- Return type:
- Returns:
A Context with configuration found in the carrier.
- inject(carrier, context=None, setter=<opentelemetry.propagators.textmap.DefaultSetter object>)[source]
Inject values from a Context into a carrier.
inject enables the propagation of values into HTTP clients or other objects which perform an HTTP request. Implementations should use the
Setter‘s set method to set values on the carrier.- Parameters:
carrier (
TypeVar(CarrierT)) – An object that a place to define HTTP headers. Should be paired with setter, which should know how to set header values on the carrier.context (
Context|None) – an optional Context to use. Defaults to current context if not set.setter (
Setter[TypeVar(CarrierT)]) – An optionalSetterobject that can set values on the carrier.
- Return type: