Repository navigation
Description
Problem
ChainStakerSet documents that on a mid-run watcher RPC outage the cached active-staker set "can drift from chain state," and the only operator-visible signal is a warn! log line — explicitly not covered by decdn_rpc_healthy (which tracks a different watchdog). See crates/node/src/dht/chain_staker_set.rs (§Failure model, ~L28–37; backoff/restart in watcher_loop).
This is a pre-existing limitation, but #757 (probe-time stake-lane reservation, PR #782) added a new consumer that makes the drift revenue-impacting: under an active reservation, a stale active set decides which probes are shed. If the watcher is down and an operator's bond was slashed/unbonded on-chain, the node keeps treating them as stake-lane (and keeps shedding paying end-clients to reserve headroom for a no-longer-eligible peer); conversely a newly-registered operator is wrongly reserved out. The DHT Store/FindValue admission path has the same dependency.
A "documented degradation" is only acceptable if it's alertable. Today it relies on log-grep.
Proposal
Expose watcher health as metric(s) so the drift window is dashboard-visible and alertable, e.g. one or more of:
decdn_staker_set_watcher_restarts_total(counter) — incremented each timewatcher_loopre-establishes filters after an error.decdn_staker_set_last_event_seconds/decdn_staker_set_watcher_down_seconds(gauge) — time since the last successful event-stream cycle, so an alert can fire on a sustained outage.- (optional)
decdn_staker_set_active_count(gauge) — current cached active-set size, to spot a collapse.
Register in adr/appendix-observability.md (the canonical metric registry) alongside the existing decdn_rpc_healthy row, with recommended alert thresholds.
Notes
- A
getActiveNodesresync-on-extended-outage path is already noted as a separate follow-up in the same module doc; this issue is only about observability of the existing watcher, not the resync logic. - Touches
crates/node/src/dht/chain_staker_set.rs+crates/node/src/metrics.rs+ the observability appendix.
Surfaced during the PR #782 review (silent-failure analysis).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon Jun 2, 2026
🎯 Triage report
This issue requests Prometheus-style metrics (
watcher_restarts_total,last_event_seconds, optionallyactive_count) for theChainStakerSetwatcher loop to make silent RPC outages alertable. The motivation is strengthened by PR #782 making the stale active-set revenue-impacting: a drifted set causes wrong probe-shedding decisions. The scope is narrow and well-specified — three concrete metric names, two source files, and one ADR appendix update.📊 Assessment
enhancement,technical,rust(already applied)mediumpriority label could also apply given revenue-impact context from #782metrics.rs), and documentation target (appendix-observability.md) are all named. Touched files are identified. No design decisions required.🔗 Similar issues
warn!-only silent paths); same pattern of "watcher failure is only a log line" but for the incentive crate rather than the DHT staker set.💡 Notes and suggestions
Implementation checklist:
crates/node/src/metrics.rs: registerdecdn_staker_set_watcher_restarts_total(Counter),decdn_staker_set_watcher_down_secondsordecdn_staker_set_last_event_seconds(Gauge), and optionallydecdn_staker_set_active_count(Gauge).crates/node/src/dht/chain_staker_set.rs: increment the restart counter at the top of eachwatcher_loopretry; update the last-event gauge on each successful filter cycle; updateactive_countwhenever the cached set is replaced.adr/appendix-observability.md: add a new table row for each metric with description, type, and recommended alert threshold (e.g., alert ifwatcher_down_seconds > 300).unwrap_used,expect_used) is respected in new metric registration code.Priority note: The
mediumlabel from #751 would be appropriate here given the revenue-impact path identified in #782. Maintainers may want to tag it accordingly.Out of scope (per issue): The
getActiveNodesresync-on-extended-outage path is explicitly deferred; do not implement it here.Add this agentic workflows to your repo
To install this agentic workflow, run
feat(node): surface ChainStakerSet watcher drift via metrics (#783)
fix(node): correct watcher down_seconds semantics + instrument resolv…
feat(node): surface ChainStakerSet watcher drift via metrics (#783) (#…