instrument_propagator behaviour (instrument v1.0.0)
View SourcePluggable context propagator registry.
This module provides a registry for context propagators that handle injecting and extracting context from carriers (e.g., HTTP headers).
Built-in Propagators
- instrument_propagator_tracecontext - W3C TraceContext - instrument_propagator_baggage - W3C Baggage
Example Usage
%% Register a propagator
instrument_propagator:register(instrument_propagator_tracecontext).
%% Get all registered propagators
Propagators = instrument_propagator:list().
%% Inject context using all propagators
Carrier = instrument_propagator:inject(#{}).
%% Extract context using all propagators
Ctx = instrument_propagator:extract(Carrier).
Summary
Functions
Extracts context from a carrier using all registered propagators.
Extracts context from a carrier into an existing context.
Returns all header fields used by registered propagators.
Gets the list of registered propagators.
Injects context into a carrier using all registered propagators.
Injects context into a carrier using all registered propagators.
Lists all registered propagators.
Registers a propagator module.
Sets the list of propagators (replacing existing ones).
Unregisters a propagator module.
Callbacks
Functions
Extracts context from a carrier using all registered propagators.
Extracts context from a carrier into an existing context.
-spec fields() -> [binary()].
Returns all header fields used by registered propagators.
-spec get_propagators() -> [module()].
Gets the list of registered propagators.
Injects context into a carrier using all registered propagators.
Injects context into a carrier using all registered propagators.
-spec list() -> [module()].
Lists all registered propagators.
-spec register(module()) -> ok.
Registers a propagator module.
-spec set_propagators([module()]) -> ok.
Sets the list of propagators (replacing existing ones).
-spec unregister(module()) -> ok.
Unregisters a propagator module.