Skip to content

Commit

Permalink
debug assistance
Browse files Browse the repository at this point in the history
  • Loading branch information
FGasper committed Jan 7, 2025
1 parent efbe591 commit 70f0a95
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/verifier/change_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,12 @@ func (csr *ChangeStreamReader) readAndHandleOneChangeEventBatch(
}

// This only logs in tests.
csr.logger.Trace().Interface("event", changeEventBatch[eventsRead]).Msgf("%s received a change event", csr)
csr.logger.Debug().
Stringer("changeStream", csr).
Interface("event", changeEventBatch[eventsRead]).
Int("eventsPreviouslyReadInBatch", eventsRead).
Int("batchSize", len(changeEventBatch)).
Msg("Received a change event.")

if changeEventBatch[eventsRead].ClusterTime != nil &&
(csr.lastChangeEventTime == nil ||
Expand All @@ -315,10 +320,13 @@ func (csr *ChangeStreamReader) readAndHandleOneChangeEventBatch(

if event, has := latestEvent.Get(); has {
csr.logger.Trace().
Stringer("changeStream", csr).
Interface("event", event).
Msg("Updated lastChangeEventTime.")
}

ri.NoteSuccess("parsed %d-event batch", len(changeEventBatch))

var tokenTs primitive.Timestamp
tokenTs, err := extractTimestampFromResumeToken(cs.ResumeToken())
if err == nil {
Expand All @@ -336,6 +344,8 @@ func (csr *ChangeStreamReader) readAndHandleOneChangeEventBatch(
case csr.changeEventBatchChan <- changeEventBatch:
}

ri.NoteSuccess("sent %d-event batch to handler", len(changeEventBatch))

return nil
}

Expand Down

0 comments on commit 70f0a95

Please sign in to comment.