opentelemetry.context.base_context module

class opentelemetry.context.context.Context[source]

Bases: dict, typing.Generic

class opentelemetry.context.context.RuntimeContext[source]

Bases: abc.ABC

The RuntimeContext interface provides a wrapper for the different mechanisms that are used to propagate context in Python. Implementations can be made available via entry_points and selected through environment variables.

abstract attach(context)[source]

Sets the current Context object. Returns a token that can be used to reset to the previous Context.

Parameters

context (Context) – The Context to set.

Return type

object

abstract get_current()[source]

Returns the current Context object.

Return type

Context

abstract detach(token)[source]

Resets Context to a previous value

Parameters

token (object) – A reference to a previous Context.

Return type

None