diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-06-21 06:15:03 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-06-21 06:15:03 +0100 |
commit | b088aafcae71fa61433f92ce0b139802a9cbd304 (patch) | |
tree | c3f8063a1a10ce58f78c0f457bd65e394838ffe5 /synapse/http | |
parent | Merge pull request #3416 from matrix-org/rav/restart_indicator (diff) | |
download | synapse-b088aafcae71fa61433f92ce0b139802a9cbd304.tar.xz |
Log number of events fetched from DB
When we finish processing a request, log the number of events we fetched from the database to handle it. [I'm trying to figure out which requests are responsible for large amounts of event cache churn. It may turn out to be more helpful to add counts to the prometheus per-request/block metrics, but that is an extension to this code anyway.]
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/site.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py index 2664006f8c..74a752d6cf 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py @@ -99,16 +99,18 @@ class SynapseRequest(Request): db_txn_count = context.db_txn_count db_txn_duration_sec = context.db_txn_duration_sec db_sched_duration_sec = context.db_sched_duration_sec + evt_db_fetch_count = context.evt_db_fetch_count except Exception: ru_utime, ru_stime = (0, 0) db_txn_count, db_txn_duration_sec = (0, 0) + evt_db_fetch_count = 0 end_time = time.time() self.site.access_logger.info( "%s - %s - {%s}" " Processed request: %.3fsec (%.3fsec, %.3fsec) (%.3fsec/%.3fsec/%d)" - " %sB %s \"%s %s %s\" \"%s\"", + " %sB %s \"%s %s %s\" \"%s\" [%d dbevts]", self.getClientIP(), self.site.site_tag, self.authenticated_entity, @@ -124,6 +126,7 @@ class SynapseRequest(Request): self.get_redacted_uri(), self.clientproto, self.get_user_agent(), + evt_db_fetch_count, ) try: |