Repository navigation
feat(node): export probe collection latency and time-to-first-byte histograms - #2151
Merged
Merged
Conversation
…stograms (#2047) The exporter registered no histograms, so no latency SLO could be written in PromQL; latency came only from sampled Tempo span durations, and serve_stream duration grows with blob size. Add four iroh-metrics histograms: - decdn_probe_collection_latency_seconds (M-tier, ADR-specified buckets): one probe round's collection window in probe_and_rank. A round that sends no probe records nothing. - decdn_serve_first_byte_{hit,miss}_seconds: decoded request to the first ChunkData frame. A one-shot FirstByteClock carries the availability gate's RequestClass, so a buffered fill served through deliver still records as a miss. - decdn_node_pull_first_byte_seconds: each paid pull leg, from the start of its open to its first bao bytes. TimedSource wraps the node's PeerSource; timed_open is the only TimedReader constructor, so an adopted header-handshake pull keeps the start of the handshake open. DecdnMetrics moves to #[metrics(default)] because Histogram has no Default. The ADR registry rows, the latency guidance, the delivery and node dashboards, and CHANGELOG are updated. Closes #2047 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Extend or otherwise document the histogram range so latency quantiles represent tails beyond 30 seconds.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds Prometheus histograms for probe collection latency and serve/pull time-to-first-byte, including dashboards, tests, and documentation.
Changes:
- Instruments probe, serve, and upstream pull latency.
- Adds Grafana panels and registry documentation.
- Extends integration coverage and changelog entries.
- Moderate finding (2 votes): finite buckets cap at 30 seconds, flattening longer latency quantiles.
| File | Reviewed changes |
|---|---|
monitoring/dashboard-node.json |
Adds probe latency panel. |
monitoring/dashboard-delivery.json |
Adds serve and pull latency panels. |
crates/node/tests/partial_serve.rs |
Tests serve classification. |
crates/node/tests/origin_range_pull.rs |
Tests origin miss timing. |
crates/node/tests/node_origin_pull.rs |
Tests probe and pull observations. |
crates/node/tests/client_loopback.rs |
Tests serve timing behavior. |
crates/node/src/node_origin/timed_source.rs |
Times upstream pull legs. |
crates/node/src/node_origin/pull_leg.rs |
Integrates timed pull legs. |
crates/node/src/node_origin/mod.rs |
Instruments probe and buffered-pull timing. |
crates/node/src/metrics.rs |
Defines and records histograms. |
crates/node/src/handlers/client/window.rs |
Propagates timing clocks. |
crates/node/src/handlers/client/serve_leg.rs |
Records miss first-byte timing. |
crates/node/src/handlers/client/dispatch.rs |
Classifies requests and starts clocks. |
crates/node/src/handlers/client/delivery.rs |
Records hit first-byte timing. |
CHANGELOG.md |
Documents observability additions. |
adr/appendix-observability.md |
Updates metric registry and guidance. |
💡 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 1cfe009 in the Show a line coverage summary of the most impacted files.
Updated |
The time-to-first-byte buckets stopped at 30 s. A cache miss can wait for discovery (up to 32.5 s alone), a pull leg's open plus a stall window, and on a buffered fill the whole blob, bounded only by the outer pull deadline (167.5 s at the default timeouts). Past 30 s every observation landed in +Inf alone, so histogram_quantile pinned p95/p99 at 30 s exactly where a slow miss matters. Add 60, 120 and 300 s buckets, and a test that the top bucket exceeds outer_pull_deadline at the default timeouts, so the ceiling cannot silently fall behind a default change. Co-Authored-By: Claude Opus 5.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.

What
The exporter registered no histograms, so no latency SLO could be written in PromQL. Latency came only from Tempo span durations, which depend on trace sampling, and
serve_streamduration grows with blob size. This adds four histograms:decdn_probe_collection_latency_secondsplanned)decdn_serve_first_byte_hit_secondsChunkDataframe, for serves the availability gate classes as a hit (complete or partial).decdn_serve_first_byte_miss_secondsdecdn_node_pull_first_byte_secondsIt also exercises the
_bucket/_sum/_countbranch of the registry and monitoring gates against a real histogram for the first time.Closes #2047
Reviewer notes
deliver, sodispatch.rsfixes oneRequestClassat the gate. That same value drives both load-shed admission and theFirstByteClock, so a stream can't be admitted in one class and timed in another.PrimedSource) are the subtle part of the pull histogram. The adoptingopenreturns at once, so a clock started there would read about 0.timed_openis the onlyTimedReaderconstructor, andPrimedSource<TimedSource<PeerSource>>only accepts aTimedReader, so both handshake sites (mod.rsbuffered path,pull_leg.rspredicted first leg) time from before their own open.decdn-clientis unchanged.DecdnMetricsmoves from std#[derive(Default)]to#[metrics(default, ...)]becauseHistogramhas noDefault. Every other field still getsDefault::default().decdn-delivery, and a probe collection latency panel ondecdn-node. No alert rule, because there is no agreed SLO threshold yet.TimedReaderread-error test. The error returns via?before anything is recorded, and no test reader in the repo injects an I/O error.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warnings(exit 0)cargo nextest run -p decdn-node: 1283 passedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemspre-commit run --all-filesCacheHiton the buffered-filldeliverpath failsbound_client_fetch_triggers_reactive_origin_pull_throughandlocal_populate_serves_own_origin_with_node_to_node_off.contracts/changed: n/aCHANGELOG.mdentry addedadr/appendix-observability.mdregistry rows and latency guidance updated🤖 Generated with Claude Code