#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.