From 176aa55fd5971610727cb10372faf521542653d9 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 29 Sep 2021 11:59:43 +0100 Subject: [PATCH] add event id to logcontext when handling incoming PDUs (#10936) --- changelog.d/10936.misc | 1 + synapse/federation/federation_server.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/10936.misc diff --git a/changelog.d/10936.misc b/changelog.d/10936.misc new file mode 100644 index 000000000..9d1d6e5b0 --- /dev/null +++ b/changelog.d/10936.misc @@ -0,0 +1 @@ +Include the event id in the logcontext when handling PDUs received over federation. diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index 638959cbe..83f11d6b8 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -1008,7 +1008,10 @@ class FederationServer(FederationBase): async with lock: logger.info("handling received PDU: %s", event) try: - await self._federation_event_handler.on_receive_pdu(origin, event) + with nested_logging_context(event.event_id): + await self._federation_event_handler.on_receive_pdu( + origin, event + ) except FederationError as e: # XXX: Ideally we'd inform the remote we failed to process # the event, but we can't return an error in the transaction