Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/service-library/src/servicelib/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ def get_context() -> TracingContext:

@contextmanager
def use_tracing_context(context: TracingContext):
token: object | None = None
if context is not None:
otcontext.attach(context)
token = otcontext.attach(context)
try:
yield
finally:
if context is not None:
otcontext.detach(context)
if token is not None:
otcontext.detach(token)


def setup_log_tracing(tracing_settings: TracingSettings):
Expand Down
Loading