summary refs log tree commit diff
path: root/synapse/metrics
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-12-14 14:19:47 -0500
committerGitHub <noreply@github.com>2020-12-14 14:19:47 -0500
commit1619802228033455ff6e5863c52556996b38e8c6 (patch)
tree221d82bcf5ef163c833a5c602048beed7d3d1287 /synapse/metrics
parentPreparatory refactoring of the OidcHandlerTestCase (#8911) (diff)
downloadsynapse-1619802228033455ff6e5863c52556996b38e8c6.tar.xz
Various clean-ups to the logging context code (#8935)
Diffstat (limited to 'synapse/metrics')
-rw-r--r--synapse/metrics/background_process_metrics.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/metrics/background_process_metrics.py b/synapse/metrics/background_process_metrics.py
index 76b7decf26..70e0fa45d9 100644
--- a/synapse/metrics/background_process_metrics.py
+++ b/synapse/metrics/background_process_metrics.py
@@ -199,8 +199,7 @@ def run_as_background_process(desc: str, func, *args, bg_start_span=True, **kwar
         _background_process_start_count.labels(desc).inc()
         _background_process_in_flight_count.labels(desc).inc()
 
-        with BackgroundProcessLoggingContext(desc) as context:
-            context.request = "%s-%i" % (desc, count)
+        with BackgroundProcessLoggingContext(desc, "%s-%i" % (desc, count)) as context:
             try:
                 ctx = noop_context_manager()
                 if bg_start_span:
@@ -244,8 +243,8 @@ class BackgroundProcessLoggingContext(LoggingContext):
 
     __slots__ = ["_proc"]
 
-    def __init__(self, name: str):
-        super().__init__(name)
+    def __init__(self, name: str, request: Optional[str] = None):
+        super().__init__(name, request=request)
 
         self._proc = _BackgroundProcess(name, self)