summary refs log tree commit diff
path: root/synapse/handlers/presence.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-09-06 11:37:20 +0100
committerGitHub <noreply@github.com>2016-09-06 11:37:20 +0100
commit8da7d0e4f9debdba7c1d54bf29a3516a9dfcc6d2 (patch)
tree46aff49a5bdd1cf7db7ef2d4cb105bab0d59b353 /synapse/handlers/presence.py
parentMerge pull request #1072 from matrix-org/erikj/presence_fiddle (diff)
parentRecord counts of state changes (diff)
downloadsynapse-8da7d0e4f9debdba7c1d54bf29a3516a9dfcc6d2.tar.xz
Merge pull request #1073 from matrix-org/erikj/presence_fiddle
Record counts of state changes
Diffstat (limited to 'synapse/handlers/presence.py')
-rw-r--r--synapse/handlers/presence.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index a9f5233119..da9f0da69e 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -53,6 +53,9 @@ bump_active_time_counter = metrics.register_counter("bump_active_time")
 get_updates_counter = metrics.register_counter("get_updates", labels=["type"])
 
 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
@@ -950,6 +953,7 @@ def should_notify(old_state, new_state):
 
     if old_state.state != new_state.state:
         notify_reason_counter.inc("state_change")
+        state_transition_counter.inc(old_state.state, new_state.state)
         return True
 
     if old_state.state == PresenceState.ONLINE: