Explore scratchpad · NVIDIA/hyperflare-inference #548

Raw Markdown for agents: https://autobot.eidonix.com/p/2c9bf421-4697-4abf-8deb-56d7194e55b5.md

#1 [high] Change: PR #548 shape, size and files

PR #548 "Add request latency histograms and process metrics", author WynnD (GitHub association NONE; Discord oystersmiles). Open as a DRAFT, opened 2026-11-26, last updated same day, base main, head ebecef1, branched from f377dc8. Size 8 files +545/−20. Labels: none. Reviews: none. CI on head commit: no checks. Closes #536.

Files:

Immutable/non-atomic note: last_token_ns: u64 is a plain field, not Option<> — 0 means none; Metrics::new uses Default for times.

#2 [high] Why: issue #536 is the direct driver, filed same day

Issue #536 "Metrics: add request latency histograms and process metrics for monitoring parity with vLLM", by Napuh, opened 2026-11-26 09:03, updated same minute, open, 0 comments. Environment: hyperflare-inference v0.3.2 (c0c4f79).

Missing-vs-vLLM table it builds: e2e latency (vllm:e2e_request_latency_seconds), queue time, time_per_output_token / inter_token_latency, prefill duration, decode duration, TTFT (only flare_first_response_median_seconds 60 s median gauge today), prompt tokens per request (vllm:request_prompt_tokens), process metrics (process_cpu_seconds_total, process_resident_memory_bytes, process_open_fds, process_start_time_seconds).

Motivation stated: the median gauge cannot give P95/P99, cannot be computed over other windows, cannot be aggregated across instances; histograms let users run histogram_quantile() over any window and alert on tail latency.

It proposed exactly the names PR #548 implements: flare_request_e2e_seconds, flare_request_queue_seconds, flare_request_prefill_seconds, flare_request_decode_seconds, flare_time_per_output_token_seconds, flare_time_to_first_response_seconds, flare_request_prompt_tokens, plus process_*. It also proposed keeping flare_first_response_median_seconds for compatibility (PR #548 does).

Difference vs the proposal: #536 asked for flare_request_queue_seconds = "admission to first scheduled step"; PR #548 measures "model-scheduler arrival to first model step" (docs/api.md wording) — i.e. it starts at runtime arrival, not HTTP admission. Also #536 did not list process_virtual_memory_bytes (PR adds it) and PR #548 does not add vLLM's flare_... equivalent of inter-token latency beyond time_per_output_token.

Filed by Napuh, 0 comments, 0 interest shown beyond the filing; the same day two PRs (#548, #549) close it and #537, all by WynnD, and #541 (jere357) builds a Grafana dashboard that mentions #536.

#3 [high] Change: what the new histograms measure, verified in code

Verified in code (PR head ebecef1):

#4 [high] Change: e2e is server-side only; TTFR needs a client poll, e2e does not

#5 [high] Change: process metrics are hand-rolled procfs, Linux only, no new dependency

helios/src/server/metrics/process.rs is a hand-written clone of the Prometheus client collector, not an added dependency. libc = "0.2.189" is already an unconditional dependency of the flare-helios crate (helios/Cargo.toml:50), so no new crate and no feature gate; the module is pub(super) mod process; in metrics.rs and is only reached from the /metrics text handler (server.rs:709). No Cargo.toml change in the PR (file list confirms). This satisfies the charter's "pin everything / no new dependencies" preference — the alternative (adding the prometheus crate) would have been a dependency change.

Platform behavior: render() is a no-op outside Linux (#[cfg(not(target_os = "linux"))] let _ = text;). Windows is a supported serving target (docs/windows.md; flare-winui; the native-serving CI matrix builds and tests on windows-2022, .github/workflows/native-serving.yml:17-21,64-68), so a Windows operator scraping /metrics sees no process_* series and generic Prometheus process dashboards stay empty there. docs/api.md (PR) says "Other platforms omit them", so it is documented but the PR description's framing ("generic Prometheus process dashboards have no process_* series to read") is only resolved on Linux.

Robustness choices: each source read is .ok()-guarded and a parse failure omits only the dependent metric (no unwrap in the render path); sysconf(_SC_CLK_TCK)/_SC_PAGESIZE and getrlimit(RLIMIT_NOFILE) are wrapped in unsafe with SAFETY comments; parse_stat splits after the last ) to survive a command name containing ) and spaces, and there is a unit test for that (parse_stat_reads_fields_after_a_parenthesized_command_with_a_paren).

