summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-19 09:50:54 +0000
committerErik Johnston <erik@matrix.org>2016-02-19 09:50:54 +0000
commit5614b4dafb2e1dd59fac55fe4e8b29cd4bc3e785 (patch)
tree944b888e8148b9989d82fbecc8d49e50651f70b5 /synapse/handlers
parent"You are not..." (diff)
downloadsynapse-5614b4dafb2e1dd59fac55fe4e8b29cd4bc3e785.tar.xz
Add presence metrics
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/presence.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index fb9536cee3..86b94ab84b 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -44,6 +44,9 @@ logger = logging.getLogger(__name__)
 
 metrics = synapse.metrics.get_metrics_for(__name__)
 
+notified_presence_counter = metrics.register_counter("notified_presence")
+presence_updates_counter = metrics.register_counter("presence_updates")
+
 
 # If a user was last active in the last LAST_ACTIVE_GRANULARITY, consider them
 # "currently_active"
@@ -170,6 +173,8 @@ class PresenceHandler(BaseHandler):
             5000,
         )
 
+        metrics.register_callback("wheel_timer_size", lambda: len(self.wheel_timer))
+
     @defer.inlineCallbacks
     def _on_shutdown(self):
         """Gets called when shutting down. This lets us persist any updates that
@@ -233,7 +238,10 @@ class PresenceHandler(BaseHandler):
 
         # TODO: We should probably ensure there are no races hereafter
 
+        presence_updates_counter.inc_by(len(new_states))
+
         if to_notify:
+            notified_presence_counter.inc_by(len(to_notify))
             yield self._persist_and_notify(to_notify.values())
 
         self.unpersisted_users_changes |= set(s.user_id for s in new_states)