summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-12-08 11:52:35 +0000
committerMark Haines <mjark@negativecurvature.net>2015-12-08 11:52:35 +0000
commit219027f580774dedebf0074cf25500d424b451f3 (patch)
treeb0876351b0c892e23c81ac5a3d85f329d34df7b6 /synapse/app
parentMerge pull request #423 from matrix-org/markjh/archived_flag (diff)
parentTrack the time spent in the database per request. (diff)
downloadsynapse-219027f580774dedebf0074cf25500d424b451f3.tar.xz
Merge pull request #429 from matrix-org/markjh/db_counters
Track the time spent in the database per request.
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 58c679bbfd..56bc52e9ca 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -503,12 +503,15 @@ class SynapseRequest(Request):
         try:
             context = LoggingContext.current_context()
             ru_utime, ru_stime = context.get_resource_usage()
+            db_txn_count = context.db_txn_count
+            db_txn_duration = context.db_txn_duration
         except:
             ru_utime, ru_stime = (0, 0)
+            db_txn_count, db_txn_duration = (0, 0)
 
         self.site.access_logger.info(
             "%s - %s - {%s}"
-            " Processed request: %dms (%dms, %dms)"
+            " Processed request: %dms (%dms, %dms) (%dms/%d)"
             " %sB %s \"%s %s %s\" \"%s\"",
             self.getClientIP(),
             self.site.site_tag,
@@ -516,6 +519,8 @@ class SynapseRequest(Request):
             int(time.time() * 1000) - self.start_time,
             int(ru_utime * 1000),
             int(ru_stime * 1000),
+            int(db_txn_duration * 1000),
+            int(db_txn_count),
             self.sentLength,
             self.code,
             self.method,