#6 [high] Related work: #536/#537/#541/#549 cluster and prior histogram code

All three come from the same request wave and are dated 2026-11-26:

#7 [high] Claims and evidence: what is backed, what is not, CI has not run

#8 [high] People: first-time contributor; the area is owned by yatesdr and Luke Alonso

#9 [high] Reach: docs inconsistencies introduced or fixed by the change

#10 [high] Project fit: charter clauses on evidence, scope and what gets merged

Charter (read_charter) facts, stated as facts:

#13 [high] Research summary

Case file for PR #548 "Add request latency histograms and process metrics" (WynnD, draft, +545/−20, 8 files, head ebecef1, no CI checks, no reviews) is gathered in the scratchpad across 12 entries, one per angle.

Key findings a reader could not get from the description:

  1. flare_request_queue_seconds starts at runtime arrival, not HTTP admission: Incoming.arrival_ns is set in ModelRuntime::schedule (runtime.rs:901) and handed to the scheduler at runtime.rs:1471. Issue #536 asked for "admission to first scheduled step"; e2e and TTFR, by contrast, start at HTTP admission (AdmittedAt, server.rs:828). The description names neither start point, so a reader porting vLLM queue-time semantics can mis-map it. Prompt-token observation uses the preemption-carried original prompt length, so it agrees with per-response usage.prompt_tokens.
  2. Undeclared asymmetry in the HTTP observations: flare_time_to_first_response_seconds is recorded only when the client actually polls the body, while flare_request_e2e_seconds is recorded as soon as the handler produces the completed response even if the body is dropped (http.rs:614-617 vs :607/638; phase_tests.rs:4406-4473 pins both behaviours). e2e therefore measures server-side handling, not delivery.
  3. helios/src/server/metrics/process.rs is hand-written procfs code, Linux only; libc is already an unconditional dependency of flare-helios (Cargo.toml:50), so no Cargo change. Windows is a supported serving target and CI builds it, but a Windows scrape gets no process_* series — documented, yet it means the description's generic-dashboard motivation is resolved only on Linux. process_open_fds counts its own directory read (declared in the help string).
  4. The docs hunk also silently repairs pre-existing drift: the old text claimed host-prefix lookups were "the only histograms" while flare_host_cache_retirement_seconds already shipped. Conversely the change leaves "Counter and gauge names start with flare_" (api.md:288-289) standing while adding unprefixed process_*.
  5. Process/community: the PR is a draft with zero checks, zero comments and no maintainer engagement anywhere in the cluster. The author has no merged contribution and GitHub association NONE; their other PR (#549) was opened the same day; both close issues (#536, #537) filed the same morning by one new filer, Napuh. So the demand is under a day old and one-requester wide — relevant to the charter's "explicit maintainer request" merger test.
  6. Evidence: the claimed test runs are two module subsets (server::runtime::phase_tests 109 passed; server::metrics:: 20 passed); Windows build, full helios suite and one template-dependent test are explicitly not run, and CI does cover the first two on both ubuntu and windows-2022 (native-serving.yml:56-68) but has not run. The live scrape is a single two-GPU DeepSeek instance whose deltas include the agent session's own traffic — self-declared confound, not a controlled three-request measurement. No performance claim is made and none of the added per-completion cost is measured.
  7. Related work: nothing on main conflicts (no default-branch commit since f377dc8 touches these files); metrics.rs has three open PRs in flight (#548, #549, #542) plus #334 touching it; #507 is the function the new code sits beside; #541 is the Grafana consumer whose own auto-review says the only in-repo Grafana signal is #536. The change leaves the four existing host-cache histograms on their older [AtomicU64; 8] implementation, so the file now holds two histogram implementations.
  8. Charter fit: observability-only, no per-model branch, complete four-part description — but the motivating framing ("monitoring parity with vLLM", migrating SLO alerts) sits against the charter's "not a general-purpose production server" self-description, and no maintainer has authorized the work.

Angles with nothing found: community (no comments, reviews or reactions anywhere in the cluster).

#17 [high] AMENDMENT (2026-11-27): head d64c3ea — blocker 1 fixed, but the process refactor breaks a documented feature build

PR #548 head moved ebecef1 -> d64c3ea ("Exclude cancelled responses and reuse host helpers", 2026-11-26). Size is now +550/-20 in 10 files (was +545/-20 in 8): adds helios/src/runtime_core/mod.rs (+1) and helios/src/runtime_core/protection.rs (+1/-1), and metrics/process.rs shrank +184 -> +172. Still draft; no review, no CI evidence on the new head.

WHAT THE COMMIT DOES

  1. e2e exclusion + single observation point. http.rs:598-606: one observation per successful response, guarded if !count && !encoder.tool_limit_reached, placed just before yield Delivery::Complete(response) inside the delivery generator; the duplicate observations in the streaming filter_map (:614-617 before) and the non-streaming Delivery::Complete branch (:631-635 before) are deleted, Delivery::Complete(_) => None now (http.rs:621), and the cached metrics_handle() clone is gone (uses state.model.metrics()).
  2. process.rs now reuses shared helpers instead of hand-rolling them: page = crate::os::page_size() (process.rs:56; eos/src/unix.rs:73-75), open_fds = crate::runtime_core::open_descriptors() (:63; runtime_core/protection.rs:291-302, newly pub(crate) and re-exported at runtime_core/mod.rs:58), max_fds = crate::os::raise_open_file_limit(0) (:65; eos/src/unix.rs:138-165, desired=0 only reads the soft limit). Only /proc/self/stat and /proc/stat btime parsing stay local. process_resident_memory_bytes no longer has a separate page-size fallback (:85-93).
  3. New assertion in disabled_parallel_calls_complete_http_and_stop_decoding (phase_tests.rs:4604-4613): the tool-limit cancellation must leave flare_request_e2e_seconds_count 0.

BLOCKER 1 OF THE 26 NOV REVIEW IS FIXED. The tool-limit path was the only place the HTTP layer cancels a generation while still delivering a complete response (http.rs:471-476 skip, :526 Cancelled substitution, :563-567 generation.cancel()), and it is now excluded; docs/api.md:315-316 ("Cancelled and failed requests enter only ..._cancelled_total and ..._failed_total") is consistent again. The other cancel paths set the flag only from Generation::cancel/Drop (runtime.rs:152-154, :175-179), which either ends in an Error event or a dropped response, so no Complete and no observation. Nothing in the new head addresses the earlier "cancellation races the natural finish" remark, but I found no path where it now produces an e2e observation.

NEW HIGH FINDING — the refactor makes a documented build configuration fail to compile on Linux.

Also unchanged by the commit: the two competing histogram implementations (host-cache arrays vs Histogram<N>), the ~190-line permanent growth of every /metrics body with no opt-out, no process_* on Windows, and the unmeasured per-step/per-scrape cost.

#18 [high] AMENDMENT (2026-11-27): docs findings resolved at head; description drift grows

The d64c3ea docs hunk in docs/api.md (PR head lines 287-321) resolves most of the documentation findings in my 26 Nov report:

STILL WRONG / STILL OPEN

  1. "The HTTP histograms observe delivery" (:303) overstates the non-streaming case: e2e is recorded inside the delivery generator before the response is returned (http.rs:598-606), and first_response_http_nonstream_records_only_when_completed_body_is_offered still pins flare_request_e2e_seconds_count 1 for both poll_body = false and true (phase_tests.rs:4461-4465). Only the streaming case needs the client to drain. One clause ("non-streaming responses are observed when the body is produced").
  2. The vision phrase covers the queue boundary but not that prefill absorbs vision compute: first_scheduled_ns is stamped for every lane before the GraphKind::Vision split (runtime.rs:2191-2203 vs :2208), so flare_request_prefill_seconds includes vision work too. Partially addressed, still not said explicitly.
  3. The PR description remains silent on the queue histogram's start point (docs say model-scheduler arrival; #536 asked for admission) and now also silent on the third e2e exclusion: it still reads "observed when delivery completes a successful response, except for /v1/messages/count_tokens", with no mention of the tool-limit/cancelled exclusion that this commit adds, and no mention of the new runtime_core dependency or the shared-helper refactor.
  4. The description's Evidence section was not updated with the new assertion, and still claims "nothing about serving changes" (unchanged), the two module-subset runs (109 + 20), the run-not-run list, and "CI covers the first two" (no checks on the new head either; the author instead asked for an autobot re-review).
  5. docs/api.md:318-321 still says other platforms omit process_*; unchanged, still the Windows gap.

#19 [high] AMENDMENT (2026-11-27): #548 now has a stacked dependent (#552) and a sibling (#553); issue #551 names the proxy gap

Three new items appeared in the hours after my 26 Nov report, all by WynnD and all referring to #548:

Consequences for #548's review:

#21 [high] Research summary

The new event (commit d64c3ea on PR #548, plus three new items in the cluster) is reviewed and the amendments are in scratchpad notes #17–#20. Headline amendments:

  1. Review blocker 1 is fixed. e2e is now observed once, inside the delivery generator, guarded by !count && !encoder.tool_limit_reached (http.rs:598-606); the duplicate observations and the metrics_handle() clone are gone; and a new assertion pins flare_request_e2e_seconds_count 0 on the parallel-tool-limit path (phase_tests.rs:4604-4613). The docs naming, cumulative-window, group-split, ≥2-token and stream-drain findings from the 26 Nov review are also now fixed in docs/api.md:287-321.

  2. New high finding introduced by the same commit. process.rs:63 now calls crate::runtime_core::open_descriptors() under cfg(target_os = "linux"), but runtime_core is gated on the runtime-core feature (helios/src/lib.rs:25-26) while the server feature does not enable it (helios/Cargo.toml:25). A Linux build with --features server alone — exactly the documented commands in docs/model-development.md:99-100 and docs/scheduling-runtime-design.md:735-737 — no longer compiles. No CI job covers that combination (native-serving.yml:63,68 always passes both features; Windows compiles because the call is Linux-gated).

  3. Cluster change. #548 is now a merge-order dependency: PR #552 (draft, +929) is explicitly stacked on #548 and turns RequestTimes into llama.cpp (not opened)-style timings on response bodies, and PR #553 adds vLLM-style per-request metrics; both by the same author, whose issue #551 states plainly that Prometheus histograms cannot serve the llama-swap consumer. That raises the cost of the queue-histogram start point, since #552 propagates the same stamps into the wire format. Also: docs still call non-streaming e2e "delivery" when it is recorded before the body is returned, the description is unchanged (still no queue start point, no tool-limit exclusion, stale CI/evidence claims), no CI has run on d64c3ea, and there are still no reviews or maintainer engagement anywhere in the cluster.

#22 [high] AMENDMENT TEXT (2026-11-27): the amendments to append to the report, worded

Amendments to the 2026-11-26 report (run of 2026-11-27)

1. Head moved: ebecef1 → d64c3ea "Exclude cancelled responses and reuse host helpers". Size +550/−20 in 10 files (was +545/−20 in 8). Still draft, still no reviews, still no CI checks, no maintainer engagement.

The two new files in the diff are helios/src/runtime_core/mod.rs (+1) and helios/src/runtime_core/protection.rs (+1/−1); metrics/process.rs shrank +184 → +172.

2. Corrected: the cancelled-response blocker is fixed (it was the first blocker in the 22:00 review of my last report).

flare_request_e2e_seconds is now observed exactly once, inside the delivery generator, immediately before yield Delivery::Complete(response), guarded by if !count && !encoder.tool_limit_reached (helios/src/server/http.rs:598-606). Both former observation sites are gone (Delivery::Complete(_) => None at http.rs:621; the non-streaming arm at http.rs:635-644 now only maps the body), the cached metrics_handle() clone is gone in favour of state.model.metrics(), and disabled_parallel_calls_complete_http_and_stop_decoding now asserts flare_request_e2e_seconds_count 0 on the tool-limit path (phase_tests.rs:4604-4613). The tool-limit path was the only place HTTP cancelled a generation while still delivering a complete response (http.rs:471-476, :526, :563-567), so the documented promise that cancelled and failed requests appear only in the _cancelled_total/_failed_total counters (docs/api.md:315-316) holds again. The earlier "e2e is recorded as soon as the handler produces a response even if the body is dropped" asymmetry is now deliberate, documented, and pinned by a test.

3. Corrected: most of the documentation findings are resolved.

At the new head docs/api.md:287-321 fixes: the process_* exception to "Counter and gauge names start with flare_" (:288-290); "accumulate since server start" (:297); the split into "The HTTP histograms observe delivery" and "The runtime histograms observe completed generations" (:303, :309); the ≥2-generated-token eligibility of decode and time-per-output-token (:312-314); the stream-drain wording (:304-306); and the queue boundary named as model-scheduler arrival to the first model step, "which can be a vision step" (:309-312). The stale "The only histograms describe host prefix-store lookups" sentence is gone, so my earlier "undeclared doc repair" observation is moot and flare_host_cache_retirement_seconds is listed (:298-301).

Two doc inaccuracies remain, both smaller than before:

4. New high-severity finding the new commit introduces: the helper reuse breaks a documented feature build on Linux.

helios/src/server/metrics/process.rs:63 calls crate::runtime_core::open_descriptors(), but runtime_core is declared #[cfg(feature = "runtime-core")] pub mod runtime_core; (helios/src/lib.rs:25-26) while server is independent (:28-29) and does not enable it (helios/Cargo.toml:25; default = [] at :17). A Linux build of helios with --features server and without runtime-core therefore references a module that is not compiled (E0433). That feature set is documented and used: docs/model-development.md:99-100 (--features server --lib frontend::, --features server --test message_boundaries) and docs/scheduling-runtime-design.md:735-737 (--features server --lib scheduler::, server::runtime::phase_tests::). No CI job covers it — native-serving always passes runtime-core,server (.github/workflows/native-serving.yml:63,68), flare/flare-cli always enable both (flare/Cargo.toml:23, flare-cli/Cargo.toml:27), helios-lifecycle runs cargo kani --lib with no features — and Windows is unaffected because the call is Linux-gated, so the break is Linux-only and invisible to the matrix. Before this commit the server module had no unconditional runtime_core reference (only #[cfg(feature = "runtime-core")] code in session.rs and runtime/prompt_tests.rs). Fixes are cheap: gate the call on the feature, gate the process module, or route the fd count through the crate::os surface, which already re-exports flare_eos (helios/src/os.rs:8).

The rest of the helper consolidation is an improvement and is what the review asked for: crate::os::page_size() (process.rs:56, eos/src/unix.rs:73-75), crate::os::raise_open_file_limit(0) (:65, eos/src/unix.rs:138-165), and the shared open_descriptors (runtime_core/protection.rs:291-302, newly pub(crate) and re-exported at runtime_core/mod.rs:58). ~12 hand-rolled lines in process.rs disappear.

5. New context: #548 is now a merge-order dependency and one of three same-author PRs.

Consequence for the recommendation: the value of #548 is now partly as a dependency (#552 cannot land without it), and the cost of its weakest part — the queue histogram anchored at runtime arrival rather than HTTP admission, which #536 asked for and which the description still does not disclose — is higher, because the same stamps will be rendered into client-visible timings.

6. Unchanged since the last report.

The description was not edited: it still omits the queue histogram's start point, still omits the tool-limit exclusion it now implements, still says "nothing about serving changes", still cites the two module subsets (109 + 20 passed) with no run on the new head, still says "CI covers the first two", and does not mention the runtime_core dependency or the helper refactor. The untouched review items remain: the unmeasured per-step clock read plus lane loop and the blocking procfs reads per scrape, converting the four host-cache histograms to Histogram<8> (two implementations still coexist), gating the module on target_os instead of the let _ = text shim, the maintainer-authorization question for #536, and the ~190-line permanent /metrics growth with no opt-out. Windows still gets no process_* series (docs/api.md:318-321). No CI check has run on d64c3ea and no reviewer or maintainer has engaged with any of #536, #537, #548, #549, #551, #552 or #553.

#11 [medium] Recent activity: nothing recent on main conflicts; metrics.rs has 3 open PRs

#14 [medium] Why (continued): #537 sibling gap, demand age, and the only pre-existing signals

#15 [medium] Process: draft with no CI on head; description meets the repo's four-part rule

#20 [medium] AMENDMENT (2026-11-27): review scorecard at head d64c3ea

State at the time of this amendment (2026-11-27):

#12 [low] Community: zero comments, reviews or reactions anywhere in the cluster

Community angle: nothing found beyond what is recorded elsewhere. pr_comments on #548 returns "No comments" — no reviews, no inline comments, no reactions, no Discord discussion captured. #536 and #537 each show "Discussion (0)". The only cross-references are structural: #536 lists #548 (closes), #541 (mentions), #549 (mentions); #537 lists #549 (closes), #548 (mentions), #541 (mentions). Both issues were filed by Napuh and both PRs by WynnD the same day, so the whole cluster is two people plus the #541 author (jere357) working the same day — no maintainer has joined any of the four threads.