summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2018-01-17 14:29:37 +0000
committerGitHub <noreply@github.com>2018-01-17 14:29:37 +0000
commita7e4ff9ccaad33c7a193fd2bf233260ada10f3e9 (patch)
tree0bb7d6f5f5bdeb7081e810bc119820b36b51d943 /synapse/storage/_base.py
parentMerge pull request #2797 from matrix-org/rav/user_id_checking (diff)
parentMerge remote-tracking branch 'origin/develop' into rav/track_db_scheduling (diff)
downloadsynapse-a7e4ff9ccaad33c7a193fd2bf233260ada10f3e9.tar.xz
Merge pull request #2795 from matrix-org/rav/track_db_scheduling
Track DB scheduling delay per-request
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index 986617674c..68125006eb 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -347,7 +347,9 @@ class SQLBaseStore(object):
 
         def inner_func(conn, *args, **kwargs):
             with LoggingContext("runWithConnection") as context:
-                sql_scheduling_timer.inc_by(time.time() * 1000 - start_time)
+                sched_duration_ms = time.time() * 1000 - start_time
+                sql_scheduling_timer.inc_by(sched_duration_ms)
+                current_context.add_database_scheduled(sched_duration_ms)
 
                 if self.database_engine.is_connection_closed(conn):
                     logger.debug("Reconnecting closed database connection")