common Module

Common functions shared by both the sync and the async decorators.

Functions

change_context

Execute this block inside the given context and restore it afterwards.

This does not start and ends the span, but just make sure all code is executed within that span.

If span is None, no-op.

change_context(span: Optional[AbstractSpan]) -> Generator

Parameters

span
AbstractSpan
Required

A span

Return type

<xref:contextmanager>

with_current_context

Passes the current spans to the new context the function will be run in.

with_current_context(func: Callable) -> Any

Parameters

func
Required

The function that will be run in the new context

Returns

The func wrapped with correct context

Return type