diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-07 17:56:11 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-07 17:56:11 +0000 |
commit | 6a5ff5f223c1b4311aa63574663c0335d0c6bd79 (patch) | |
tree | b0876351b0c892e23c81ac5a3d85f329d34df7b6 /synapse/http | |
parent | Merge pull request #423 from matrix-org/markjh/archived_flag (diff) | |
download | synapse-6a5ff5f223c1b4311aa63574663c0335d0c6bd79.tar.xz |
Track the time spent in the database per request.
and track the number of transactions that request started.
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/server.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index 06fb53707b..c44bdfc888 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -61,6 +61,15 @@ response_ru_stime = metrics.register_distribution( "response_ru_stime", labels=["method", "servlet"] ) +response_db_txn_count = metrics.register_distribution( + "response_db_txn_count", labels=["method", "servlet"] +) + +response_db_txn_duration = metrics.register_distribution( + "response_db_txn_duration", labels=["method", "servlet"] +) + + _next_request_id = 0 @@ -235,6 +244,12 @@ class JsonResource(HttpServer, resource.Resource): response_ru_utime.inc_by(ru_utime, request.method, servlet_classname) response_ru_stime.inc_by(ru_stime, request.method, servlet_classname) + response_db_txn_count.inc_by( + context.db_txn_count, request.method, servlet_classname + ) + response_db_txn_duration.inc_by( + context.db_txn_duration, request.method, servlet_classname + ) except: pass |