opentelemetry.context package¶
Submodules¶
Module contents¶
-
opentelemetry.context.
create_key
(keyname)[source]¶ To allow cross-cutting concern to control access to their local state, the RuntimeContext API provides a function which takes a keyname as input, and returns a unique key. :type keyname:
str
:param keyname: The key name is for debugging purposes and is not required to be unique.- Return type
- Returns
A unique string representing the newly created key.
-
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.
-
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.