PR #560 — "Emit vLLM-compatible per-request metrics from runtime instants"
Author WynnD (Discord oystersmiles), draft, opened 2026-11-28, base main, head 037b9d5f, 18 files +1898/−123, no labels, no reviews, no CI checks. Closes #551. https://github.com/NVIDIA/hyperflare-inference/pull/560
Key findings
- The published diff is two pull requests. The branch is cut from #548's branch (
metrics/request-latency-histograms, head49373bc5), so the GitHub diff againstmaincontains all of #548 plus #560.helios/src/server/metrics.rsis +548/−2 andlatency.rs+24/−8 — byte-for-byte #548's changes;docs/api.mdis +178/−4 here versus #548's +127/−4. Only about +880/−72 is this PR's own work. The description does disclose the stacking and says "the dependency must merge first", but #548 is itself a draft whose only verdicts are three "Changes Requested" auto-reviews, the latest (2026-11-27 07:04) listing a--features serverbuild break and unreconciled evidence. Nothing in GitHub expresses the dependency; a reviewer sees one change twice the size of the PR's own. - A candidate undeclared behaviour change does not hold — the description's cost claim is accurate. The
http.rsfall-through submission arm changed fromgenerate_many(prompts)togenerate_many_observed(prompts, None, commits)(http.rs:364-375).generate_manyisenqueue_many(prompts, None, false)(runtime.rs:856-858) andgenerate_many_observedisenqueue_many(prompts, observation, commits)(runtime.rs:862-869), so with the flag off both are(None, false)andoutput_event_capacity's multiplier1 + usize::from(observed) + usize::from(commits)(runtime.rs:62-84,observed = observation.is_some()at runtime.rs:920) is unchanged. I checked this specifically because the arm looks like a widened observation path; it is only a helper-signature widening (commitshad been hardcodedfalse). Thecontinuous_usagearm'sobservation.timestamps→Some(observation.timestamps)is the same bool→Option<bool>widening, not a behaviour change. - The motivating defect is real and externally citable, but reach is narrower than the motivation. llama-swap v250 (
60226b6)buildMetricsininternal/server/metrics.go(not opened) reads a llama.cpp (not opened)timingsor vLLMmetricsobject out of the proxied body or any SSE event, so Flare's rates show −1 (#551, https://github.com/NVIDIA/hyperflare-inference/issues/551). But a Chat or Completions stream carries the object only when the client sentstream_options.include_usage(encode.rs:244-253); only a Responses stream always carries it. Plain Chat streaming — the common gateway path — gets nothing unless the client or gateway sets that option. #551 itself flags the same concern about vLLM's object; #560's description restates the requirement without noting it narrows the llama-swap case. - No end-to-end evidence at all, and the two superseded PRs are where the evidence was. #560 states plainly what was not run: GPU, exported core, live server, llama-swap or gateway check, Windows build, CPU overhead. Both #552 and #553 carried live llama-swap numbers (e.g. #553: 4925.84 ms TTFT / 3.20 tok/s non-stream, 128.01 ms mean ITL streaming). The switch to runtime instants traded those away and nothing replaced them.
- The series has received no human maintainer attention whatsoever. Across #548, #549, #551, #552, #553, #560, #536 and #537 — seven items from two outside contributors — no human maintainer has commented. The only substantive project feedback is flare-autobot's, and its two stopping verdicts ("low value or does not align with the project charter") are on #553, the HTTP-timed predecessor of this exact feature, not on #560. #560 also has no autobot case file, unlike its three siblings which each got one within ~30 minutes.
- The flag sits exactly where the repo's rules are strictest. AGENTS.md:188-193 warns against "configuration switches without a concrete requirement"; there is a concrete requirement (named external gateway) but no maintainer endorsement. The deliberate absence of a
[server]config key produces two documented consequences: the WinUI desktop controller cannot enable the option, and a persistent Orbit group that saved the flag cannot turn it off (no negating flag exists). #553 had added that config key and #560 drops it;flare::configuration::Serveris#[serde(default)]withoutdeny_unknown_fields, so a user following #553's documentation gets the key silently ignored.
The change
Plain terms: the model worker already timestamps a request's first scheduled step, first committed token, last committed token and model-queue arrival. This PR adds one more event (Committed { at_ns }, the step's completion instant) and carries all of them to the HTTP layer, which renders vLLM's six-key metrics object from them without reading any clock.
Verified in the diff at head 037b9d5f:
GenerationEvent::Committed { at_ns }emitted insideWorker::complete's per-request token loop whenposition == 0andrequest.incoming.commits, aftercompleted_at_ns = monotonic_ns(), alongsiderecord.tokens_committed(...)(runtime.rs:1826-1833). One event per step that committed at least one token for the request, even if the step committed several (speculative round).GenerationEvent::Finishedgainsarrival_nsandtimes(runtime.rs:97-100 region), filled on all terminal paths (user/text stop, natural finish,finish_cancelled).Incominggainscommits: boolandrecord: RequestRecord(runtime.rs:926-950).output_event_capacity(minimum, observed, commits)multiplies by1 + observed + commits(runtime.rs:62-84);enqueue_manypassesobservation.is_some()andcommits(runtime.rs:920). The comment at runtime.rs:918 notes Tokio allocates blocks as events arrive, so this is a reservation bound, not an allocation.generate/generate_manykeep passing(None/false, false);generate_observed/generate_many_observed/enqueue_manytake the flag (runtime.rs:843-876).Encoder::enable_request_metrics(streaming)(encode.rs:244-253) setsself.metricstoNonefor Messages,Nonewhen not placed (unstreamed is always placed) orprompts.len() > 1,Suppressedwhenchoices_per_prompt > 1, elseSingle(Timing); returnsstreaming && Single, which becomescommits.record_commit,record_times,metrics_value(encode.rs:254-294): all six keys always present —queue_time_ms(arrival → first scheduled),time_to_first_token_ms(scheduled → first token),time_to_first_content_token_ms(scheduled → content instant, stream only),generation_time_ms(first → last token),mean_itl_ms(generation / (generated − 1), only when > 1 token),tokens_per_second(generated × 1e9 / (last − first scheduled)), each null when its instants were not reached.http.rs: encoder built before submission (http.rs:332-363),commitscomputed fromstate.per_request_metrics && encoder.enable_request_metrics(decoded.stream)(http.rs:363), passed to all three submission arms; delivery loop consumesCommittedviaencoder.record_commitandFinishedviaencoder.record_times(http.rs:524-546); body getsresponse["metrics"]at top level when not streaming (http.rs:610-619).ServerConfig.per_request_metrics(server.rs:129),HttpStatecopy,Bootstrap::loadaccepting only a JSON bool or absence (config.rs:353-357);per_request_metricsin the observation module'sperformanceobject besideingress_ns,enqueue_ns,reused_prompt_tokens.- CLI:
--enable-per-request-metricsonRunandOrbitRun(cli.rs:643-648, 856-861), forwarded inrank_zero_options()only when true (cli.rs:694-698), set into the server config JSON only when true (main.rs:352-357). Testper_request_metrics_flag_is_off_by_default_and_reaches_rank_zero(cli.rs:1374-1400) covers default,flare run, and rank zero's re-parse. - Docs:
docs/api.mdgains a "Per-request metrics" section (≈:1002-1057) and a vLLM correspondence table (≈:475-520);docs/cli-design.mdlists the flag (≈:736) and the rank-zero forwarding (≈:173);helios/model-contract.md(+14/−6) definesfirst_scheduled_ns, thetoken_timestamps_ns[0] − first_scheduled_nsinterval and the extra event in the response budget.
Description versus code:
- Accurate where it matters: the stacked scope, the "no clock read added" claim (true of this PR's hunks; #548's hunks do add one
monotonic_nsper submitted step inreserve_and_pack), the "nometricskey when off" claim, and thecreated-timestamp shift from moving the encoder earlier. - Undeclared but harmless: the two helper-signature widenings described in Key finding 2.
- Latent, not observable today:
first_scheduled_nsin the delivery loop is assigned on everyFinished(http.rs:541), so for multi-choice Completions the last choice wins; the code comments thatperformanceis Chat-only and Chat has one choice. - Undeclared because it belongs to #548 but rides in this diff:
RequestRecord.max_tokens,tokens_committed,request_completedreplacingcompleted.fetch_add,admission_rejectedcounters, theflare_parked_requestsgauge,cache_lookup_tokens, thefirst_responsehistogram, andMetrics::response_completede2e observation. None appears in #560's "What changed", but all appear in the diff a reviewer reads. - Description's failure-path claim verified:
metricsis only emitted atDelivery::Complete; the failure path yieldsDelivery::Failedbefore reaching it.
The why
- #551 (open, WynnD, 2026-11-27) names the consumer and the mechanism: llama-swap v250
buildMetricsreads llama.cpp (not opened)timingsor vLLMmetricsfrom the proxied body/SSE; Flare emits onlyusage, so rates stay −1 and the input-token column shows the whole prompt. https://github.com/NVIDIA/hyperflare-inference/issues/551 - Adjacent monitoring-parity asks predate it by a day and are about
/metrics, not response bodies: #536 (request latency histograms, vLLM parity) and #537 (KV cache usage) opened by Napuh 2026-11-26. #548 closes #536; #537 has no PR. - Age and breadth: the whole want is two days old at review time, comes from two outside contributors, and cites no maintainer request or roadmap item. vLLM's feature being copied is
--enable-per-request-metricswithqueue_time_ms,time_to_first_token_ms,time_to_first_content_token_ms,generation_time_ms,mean_itl_ms,tokens_per_secondplusmetrics.speculative_decoding, which #560 does not implement (stated in its limitations).
Related work
- #548 (open, draft, same author) "Add per-request histograms and vLLM-parity request metrics", +1016/−51, head
49373bc5: the required base. It suppliesRequestTimes/RequestRecord, the completion histograms,model_step_tokens, the parked gauge,admission_rejectedandcache_lookup_tokens. 5 discussion entries, 3 auto-reviews all "Changes Requested". - #551 (open issue): closed by #560.
- #552 (closed 2026-11-28 02:04, draft, +929/−26) "Report request timings on final responses": emitted llama.cpp (not opened)
timings(cache_n,prompt_n,prompt_ms,prompt_per_second,predicted_*,draft_n,draft_n_accepted), stacked on #548, carried per-request draft counts. Closed by the author as superseded because emitting both objects made llama-swap subtract cached prompt tokens twice. #560 explicitly does not carry thetimingsobject or the draft counts. - #553 (closed 2026-11-28 02:05, draft, +364/−9) "Add vLLM-compatible per-request metrics": same object but timed from HTTP admission, so
queue_time_mswas always null and stop-string requests timed wrong; also added[server] per_request_metricsinflare/src(configuration.rs, settings.rs, controller.rs). Superseded. Its two auto-reviews are the only project-side verdict on the idea: "## Review Stopped — Auto-Review halted due to finding: It is low value or does not align with the project charter." That verdict concerns #553's HTTP-timed variant, not #560. - #549 (open, same author) "Report KV pages held by active requests": independent, overlaps this PR only through shared #548 files; #548 notes a rebase-order relationship with #549 on
docs/api.mdand metrics fixture rows. #560 does not mention #549. - #536 / #537 (open issues, Napuh): the
/metrics-side asks; #536 is #548's close target, #537 is unimplemented. - #507 (merged 2026-11-24, Luke Alonso): persistent worker counter schema, Prometheus metrics,
/v1/worker,flare parallax. This is the metrics infrastructure the series extends; #560 builds on it and reverses none of it. - #167 (merged): reasoning-token budget, which is why the forced
</think>token has no commit instant — #560's limitation notes it is counted ingenerated_tokensbut has no commit instant.
Recent activity
- The edited areas are owned by Luke Alonso: 208 commits in
helios/srcand 370 indocsin 180 days, versus Martin Vit 49 and yatesdr 47 inhelios/src;flare-cli/srcis Luke Alonso 11, eugr 3, yatesdr 3. - The most relevant recent main commits:
f646bebc#507 (2026-11-24, the metrics shape being extended),6d74db3a"Fix Rust compiler warnings across Helios, Heliopause, and Selene" (2026-11-26, predates the branch),883abc17#556 DispatchRing andc9693765#555 batch capacities (both 2026-11-27, different files). No commit on main changesGenerationEvent::Finished, so the branch's widest signature change lands on a stable surface, but nothing has been rebased onto main since883abc17. verification/helios-lifecycle/check.py:218-220mutates source text matching_capacity: Some(capacity.clone()),\n arrival_ns,inruntime.rs; at head that adjacency still holds (runtime.rs:926-928), so the TLA+ mutation harness keeps matching.arrival_nswas added by #548, not #560.- The change builds on, and conflicts with, nothing in main textually; it is a strict extension of the #507 metrics surface.
People
- WynnD / Wynn Drahorad, Discord
oystersmiles: GitHub association NONE, 0 merged, 2 closed, 3 open in 180 days — #548 (base), #549, #551 (issue), #552, #553. All five are one metrics push in the author's first week; nothing has landed. The pattern across the series is compliance: the author prompts@flare-autobotto re-review and rewrites the diff down each round, closing #552 and #553 himself within a minute of each other (02:04/02:05 on 2026-11-28) rather than defending them. - Napuh, the only other outsider in the space: #536 and #537, opening 2026-11-26 with vLLM-parity complaints and an environment (v0.3.2 at
c0c4f79). Not present in #560. - Maintainers: Luke Alonso (author of #507, priority contributor in the charter), Martin Vit, yatesdr. None has commented on any item in this series, so there is no maintainer signal in either direction.
- flare-autobot, the only reviewer that has engaged the cluster: #548 Changes Requested ×3, #549 Changes Requested ×2 (blockers fixed by round 2), #553 Review Stopped, #560 nothing yet.
Community
- #560 itself: zero comments, zero reactions, zero reviews, no CI checks, and no autobot case file — the last is notable because #548, #549 and #553 each received one within about 30 minutes of opening.
- Cluster engagement for scale: #548 5 entries; #549 4; #553 5; #552 1 (just the closing note, never reviewed); #551, #536, #537 0 each.
- No human maintainer has written a single comment anywhere in the cluster.
Project fit
- Lines up: the problem is a reproducible defect in a named external consumer, which fits "What gets merged" (charter line 35 / AGENTS.md:165-169) better than a hypothetical future consumer would. The change adds no per-model branch, so it is consistent with the model-agnostic runtime invariant (charter line 12 / AGENTS.md:407-421). Stacked-PR expectations (AGENTS.md:128-129) are met in the description: what the dependency supplies, what this diff adds, and the merge order.
- Does not line up: AGENTS.md:188-193 ("do not add ... configuration switches without a concrete requirement") and the "no per-model special cases or flags" pressure at charter line 43 / AGENTS.md:449-456 point at the new user-facing flag; the concrete requirement exists but is outsiders' deployment, not a maintainer ask. The flag also has no configuration-file home by design, so the desktop controller and persistent Orbit both lose access to it — the description documents these rather than solving them. The charter's benchmarking guidance (AGENTS.md:493-495) speaks to comparing runtimes, not adopting a competitor's wire format, so it neither endorses nor forbids the vLLM-shaped object.
- Process paperwork gap: AGENTS.md:56-58 asks that unresolved defects and unrun checks be recorded in
docs/TODO.txt;per_request_metricsdoes not appear there (only an unrelated "metrics port" line at :261). The limitations live only in the description.
Claims and evidence
| Claim | Backing |
|---|---|
cargo check --features server clean, cargo check (flare-cli) clean |
Author report only; no CI run exists on 037b9d5f |
820 passed / 1 failed in server:: scheduler:: cache::; 33 passed in cli:: |
Author report; the named failure server::protocol::decode::native_prompt_tests::messages_image_hints_end_after_expansion_for_text_and_segmented_templates (needs FLARE_TEST_TEMPLATE_DIR from tests/frontend/prepare_templates.py (not opened)) is the same pre-existing failure #548, #549 and #552 all report — consistent, uncorroborated |
| The six tests behave as described | Verified present and asserting what the description says: performance_reports_the_first_scheduled_model_step, per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer, per_request_metrics_reach_completions_and_responses_where_vllm_places_them, per_request_metrics_are_absent_without_the_option_and_null_for_several_choices (protocol/phase tests, ≈phase_tests.rs:4520-4850), per_request_metrics_follow_vllm_placement_and_null_rules and content_instant_excludes_reasoning_tool_calls_and_suppressed_text (protocol/tests.rs ≈:2350, :2520), the CLI flag test (cli.rs:1374) and the bootstrap test (config.rs:724-740) |
| Only content-instant streams request commit events | Directly asserted: the tests drive a real worker with 3 ms pauses and check commits == stream, pinning instants inside the producing step |
| Option off adds nothing but a position-zero branch | Consistent with code: commits false everywhere, capacity multiplier unchanged (verified, see Key finding 2) |
| No clock read added | True of this PR's hunks; #548's hunks add one monotonic_ns per submitted step |
| Cost figures | Read from code, explicitly unmeasured — which matches AGENTS.md:74-112's requirement to separate expectation from measurement |
| Works with llama-swap / gateways | Not tested at all; and Chat streaming needs include_usage to carry the object |
Reach
- Users: nothing changes on the wire with the flag off (asserted by test). With it on, JSON bodies always carry the object at top level; Chat/Completions streams only with
stream_options.include_usage; Responses streams always; Anthropic Messages never.n > 1yields"metrics": null; multi-prompt Completions omit it. - Operators: one new boolean, off by default, no config-file key. Orbit forwards it to rank zero only when set, so it cannot be saved as permanently off; there is no
--no-enable-per-request-metrics. The WinUI desktop controller reads only configuration settings, so it cannot enable the option — verified:flare/src/configuration.rs'sServerstruct andflare/src/runtime_settings.rshave no such field andflare-winui/bridge/src/lib.rsmaps only existing runtime settings;GroupSpec.rank_zero: Vec<String>is persisted bycontroller.rs:841-879and reloaded at:691. - Compatibility: existing keys (
usage,choices) untouched;metrics.speculative_decodingabsent; vLLM's always-serialise-metrics-even-null convention not followed (no key at all when off). A client reading fields by name sees the same values. - Cost when on for a content-instant stream: one
Committedevent per token-generating step, oneu64store each, one comparison per content event, and the event reservation rising from 2× to 3× generated tokens. Otherwise one small encoder struct and one render. - Docs:
docs/api.md,docs/cli-design.md,helios/model-contract.mdall updated in this diff; nodocs/TODO.txtentry for the known gaps.
Process
- Draft; opened 2026-11-28; last updated the same day; under a day old at review time; no CI checks; no comments; no reviews; no autobot case file.
- Base #548 is a draft with three "Changes Requested" auto-reviews and an unresolved
--features serverbuild break, so #560 cannot merge in its current state by construction. - Author has no merged PRs and no repository association; the charter's priority-contributor list (@voipmonitor, @original-el8, @lukealonso) does not include them.
- Two items in the stack and one sibling are open from the same author (#548, #549, #560 plus issue #551), which makes rebase order against #548 the practical bottleneck for the whole group.
Open questions / not found
- Whether any maintainer wants vLLM-shaped per-request metrics in Flare at all: no maintainer statement exists anywhere in the cluster; the only verdict is the auto-reviewer's "low value / charter" stop on #553.
- Whether the flag clears AGENTS.md:188-193's bar: the requirement is concrete (external gateway) but not a maintainer request; unresolvable from the record.
- Whether the llama-swap motivation survives the
include_usagegate in practice — llama-swap would have to setstream_options.include_usagefor Chat streaming; not tested and not discussed in #560. - Performance impact when enabled: stated as unmeasured by the author, and no measurement exists.
- Whether the WinUI and persistent-Orbit gaps are acceptable long-term or need a follow-up flag/config key; documented as consequences, no plan recorded.
- What changed between #548's head
49373bc5and the copy of #548 carried in this branch: the branch shows #548's files verbatim in the diff, but #548's own head has moved / has open review blockers, so a rebase will change this diff. - No reaction or review data exists to gauge interest beyond the zero counts above.