otel_ctx (OpenTelemetry API v1.4.0)
View SourceCtx is responsible for propagating values within a process that are associated with a particular Trace or set of Baggage. OpenTelemetry.Tracer
and OpenTelemetry.Baggage
handle updating the Context.
Functions in this module include variants that explicitly take a Ctx
argument and variants that implicitly use the current context, which is the context stored in the process dictionary.
Summary
Functions
Attaches the given context to the current process.
Removes all key-value pairs from the current context.
Removes all key-value pairs from the given context.
Detaches the given context from the current process.
Returns the current context.
Gets a value from the current context under the given key.
Gets a value from the current context under the given key, or returns the default value if the key is not present in the current context.
Gets a value from the given context under the given key, or returns the default value if the key is not present in the given context or if Ctx
is undefined
.
Creates a new context.
Removes the value under the given key from the current context.
Removes the value under the given key from the given context.
Sets a value in the current context under the given key.
Sets a value in the given context under the given key.
Attaches a context and runs a function, detaching the context at the end.
Types
Functions
Attaches the given context to the current process.
Essentially, this sets Ctx
as the current context .
-spec clear() -> ok.
Removes all key-value pairs from the current context.
Removes all key-value pairs from the given context.
Returns an empty context.
Detaches the given context from the current process.
-spec get_current() -> map().
Returns the current context.
-spec get_value(term()) -> eqwalizer:dynamic().
Gets a value from the current context under the given key.
-spec get_value(term(), term()) -> eqwalizer:dynamic().
Gets a value from the current context under the given key, or returns the default value if the key is not present in the current context.
-spec get_value(t(), term(), term()) -> eqwalizer:dynamic().
Gets a value from the given context under the given key, or returns the default value if the key is not present in the given context or if Ctx
is undefined
.
-spec new() -> t().
Creates a new context.
-spec remove(term()) -> ok.
Removes the value under the given key from the current context.
Removes the value under the given key from the given context.
Returns the updated context.
Sets a value in the current context under the given key.
Sets a value in the given context under the given key.
Returns the updated context.
Attaches a context and runs a function, detaching the context at the end.
Returns the detached context.