Repository navigation
fix(node): attribute every inbound stream failure to one reason counter - #2166
Merged
Merged
Conversation
About 91% of decdn_streams_failed_total{direction="inbound"} had no reason
counter, so the Unattributed stream failures panel showed a baseline no
operator could read (#2073).
- Five new sibling counters: rejected_stream_cap_full, request_unreadable,
voucher_rejected, client_declined (the peer left before a voucher credited
a byte, which includes the unadopted header handshake) and
client_abandoned (the peer left after paying).
- ServeEnd::meter and ErrEnd count every end in one exhaustive place in the
dispatch sink, reason before the failed count, so each inbound failure
counts on exactly one reason and a new variant cannot compile unmetered.
- The deliver/serve_leg wrappers own the paid-byte count and tag a
post-payment error PaidProgress, which splits declined from abandoned.
- A refusal, voucher reject or mid-stream stop whose frame a departed peer
never reads keeps its own reason. A sign failure counts only as a node
fault. A framed write after this node's own close is a node fault.
- A spent proof budget and an unreadable request end as Stopped/Reset and
keep their detail on the span's error field.
- INBOUND_FAILURE_REASONS drives both Unattributed panels; tests hold the
list to the panels, to every exported serve_stream counter, and to the
metering of every end. Loopback and miss-path tests assert the residual
is zero.
Closes #2073
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The broad runtime, metrics, dashboard, and integration changes warrant final human review.
Review effort: Lite
Findings: None
What changed in this PR
This PR centralizes inbound stream-failure attribution so every failure maps to one reason counter, with updated dashboards, tests, and documentation.
Changes:
- Adds five failure-reason counters and exhaustive outcome metering.
- Expands attribution coverage across stream, voucher, and write-error paths.
- Updates dashboards, metrics documentation, changelog, and integration tests.
| File | Reviewed changes |
|---|---|
monitoring/grafana-dashboard.json |
Updates failure residual panel. |
monitoring/dashboard-delivery.json |
Adds outcome series and residual panel updates. |
crates/node/tests/support/mod.rs |
Adds attribution polling support. |
crates/node/tests/node_origin_pull.rs |
Adds pull-through attribution coverage. |
crates/node/tests/client_loopback.rs |
Adds loopback attribution scenarios. |
crates/node/src/metrics.rs |
Defines counters and attribution validation. |
crates/node/src/handlers/client/wire.rs |
Classifies peer and node write failures. |
crates/node/src/handlers/client/voucher.rs |
Updates proof-budget outcomes. |
crates/node/src/handlers/client/serve_leg.rs |
Tracks paid miss-leg progress. |
crates/node/src/handlers/client/outcome.rs |
Centralizes exhaustive outcome metering. |
crates/node/src/handlers/client/mod.rs |
Routes stop outcomes through centralized metering. |
crates/node/src/handlers/client/dispatch.rs |
Applies attribution at stream completion. |
crates/node/src/handlers/client/delivery.rs |
Tracks paid progress and stop outcomes. |
CHANGELOG.md |
Documents the observability fix. |
adr/appendix-observability.md |
Updates metric definitions and semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit d514549 in the Show a line coverage summary of the most impacted files.
|
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.
Closes #2073
Summary
decdn_streams_failed_total{direction="inbound"}ran ~297/day above the sum of its reason siblings, so the Unattributed stream failures panel (#2071) had an unreadable baseline. This PR makes every failed inbound stream count on exactly one reason counter, so the residual is 0 and any positive rate is a bug.The residual was: stream-cap resets, unreadable requests, cache-hit voucher rejects, and every peer-attributable end (declined quotes, header handshakes, mid-stream drops). Requesters close with code
0, so the node cannot see why a peer left — but it can see whether any voucher credited bytes, which cleanly splits declined from abandoned with no wire change.New counters
decdn_serve_stream_rejected_stream_cap_full_totaldecdn_serve_stream_request_unreadable_totaldecdn_serve_stream_voucher_rejected_totaldecdn_serve_stream_client_declined_total— left before any voucher credited a byte (incl. the unadopted header handshake)decdn_serve_stream_client_abandoned_total— left after payingMechanics
ServeEnd::meter+ErrEnd(outcome.rs) count every end in one exhaustive place in the dispatch sink, reason before the failed count (panics included), replacing 14 per-site bumps.deliver/serve_legbecome thin wrappers owningpaid; a post-payment error carries aPaidProgressmarker.write_rejectandrespond_errortolerate a departed peer, so a refusal/reject/stop keeps its reason; a sign failure counts only as a node fault; a framed write after this node's own close is a node fault (downcast of the wrappedWriteError).ServeStop::ProofBudgetExhausted; request-read failure →ResetCause::RequestUnreadable; both keep their detail on the spanerrorfield.INBOUND_FAILURE_REASONSdrives both Unattributed panels; the delivery dashboard gains the new series.ADR
appendix-observability.mdrows and CHANGELOG updated.Test plan
ServeEnd/ErrEndmeters exactly one listed counter and together they cover the list; every exporteddecdn_serve_stream_*counter is listed; both panels subtract exactly the list;ClosedStreamframed-write classification;tag_paid_progress; tolerant write.assert_inbound_failures_attributed.cargo clippy --workspace --all-targets -D warnings, rustdoc-D warnings,cargo nextest run -p decdn-node(1379 passed ×2; one retry of the knownsilent_upstreams_do_not_starve_the_candidate_loopoutbound timing flake), pre-commit.🤖 Generated with Claude Code