otel_propagator behaviour (OpenTelemetry API v1.4.0)
View SourceA Propagator injects or extracts data from a Context so information like baggage and trace context can be transported along with cross service requests, like an HTTP request.
Propagators are defined based on the type of encoding they inject and extract. At this time there is only a TextMapPropagator, otel_propagator_text_map
, which works on ASCII keys and values.
This behaviour is only for defining the callbacks used by each propagator per type and is only used by developers adding a new type of propagator (like for binary protocols), not implementations of propagators themselves (like B3 or W3C TraceContext).
Users configure and call propagators based on their type. See the docs for otel_propagator_text_map
for more details.
Summary
Types
A built-in propagator.
A carrier, which can be any type.
A propagator, which can be a built-in propagator, a module, or a module and associated term.
Callbacks
Types
-type builtin() :: trace_context | tracecontext | b3 | b3multi | baggage.
A built-in propagator.
-type carrier() :: term().
A carrier, which can be any type.
A propagator, which can be a built-in propagator, a module, or a module and associated term.
Callbacks
-callback extract(t(), carrier()) -> otel_ctx:t() | otel_ctx:token().
-callback extract_to(otel_ctx:t(), t(), carrier()) -> otel_ctx:t().
-callback inject_from(otel_ctx:t(), t(), carrier()) -> carrier().