summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-04-20 14:55:16 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2021-04-20 14:55:16 +0100
commit6982db965164ec54a0f5f7cb39b778f6ed0a7306 (patch)
treefdd66aaf3e4433b0e91b0a708edf280e02058178 /synapse/util
parentAdd presence federation stream (#9819) (diff)
parentUpdate v1.32.0 changelog. It's m.login.application_service, not plural (diff)
downloadsynapse-6982db965164ec54a0f5f7cb39b778f6ed0a7306.tar.xz
Merge branch 'master' into develop
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/metrics.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py
index 6ed7179e8c..6d14351bd2 100644
--- a/synapse/util/metrics.py
+++ b/synapse/util/metrics.py
@@ -104,7 +104,13 @@ class Measure:
         "start",
     ]
 
-    def __init__(self, clock, name):
+    def __init__(self, clock, name: str):
+        """
+        Args:
+            clock: A n object with a "time()" method, which returns the current
+                time in seconds.
+            name: The name of the metric to report.
+        """
         self.clock = clock
         self.name = name
         curr_context = current_context()
@@ -117,10 +123,8 @@ class Measure:
         else:
             assert isinstance(curr_context, LoggingContext)
             parent_context = curr_context
-        self._logging_context = LoggingContext(
-            "Measure[%s]" % (self.name,), parent_context
-        )
-        self.start = None
+        self._logging_context = LoggingContext(str(curr_context), parent_context)
+        self.start = None  # type: Optional[int]
 
     def __enter__(self) -> "Measure":
         if self.start is not None: