Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Enhance logging for inbound federation events #12301

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12301.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enhance logging for inbound federation events.
2 changes: 1 addition & 1 deletion synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ async def _process_incoming_pdus_in_room_inner(
# has started processing).
while True:
async with lock:
logger.info("handling received PDU: %s", event)
logger.info("handling received PDU in room %s: %s", room_id, event)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question for reviewer: I also considered updating FrozenEvent.__repr__ to include the room ID, since it seems a generally useful thing to log about an event. However, I'm wary of making repr(event) huge, and normally there are other clues in the logs about which room we are working in, so I decided against that approach. But thoughts on this would be welcome.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to do it this way. If we find ourselves adding more room_id logging then we can revisit whether we should fold that into the __repr__

try:
with nested_logging_context(event.event_id):
await self._federation_event_handler.on_receive_pdu(
Expand Down