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/storage | |
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/storage')
-rw-r--r-- | synapse/storage/events_worker.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py index 32d9d00ffb..cf4efa9d12 100644 --- a/synapse/storage/events_worker.py +++ b/synapse/storage/events_worker.py @@ -21,6 +21,7 @@ from synapse.events.utils import prune_event from synapse.util.logcontext import ( PreserveLoggingContext, make_deferred_yieldable, run_in_background, + LoggingContext, ) from synapse.util.metrics import Measure from synapse.api.errors import SynapseError @@ -145,6 +146,9 @@ class EventsWorkerStore(SQLBaseStore): missing_events_ids = [e for e in event_ids if e not in event_entry_map] if missing_events_ids: + log_ctx = LoggingContext.current_context() + log_ctx.evt_db_fetch_count += len(missing_events_ids) + missing_events = yield self._enqueue_events( missing_events_ids, check_redacted=check_redacted, |