diff options
author | Erik Johnston <erik@matrix.org> | 2020-06-30 16:58:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 16:58:06 +0100 |
commit | a99658074dc3b2b0f6abcb4f98d56bc1386398aa (patch) | |
tree | 108e1d5a12f2e3e1860aacad4b2790e80209882e /synapse/federation/sender | |
parent | Explain the purpose of the "tests" conditional dependency requirement (#7751) (diff) | |
download | synapse-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__.py | 10 |
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"): |