summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-05-02 11:36:11 +0100
committerErik Johnston <erik@matrix.org>2017-05-15 15:11:30 +0100
commite0d2f6d5b02dd208bc55434b5c2d386827486e9f (patch)
tree583a795efdb9d2e4fe78d4c182bc52c62b2c76ea /synapse/storage
parentPrefill state caches (diff)
downloadsynapse-e0d2f6d5b02dd208bc55434b5c2d386827486e9f.tar.xz
Add more granular event send metrics
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/events.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 0dffafd90d..36574f78b8 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -374,6 +374,18 @@ class EventsStore(SQLBaseStore):
                     new_forward_extremeties=new_forward_extremeties,
                 )
                 persist_event_counter.inc_by(len(chunk))
+                for event, context in chunk:
+                    if context.app_service:
+                        origin_type = "local"
+                        origin_entity = context.app_service.id
+                    elif self.hs.is_mine_id(event.sender):
+                        origin_type = "local"
+                        origin_entity = "*client*"
+                    else:
+                        origin_type = "remote"
+                        origin_entity = get_domain_from_id(event.sender)
+
+                    event_counter.inc(event.type, origin_type, origin_entity)
 
                 for event, context in chunk:
                     if context.app_service: