Repository navigation
feat(metrics): export stream, volume, tx and DHT health; alert on the gaps - #2059
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The node dashboard currently caps routing-table size at max: 100, which will clip real values and make the new DHT visibility misleading in production.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR completes the observability rollout by wiring previously “planned” node metrics into the Rust runtime, then surfacing them in Prometheus alert rules and the bundled Grafana dashboards (delivery/chain/node), alongside registry and changelog updates.
Changes:
- Add/emit new
decdn_*metrics for stream outcomes + byte volume, on-chain tx outcomes, DHT health, fee-shares watcher health, and operator-path failures. - Add Prometheus alert rules for “latent bug / lost revenue” counters and watcher/RPC health gaps.
- Extend the Grafana dashboards + observability appendix/CHANGELOG to document and visualize the new series.
| File | Description |
|---|---|
| monitoring/prometheus-alerts.yml | Adds new alert rules for slashing, RPC health, config/receipt failures, tx timeouts, and latent-bug counters. |
| monitoring/dashboard-node.json | Adds node drilldown panels for operator-path failures and DHT activity/routing table size. |
| monitoring/dashboard-delivery.json | Adds delivery panels for stream outcomes by direction and bytes served/received. |
| monitoring/dashboard-chain.json | Adds chain panels for on-chain tx outcomes, voucher/redemption/grace-close activity, and receipt write failures. |
| crates/node/tests/bucket_refresh_clock.rs | Updates bucket-refresh test harness to provide a Metrics handle. |
| crates/node/src/runtime/reload.rs | Counts failed reload attempts into decdn_config_reload_failures_total (after metrics attachment). |
| crates/node/src/runtime/mod.rs | Attaches metrics to reload state; records bootstrap + bucket-refresh DHT metrics. |
| crates/node/src/receipt_log.rs | Plumbs metrics into the receipt writer loop and counts write failures. |
| crates/node/src/payment_settlement.rs | Counts grace-close events when unredeemed vouchers exist; counts redeemed vouchers on landed redeemMany. |
| crates/node/src/onchain_tx.rs | Centralizes tx outcome counting at the send_and_await_receipt choke point; adds a unit test. |
| crates/node/src/node_origin/pull_leg.rs | Counts bytes received on paid node-to-node pulls via the admit store. |
| crates/node/src/node_origin/mod.rs | Counts outbound stream completion/failure for upstream candidate pulls. |
| crates/node/src/node_origin/admit_store.rs | Adds optional “count bytes received” instrumentation on admitted verified ranges. |
| crates/node/src/metrics.rs | Defines and wires the new metrics families/recorders plus export-at-zero and direction split tests. |
| crates/node/src/handlers/client/voucher.rs | Increments vouchers-received counter on voucher acceptance. |
| crates/node/src/handlers/client/serve_leg.rs | Counts bytes served per written frame; counts mid-stream pool exhaustion stops. |
| crates/node/src/handlers/client/dispatch.rs | Counts inbound stream completion/failure based on ServeEnd. |
| crates/node/src/handlers/client/delivery.rs | Counts bytes served per written frame; counts mid-stream pool exhaustion stops. |
| crates/node/src/fee_shares_watcher.rs | Adds poll-failure counting and watcher downtime hooks for fee-shares. |
| crates/node/src/dht/publish.rs | Counts accepted STORE records via publish return values for single/batched republish. |
| crates/node/src/dht/lookup.rs | Counts findvalue queries and lookup round timeouts when metrics are provided. |
| crates/node/src/dht/bucket_refresh.rs | Counts bucket-refresh failures and publishes routing table size each tick. |
| CHANGELOG.md | Documents new metric families, alerts, and dashboard panels. |
| adr/appendix-observability.md | Updates the metric registry rows from planned → live and corrects descriptions/labeling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
thiras
force-pushed
the
feat/trace-spans
branch
from
September 19, 2026 02:45
ccd22a8 to
f3b4791
Compare
thiras
force-pushed
the
feat/metrics-alerts
branch
2 times, most recently
from
September 19, 2026 03:02
632f266 to
cdf0da4
Compare
thiras
force-pushed
the
feat/trace-spans
branch
from
September 19, 2026 03:02
f3b4791 to
a981dd0
Compare
thiras
force-pushed
the
feat/metrics-alerts
branch
from
September 19, 2026 03:13
cdf0da4 to
44e822c
Compare
thiras
force-pushed
the
feat/trace-spans
branch
from
September 19, 2026 03:13
a981dd0 to
6e581b0
Compare
thiras
force-pushed
the
feat/metrics-alerts
branch
2 times, most recently
from
September 19, 2026 03:44
a2b3f62 to
d113b87
Compare
… gaps
Eleven registry rows — including the Mandatory delivery counters — were
`planned` with nothing emitting them, several failure paths were only
logged, and a set of live counters whose every increase is a bug or
lost revenue had no alert.
Metrics:
- `decdn_streams_{completed,failed}_total{direction}`: every inbound
serve (from the `ServeEnd` the span already records) and every
outbound per-candidate pull counts exactly once. The reason split
stays in the sibling `serve_stream_rejected_*` / `node_pull_*`
counters, so the ADR row drops its `reason` label.
- `decdn_bytes_served_total` per written frame, `decdn_bytes_received_total`
per verified range on the paid node-to-node pulls only.
- `decdn_onchain_tx_*_total` (landed / reverted / send_failed /
receipt_failed / timeout) at the `send_and_await_receipt` choke point;
`decdn_pool_redemptions_total`, `decdn_vouchers_received_total`,
`decdn_pool_grace_closes_total` (a closing pool with an unpaid lane).
- DHT: find_value lookups, round timeouts, accepted STOREs, routing
table size, bucket-refresh and bootstrap FIND_NODE failures.
- Fee-shares watcher: `getShares()` poll failures (its tick still
succeeds, so nothing else saw them) and the downtime family the other
watchers already had.
- Config reload failures, receipt write failures, and the mid-stream
`PoolExhausted` stop (the signer-cap sibling was already counted).
Alerts (promtool-clean): slash detected, RPC unhealthy, fee-shares
stall and poll failure, sustained redemption failure, tx receipt
timeouts, serve node fault, frame accounting fault, watcher persist
failure, lane flush failure, node-pull corruption, config reload failure,
receipt log write failure. Delivery, chain and node dashboards gain
panels for each family. `vouchers_signed` stays `planned` (its payer-side
count lives in client-pull) with its description corrected.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
thiras
force-pushed
the
feat/metrics-alerts
branch
from
September 19, 2026 03:51
d113b87 to
2d69d28
Compare
Review on #2059: - The three new node-dashboard panels inherited `max: 100` from the CPU panel they were built from, clipping the routing-table size and any rate above 100. The cap is gone. - `decdn_dht_bucket_refresh_failures_total` counts invalid peer keys and panicked refresh tasks as well as FIND_NODE errors; the function, metric and ADR docs now say so. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Coverage reportTotal: 83.02% (was 83.03%, ▼ 0.01%) — 80943/97502 lines
History
|
…re alerts Multi-agent review of #2059: - The streaming miss path (`run_pull_leg`) recorded no outbound stream outcome, so `decdn_streams_*{direction="outbound"}` covered only the buffered path. It now records one outcome per assembled range (a cancelled assembly counts as neither). - The buffered path counted every candidate it skipped before opening a stream — no address, above the ADR 041 buy ceiling, a pool-open failure — as a failed stream. It now counts only candidates it opened a stream to. - Docs, ADR rows and panels say what each counter actually counts: failed inbound streams include routine outcomes (a cache-miss refusal, an early close, the free header handshake a downstream miss pull closes by design), so no raw success ratio; cancelled streams count in neither family; redemptions count lane claims; vouchers exclude PayWord reveals; `onchain_tx_*` is the settlement path only; a failed reload can leave earlier sections applied. - Alerts: `DecdnSlashDetected` fires on the value, not `increase()`, since the watcher's backfill counts every still-appealable slash before the first scrape; new `DecdnPoolGraceCloseWithUnredeemed` and `DecdnDhtRoutingTableEmpty`; the stale "no outcome-labelled stream family" comment is corrected. promtool: 33 rules OK. - Tests at the real call sites: a served stream counts one completed inbound stream, its vouchers and bytes; a relayed miss counts one completed outbound stream and bytes both ways; an own-origin fill counts no bytes received; a failed reload and a failed receipt write each count once; the grace-close predicate's four cases. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.


Third of three observability PRs; #2057 and #2058 are merged.
Why
Eleven
appendix-observabilityregistry rows — including the Mandatory delivery counters (streams completed/failed, bytes served/received) and redemptions — wereplannedwith nothing emitting them. Several failure paths were only logged (fee-sharesgetShares()re-reads, DHT refresh/bootstrap, config reload, receipt writes, the mid-streamPoolExhaustedstop). And live counters whose every increase is a bug or lost revenue had no alert (slashes_detected,rpc_healthy,redemption_failures, node-fault / corruption / persist / flush counters, fee-shares watcher liveness).Metrics
decdn_streams_{completed,failed}_total{direction}ServeEnd#2058 records on the span; outbound per upstream candidate. Every stream counts once. Reason split stays in the sibling counters (per the ADR's siblings-not-labels rule), so the row drops itsreasonlabeldecdn_bytes_served_total/decdn_bytes_received_totaldecdn_onchain_tx_{landed,reverted,send_failed,receipt_failed,timeout}_totalsend_and_await_receiptchoke pointdecdn_pool_redemptions_total,decdn_vouchers_received_total,decdn_pool_grace_closes_totalredeemManyvoucher count; voucher accept;PoolCloseInitiatedwhile this node has an unpaid lane on the poolfindvalue_queries,lookup_round_timeouts,store_published,routing_table_size,bucket_refresh_failures,bootstrap_find_node_failuresdecdn_fee_shares_watcher_{poll_failures_total,restarts_total,down_seconds}None)decdn_config_reload_failures_total,decdn_receipt_write_failures_total,decdn_serve_stream_midstream_pool_exhausted_totalvouchers_signedstaysplanned(the payer-side count lives in client-pull); its ADR description had payer/payee swapped and is fixed.reputation_score,probe_*stayplanned.Alerts (promtool: 31 rules OK)
DecdnSlashDetected(critical),DecdnRpcUnhealthy(critical),DecdnFeeSharesWatcherStalled,DecdnFeeSharesPollFailing,DecdnRedemptionFailing,DecdnOnchainTxTimeouts,DecdnServeNodeFault,DecdnFrameAccountingFault,DecdnWatcherPersistFailures,DecdnLaneFlushFailures,DecdnNodePullCorruption,DecdnConfigReloadFailed,DecdnReceiptLogWriteFailing. Latent-bug counters useincrease(...[1h]) > 0so they resolve.Dashboards
Delivery: stream outcomes by direction (+ mid-stream funding stops), wire bytes served/received. Chain: on-chain tx outcomes; vouchers/redemptions/grace closes; receipt write failures. Node: DHT discovery/publishing, routing table size, operator-path failures. Not yet pushed to Grafana Cloud.
Test plan
cargo nextest run -p decdn-node -p decdn-client-pull -p decdn-cache -p decdn-cli— 2581 passed, incl. the monitoring/ + ADR metric-name gatespromtool check rules monitoring/prometheus-alerts.yml🤖 Generated with Claude Code