summary refs log tree commit diff
path: root/synapse/state/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-17 16:29:00 +0100
committerErik Johnston <erik@matrix.org>2019-06-17 17:02:53 +0100
commitff88d36dcb3113b14a6c8d8fe4b3db467c38c06e (patch)
treeba8ebac83ab8d8187d6ffc449716a6df0dc9fd5c /synapse/state/__init__.py
parentAdd metrics for len of new extremities persisted. (diff)
downloadsynapse-ff88d36dcb3113b14a6c8d8fe4b3db467c38c06e.tar.xz
Add metric fo number of state groups in resolution
Diffstat (limited to 'synapse/state/__init__.py')
-rw-r--r--synapse/state/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py
index 36684ef9f6..3415a34367 100644
--- a/synapse/state/__init__.py
+++ b/synapse/state/__init__.py
@@ -21,6 +21,7 @@ from six import iteritems, itervalues
 
 import attr
 from frozendict import frozendict
+from prometheus_client import Histogram
 
 from twisted.internet import defer
 
@@ -37,6 +38,13 @@ from synapse.util.metrics import Measure
 logger = logging.getLogger(__name__)
 
 
+# Metrics for number of state groups involved in a resolution.
+state_groups_histogram = Histogram(
+    "synapse_state_number_state_groups", "",
+    buckets=(0, 1, 2, 3, 5, 7, 10, 20, 50, 100, "+Inf"),
+)
+
+
 KeyStateTuple = namedtuple("KeyStateTuple", ("context", "type", "state_key"))
 
 
@@ -364,6 +372,8 @@ class StateHandler(object):
             room_id, event_ids
         )
 
+        state_groups_histogram.observe(len(state_groups_ids))
+
         if len(state_groups_ids) == 0:
             defer.returnValue(_StateCacheEntry(
                 state={},