Only count non-cache state resolution

This commit is contained in:
Erik Johnston 2019-06-18 13:01:52 +01:00
parent c9385dd238
commit 16a3124b76

View File

@ -41,7 +41,7 @@ logger = logging.getLogger(__name__)
# Metrics for number of state groups involved in a resolution. # Metrics for number of state groups involved in a resolution.
state_groups_histogram = Histogram( state_groups_histogram = Histogram(
"synapse_state_number_state_groups", "", "synapse_state_number_state_groups", "",
buckets=(0, 1, 2, 3, 5, 7, 10, 15, 20, 50, 100, 200, 500, "+Inf"), buckets=(1, 2, 3, 5, 7, 10, 15, 20, 50, 100, 200, 500, "+Inf"),
) )
@ -372,8 +372,6 @@ class StateHandler(object):
room_id, event_ids room_id, event_ids
) )
state_groups_histogram.observe(len(state_groups_ids))
if len(state_groups_ids) == 0: if len(state_groups_ids) == 0:
defer.returnValue(_StateCacheEntry( defer.returnValue(_StateCacheEntry(
state={}, state={},
@ -498,6 +496,8 @@ class StateResolutionHandler(object):
"Resolving state for %s with %d groups", room_id, len(state_groups_ids) "Resolving state for %s with %d groups", room_id, len(state_groups_ids)
) )
state_groups_histogram.observe(len(state_groups_ids))
# start by assuming we won't have any conflicted state, and build up the new # start by assuming we won't have any conflicted state, and build up the new
# state map by iterating through the state groups. If we discover a conflict, # state map by iterating through the state groups. If we discover a conflict,
# we give up and instead use `resolve_events_with_store`. # we give up and instead use `resolve_events_with_store`.