summary refs log tree commit diff
path: root/synapse/util/logcontext.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-06-22 10:42:28 +0100
committerRichard van der Hoff <richard@matrix.org>2018-06-22 10:42:28 +0100
commit0495fe00350a3610cbfd9b0097ff1a8a1c31f5f4 (patch)
tree850a8d8f3fd58cde309788cdbbe7581d1e9bded7 /synapse/util/logcontext.py
parentLog number of events fetched from DB (diff)
downloadsynapse-0495fe00350a3610cbfd9b0097ff1a8a1c31f5f4.tar.xz
Indirect evt_count updates via method call
so that we can stub it for the sentinel and not have a billion failing UTs
Diffstat (limited to 'synapse/util/logcontext.py')
-rw-r--r--synapse/util/logcontext.py11
1 files changed, 11 insertions, 0 deletions
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