Repository navigation
feat(node): meter the settlement re-anchor path - #2751
Merged
Merged
Conversation
The end-of-tick re-anchor reported its outcomes only in logs, and PoolProjection::reanchor skipped a stale read with no signal at all, so a pool stuck pending (a reorg-dropped open, a reorg that lowered totalRedeemed or the deposit, a persistent read fault) was invisible. reanchor now returns a ReanchorReport: the anchored count and each skipped read with its reason. reanchor_pools sets a pending-pools gauge every tick and counts block-read faults, behind-watcher blocks, getPool faults, absent pools, the three stale-skip reasons (each with a warn! naming the pool and both values) and anchors, one sibling counter per reason. Closes #2710 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the settlement re-anchor observability changes.
No open issues 🎉
What changed in this PR
Adds observability to the node’s settlement re-anchor path, following #2709, so operators can detect pools that remain pending without changing settlement behavior.
Changes:
- Returns successful anchor counts and explicit stale-read reasons from
PoolProjection::reanchor, resetting the report on retries. - Records pending pools, read failures, skipped reads, and successful anchors, with warnings for stale reads.
- Extends metric assertions and documents the exported series. Dashboards and absent-pool retirement remain separate follow-ups.
| File | Description |
|---|---|
crates/node/src/pool_view/tests.rs |
Checks anchor reports and stale-read reasons. |
crates/node/src/pool_view.rs |
Adds structured re-anchor reports and retry-safe collection. |
crates/node/src/payment_settlement/tests.rs |
Verifies counters and pending-pool gauge values across outcomes. |
crates/node/src/payment_settlement.rs |
Records re-anchor metrics and logs stale-read details. |
crates/node/src/metrics.rs |
Defines and documents the gauge, counters, and recording methods. |
CHANGELOG.md |
Announces settlement re-anchor telemetry. |
adr/appendix-observability.md |
Registers the new metrics as live and describes their meaning. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 4 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
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.
What
The end-of-tick re-anchor that #2709 added reported its outcomes only in logs.
PoolProjection::reanchorskipped a stale read with no signal at all, so an operator could not see a pool stuck pending: an open that a reorg dropped, a reorg that loweredtotalRedeemedor the deposit, or a read that keeps failing.PoolProjection::reanchorreturns aReanchorReport: the number of reads that anchored their pool, and each skipped read with itsReanchorStalereason (BelowFolded,LowerRedeemed,LowerDeposit, checked in that order).reanchor_poolstakes&Metrics. Following the sibling-counter convention, it counts:decdn_settlement_reanchor_pending_pools, a gauge set at the end of every tick, 0 included, so it falls back;…_block_read_failures_totaland…_behind_watcher_total(the tick reads no pool);…_pool_read_failures_totaland…_absent_total;…_skipped_{below_folded,lower_redeemed,lower_deposit}_total, each with awarn!that names the pool, the held value and the read value;…_anchored_total, the denominator.PoolProjection::updatetakesFnMut, soreanchorcan collect its report.rcumay retry the closure, so the report resets at the start of each run.adr/appendix-observability.md(live), field docs inmetrics.rs, and a CHANGELOG entry.Closes #2710
Reviewer notes
ReanchorReport/reanchorinpool_view.rs, thenreanchor_poolsandcount_reanchor_skipinpayment_settlement.rs.anchoredcount comes from the projection, not fromreads.len() - skipped.len(). A read for a pool that left the projection mid-tick, or that was folded from itsPoolOpened, counts as neither.decdn_settlement_reanchor_pending_poolsstays above 0 for more than a few rotations, follow once this merges.Verification
cargo denyreports the existing RUSTSEC-2026-0387 advisory, warn-only, already on main)cargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run --workspace: 6158 passed (includesadr_registry_names_are_exported)CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-itemsadr/:make -C adr check-refsadr/appendix-observability.md; devops dashboards to follow (see above)CHANGELOG.mdentryabsentincrement removed,reanchor_pools_keeps_a_pool_absent_at_the_pinned_blockfails.🤖 Generated with Claude Code