summary refs log tree commit diff
path: root/synapse/federation/sender
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-06-30 16:58:06 +0100
committerGitHub <noreply@github.com>2020-06-30 16:58:06 +0100
commita99658074dc3b2b0f6abcb4f98d56bc1386398aa (patch)
tree108e1d5a12f2e3e1860aacad4b2790e80209882e /synapse/federation/sender
parentExplain the purpose of the "tests" conditional dependency requirement (#7751) (diff)
downloadsynapse-a99658074dc3b2b0f6abcb4f98d56bc1386398aa.tar.xz
Add some metrics for inbound and outbound federation processing times (#7755)
Diffstat (limited to 'synapse/federation/sender')
-rw-r--r--synapse/federation/sender/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/federation/sender/__init__.py b/synapse/federation/sender/__init__.py
index 5b8faea4e7..23fb515683 100644
--- a/synapse/federation/sender/__init__.py
+++ b/synapse/federation/sender/__init__.py
@@ -201,7 +201,15 @@ class FederationSender(object):
 
                     logger.debug("Sending %s to %r", event, destinations)
 
-                    self._send_pdu(event, destinations)
+                    if destinations:
+                        self._send_pdu(event, destinations)
+
+                        now = self.clock.time_msec()
+                        ts = await self.store.get_received_ts(event.event_id)
+
+                        synapse.metrics.event_processing_lag_by_event.labels(
+                            "federation_sender"
+                        ).observe(now - ts)
 
                 async def handle_room_events(events: Iterable[EventBase]) -> None:
                     with Measure(self.clock, "handle_room_events"):