Skip to content
Merged
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions synapse/metrics/background_process_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ def run_as_background_process(
rules.
"""

# Since we track the tracing scope in the `LoggingContext`, before we move to the
# sentinel logcontext (or a new new `LoggingContext`), grab the currently active
Comment thread
MadLittleMods marked this conversation as resolved.
Outdated
# tracing span (if any) so that we can create a cross-link to the background process
# trace.
original_active_tracing_span = active_span()

async def run() -> Optional[R]:
with _bg_metrics_lock:
count = _background_process_counts.get(desc, 0)
Expand All @@ -276,8 +282,6 @@ async def run() -> Optional[R]:
) as logging_context:
try:
if bg_start_span:
original_active_tracing_span = active_span()

# If there is already an active span (e.g. because this background
# process was started as part of handling a request for example),
# because this is a long-running background task that may serve a
Expand Down