mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-11 13:54:19 -05:00
Merge pull request #1073 from matrix-org/erikj/presence_fiddle
Record counts of state changes
This commit is contained in:
commit
8da7d0e4f9
@ -53,6 +53,9 @@ bump_active_time_counter = metrics.register_counter("bump_active_time")
|
|||||||
get_updates_counter = metrics.register_counter("get_updates", labels=["type"])
|
get_updates_counter = metrics.register_counter("get_updates", labels=["type"])
|
||||||
|
|
||||||
notify_reason_counter = metrics.register_counter("notify_reason", labels=["reason"])
|
notify_reason_counter = metrics.register_counter("notify_reason", labels=["reason"])
|
||||||
|
state_transition_counter = metrics.register_counter(
|
||||||
|
"state_transition", labels=["from", "to"]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# If a user was last active in the last LAST_ACTIVE_GRANULARITY, consider them
|
# If a user was last active in the last LAST_ACTIVE_GRANULARITY, consider them
|
||||||
@ -950,6 +953,7 @@ def should_notify(old_state, new_state):
|
|||||||
|
|
||||||
if old_state.state != new_state.state:
|
if old_state.state != new_state.state:
|
||||||
notify_reason_counter.inc("state_change")
|
notify_reason_counter.inc("state_change")
|
||||||
|
state_transition_counter.inc(old_state.state, new_state.state)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if old_state.state == PresenceState.ONLINE:
|
if old_state.state == PresenceState.ONLINE:
|
||||||
|
Loading…
Reference in New Issue
Block a user