Skip to content

Commit

Permalink
Reduce log spam generated by conflicting session_id and event_index (#…
Browse files Browse the repository at this point in the history
…48548)

Alters the log messages from #40854
such that they only occur if the fallback mechanism fails.

Updates #46801
  • Loading branch information
rosstimothy authored Nov 7, 2024
1 parent f0b8eef commit 53ccda9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/events/dynamoevents/dynamoevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,18 @@ func (l *Log) putAuditEvent(ctx context.Context, sessionID string, in apievents.
// item event index/session id. Since we can't change the session
// id, update the event index with a new value and retry the put
// item.
l.logger.ErrorContext(ctx, "Conflict on event session_id and event_index",
"error", err,
"event_type", in.GetType(),
"session_id", sessionID,
"event_index", in.GetIndex())
return trace.Wrap(l.handleConditionError(ctx, err, sessionID, in))
if err2 := l.handleConditionError(ctx, err, sessionID, in); err2 != nil {
// Only log about the original conflict if updating
// the session information fails.
l.logger.ErrorContext(ctx, "Conflict on event session_id and event_index",
"error", err,
"event_type", in.GetType(),
"session_id", sessionID,
"event_index", in.GetIndex())
return trace.Wrap(err2)
}

return nil
}

return err
Expand Down

0 comments on commit 53ccda9

Please sign in to comment.