feat(cli): block-listener INFO heartbeat (closes #333)#344
Merged
Conversation
`charon listen` logged received blocks at DEBUG only, so under the default `RUST_LOG=info` filter the post-startup terminal stayed silent for minutes at a time and operators routinely assumed the bot had hung. The block listener was in fact ticking; the only proof was scraping `/metrics`. Add a low-frequency INFO heartbeat keyed off the chain block number. Default cadence is 50 blocks (~150s on BSC's 3s block time); operators tune via `[bot] heartbeat_blocks = N`, and a value of `0` disables it entirely (e.g. JSON-log pipelines that prefer to derive liveness from the metrics surface). Block-number-keyed (vs internal counter) so cadence stays deterministic across restarts, which matters for log-grep based liveness checks. Backfill heads are skipped so a reconnect storm replaying many synthesised heads cannot fire N heartbeat lines. The existing per-block DEBUG line stays for high-resolution debugging.
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
BotConfig::heartbeat_blocks(default 50, configurable via[bot] heartbeat_blocks).info!line at everyNthnon-backfill block on the listening chain.0disables the heartbeat entirely.debug!line preserved.Why
Default
RUST_LOG=infoproduced no post-startup output for minutes at a time; operators assumed the bot had hung even though the listener was ticking. Closes #333.Test plan
cargo test --workspace --lib58/58 (incl. 2 new heartbeat tests in BotConfig)cargo build --workspacecleanheartbeat_blocks != 0short-circuit