View Source otel_baggage (opentelemetry_api v1.3.0)
Baggage is used to annotate telemetry, adding context and information to metrics, traces, and logs. It is represented by a set of name/value pairs describing user-defined properties.
The baggage can be stored either in the current context (withset/1
or set/3
, for example) or in an explicit Context (see otel_ctx
).
Link to this section Summary
Types
Functions
Sets the given key-value pairs in the current baggage.
Sets the given key-value pair in the current baggage, or sets the given key-value pairs in the baggage for the given context.
Sets the given key-value pair in the current baggage (with the associated metadata), or sets the given key-value pair in the baggage for the given context.
Sets the given key-value pair in the baggage for the given context, with the associated metadata.
Sets the given key-value pairs in the baggage for the given context.
Sets the given key-value pair in the baggage for the given context.
Sets the given key-value pair in the baggage for the given context, with the associated metadata.
Link to this section Types
-type input_key() :: key() | unicode:charlist().
-type input_value() :: value() | unicode:charlist() | atom().
-type key() :: unicode:unicode_binary().
-type metadata() :: [unicode:unicode_binary() | {unicode:unicode_binary(), unicode:unicode_binary()}].
-type value() :: unicode:unicode_binary().
Link to this section Functions
-spec clear() -> ok.
-spec clear(otel_ctx:t()) -> otel_ctx:t().
-spec get_all() -> t().
-spec get_all(otel_ctx:t()) -> t().
Sets the given key-value pairs in the current baggage.
If you need to set metadata for the key-value pair, useset/3
instead.
-spec set(otel_ctx:t() | input_key(), #{input_key() => input_value()} | [{input_key(), input_value()}] | input_value()) -> otel_ctx:t() | ok.
Sets the given key-value pair in the current baggage, or sets the given key-value pairs in the baggage for the given context.
Returnsok
when using the set(Key, Value)
form, or the updated context when using the set(Ctx, KeyValues)
form.
-spec set(otel_ctx:t() | input_key(), input_key() | input_value(), input_value() | metadata()) -> otel_ctx:t() | ok.
Sets the given key-value pair in the current baggage (with the associated metadata), or sets the given key-value pair in the baggage for the given context.
Returnsok
when using the set(Key, Value, Metadata)
form, or the updated context when using the set(Ctx, Key, Value)
form.
-spec set(otel_ctx:t(), input_key(), input_value(), metadata()) -> otel_ctx:t().
Sets the given key-value pair in the baggage for the given context, with the associated metadata.
Returns the updated context.-spec set_to(otel_ctx:t(), #{input_key() => input_value()} | [{input_key(), input_value()}]) -> otel_ctx:t().
Sets the given key-value pairs in the baggage for the given context.
Returns the updated context.-spec set_to(otel_ctx:t(), input_key(), input_value()) -> otel_ctx:t().
Sets the given key-value pair in the baggage for the given context.
Returns the updated context.-spec set_to(otel_ctx:t(), input_key(), input_value(), metadata()) -> otel_ctx:t().
Sets the given key-value pair in the baggage for the given context, with the associated metadata.
Returns the updated context.