From 534c29ab02e4566712bcc7eb9912b1a7a21e0ae4 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 18 Jan 2021 12:58:48 +0000 Subject: [PATCH] Log event ID on consumer errors (fixes #1714) --- federationsender/consumers/roomserver.go | 1 + syncapi/consumers/roomserver.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/federationsender/consumers/roomserver.go b/federationsender/consumers/roomserver.go index b53cb251b..513919c6f 100644 --- a/federationsender/consumers/roomserver.go +++ b/federationsender/consumers/roomserver.go @@ -102,6 +102,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error { default: // panic rather than continue with an inconsistent database log.WithFields(log.Fields{ + "event_id": ev.EventID(), "event": string(ev.JSON()), "add": output.NewRoomEvent.AddsStateEventIDs, "del": output.NewRoomEvent.RemovesStateEventIDs, diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go index 1d47b73a6..a8cc5f710 100644 --- a/syncapi/consumers/roomserver.go +++ b/syncapi/consumers/roomserver.go @@ -173,6 +173,7 @@ func (s *OutputRoomEventConsumer) onNewRoomEvent( if err != nil { // panic rather than continue with an inconsistent database log.WithFields(log.Fields{ + "event_id": ev.EventID(), "event": string(ev.JSON()), log.ErrorKey: err, "add": msg.AddsStateEventIDs, @@ -215,6 +216,7 @@ func (s *OutputRoomEventConsumer) onOldRoomEvent( if err != nil { // panic rather than continue with an inconsistent database log.WithFields(log.Fields{ + "event_id": ev.EventID(), "event": string(ev.JSON()), log.ErrorKey: err, }).Panicf("roomserver output log: write old event failure") @@ -276,6 +278,7 @@ func (s *OutputRoomEventConsumer) onNewInviteEvent( if err != nil { // panic rather than continue with an inconsistent database log.WithFields(log.Fields{ + "event_id": msg.Event.EventID(), "event": string(msg.Event.JSON()), "pdupos": pduPos, log.ErrorKey: err,