Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛Fix opentelemetry detach bug #6941

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