From 4ae7335b014a5d0373c3bd8115d9c6ebd45b432e Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:15:04 +0100 Subject: [PATCH] Be more verbose when logging state resets --- .../internal/input/input_latest_events.go | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index f6b9d0513..cf4fe04be 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -279,22 +279,26 @@ func (u *latestEventsUpdater) latestState(ctx context.Context, roomInfo *types.R if removed := len(u.removed) - len(u.added); !u.rewritesState && removed > 0 { logrus.WithFields(logrus.Fields{ - "event_id": u.event.EventID(), - "room_id": u.event.RoomID().String(), - "old_state_nid": u.oldStateNID, - "new_state_nid": u.newStateNID, - "old_latest": u.oldLatest.EventIDs(), - "new_latest": u.latest.EventIDs(), + "event_id": u.event.EventID(), + "room_id": u.event.RoomID().String(), + "old_state_nid": u.oldStateNID, + "new_state_nid": u.newStateNID, + "old_latest": u.oldLatest.EventIDs(), + "new_latest": u.latest.EventIDs(), + "rewrites_state": u.rewritesState, + "state_at_event": fmt.Sprintf("%#v", u.stateAtEvent), }).Warnf("State reset detected (removing %d events)", removed) sentry.WithScope(func(scope *sentry.Scope) { scope.SetLevel("warning") scope.SetContext("State reset", map[string]interface{}{ - "Event ID": u.event.EventID(), - "Old state NID": fmt.Sprintf("%d", u.oldStateNID), - "New state NID": fmt.Sprintf("%d", u.newStateNID), - "Old latest": u.oldLatest.EventIDs(), - "New latest": u.latest.EventIDs(), - "State removed": removed, + "Event ID": u.event.EventID(), + "Old state NID": fmt.Sprintf("%d", u.oldStateNID), + "New state NID": fmt.Sprintf("%d", u.newStateNID), + "Old latest": u.oldLatest.EventIDs(), + "New latest": u.latest.EventIDs(), + "State removed": removed, + "State rewritten": fmt.Sprintf("%v", u.rewritesState), + "State at event": fmt.Sprintf("%#v", u.stateAtEvent), }) sentry.CaptureMessage("State reset detected") })