summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-04-12 12:18:57 +0100
committerGitHub <noreply@github.com>2018-04-12 12:18:57 +0100
commit0f13f30fcadc0aec3230435f1e5e8df4f4e6eac7 (patch)
tree1f52b177c8ca278ed84d568652f892484ef2dc33 /synapse/handlers
parentMerge pull request #3059 from matrix-org/rav/doc_response_cache (diff)
parentFormat docstring (diff)
downloadsynapse-0f13f30fcadc0aec3230435f1e5e8df4f4e6eac7.tar.xz
Merge pull request #3090 from matrix-org/erikj/processed_event_lag
Add metrics for event processing lag
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/appservice.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 69eacff949..0245197c02 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -125,9 +125,23 @@ class ApplicationServicesHandler(object):
                         for evs in events_by_room.itervalues()
                     ], consumeErrors=True))
 
+                    yield self.store.set_appservice_last_pos(upper_bound)
+
+                    now = self.clock.time_msec()
+                    ts = yield self.store.get_received_ts(events[-1].event_id)
+
+                    synapse.metrics.event_processing_positions.set(
+                        upper_bound, "appservice_sender",
+                    )
+
                     events_processed_counter.inc_by(len(events))
 
-                    yield self.store.set_appservice_last_pos(upper_bound)
+                    synapse.metrics.event_processing_lag.set(
+                        now - ts, "appservice_sender",
+                    )
+                    synapse.metrics.event_processing_last_ts.set(
+                        ts, "appservice_sender",
+                    )
             finally:
                 self.is_processing = False