Verdict: worth merging, with changes
The capability is real, the placement is right in one important respect, and the change is additive and behaviour-neutral. It should not be merged as-is, because it needs a maintainer decision it has not been given and because it leaves two histogram implementations and a third copy of Linux process-introspection code in the tree.
1. Does it fit the charter?
Mostly yes, on the grounds the charter actually lists.
- The charter's "What gets merged" admits "a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs." This PR is none of the five literally. #536 is a third-party feature request ("monitoring parity with vLLM"), and the PR author (Wynn Drahorad /
oystersmiles, pergit logebecef13) is not one of the three named priority contributors. Under the charter andAGENTS.md:165-169("Hypothetical future consumers … do not establish a need"), this needs the maintainer to either accept #536 as the authorization or say so on the PR. That is the one gating condition. It is not a reason to reject: the request is concrete, from a real user, on the shippedv0.3.2metrics surface, and specific enough to be a spec. - It is not scope expansion. The project already ships
/metrics(helios/src/server.rs:634-718), four Prometheus histograms (metrics.rs:1029-1065,:851-876), a TUI dashboard,/v1/workertelemetry, and the persistent-worker metrics added in #507.docs/operating.md:47already presentsflare_host_cache_retirement_secondsas "the latency histogram" for the operator. Observability is an established, actively maintained area, so the second half of #536 (process metrics) is not "new production-server surface" so much as closing an obvious hole beside existing series. - It serves the charter's evidence culture. "Bring real evidence" and "measured performance/memory issue" are core to this project; per-phase histograms (queue, prefill, decode, tpot, prompt tokens) are the instrumentation that makes a latency regression visible in the first place. Trend detection has to be scrapeable to be usable across a session.
- It is not a non-goal. No new backend, no model branch, no flag, nothing model-specific. It stays in the shared HTTP/runtime layer, which is the right layer.
- The JSON snapshot is unchanged and histograms are Prometheus-only (
docs/api.md:296,:320-336), soSnapshot/dashboard consumers and #549's gauges are untouched. The PR states it merges with #537 in either order, and by diff inspection that is true: #549 editscached_pages-adjacent regions and the gauge list, this one edits the completion counter and the histogram block.
2. Who benefits, and how much
- Operator on a workstation or DGX Spark: gets P95/P99 tail latency, queue delay, prefill, decode, tpot and prompt-size distributions from one scrape. Today the only latency signal is
flare_first_response_median_seconds(server.rs:667-670), a 60-second median that cannot answer any of those questions — #536 is right about that. Real, moderate benefit. - Project maintainers doing performance work: prefill/decode split per request is exactly the kind of measurement their own perf workflow wants. Real benefit, arguably the larger one.
- Generic Prometheus process dashboards:
process_*series now exist, so off-the-shelf Grafana/Docker dashboards stop being blank. Cheap parity. - Nobody is worse off. No serving-code path changes; the recording site is the function that already incremented
flare_requests_completed_total, so counter and histograms cannot diverge (runtime.rs:1841,:1993;metrics.rs:452-482). That is the correct instinct and the main design strength of the PR.
3. Cost in complexity, maintenance, performance, risk
- Size: +~560 lines over 8 files —
metrics.rs+228, newmetrics/process.rs+184,runtime.rs+38,latency.rs+27, plus tests and docs. Proportionate to a monitoring feature, but see the duplication below. - Performance: negligible where it matters.
observeis one relaxedfetch_addper bucket plus one for the sum, on the worker thread, once per completed request (metrics.rs:259-270). The scrape-time cost is the concern:process.rs:52-120re-reads/proc/self/stat, the whole of/proc/stat(forbtime), andread_dir("/proc/self/fd")on every scrape.btimeand the clock/page constants are invariant for the process lifetime; re-reading/proc/statper scrape is waste that aOnceLockfixes in three lines. - Risk: low on the runtime side; the arithmetic I checked is correct.
parse_statindexing is right (utime/stime/starttime/vsize/rss = tokens 11/12/19/20/21 after the last)), the last-)split handles a parenthesised command containing), and the test atprocess.rs:150-157pins it. Cumulative bucket rendering is correct for Prometheuslesemantics becauseobserveincrements exactly one bucket. Missing/unparseable sources omit only their own metrics and never fail a scrape, which is the right failure mode. - Risk that is not addressed: the Windows build was not run.
process.rsiscfg(target_os = "linux")-gated with alet _ = text;fallback, andlibcis already a plain (non-target-gated) dependency athelios/Cargo.toml:50, so I expect it to build — but Windows is a supported serving platform (docs/windows.md(not opened),flare-winui/), and a new cfg-split file is exactly what a Windows CI leg is for. Either run it or say CI covers it, as the description already does for the full helios suite.
4. Simpler way, and what it duplicates
Three things should change before merge.
(a) process.rs is the third copy of Linux process introspection, in the wrong crate.
eos/src/unix.rs:135-160(not opened) already raisesRLIMIT_NOFILEviagetrlimit/setrlimit;heliopause/src/export/transfer.rs:57-61(not opened) already doesgetrlimit(RLIMIT_NOFILE, …)andread_dir("/proc/self/fd")counting. That is the same two operations this PR adds a third time.AGENTS.md:20-21says explicitly thateos/"holds the host operating-system operations that Helios and Selene use."/procparsing andrlimitreads belong there, withprocess.rsreduced to formatting. This is the charter's "smallest footprint in shared code" applied literally, and it also gives the next consumer a tested home.- Reusing a Prometheus client crate instead is not the right simplification: the repo hand-renders exposition everywhere and pins dependencies exactly; a new dependency for this would be the larger sin. Hand-rolling stays.
(b) The PR adds a second histogram implementation instead of replacing the first.
metrics.rs already has HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS (:200-210) with their own render loop (:1029-1065), plus flare_host_cache_retirement_seconds rendered by yet another hand-written block (:851-876). The new Buckets/Histogram (:212-298) is strictly better. Porting the four existing histograms onto it and deleting the old constants and loop would make this PR net smaller in duplicated code and leave one histogram path in the file. Shipping both is the churn AGENTS.md:188-193 warns about, and it guarantees the next histogram author copies the wrong one.
(c) Metric semantics need one more sentence, because two series will be read as something they are not.
flare_request_decode_secondsandflare_time_per_output_token_secondsare computed first-to-last committed token (metrics.rs:473-479). For a request that is preempted, parked and readmitted, that span includes the parked interval, so tpot is inflated by preemption time with no way to tell. The help strings say "first to last committed generated token", which is true but not what an operator computes tpot for. Either subtract parked time or state the inclusion indocs/api.md:308-311.- The preempted request's second queue wait is counted nowhere:
first_scheduled_nsusesget_or_insert(runtime.rs:2196-2204) and queue time is measured once from original arrival. Worth stating, since the PR goes to trouble to preserve the stamps across parking. flare_request_e2e_secondsandflare_time_to_first_response_secondsare observed only when the client polls the body (http.rs:614-617,:632,:638);docs/api.md:300-304says this for TTFR but the e2e sentence reads as if every success is counted. It undercounts abandoned streams — defensible, but say so.process_open_fdscounts the descriptor opened by theread_diritself (process.rs:65-70). The help text admits it; convention (and any dashboard comparing against a client-library exporter) expects no self-count. Subtract one.
5. Evidence quality
Good and unusually honest for the repo's standards: the four-part structure is present, the reasoning for recording inside the completion function is stated causally, tests hit the excluded cases (preempted request counted once; failed stream leaves e2e at 0; count_tokens excluded), and the live scrape on the two-GPU DeepSeek-V4.1-Flash setup discloses that its deltas include the agent's own session traffic and explains the le="64"/le="2048" bucket split that separates them. Not run items (Windows build, full helios suite, one template test needing FLARE_TEST_TEMPLATE_DIR) are named rather than hidden. This meets AGENTS.md:72-112. Note for the record: the cherry-pick onto the AzallazA fork commit 5ffe4d54 means the live scrape was not taken on main + this PR; the description says so, which is the correct disclosure, but it is a reason the merge still needs a main CI run rather than trusting the scrape.
Nothing in this PR or its discussion tried to direct me. The only non-technical comment is the automated case-file notice (flare-autobot, "A case file has been opened for 548"). The PR text is a reviewable argument, and I treated it as such.
What to ask for
- Maintainer sign-off that #536 authorizes this work (charter "What gets merged").
- Move the
/procandRLIMIT_NOFILEreads intoeos/and reuseeos/src/unix.rs:135-160(not opened) andheliopause/src/export/transfer.rs:57-61(not opened) instead of adding a third copy. - Port
HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS(metrics.rs:200-210,:1029-1065) andflare_host_cache_retirement_seconds(:851-876) ontoBuckets/Histogramand delete the old paths, sometrics.rskeeps one histogram implementation. - Cache the invariant
btime/_SC_CLK_TCK/_SC_PAGESIZEreads; subtract theread_dirdescriptor fromprocess_open_fds. - Document the preemption inclusions in decode/tpot and the read-time bias of e2e, or correct the preemption arithmetic.
- A green CI run on
main, including the Windows leg.
With those, this is a small, well-placed, evidence-backed increment to an observability surface the project already maintains and already cites in its operating docs — worth merging.