summary refs log tree commit diff
path: root/synapse/util/metrics.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-04 10:22:44 +0000
committerErik Johnston <erik@matrix.org>2016-02-08 14:26:45 +0000
commit2c1fbea5319db2c64fa486adb32b5e66680b6daf (patch)
treef34fb636206664ffa531e30d703469ff1a6d3a19 /synapse/util/metrics.py
parentAdd metrics to pushers (diff)
downloadsynapse-2c1fbea5319db2c64fa486adb32b5e66680b6daf.tar.xz
Fix up logcontexts
Diffstat (limited to 'synapse/util/metrics.py')
-rw-r--r--synapse/util/metrics.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py
index daf6087fe0..ca48007218 100644
--- a/synapse/util/metrics.py
+++ b/synapse/util/metrics.py
@@ -68,16 +68,18 @@ class Measure(object):
         block_timer.inc_by(duration, self.name)
 
         context = LoggingContext.current_context()
-        if not context:
-            return
 
         if context != self.start_context:
             logger.warn(
-                "Context have unexpectedly changed %r, %r",
-                context, self.start_context
+                "Context have unexpectedly changed from '%s' to '%s'. (%r)",
+                context, self.start_context, self.name
             )
             return
 
+        if not context:
+            logger.warn("Expected context. (%r)", self.name)
+            return
+
         ru_utime, ru_stime = context.get_resource_usage()
 
         block_ru_utime.inc_by(ru_utime, self.name)