feat: log per-dir traversal at debug + a periodic progress heartbeat#30
Merged
Conversation
Until now every info-level walker event was per-file: transferred, skipped, failed. A directory-only subtree (think node_modules, .yarn, etc) can run for many minutes without any of those firing, which from the outside looks identical to a wedged process — the tracking doc is frozen too because flushProgress only flushes every N files, never on bare dir visits. Add a debug-level migration.dir_visited event after each listing, carrying the current path, entries count, pending queue size and running total of directories visited. Add an info-level migration.progress heartbeat that fires every 30s independent of file activity. Together they turn the silent traversal into an observable one: operators get a steady "still alive" signal at info, plus a precise breadcrumb trail at debug for diagnosis.
The 5-field object literal was constructed on every iteration of the traversal loop regardless of LOG_LEVEL, since pino only checks the level after receiving its arguments. With ~10k+ dir visits per migration on a node_modules-class tree and multiple concurrent migrations per process, that is a measurable allocation we can avoid with a single isLevelEnabled call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
migration.file_transferred/skipped/failed). A directory-only subtree (node_modules,.yarn, etc) can run for many minutes without any of those firing, which is indistinguishable from a wedged process.flushProgressonly flushes every N files so the tracking doc looks frozen too.migration.dir_visitedafter each listing, carrying the current path, entries count, pending queue size and running total of directories visited.migration.progressheartbeat that fires every 30 s independent of file activity. Cleared infinallyso a settled migration does not leak the timer.