opentelemetry.context package¶
Submodules¶
Module contents¶
-
opentelemetry.context.
get_value
(key, context=None)[source]¶ To access the local state of a concern, the RuntimeContext API provides a function which takes a context and a key as input, and returns a value.
- Parameters
key (
str
) – The key of the value to retrieve.context (
Optional
[Context
]) – The context from which to retrieve the value, if None, the current context is used.
- Return type
object
- Returns
The value associated with the key.
-
opentelemetry.context.
set_value
(key, value, context=None)[source]¶ To record the local state of a cross-cutting concern, the RuntimeContext API provides a function which takes a context, a key, and a value as input, and returns an updated context which contains the new value.
-
opentelemetry.context.
get_current
()[source]¶ To access the context associated with program execution, the Context API provides a function which takes no arguments and returns a Context.