otel_baggage (OpenTelemetry API v1.4.0)
View SourceBaggage 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 (with set/1
or set/3
, for example) or in an explicit Context (see otel_ctx
).
Summary
Types
An input key, that is, a key that is then converted to a UTF-8 binary.
An input value, that is, a value that is then converted to a UTF-8 binary.
The type for the baggage key, which is a UTF-8 binary.
The type for the baggage metadata, which is a list of UTF-8 binaries or a list of tuples of UTF-8 binaries (as key-value pairs).
The type for the baggage.
The type for the baggage value, which is a UTF-8 binary.
Functions
Clears the baggage, removing all the current key-value pairs.
Clears the baggage for the given context, removing all the current key-value pairs.
Returns the baggage from the process dictionary.
Returns the baggage for the given context.
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.
Types
-type input_key() :: key() | unicode:charlist().
An input key, that is, a key that is then converted to a UTF-8 binary.
-type input_value() :: value() | unicode:charlist() | atom().
An input value, that is, a value that is then converted to a UTF-8 binary.
-type key() :: unicode:unicode_binary().
The type for the baggage key, which is a UTF-8 binary.
-type metadata() :: [unicode:unicode_binary() | {unicode:unicode_binary(), unicode:unicode_binary()}].
The type for the baggage metadata, which is a list of UTF-8 binaries or a list of tuples of UTF-8 binaries (as key-value pairs).
The type for the baggage.
-type value() :: unicode:unicode_binary().
The type for the baggage value, which is a UTF-8 binary.
Functions
-spec clear() -> ok.
Clears the baggage, removing all the current key-value pairs.
-spec clear(otel_ctx:t()) -> otel_ctx:t().
Clears the baggage for the given context, removing all the current key-value pairs.
-spec get_all() -> t().
Returns the baggage from the process dictionary.
-spec get_all(otel_ctx:t()) -> t().
Returns the baggage for the given context.
Sets the given key-value pairs in the current baggage.
If you need to set metadata for the key-value pair, use set/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.
Returns ok
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.
Returns ok
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.