mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Add metric fo number of state groups in resolution
This commit is contained in:
parent
499d4a32cd
commit
ff88d36dcb
@ -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={},
|
||||
|
Loading…
Reference in New Issue
Block a user