#1 [high] PR 548 overview and scope
PR #548 "Add request latency histograms and process metrics" (draft, opened 2026-11-26, head ebecef1, 8 files +545/-20). Closes #536 (opened by Napuh, a non-maintainer; asks for vLLM-parity request histograms + process_* metrics).
Files: docs/api.md (+25/-3), helios/src/server.rs (+2), helios/src/server/http.rs (+6/-1), helios/src/server/latency.rs (+27/-8), helios/src/server/metrics.rs (+228), helios/src/server/metrics/process.rs (new +184), helios/src/server/runtime.rs (+38/-8), helios/src/server/runtime/phase_tests.rs (+35).
What it adds:
- metrics.rs: generic
Buckets<const N>{ bounds: [f64;N], scale: f64 } consts REQUEST_SECONDS(Buckets<21>), TOKEN_SECONDS(Buckets<19>), PROMPT_TOKENS(Buckets<21>, scale 1.0);Histogram<const N>{ counts: [AtomicU64;N], sum: AtomicU64 } with observe(buckets, u64) + render(text, name, help, buckets) that writes# HELP flare_{name};RequestTimes{ first_scheduled_ns: Option, first_token_ns: Option, last_token_ns: u64 }; six new Metrics fields (request_e2e pub(super) Histogram<21>, request_queue/prefill/decode Histogram<21>, time_per_output_token Histogram<19>, request_prompt_tokens Histogram<21>);Metrics::request_completed(arrival_ns, times, prompt_tokens, generated_tokens)incrementscompletedthen observes. - runtime.rs: Incoming.times, stamped in Worker::complete (first/last token ns, completed_at_ns) and Worker::reserve_and_pack (first_scheduled_ns); both former
self.metrics.completed.fetch_add(1, ...)sites (Worker::complete stop path ~1836, Worker::publish ~1993) now call request_completed. - latency.rs: FirstResponseSamples gains
histogram: Histogram<21>besidewindow: Mutex<Samples>; output() observes; newrender_histogram(separate impl block at 122-131). - server.rs:
state.first_response.render_histogram(&mut text)at 671;metrics::process::render(&mut text)at 709. - http.rs: e2e observed in Delivery::Complete for streaming (615) and non-stream (632), guarded by
if !count(count = path is /v1/messages/count_tokens). - process.rs (Linux only): /proc/self/stat parse_stat, /proc/stat btime, /proc/self/fd count, getrlimit(NOFILE); six metrics; per-source Option fallbacks;
metric()helper (takes impl Display, no flare_ prefix); non-Linux stublet _ = text;. - api.md: new paragraphs listing histograms and process metrics.
Repo rules relevant to lens D:
- AGENTS.md L188-193: "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement... Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost."
- AGENTS.md L194-199 "Require focused, meaningful validation... source-text checks and mocks that bypass the behavior cannot establish runtime correctness."
- AGENTS.md L16-18 / docs/design-review.md principle 1: "Keep Helios as simple as possible."
- AGENTS.md contribution rules L165-169: contributions must address a maintainer request, demonstrated defect, measured perf/memory problem, or inaccurate docs.
- design-review.md principle 15 (scope) and 16 (prose).
- .agents/skills/repo-prose/SKILL.md: present-state spec, no hidden context, no bloat.
#2 [high] Findings: lens D (simplicity) on PR 548 — final list
PR #548 "Add request latency histograms and process metrics" (draft, head ebecef1, 8 files +545/-20, closes #536). Lens D (simplicity) findings, all verified against the diff and surrounding code.
-
[should fix] Duplicate histogram plumbing — helios/src/server/metrics.rs:212-298 (
Buckets/Histogram) vs the existing host-cache histogram code at metrics.rs:200-210 (HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS as[u64; N]), 670-692 (host_lookup_cost), 1029-1065 (render loop writing_bucket/_count/_sumand+Inf). The PR adds a second, differently-shaped histogram mechanism (f64 bounds +scaledivisor +impl Displayrender) while three existing series already render the same exposition. Fix: makeHistogram<N>/Buckets<N>the one mechanism and delete HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS plus the 1029-1065 block; or, smaller still, dropHistogramand reuse the existing u64-bucket arrays, since two of the three new seconds histograms share one bound list. -
[should fix] The
scale: f64field is redundant — metrics.rs:214-241, 260-270, 291-295. Every observation is already ns;scaleis used only asvalue as f64 / scalefor bucketing andsum / scalefor rendering. Smaller version: keep bounds in ns as[u64; N]like the existing HOST_*_BUCKETS and divide by 1e9 once at render. This removes thescalefield, the PROMPT_TOKENSscale: 1.0special case, and the "integer grid / correctly rounded" comment at 261-262. -
[should fix]
request_prompt_tokensdoes not need a histogram type at all — metrics.rs:235-241, 332, 471-472, 1419-1424, plus the docs/api.md paragraph. Prompt size is a whole-token count and the repo already exposesflare_prefill_tokens_totalandflare_cache_reused_tokens_total. If the per-request distribution is genuinely required, share the existing renderer with a fixed bucket list; as written it is the largest of the six added histograms (21 atomics + sum). -
[should fix] Separate
render_histogramat latency.rs:122-131 is a third impl block onFirstResponseSamples, takes&mut Stringand hard-codes the metric name, and exists only because the histogram lives onFirstResponseSamples(constructed at server.rs:313). Smaller version: move theHistogram<21>ontoMetrics(which already ownsrequest_e2e), observe it fromFirstResponse::outputthrough a metrics handle as http.rs does for e2e; then deleterender_histogram, the extra impl block, and the scrape line at server.rs:671. -
[should fix]
#[cfg(not(target_os = "linux"))] { let _ = text; }at metrics/process.rs:12-15 is dead code that silences an unused parameter. Other platform-gated code in helios uses real empty branches orcfg'd item bodies (runtime_core/protection.rs:298-301, core/cache.rs:4196). Smaller version: gate the wholerenderitem on linux and gate the call at server.rs:709. -
[should fix] process.rs re-implements
metric()(metrics/process.rs:42-49) differing from metrics.rs:1597-1602 in that it takesimpl Displayand omits theflare_prefix. No caller needsimpl Displayfor anything but f64/u64. Keep one writer. AGENTS.md L188-193 rejects abstractions and churn without a concrete requirement. -
[should fix] Four per-source
Optionfallbacks inrender_linux(metrics/process.rs:55-131: sysconf_SC_CLK_TCK/_SC_PAGESIZE,getrlimitreturn,read_dir,parse_stat) are speculative robustness with no concrete requirement and cost more code than the metrics they guard (fourif let (Some, Some)blocks, twothen_somesites). Smaller version: read both sysconf values once, default the page size as eos/src/unix.rs:74 already does (unwrap_or(4096)), and let the rest fail early. The module doc's "a scrape never fails and never panics" is a guarantee nothing in the repo requires forprocess_*. -
[nit]
parse_statskip arithmetic (metrics/process.rs:21-32) — thevalue(11)/value(0)/value(6)/value(0)/value(0)chain plus the "token N - 3" comment is harder to check than naming the fields. Smaller version:split_whitespace().skip(11)thennext()in field order. -
[nit]
last_token_nsduplicates existing scheduler accounting — runtime.rs:1774-1775 stamps first/last token ns inWorker::complete, while the scheduler already maintainsaccounting.last_output_ns(scheduler/policy.rs:275, surfaced at runtime.rs:1172-1173, used at policy.rs:478). Only the first-token instant has no existing home. Smaller version: keepfirst_token_nsonly and read the last-token instant from accounting; deletes oneu64per in-flight request and one store per committed token. -
[nit] Comment bloat: metrics.rs:212-213, 243-244, 261-262, 300 (four doc comments around three struct fields), runtime.rs:193 and 2189-2190, process.rs:1-6. metrics.rs:261-262 explains an invariant the code should not have (finding 2); runtime.rs:2189-2190 only makes sense if the reader knows
reserve_and_packhas a second caller. The prose skill asks comments to explain invariants, not defenses. -
[nit] Part of
request_histograms_bucket_completed_request_timings(metrics.rs:1674-1701) proves nothing about the PR's claim: thefirst_scheduled_ns: Nonesecond observation asserts counts stay at 1, exercising the helper's branch rather than the runtime stamping. The stamping is covered by runtime/phase_tests.rs:576-583 (count == 1), which itself asserts only that a count exists, not a bucket. AGENTS.md L194-199. -
[nit] phase_tests.rs:4428-4432, 4461-4471, 5380-5389 bolt
render()string assertions onto three pre-existing tests (first_response_http_*,metrics_route_*), restating what metrics.rs:1652 and the latency tests already prove and making unrelated tests brittle to HELP-text edits. Keep only theprocess_resident_memory_bytespresence check in the route test as the one end-to-end check. -
[nit] docs/api.md +25 lines enumerates eleven series, repeating definitions that the HELP strings at metrics.rs:1393-1423 carry verbatim. Keep the two facts a scrape cannot supply: histograms are absent from
format=json, andprocess_*is Linux-only; point at the scrape for the rest.
Non-findings verified: state.model.metrics_handle() at http.rs:603 is required by the filter_map closure; if !count correctly excludes /v1/messages/count_tokens, which server.rs:584 routes to the same http::generate handler; RequestTimes survives parking because park moves Incoming wholesale (runtime.rs:2096, 2121) and readmission reuses it.
Repo rules cited: AGENTS.md L16-18 and docs/design-review.md principle 1 ("Keep Helios as simple as possible"); AGENTS.md L188-193 (reject unsupported abstractions and churn); AGENTS.md L194-199 (focused, meaningful validation); .agents/skills/repo-prose/SKILL.md L38-46 (comments explain invariants).
#4 [high] Delta after commits d64c3ea3 + a34c4d06 (lens D)
Head now a34c4d06 ("Hoist completion values and tighten stat parsing"), after d64c3ea3 ("Exclude cancelled responses and reuse host helpers"). 10 files, +548/-25.
FIXED by d64c3ea3:
- process.rs previously read sysconf(_SC_PAGESIZE), getrlimit, read_dir itself; now
crate::os::page_size()(eos/src/unix.rs:73-75),crate::runtime_core::open_descriptors()(protection.rs:291-302, widened to pub(crate) at runtime_core/mod.rs:58) andcrate::os::raise_open_file_limit(0)(eos/src/unix.rs:138-165). My earlier "four speculative Option fallbacks" finding shrinks to one (sysconf _SC_CLK_TCK) + procfs reads. - latency.rs:122-131 separate impl block for
render_histogramis gone; it now sits in the main impl at latency.rs:101-108. (Third-impl-block nit resolved; forwarder + server.rs:671 hook remain.) - http.rs: e2e observed once, before
yield Delivery::Complete(http.rs:598-605); the two duplicateif !countobservations in the stream/nonstream arms are gone (stream arm is nowDelivery::Complete(_) => Noneat http.rs:621; nonstream Complete arm at 635-644 no longer observes). - runtime.rs Worker::publish hoists prompt_tokens/generated_tokens (runtime.rs:1993-2001) as Worker::complete does (1838-1846).
- metrics.rs test: the impossible
{first_scheduled_ns: None, first_token_ns: Some}state is replaced by a zero-tokenRequestTimes::default()case (metrics.rs:1678-1690).
STILL OPEN (unchanged by the delta):
- should fix — three histogram mechanisms: new
Buckets/Histogram(metrics.rs:212-298) vsHOST_TIME_BUCKETS/HOST_TOKEN_BUCKETSu64 arrays (metrics.rs:200-210) rendered at 1029-1065, vs the hand-written retirement histogram block at 851-877. - should fix —
scale: f64(metrics.rs:216, 263, 294) plus the PROMPT_TOKENSscale: 1.0(metrics.rs:240) and the rounding comment (261-262). Every observation is integer ns; u64 ns bounds + one division at render deletes all three. - should fix — second
metric()writer at metrics/process.rs:48-54 duplicating metrics.rs:1597-1602 with onlyimpl Displaywidening. - should fix/nit —
time_to_first_responsehistogram lives onFirstResponseSamples(latency.rs:36) instead ofMetrics, so it needs the forwardingrender_histogram(latency.rs:101-108), the scrape hook at server.rs:671 and a test-only call at phase_tests.rs:4467. - nit —
#[cfg(not(target_os="linux"))] let _ = text;shim metrics/process.rs:12-13.
NEW in a34c4d06:
6. should fix (nit) — metrics/process.rs:81-98: two consecutive if let Some(stat) = stat blocks with the same test, one per metric. Merge into one block writing both gauges (or one loop over (name, help, value)).
7. nit — metrics/process.rs:24-28: added state-character whitelist "RSDZTtWXxKPI" parsing /proc/self/stat. Speculative validation: procfs cannot emit anything else, and the parser is only called on /proc/self/stat (process.rs:62-64). ~5 lines and a comment for a case that cannot occur; AGENTS.md L188-193.
8. should fix (nit) — metrics/process.rs:69-70: crate::os::raise_open_file_limit(0) used as a read-only getter of RLIMIT_NOFILE. Reads as a mutation at the call site; eos has no getter, so either add one or comment the trick (the comment is there but the API misuse remains). Windows path returns None (eos/src/windows.rs:215).
9. nit — pub(crate) use protection::open_descriptors (runtime_core/mod.rs:58) widens a runtime_core private for one metrics call. AGENTS.md L20-21 puts host OS operations in eos/; the fd count belongs beside page_size there.
Tests: phase_tests.rs:4428-4432, 4461-4471, 4601-4611, 5391-5398 still bolt full metrics().render() string checks onto three unrelated tests; 4611's tool-limit check restates 4428; 5391 duplicates 4466-4471. Each assert re-renders the whole scrape inside a loop (4461-4471 renders twice per iteration). AGENTS.md L194-199.
#5 [high] Report of 2026-11-27, run 2 (post-delta) — lens D verdict and findings
Verdict: should-fix issues only (no blockers in lens D). Supersedes entry #3 for head a34c4d06.
Should fix
1. Three histogram mechanisms in one file — helios/src/server/metrics.rs:212-298 vs :200-210/:1029-1065 vs :851-877
The PR adds Buckets<const N> (f64 bounds ending at f64::INFINITY + a scale divisor) and Histogram<N> with its own render writing # HELP/# TYPE. The same file already renders histograms two other ways: HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS as [u64; N] with u64::MAX for +Inf (host_lookup_cost :670-692, render loop :1029-1065) and the hand-written flare_host_cache_retirement_seconds block (:851-877). Three implementations means three places for a +Inf/cumulative/escaping bug and two bucket vocabularies in one struct. Fix: express the new seconds histograms as [u64; N] ns bounds like the existing ones (four of the five seconds series already share one bound list), or, larger but better, migrate the host and retirement series onto Histogram<N> and delete :200-210, :1029-1065 and :851-877. AGENTS.md L188-193.
2. scale: f64 is redundant — metrics.rs:216, 240, 261-263, 291-295
Every observation is already an integer nanosecond count (as_nanos() as u64 at http.rs:601-603, latency.rs:121-124; saturating_sub at metrics.rs:464-477). scale exists only so observe can divide (value as f64 / buckets.scale, :263) and render can divide the sum (:294). Keep bounds in ns as [u64; N], bucket with integer comparison, divide by 1e9 once when writing _sum. That deletes the field, the PROMPT_TOKENS scale: 1.0 (:240) and the "Division is correctly rounded" comment (:261-262), which exists only to justify the representation.
3. Second metric() writer — helios/src/server/metrics/process.rs:48-54 vs metrics.rs:1597-1602
Same name, same shape, differing only in value: impl Display vs u64 and a hard-coded process_ prefix instead of flare_. Every caller passes u64 or an f64 it computed inline (process.rs:78, 87, 96, 105, 114, 123); nothing needs impl Display. Fix: keep metrics::metric and either pass the formatted CPU/start-time values through it or widen the one function to impl Display and delete the copy. One writer, one prefix rule.
4. The TTFR histogram hangs off the sampler instead of Metrics — helios/src/server/latency.rs:36, 101-108, :121-124; helios/src/server.rs:671
FirstResponseSamples gained a histogram field and a render_histogram(&self, text) forwarder that hard-codes the series name and help; server.rs:671 exists solely to call it, and phase_tests.rs:4466-4471 calls it directly because the series is otherwise unreachable except through a scrape. Metrics already owns request_e2e and is rendered by the same scrape. Fix: put time_to_first_response: Histogram<21> on Metrics, observe it from FirstResponse::output through the metrics handle http.rs already fetches, render it in the same loop as the other six (metrics.rs:1389-1424). Deletes the field, the forwarder, the scrape hook and the special-case test call.
5. Duplicate if let Some(stat) block — metrics/process.rs:81-98
Two consecutive blocks test the same Option to write one gauge each. Merge into one block writing both process_virtual_memory_bytes and process_resident_memory_bytes, or one small loop over (name, help, value).
6. raise_open_file_limit(0) used as a getter — metrics/process.rs:69-70
The call reads as a mutation in a scrape path; its only effect is returning the current soft limit. eos has no read-only accessor. Fix: add pub fn open_file_limit() -> Option<u64> to eos/src/unix.rs beside raise_open_file_limit (eos/src/unix.rs:138-165 already does the getrlimit and returns early) and call that. AGENTS.md L20-21 puts host OS operations in eos/.
Nits
- metrics/process.rs:24-28 — the added state-character whitelist (
"RSDZTtWXxKPI") validates a value procfs cannot get wrong and the parser is only fed/proc/self/stat(process.rs:62-64). Five lines and a comment for an impossible case; drop it, or keeprfind(')')and parse. Settled only by argument, not by test. - metrics/process.rs:12-13 —
let _ = text;on non-Linux exists only to silence an unused parameter. Gate therenderitem and the call site asruntime_core/protection.rs:292-301gatesopen_descriptors, and delete the branch. - metrics/process.rs:1-6 — module doc promises "a scrape never fails and never panics"; with three sources left, say only that missing procfs entries omit their series.
- metrics.rs:212-213, 243-244, 300 — four doc comments over three declarations, two of which restate the type name.
- phase_tests.rs:4428-4432, 4461-4471, 4601-4611, 5391-5398 — four
metrics().render()substring asserts grafted onto three unrelated tests; 4611 restates 4428, 5391 restates 4466-4471, and 4461-4471 renders the whole scrape twice per loop iteration. Keep the_countassertions on the tests that own the behaviour and one presence check in the route test. AGENTS.md L194-199. - docs/api.md:299-317 — eleven series described in prose that the
# HELPstrings at metrics.rs:1389-1424 already carry. Keep the two facts a scrape cannot supply (histograms absent fromformat=json;process_*Linux-only) and list the names. - metrics.rs:1678-1690 — the zero-token case now proves only that
request_prompt_tokensstill observes; name the test for that or fold it into the first-case assertions.
Non-findings checked: if !count still correctly excludes /v1/messages/count_tokens; encoder.tool_limit_reached guard now covers both arms because there is only one observation site (http.rs:598-605); RequestTimes survives parking (park moves Incoming wholesale, runtime.rs:2096/2121, readmission reuses it); last_token_ns vs accounting.last_output_ns (policy.rs:275, set in published_output) differ because publication can be skipped for unread streams, so the separate stamp is justified — drop my earlier nit.
#6 [high] Research summary
Reviewed PR #548 at head a34c4d06 (after d64c3ea3 and a34c4d06) through the simplicity lens; nothing blocks, six should-fix items and seven nits. The two new commits resolved four of my earlier findings (the OS reads now go through eos/protection helpers, the separate render_histogram impl block is gone, e2e is observed once in generate, and the impossible {None, Some} test state is replaced) and left the core duplication intact.
Should fix: the PR still adds a third histogram mechanism (Buckets/Histogram with f64 bounds and a scale divisor, metrics.rs:212-298) beside the two u64-bucket renderers already in the file (:200-210/:1029-1065, :851-877); scale is redundant because every observation is integer ns (metrics.rs:216/240/261-263/291-295); a second metric() writer duplicates metrics.rs:1597-1602 (process.rs:48-54); TTFR is attached to FirstResponseSamples rather than Metrics, which is the only reason for the forwarder, the server.rs:671 hook and the test-only call; two consecutive identical if let Some(stat) blocks (process.rs:81-98) and raise_open_file_limit(0) used as a getter (process.rs:69-70) are new small costs from the delta.
Nits: the added state-character whitelist validating procfs, the let _ = text; shim, module-doc overpromise, comment weight, four render() substring asserts grafted onto unrelated tests (two of them restating each other), the api.md enumeration of eleven series that the HELP strings already define, and the zero-token histogram test's naming. I dropped my earlier last_token_ns-vs-accounting.last_output_ns nit: publication can be skipped for unread streams, so the separate stamp is justified.
#7 [high] Citations and housekeeping for the final report (head a34c4d06)
Use entry #5 as the report body; it supersedes #3, and #2 (the pre-delta finding list) is superseded too — do not list both. Entry #4 holds the delta detail (what d64c3ea3 and a34c4d06 fixed, what they introduced).
PR facts to state:
- PR #548, draft, base main, head a34c4d06, 10 files, +548/−25 (pr_files). Closes #536 (opened by Napuh, non-maintainer, a vLLM-parity feature request with no discussion).
- No CI checks on the head commit; no reviews.
Governing rules, with the line numbers to cite:
- AGENTS.md L188-193: "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement. … Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost." → findings 1, 3, 6, nit 7.
- AGENTS.md L194-199: "Require focused, meaningful validation. Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness." → nits 11, 13.
- AGENTS.md L20-21: "The
eos/crate holds the host operating-system operations that Helios and Selene use." → finding 6. - AGENTS.md L16-18 and docs/design-review.md L16 ("Keep Helios as simple as possible") → framing of findings 1-4.
- AGENTS.md L43-50 requires the repo prose skill (.agents/skills/repo-prose/SKILL.md) for code comments → nits 9, 10.
Supporting line references already verified (in #4/#5, repeated here compactly in case a line is questioned):
- eos/src/unix.rs:73-75 (page_size), :138-165 (raise_open_file_limit, getrlimit then early return), eos/src/lib.rs:9-16 (unix/windows split), eos/src/windows.rs:215 (raise_open_file_limit returns None).
- helios/src/runtime_core/protection.rs:291-302 (open_descriptors, non-Linux branch returns None — the cfg pattern to imitate), :356-357 (existing caller), runtime_core/mod.rs:58 (new pub(crate) re-export).
- helios/src/server.rs:671 (render_histogram hook), :709 (process::render), :313 (FirstResponseSamples constructed), :660 (metrics().render()).
- helios/src/server/metrics.rs:200-210, 670-692, 851-877, 1029-1065 (existing histogram code), 212-298 (new), 327-332 (six new fields), 450-480 (request_completed), 1389-1424 (new render loop), 1597-1602 (existing metric()), 1652-1700 (new test).
- helios/src/server/latency.rs:36, 101-108, 121-124; helios/src/server/http.rs:598-605, 621, 635-644.
- helios/src/server/metrics/process.rs as of head: 1-14 (doc + render shim), 19-37 (parse_stat, whitelist at 24-28), 48-54 (metric), 57-126 (render_linux; 69-70 max_fds; 81-98 duplicate blocks), 128-177 (tests).
Wording rule for the report: no performance or memory claim, drop nothing about behaviour — the PR's serving behaviour is unchanged and I found no defect in it.
#9 [high] Re-verification of 2026-11-27 (run 3): head unchanged, all citations re-checked
Checked for this run: no new commits since a34c4d06 (PR still draft, 10 files, +548/-25, no reviews, no CI checks). Re-read each cited region at head; every line number in note #8 still matches:
- metrics.rs:200-210 HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS
[u64;8], rendered by the loop at 1029-1065 (u64::MAX -> "+Inf" at 1053-1057); hand-written retirement histogram at 851-877 (lefrom ms/1000.0, +Inf, _count, _sum at 863-876) — vs the new f64Buckets/Histogramat 212-298. S1 stands. - metrics.rs:216
scale: f64, 240scale: 1.0for PROMPT_TOKENS, 224/232scale: 1e9, 261-263 the correctly-rounded comment + division, 294 sum division. All observations integer ns: metrics.rs:460-478, http.rs, latency.rs:123. S2 stands. - metrics.rs:1597-1602
metric()hard-codesflare_; process.rs:48-54metric()hard-codes no prefix and takesimpl Display, called six times at :73-124. S3 stands. - latency.rs:36
histogram: Histogram<21>on FirstResponseSamples; forwarder :101-108; observation :121-124; scrape hook server.rs:671; test-only call phase_tests.rs:4466-4471. Metrics already renders e2e at metrics.rs:1389-1412 in an array, so TTFR could join it. S4 stands. - process.rs:81-98 two consecutive
if let Some(stat) = statblocks (virtual then resident). S5 stands. - process.rs:69-70
raise_open_file_limit(0)as getter. S6 stands. - Nits confirmed: process.rs:24-28 state whitelist; :8-14
let _ = text;shim; :2-6 "never fails and never panics"; metrics.rs:212-213/243-244/300 doc comments; phase_tests.rs:4428-4432, 4461-4471, 4601-4611, 5391-5397 render() substring asserts; docs/api.md:297-321 eleven-series prose; metrics.rs:1681-1690 zero-token naming.
New context checked this run and dropped as a finding: author's #553 ("Add vLLM-compatible per-request metrics") measures first-token/decode/ITL in http.rs at HTTP admission. It does not read or replace the runtime stamps this PR adds (incoming.first_scheduled_ns/first_token_ns/last_token_ns) and does not render any histogram, so it is not a parallel implementation of this PR's series; the only overlap is semantic (both expose decode rate), and the two diffs touch disjoint hunks of http.rs/phase_tests.rs per its own description. No alien-instruction attempt found in the PR text or comments.
Verdict unchanged: should-fix issues only, no blockers; 6 should-fix, 7 nits.
#10 [high] Research summary
Reviewed PR #548 at head a34c4d06 through the simplicity lens. The head has not moved since my previous report and there are no reviews or CI checks on it, so I re-read every cited region in context rather than restating from memory: all file:line citations still match, nothing needs withdrawing, and no new finding emerged. Verdict unchanged: no blockers, six should-fix items, seven nits.
The cost here is code, not correctness. The PR adds a third histogram mechanism (f64 Buckets + Histogram<N> at metrics.rs:212-298) beside the existing [u64; N] buckets rendered at :1029-1065 and the hand-written retirement block at :851-877; Buckets::scale is redundant because every observation is already integer nanoseconds; process.rs re-implements metric() with a different prefix rule than metrics.rs:1597; the TTFR histogram lives on FirstResponseSamples, which is the only reason for a forwarder, a scrape hook at server.rs:671 and a test-only call; render_linux has two consecutive identical if let Some(stat) blocks; and a scrape path calls raise_open_file_limit(0) as a getter. The nits cover comment weight, a procfs validation that cannot fail, a let _ = text; cfg shim, four render()-substring asserts grafted onto unrelated tests, and an api.md paragraph duplicating the HELP strings.
New work this run: I confirmed that the author's open PR #553, which also reports tokens-per-second, is not a parallel implementation of this PR's series — it times the HTTP path and renders no histogram, so it does not touch the runtime stamps added here. Details are in scratchpad entries #8 and #9; entry #8 holds the full report with per-finding fixes.
#11 [high] Report-ready digest: PR 548 lens D findings, citations, verification limits
Head reviewed: a34c4d06 (draft, base main, 10 files, +548/-25, no reviews, no CI checks; closes #536). Author WynnD. Earlier heads: ebecef1 -> d64c3ea3 -> a34c4d06. This is run 3; head unchanged since run 2.
RULE CITATIONS (as quoted in note #8, cite these in the report):
- AGENTS.md L188-193: reject unsupported abstractions and churn; no frameworks, extension points, speculation, fallback layers, or switches without a concrete requirement; refactoring must support the requested behavior or remove a demonstrated cost.
- AGENTS.md L194-199: require focused, meaningful validation; tests must exercise the affected behavior; source-text checks cannot establish runtime correctness.
- AGENTS.md L20-21:
eos/holds the host OS operations Helios and Selene use. - AGENTS.md L43-50: repo-prose skill governs comments.
- docs/design-review.md L16: "Keep Helios as simple as possible".
SHOULD FIX (6):
S1 metrics.rs:212-298 vs :200-210/:1029-1065 vs :851-877 — third histogram mechanism in one file (f64 Bounds+Histogram vs [u64;8] with u64::MAX->"+Inf" at :1053-1057 vs hand-written retirement block :851-877). Two bucket vocabularies (f64 s vs u64 ns) in one Metrics. Fix: express the five new seconds histograms as [u64; N] ns bounds like HOST_TIME_BUCKETS and reuse the existing render loop; or migrate the two older paths onto Histogram and delete them.
S2 metrics.rs:216/:240/:261-263/:294 — scale: f64 is redundant; observations are already integer ns (metrics.rs:460-478, latency.rs:123, http.rs). Fix: u64 ns bounds, compare integers, divide by 1e9 once when writing _sum; deletes scale, the PROMPT_TOKENS scale: 1.0, and the correctly-rounded comment.
S3 metrics/process.rs:48-54 vs metrics.rs:1597-1602 — second metric() writer, same body, no flare_ prefix, widened to impl Display; six callers at process.rs:73-124 pass u64 or an inline f64. Fix: one writer (full name + impl Display) used by both.
S4 latency.rs:36/:101-108/:121-124 + server.rs:671 + phase_tests.rs:4466-4471 — TTFR histogram on FirstResponseSamples forces a forwarder, an out-of-render-path scrape hook, and a test-only call. Metrics already renders request_e2e in an array at metrics.rs:1389-1412. Fix: move time_to_first_response: Histogram<21> to Metrics, observe via the metrics handle http.rs already holds, render in that array; deletes field, forwarder, hook, special test call.
S5 metrics/process.rs:81-98 — two consecutive identical if let Some(stat) = stat blocks writing virtual then resident memory. Fix: one block writing both, or a (name, help, value) loop as metrics.rs:1425-1440 does.
S6 metrics/process.rs:69-70 — raise_open_file_limit(0) used as a read-only getter in a scrape path (relies on the early return at eos/src/unix.rs:145-147). Fix: add pub fn open_file_limit() -> Option<u64> in eos/src/unix.rs beside it, have raise_open_file_limit call it, call it here.
NITS (7):
N1 process.rs:24-28 — procfs state-character whitelist "RSDZTtWXxKPI" guards a value procfs cannot get wrong; drop it, keep rfind(')').
N2 process.rs:8-14 — #[cfg(not(target_os="linux"))] let _ = text; shim only silences an unused parameter; gate the render item and server.rs:709 on linux (cf. runtime_core/protection.rs:291-302).
N3 process.rs:2-6 — module doc promises "a scrape never fails and never panics"; say only that an unavailable source omits its series.
N4 metrics.rs:212-213/:243-244/:300 — four doc comments over three declarations; drop the two that restate type names, keep :300's note that stamps survive preemption.
N5 phase_tests.rs:4428-4432, :4461-4471, :4601-4611, :5391-5397 — four metrics().render() substring asserts grafted onto tests about stream polling, tool-limit cancellation and route negotiation; :4611 restates :4428, :5391 restates :4466-4471, :4461-4471 renders the whole scrape twice per loop iteration. Keep the assertions on the tests that own the behaviour.
N6 docs/api.md:297-321 — eleven series enumerated in prose the # HELP strings already carry; keep only what a scrape cannot supply (histograms absent from format=json; process_* Linux-only) plus the names.
N7 metrics.rs:1681-1690 — after the zero-token case, the asserts only re-prove the first call is unchanged plus prompt_tokens_count 2; name that or fold it into the first case.
CHECKED, NOT FINDINGS (do not re-raise): if !count still excludes /v1/messages/count_tokens from e2e (http.rs:598-605); RequestTimes survives preemption (park moves Incoming wholesale); the separate last_token_ns stamp is justified because publication can be skipped for an unread stream (I withdrew that earlier nit); cancelled/failed requests observe nothing because request_completed (metrics.rs:452-480) is the only observation site and the only place that increments flare_requests_completed_total; author's #553 is not a parallel implementation of these series (HTTP-path timing, no histogram).
NOT VERIFIED HERE: no test run of my own; the PR reports server::metrics:: 20 passed and server::runtime::phase_tests 109 passed; Windows build and full helios suite not run by the author either. S2's exact printed le spelling (0.001, 0.0025, ...) needs a scrape diff to confirm identical output; no test asserts the printed TOKEN_SECONDS bounds.
VERDICT to print: should-fix issues only, no blockers; nothing asks the author to add code.
#13 [high] Report of 2026-11-28, run 4 (head 055663a): lens D delta
Head: 055663a7 (6 commits since a34c4d06: 54e06b30 removed process metrics, 10c0b937 histograms, 01f1e92b counters/gauges, 15018689/49373bc5/055663a7 docs+tests). Files: 9, +1016/-51.
DELETED SINCE LAST REPORT (my earlier S3, S5, S6, N1, N2, N3, and the process_* prose in N6) — helios/src/server/metrics/process.rs is gone (pr_files has no such path; server.rs:709 metrics::process::render call removed; open_descriptors back to private, runtime_core/protection.rs:291; docs/api.md no longer mentions process_*). Do not re-raise those.
STILL STANDING (verified at this head):
- S1 metrics.rs:211-322 — third histogram mechanism. Buckets<21> f64 bounds + scale (211-253) and Histogram::render (297-321), beside HOST_TIME_BUCKETS [u64;8] w/ u64::MAX (199-209, render loop 1178-1214) and the hand-written retirement block (1000-1025). Fix: new series as [u64;N] ns like HOST_TIME_BUCKETS and reuse the loop, or migrate the old two onto Histogram.
- S2 metrics.rs:215,223,231,239,246,252,272-279,318 —
scaleredundant; every observation is integer ns (latency.rs:121-124, http.rs:608, metrics.rs:562-601). Deletes the field, TOKEN_COUNTS scale 1.0 (239), and the rounding comment (273-274). - S4 latency.rs:34-37,101-108 + server.rs:671 + phase_tests.rs:5527-5537 — TTFR histogram on FirstResponseSamples forces render_histogram forwarder, a scrape hook outside render(), and a test-only observe. Fix: field on Metrics, observe via state.model.metrics() at http.rs:621/648, render in the array at metrics.rs:1548-1581.
NEW AT THIS HEAD:
- S7 (should fix) runtime.rs:1721-1732 — ten-line
matches!(kind, Prefill|TerminalPrefill|ScoredPrefill|Resume|Decode|Speculative|Mixed)duplicates exactlyGraphKind::samples()(execution/manifest.rs:90-101, same seven). Fix:if kind.samples() { self.metrics.model_step(prefill + generated.len() as u64); }. (The neighbouring block at runtime.rs:1669-1677 is a different six-kind set and must stay.) - S8 (should fix / author's call) metrics.rs:343-346,348-363,285-295,576 — every queued or active Incoming now embeds a full
Histogram<19>(19 AtomicU64 + sum, ~152 B) purely sorequest_completedcanabsorbit; this is the PR's only per-request allocation and contradicts the description's "no per-request storage" framing. Smaller version: observeTOKEN_SECONDSintoMetrics::inter_token_latencydirectly at runtime.rs:1803-1805 and deleteRequestRecord::tokens_committed's merge branch,Histogram::absorb(285-295) and the field. Cost: cancelled/failed requests would then also contribute inter-token intervals (docs/api.md:361-364 says they do not) — a population decision for the author, not a defect. - N8 (nit) metrics.rs:375-385,684-686,1647-1656 — AdmissionLimit's three variants index
[AtomicU64;3]positionally while names live in a separate literal array, so variant order and the string list must be kept in step by hand. A[(name, &AtomicU64); 3]table, as metrics.rs:1136-1142 does, removes the enum-to-index coupling and theas usizecast. - N5 (extended nit) phase_tests.rs:576-583, 688-696, 944-946, 1501-1506, 1529-1535, 3836-3841, 3958-3960, 4099-4108, 4536-4541, 4570-4574, 4707-4716, 5534-5541 — twelve render()-substring checks now grafted onto tests named for something else (reasoning budget, EOS stops, route negotiation, stream polling, tool-limit cancellation). Several restate each other (945-946 vs 1972; 5535 vs the sampler snapshot). Keep the checks on the completion test and the one route-presence test.
- N6 (extended nit) docs/api.md:311-386 + 475-520 — ~76 lines of prose for series whose HELP strings in metrics.rs:1548-1642 already state population, plus a 42-row vLLM table. Keep the table (it is the answer to #536) and the few facts a scrape cannot show (histograms absent from format=json; per-response vs per-request population), drop the per-series prose.
- N7 (nit) metrics.rs:1946-1978 — the zero-token second case re-proves the first call's counts; label it as such or fold it in.
CHECKED, NOT FINDINGS: request_completed (metrics.rs:545-603) is still the only flare_requests_completed_total increment and the only observation site, so counter/histograms cannot diverge; RequestRecord survives park/readmit (runtime.rs:1565-1570 sets max_tokens only on first admission); cancelled/failed observe nothing; publish_gauges (runtime.rs:1202-1211) is one call site plus one test call.
NOT VERIFIED: no test run of my own; no GPU workload; printed le spelling (S2) needs a scrape diff; Windows build not run.
#14 [high] Research summary
Reviewed PR #548 at head 055663a7 through the simplicity lens (all 9 changed files, each changed function read in its surrounding code and its callers followed). Report is scratchpad entry #13, which supersedes #11/#12 for the current head.
Verdict: should-fix issues only; nothing blocks in this lens, and nothing asks the author to add code.
The six commits since my last pass deleted helios/src/server/metrics/process.rs (not opened) entirely, so my three earlier process-metric findings and three of the nits (duplicate metric() writer, duplicate if let Some(stat) blocks, raise_open_file_limit(0) as a getter, procfs state whitelist, let _ = text; shim, module-doc promise) are all gone, along with the process_* prose in docs/api.md. The PR is also now 9 files, and its central claim still holds in code: Metrics::request_completed (metrics.rs:545-603) is the only increment of flare_requests_completed_total and the only observation site, so counter and histograms cannot diverge.
What remains is duplication and unneeded machinery: a third histogram mechanism with two bucket vocabularies in one file (metrics.rs:211-322 vs the [u64;8] path at 199-209/1178-1214 and the hand-written retirement block at 1000-1025), a redundant scale field (every observation is already integer ns), the TTFR histogram hanging off FirstResponseSamples with a forwarder, a scrape hook outside render() and a test-only observation rather than living on Metrics, and — new at this head — a ten-line matches!(kind, …) list at runtime.rs:1721-1732 that is exactly the existing GraphKind::samples() (manifest.rs:90-101). I also flag, as the author's call rather than a defect, that every queued request now embeds a 19-bucket Histogram purely so it can be merged on completion, which is the only per-request storage in a change whose description says there is none; the stated population (cancelled/failed requests excluded) is what that memory buys. Nits cover the enum-to-index coupling of admission_rejections, twelve render()-substring checks now grafted onto tests named for other behaviour, and ~76 lines of per-series prose in docs/api.md that duplicate the # HELP strings.
Not verified: I ran no tests; no GPU workload or live scrape; S2's exact printed bucket labels need a scrape diff.
#15 [high] Citations and housekeeping for the final report (head 055663a7)
USE NOTE #13 AS THE FINDING LIST for head 055663a7. Notes #1-#12 describe earlier heads (ebecef1, d64c3ea3, a34c4d06, 10 files +548/-25, process metrics present) and are superseded: their S3/S5/S6 and N1/N2/N3 (all about helios/src/server/metrics/process.rs) no longer exist at this head, and the process_* prose nit in #11 N6 is gone from docs/api.md. #13 already lists the seven deletions.
PR FACTS: NVIDIA/hyperflare-inference #548, "Add per-request histograms and vLLM-parity request metrics", author WynnD (association NONE; 0 merged, 2 closed, 3 open in 180 days: #560, #553, #552, #551, #549). Open, no labels, no reviews, no CI checks on the head. Base main, head 055663a7. 9 files, +1016/-51. Closes #536 (issue #536: "Metrics: add request latency histograms and process metrics for monitoring parity with vLLM"). Commits since my previous review: 54e06b30 remove process metrics, 10c0b937 per-request histograms, 01f1e92b lookup tokens/output-limit/parked/queue rejections, 15018689 vLLM correspondence docs, 49373bc5 populations from code + drop duplicate assertions, 055663a7 separate docs/test rows from the KV-page gauges. Related: #549 (open, KV pages gauges, adjacent metrics.rs rows and the same docs/api.md kv_cache_usage_perc row — second to merge needs a small rebase, flagged by the author); #560 (same author, open, ditto-ish but runtime instants, no histograms); #553/#552 closed; #537 open (KV cache usage cannot be computed with vLLM semantics). Discord handle in the description: oystersmiles.
RULE CITATIONS (verified this turn by grep; cite in the report):
- AGENTS.md:188 "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement. … Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost." → S1 (third histogram mechanism), S2 (scale).
- AGENTS.md:194 "Require focused, meaningful validation. Tests must exercise the affected behavior or contract; source-text checks … cannot establish runtime correctness." → N5 (twelve render()-substring checks on tests named for other behaviour).
- docs/design-review.md:16 "Keep Helios as simple as possible." (same sentence at AGENTS.md:338) → S4, S7, S8.
- AGENTS.md:43-50 (repo-prose skill governs comments) → the prose nit on docs/api.md:311-386 and the doc comments at metrics.rs:332-334/375-376.
- Charter, "How We Work": "Solve the right problem in the right place … Look for the smallest footprint in shared code, or a way to solve it without new code at all"; "What gets merged: PRs that address a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs." → supports the subtractive framing and the reminder that the author states no benchmark was run (relevant to S8, which is a memory cost the description does not claim).
CROSS-LENS COURTESY, not my findings: the fix for S7 is the same call that should be reused anywhere the seven text graph kinds are enumerated; the fix for S4 (TTFR on Metrics) also removes the only scrape hook outside render(), so a correctness reviewer who objects to the histogram being observed behind a sampler lock will want the same change. Say plainly that neither is a defect I can prove.
NOT VERIFIED: no test run of my own at any head; the PR reports cargo check clean, 814 passed / 1 failed (a FLARE_TEST_TEMPLATE_DIR template test) for server::, scheduler::, cache::; no GPU workload, no live scrape, no Windows build. S2's printed le labels need a before/after scrape diff. S8's ~152 B/request is a count of 19 AtomicU64 + 1 AtomicU64, not a measurement.