Architecture report · NVIDIA/hyperflare-inference #548

Raw Markdown for agents: https://autobot.eidonix.com/p/734997ec-ec61-48d7-898e-ff0aa9e36f6c.md

Architecture & scope review — PR #548 "Add request latency histograms and process metrics"

Head reviewed: a34c4d0 (includes the two follow-up commits d64c3ea3 and a34c4d06). All 10 changed files read with surrounding code; judged against the charter, AGENTS.md, docs/design-review.md, and the surrounding Helios code.

Key findings

Verdict: should-fix issues only — no blocking architectural defect. The approach is right and the code is careful: recording the observations inside the single function that already counts completions is the correct place, the stamps survive preemption, format=json and Snapshot are untouched, and nothing crosses the preparation/runtime boundary or branches on model identity. Four should-fix items remain, one of them narrow (two accessors in eos), one a scope/authorization question for a maintainer rather than a code defect.

  1. Should fix — layering: process.rs:56-70 still reads _SC_CLK_TCK and both /proc files inline, and now reads RLIMIT_NOFILE through the mutating helper raise_open_file_limit(0), which is only mutation-free by accident (eos/src/unix.rs:145).
  2. Should fix — scope: the PR is authorized by, and closes, an outside feature request framed as vLLM dashboard parity. AGENTS.md:165-169,201-203 and the charter's "What gets merged" do not list a feature request among the merge criteria.
  3. Should fix — duplication: a second histogram implementation and a second metric formatter now coexist in metrics.rs without the existing host histograms being migrated onto them (AGENTS.md:188-193).
  4. Should fix — evidence: "nothing about serving changes" is asserted, not measured, although the change adds a clock read per scheduled step and blocking /proc reads per scrape (docs/design-review.md:97-105).

Nits: the fallback-layer structure of process.rs; a residual population mismatch in docs/api.md; the TTFR histogram being rendered from server.rs while every other family renders inside Metrics::render.


Should fix

1. Residual OS access in the serving metrics module, and a mutating helper used as a getter

helios/src/server/metrics/process.rs:56-70

The two follow-up commits did fix most of what I flagged earlier: process.rs:61 now calls crate::os::page_size() (eos/src/unix.rs:73-75), :68 calls crate::runtime_core::open_descriptors() (helios/src/runtime_core/protection.rs:291-302, re-exported at runtime_core/mod.rs:58 (not opened)), and the hand-rolled getrlimit is gone. What remains, against AGENTS.md:20-22 ("The eos/ crate holds the host operating-system operations that Helios and Selene use"):

Fix: add clock_ticks() -> Option<u64> and open_file_limit() -> Option<u64> (getrlimit only) to eos/src/unix.rs beside page_size, and keep process.rs to parsing and formatting. No new code outside eos.

2. Scope authorization: "monitoring parity with vLLM" is not a merge criterion

PR description ("Closes #536"); issue #536; AGENTS.md:165-169,201-203; charter "What gets merged" and "Alternatives / Competitors"

The whole justification is issue #536, "Metrics: add request latency histograms and process metrics for monitoring parity with vLLM", whose stated goal is to move existing vLLM Grafana dashboards onto Flare. The rules that bear on it:

Nothing here is architecturally wrong, and the observability gap is real — tail latency, queue delay, prefill time and decode rate genuinely are unobservable from a scrape today. But the fix is procedural: get a maintainer decision recorded on #536, or reframe the PR around the defect ("tail latency is unobservable from /metrics") instead of vLLM parity. Worth noting for that decision: the same author's sibling PR #553 (vLLM-compatible per-request metrics) was already halted as low-value/off-charter, and #549, #552 and #551 rebuild overlapping observability surfaces — a maintainer should decide the shape of this cluster once rather than merge four variants.

3. Two histogram mechanisms and two metric formatters in one module

helios/src/server/metrics.rs:212-298 vs :200-210,670-692,1029-1065; helios/src/server/metrics/process.rs:47-54 vs metrics.rs:1597-1602

AGENTS.md:188-193 asks reviewers to reject "frameworks, extension points, speculative compatibility, fallback layers … Refactoring must directly support the requested behavior". This change introduces a net-new mechanism where the file already had one:

  1. Buckets<const N> / Histogram<const N> (metrics.rs:212-298) is a second histogram implementation alongside the existing HOST_TIME_BUCKETS / HOST_TOKEN_BUCKETS arrays plus the inline cumulative render loop (metrics.rs:1029-1065) and the hand-written bucket search in host_lookup_cost (metrics.rs:670-692). The new type is better — it carries bounds and scale together — so the right move is to migrate the three host histograms onto it, which also removes an unwrap() at :689. As written, the file has two bucket-declaration conventions (u64 boundaries with u64::MAX as +Inf, metrics.rs:200-210, versus f64 bounds with f64::INFINITY, :219-241) and two render paths, with no guidance for the next metric author. The PR already touches both regions, so the migration is in scope.
  2. process::metric (process.rs:47-54) duplicates metrics::metric (metrics.rs:1597-1602), differing only in that the process names must not take the flare_ prefix. That is a legitimate difference expressed by copying the formatter. A single metric taking the full name, with the flare_ prefix supplied by the caller, keeps one formatter.

Neither is blocking; both are the "same thing twice in one module" that docs/design-review.md:16-25 (principle 1, "Keep Helios as simple as possible") pushes back on.

4. The serving-cost claim is asserted, not measured

PR description ("Observability only … nothing about serving changes"); docs/design-review.md:97-105; AGENTS.md:194-199

docs/design-review.md:97-105 requires evidence to be connected to claims and unrun checks and material limitations to be disclosed. The added hot-path work is real, if small:

Fix: say "the added cost is one clock read per scheduled step and one /proc read per scrape; not measured" rather than "nothing about serving changes".

A related description-only issue: the live-scrape evidence is internally inconsistent. It reports runtime families gaining 5 observations while flare_time_to_first_response_seconds gained 6, then accounts for 5 prompt-token observations ("le=\"64\" gained exactly one … le=\"2048\" gained four") while conceding the deltas "include" this agent session's own requests and "exceed the three requests below". A reviewer cannot check per-request observation counts from those numbers, and no duration is attributed to an individual request, so decode_sum/e2e_sum cannot be cross-checked against the reported completion-token counts (60, 1500, 695). The measurement is also on the AzallazA fork commit 5ffe4d54 with this commit cherry-picked, not on main. That limitation is disclosed, which is correct; the recommendation is to lean on the unit-test evidence (metrics.rs:1649-1697), which does establish the bucket boundaries, and present the scrape as a smoke check.


Nits


Verified sound (no finding)

Open questions / not covered by me

Link: https://github.com/NVIDIA/hyperflare-inference/pull/548