Skip to content

Commit

Permalink
Add epoch-seconds timestamp to debug logs of oplog entries (#63)
Browse files Browse the repository at this point in the history
When we get an oplog entry, we log it out at debug level. This adds an
extra metadata field that prints the server time in seconds since the
epoch so that it's easy to see visually how delayed oplog entries are.
  • Loading branch information
torywheelwright committed Apr 4, 2024
1 parent eda10da commit 9b4148d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildGoModule {
pname = "oplogtoredis";
version = "3.3.0";
version = "3.4.0";
src = builtins.path { path = ./.; };

postInstall = ''
Expand Down
3 changes: 1 addition & 2 deletions lib/oplog/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ func (tailer *Tailer) unmarshalEntry(rawData bson.Raw) (timestamp *primitive.Tim
timestamp = &result.Timestamp

entries := tailer.parseRawOplogEntry(result, nil)
log.Log.Debugw("Received oplog entry",
"entry", result)
log.Log.Debugw("Received oplog entry", "entry", result, "processTime", time.Now().UnixMilli())

status := "ignored"
database := "(no database)"
Expand Down

0 comments on commit 9b4148d

Please sign in to comment.