summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2015-03-11 18:57:35 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 16:24:51 +0000
commite75fa8bbbf1215a89e0239f96789317b96383734 (patch)
treee3e403f4d2a49e7132841ba33a5ac4cd86b91920 /synapse
parentNeater metrics from TransactionQueue (diff)
downloadsynapse-e75fa8bbbf1215a89e0239f96789317b96383734.tar.xz
Bugfix to sql_txn_timer increment - add only the per-TXN duration, not the total time ever spent since boot
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/_base.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index f742fe15df..40f2fc6d76 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -260,15 +260,13 @@ class SQLBaseStore(object):
                     raise
                 finally:
                     end = time.time() * 1000
-                    transaction_logger.debug(
-                        "[TXN END] {%s} %f",
-                        name, end - start
-                    )
+                    duration = end - start
 
-                    self._current_txn_total_time += end - start
-                    self._txn_perf_counters.update(desc, start, end)
+                    transaction_logger.debug("[TXN END] {%s} %f", name, duration)
 
-                    sql_txn_timer.inc_by(self._current_txn_total_time, desc)
+                    self._current_txn_total_time += duration
+                    self._txn_perf_counters.update(desc, start, end)
+                    sql_txn_timer.inc_by(duration, desc)
 
         with PreserveLoggingContext():
             result = yield self._db_pool.runInteraction(