summary refs log tree commit diff
path: root/synapse/util/metrics.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-05-28 19:39:27 +1000
committerAmber Brown <hawkowl@atleastfornow.net>2018-05-28 19:39:27 +1000
commit3ef5cd74a6bff9b33144cb834782e0402e6eb152 (patch)
tree6a8905a36f70f1d83e7223625afba605a0cf8b6b /synapse/util/metrics.py
parentinvalid syntax :( (diff)
downloadsynapse-3ef5cd74a6bff9b33144cb834782e0402e6eb152.tar.xz
update to more consistently use seconds in any metrics or logging
Diffstat (limited to 'synapse/util/metrics.py')
-rw-r--r--synapse/util/metrics.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py
index 424fdcb036..23fc0ca20d 100644
--- a/synapse/util/metrics.py
+++ b/synapse/util/metrics.py
@@ -74,7 +74,7 @@ class Measure(object):
         self.created_context = False
 
     def __enter__(self):
-        self.start = self.clock.time_msec()
+        self.start = self.clock.time()
         self.start_context = LoggingContext.current_context()
         if not self.start_context:
             self.start_context = LoggingContext("Measure")
@@ -90,7 +90,7 @@ class Measure(object):
         if isinstance(exc_type, Exception) or not self.start_context:
             return
 
-        duration = self.clock.time_msec() - self.start
+        duration = self.clock.time() - self.start
 
         block_counter.labels(self.name).inc()
         block_timer.labels(self.name).inc(duration)
@@ -114,9 +114,9 @@ class Measure(object):
         block_ru_stime.labels(self.name).inc(ru_stime - self.ru_stime)
         block_db_txn_count.labels(self.name).inc(context.db_txn_count - self.db_txn_count)
         block_db_txn_duration.labels(self.name).inc(
-            (context.db_txn_duration_ms - self.db_txn_duration_ms) / 1000.)
+            context.db_txn_duration_sec - self.db_txn_duration_sec)
         block_db_sched_duration.labels(self.name).inc(
-            (context.db_sched_duration_ms - self.db_sched_duration_ms) / 1000.)
+            context.db_sched_duration_sec - self.db_sched_duration_sec)
 
         if self.created_context:
             self.start_context.__exit__(exc_type, exc_val, exc_tb)