From 109882230c309d48df143ad370192f0541b636f3 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:57:27 +0100 Subject: Clean up logging on event persister endpoints (#16488) --- changelog.d/16488.misc | 1 + synapse/replication/http/federation.py | 6 +++++- synapse/replication/http/send_events.py | 13 ++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 changelog.d/16488.misc diff --git a/changelog.d/16488.misc b/changelog.d/16488.misc new file mode 100644 index 0000000000..9e70e45b22 --- /dev/null +++ b/changelog.d/16488.misc @@ -0,0 +1 @@ +Clean up logging on event persister endpoints. diff --git a/synapse/replication/http/federation.py b/synapse/replication/http/federation.py index 53ad327030..e728297dce 100644 --- a/synapse/replication/http/federation.py +++ b/synapse/replication/http/federation.py @@ -138,7 +138,11 @@ class ReplicationFederationSendEventsRestServlet(ReplicationEndpoint): event_and_contexts.append((event, context)) - logger.info("Got %d events from federation", len(event_and_contexts)) + logger.info( + "Got batch of %i events to persist to room %s", + len(event_and_contexts), + room_id, + ) max_stream_id = await self.federation_event_handler.persist_events_and_notify( room_id, event_and_contexts, backfilled diff --git a/synapse/replication/http/send_events.py b/synapse/replication/http/send_events.py index 4f82c9f96d..8eea256063 100644 --- a/synapse/replication/http/send_events.py +++ b/synapse/replication/http/send_events.py @@ -118,6 +118,7 @@ class ReplicationSendEventsRestServlet(ReplicationEndpoint): with Measure(self.clock, "repl_send_events_parse"): events_and_context = [] events = payload["events"] + rooms = set() for event_payload in events: event_dict = event_payload["event"] @@ -144,11 +145,13 @@ class ReplicationSendEventsRestServlet(ReplicationEndpoint): UserID.from_string(u) for u in event_payload["extra_users"] ] - logger.info( - "Got batch of events to send, last ID of batch is: %s, sending into room: %s", - event.event_id, - event.room_id, - ) + # all the rooms *should* be the same, but we'll log separately to be + # sure. + rooms.add(event.room_id) + + logger.info( + "Got batch of %i events to persist to rooms %s", len(events), rooms + ) last_event = ( await self.event_creation_handler.persist_and_notify_client_events( -- cgit 1.4.1