summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--synapse/storage/events_worker.py2
-rw-r--r--synapse/util/logcontext.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py
index cf4efa9d12..3a634842ca 100644
--- a/synapse/storage/events_worker.py
+++ b/synapse/storage/events_worker.py
@@ -147,7 +147,7 @@ class EventsWorkerStore(SQLBaseStore):
 
         if missing_events_ids:
             log_ctx = LoggingContext.current_context()
-            log_ctx.evt_db_fetch_count += len(missing_events_ids)
+            log_ctx.record_event_fetch(len(missing_events_ids))
 
             missing_events = yield self._enqueue_events(
                 missing_events_ids,
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py
index 2bfd4bee96..df2b71b791 100644
--- a/synapse/util/logcontext.py
+++ b/synapse/util/logcontext.py
@@ -91,6 +91,9 @@ class LoggingContext(object):
         def add_database_scheduled(self, sched_sec):
             pass
 
+        def record_event_fetch(self, event_count):
+            pass
+
         def __nonzero__(self):
             return False
         __bool__ = __nonzero__  # python3
@@ -247,6 +250,14 @@ class LoggingContext(object):
         """
         self.db_sched_duration_sec += sched_sec
 
+    def record_event_fetch(self, event_count):
+        """Record a number of events being fetched from the db
+
+        Args:
+            event_count (int): number of events being fetched
+        """
+        self.evt_db_fetch_count += event_count
+
 
 class LoggingContextFilter(logging.Filter):
     """Logging filter that adds values from the current logging context to each