Repository navigation
3.x.x: Export node peers, initial block download, observation age and hashrate-rollup lag (#467) - #470
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
a0a64d5 to
8982de3
Compare
7688425 to
1f32361
Compare
1f32361 to
f58fd0e
Compare
The remaining P2 of #278 adds four label-less gauges to the native registry. Node observation gets one site: readiness::chain_info_with_metrics records only what the attempt already fetched, so it adds no RPC call. A check that short-circuits before getnetworkinfo - regtest, initial block download, or blocks disagreeing with headers - leaves the peer count unknown at -1 rather than keeping an earlier reading that would advertise an unconfirmed peer floor; an answered zero stays a real zero. The sync flag is recorded whenever getblockchaininfo answers with the boolean, including the 1 that then makes readiness fail. The observation age is stamped on that answered call rather than on a fully successful check, so an unready-but-reachable node keeps a small age while an unreachable node's age grows. Concurrent refresh, block-wait, candidate and broadcaster observations are ordered by the instant each attempt began, and the publish happens under the same guard that authorised it, so a slower older attempt cannot roll back a newer one. The rollup watermark is a share sequence, not a time, so the lag is defined as the monotonic time since this frontend's last pass that advanced the watermark within its batch bound. A lost race or a full batch leaves the stamp alone, so alerts must take the minimum across instances. With the rollup disabled the family is declared without any sample, because a frontend that never runs it has no lag to report. All four are live, so every scrape recomputes them from one registry read. Unknown is -1, never NaN and never a stale value. The setters reuse reserved closed keys and allocate nothing. Co-Authored-By: Claude Opus 5 <[email protected]>
Moving the peer recording below the min_peers check passed every named suite, so the invariant that a count below the floor is still an answered count was unguarded. The new test drives the real entry point with a node answering 0 and 1 peers against a floor of 2: readiness refuses it, yet the gauge reads the answered count rather than -1, so the exposition cannot hide the very shortfall that closed admission, and an answered zero stays a real zero. The observation age also discarded a later answer whenever its attempt had started earlier than the one already published. The age asks when the node last answered, not which attempt owns the published peer and sync pair, so it now keeps the latest answer any attempt received; the ordering guard still governs that pair alone. This adds no RPC call and leaves the setters allocation-free. Co-Authored-By: Claude Opus 5 <[email protected]>
…a scrape cannot deadlock an observation
|
Rebased onto |
f58fd0e to
b64f09a
Compare
Brings in #470, #512, #513, #514 and #515. #515 opens the share append's transaction through AppendConnection::begin, which records BEGIN completion so that a future cancelled before the reply retires the connection instead of returning it to the pool; this branch opens the same transaction with "BEGIN; SET LOCAL plan_cache_mode = force_generic_plan" so the share_id probe is planned once per connection. Resolution keeps both: AppendConnection::begin takes the opening statement and the append passes APPEND_TRANSACTION_BEGIN. SQLx reads every reply of that simple query through its ReadyForQuery before begin returns, so the guard records completion only once the whole batch is in. ledger_cancelled_begin now cancels the append on the custom BEGIN, and a new case holds only the batch's closing ReadyForQuery (the execution proxy gains pause_statement_ready) and proves the connection is still retired. The pool-acquire inventory, the gated-test manifest and the #482 ops notes follow the new call sites. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Part of #467 (remaining P2 of #278). Base
3.x.xatd78659de.What
Four label-less gauges from the native registry, recorded at one observation site (
readiness::chain_info_with_metrics, which adds no RPC call) and from the rollup loop:qbit_prism_node_peers,qbit_prism_node_initial_block_download: from the latest observation; -1 when unknown, never a carried-over value (RPC refused, IBD/header short-circuit, regtest).qbit_prism_node_observation_age_seconds: monotonic age of the last answeredgetblockchaininfo, computed at render; grows while the node is unreachable.qbit_prism_hashrate_rollup_watermark_lag_seconds: the watermark is a share sequence, so lag is defined as monotonic time since this frontend's last caught-up pass (advanced && scanned < batch); -1 until the first; declared without a sample whenPRISM_HASHRATE_ROLLUP_ENABLED=0. Alerts should take the minimum across instances (a frontend that keeps losing the race reads high).A late, slower observation cannot overwrite a newer one; the age keeps the latest answer. Metrics-only call swaps at
coordinator.rs(observe_chain_info) andbroadcaster.rs.Evidence
getnetworkinfo→ peers -1, not the last value; refusinggetblockchaininfo→ age keeps growing:tests/readiness_rpc.rs:214; below-floor count is an answered count::258; out-of-order guard::295,:320.src/rollups/tests.rs:428,:439.tests/observability/cardinality.rs,contract.rs);scripts/generate_prism_metrics.py --checkclean; allocation-free setters (tests/metrics_allocation.rs).-D warnings,check_gate_env_reads,check_prism_settings,check_toolchain_pinpass; suites readiness_rpc 11, observability 17, metrics_allocation 4, lib 481.Not covered
No Postgres-backed rollup-lag test (no gated entry); no alert rule or dashboard for the four families; per-worker series, threads/FDs and payout build duration stay parked; a cancelled readiness attempt records nothing (honest, documented). Coordinates with #458 (same census counts) and with #468 (six refusal reasons: combined census is 173 startup / 272 populated series).
Merge order: this PR first, then #468's, then #469's.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.