Behaviours: otel_propagator.
This module defines the otel_propagator_text_map behaviour.
Required callback functions: inject/4, extract/5, fields/1.
A TextMap Propagator is a Propagator that performs injection and extraction with ASCII keys and values.
An example of configuring the TextMap Propagator to inject and extract Baggage and TraceContext:
{text_map_propagators, [trace_context, baggage]},
The propagators are then used at the points that cross service
communication is performed. By default inject
and extract
work on a
generic list of 2-tuple's with binary string keys and values. A user
defined function for setting a key/value in the carrier and for getting
the value of a key from a carrier can be passed as an argument. For
example, injecting and extracting to and from Hackney headers could be
done with Hackney specific functions:
set_header(Headers, Key, Value) -> hackney_headers:store(Key, Value, Headers). some_fun_calling_hackney() -> Headers = otel_propagator_text_map:inject(hackney_headers:new(), fun set_header/2), ...
An example of extraction in an Elli request handler:
get_header(Req, Key) -> elli_request:get_header(Key, Req, Default). handle(Req, _Args) -> otel_propagator_text_map:extract(Req, fun get_header/2), ... {ok, [], <<"hello world">>}.
carrier_get() = fun((otel_propagator:carrier(), unicode:latin1_binary()) -> unicode:latin1_binary() | undefined)
carrier_keys() = fun((otel_propagator:carrier()) -> [unicode:latin1_binary()])
carrier_set() = fun((otel_propagator:carrier(), unicode:latin1_binary(), unicode:latin1_binary()) -> otel_propagator:carrier())
default_text_map_carrier() = [{unicode:latin1_binary(), unicode:latin1_binary()}]
field_key() = unicode:latin1_binary()
field_value() = unicode:latin1_binary()
propagator_options() = term()
t() = module() | {module(), propagator_options()}
default_carrier_get(Key::field_key(), List::default_text_map_carrier()) -> field_value() | undefined
default_carrier_keys(Rest::default_text_map_carrier()) -> [field_key()]
default_carrier_set(Key::field_key(), Value::field_value(), Rest::default_text_map_carrier()) -> default_text_map_carrier()
extract(Carrier::otel_propagator:carrier()) -> otel_ctx:t()
extract(Propagator::otel_propagator:t(), Carrier::otel_propagator:carrier()) -> otel_ctx:t()
extract(Propagator::otel_propagator:t(), Carrier::otel_propagator:carrier(), CarrierKeysFun::function(), CarrierGetFun::function()) -> otel_ctx:t()
extract_to(Context::otel_ctx:t(), Carrier::otel_propagator:carrier()) -> otel_ctx:t()
extract_to(Context::otel_ctx:t(), Propagator::otel_propagator:t(), Carrier::otel_propagator:carrier()) -> otel_ctx:t()
extract_to(Context::otel_ctx:t(), Module::otel_propagator:t(), Carrier::otel_propagator:carrier(), CarrierKeysFun::function(), CarrierGetFun::function()) -> otel_ctx:t()
fields(Propagator::otel_propagator:t()) -> [field_key()]
inject(Carrier::otel_propagator:carrier()) -> otel_propagator:carrier()
inject(Propagator::otel_propagator:t(), Carrier::otel_propagator:carrier()) -> otel_propagator:carrier()
inject(Propagator::otel_propagator:t(), Carrier::otel_propagator:carrier(), CarrierSetFun::function()) -> otel_propagator:carrier()
inject_from(Context::otel_ctx:t(), Carrier::otel_propagator:carrier()) -> otel_propagator:carrier()
inject_from(Context::otel_ctx:t(), Propagator::otel_propagator:t(), Carrier::otel_propagator:carrier()) -> otel_propagator:carrier()
inject_from(Context::otel_ctx:t(), Module::otel_propagator:t(), Carrier::otel_propagator:carrier(), CarrierSetFun::function()) -> otel_propagator:carrier()
Generated by EDoc