Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

opentracing: use a consistent name for background processes #10135

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions changelog.d/10135.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OpenTracing: use a consistent name for background processes.
1 change: 1 addition & 0 deletions synapse/logging/opentracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ def ensure_active_span_inner_2(*args, **kwargs):
@contextlib.contextmanager
def noop_context_manager(*args, **kwargs):
"""Does exactly what it says on the tin"""
# TODO: replace with contextlib.nullcontext once we drop support for Python 3.6
yield


Expand Down
5 changes: 3 additions & 2 deletions synapse/metrics/background_process_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,12 @@ async def run():

with BackgroundProcessLoggingContext(desc, count) as context:
try:
ctx = noop_context_manager()
if bg_start_span:
ctx = start_active_span(
desc, tags={SynapseTags.REQUEST_ID: str(context)}
f"bgproc.{desc}", tags={SynapseTags.REQUEST_ID: str(context)}
)
else:
ctx = noop_context_manager()
with ctx:
return await maybe_awaitable(func(*args, **kwargs))
except Exception:
Expand Down