correlation.set_context_var()

An async context manager to simplify the use of ContextVars.

Usage

Source

correlation.set_context_var(
    context_var,
    value,
)

The value will be reset upon exiting the context.