2.5 KiB
2.5 KiB
In-Flight Monitor — Count + Activity Spark
Date: 2026-08-14 Status: Approved (design)
Summary
Enhance the In-Flight Monitor action so its key shows the number of in-flight requests for the configured model plus a count-trend spark: a tiny line/area chart of that count over the last ~60s, so activity is visible even during a single long-running request.
Layout (72×72 SVG, rendered via renderInflight)
- Top: model short name (small, white) — existing.
- Center: the status. When
ready:- count > 0 → the count number, large/bold (e.g.
3), on the redACTIVEbackground, with the existing pulse. - count === 0 →
IDLEon green — existing. loading→LOADING,stopped→OFF, offline →OFFLINE, unconfigured →NO MODEL, unknown →…— all unchanged.
- count > 0 → the count number, large/bold (e.g.
- Bottom strip (~14px): the count-trend spark — a small polyline + faint area fill of the model's in-flight count over the last 60 samples, in the state color. Flat at the baseline when idle; spikes when requests come and go.
Data Flow
- The feed side is unchanged —
InflightTrackeralready exposes exact per-model counts. - Each key's per-key state (in
inflight-monitor.ts, keyed byev.action.id) gains:history: number[]— a 60-sample ring buffer of the live count.sampler?: ReturnType<typeof setInterval>— a 1s interval that pushesruntime.tracker.count(modelId)intohistoryand re-renders. Started inonWillAppear, cleared inonWillDisappear.
- Live feed events (
add/remove/snapshot) still re-render the big number immediately via the existing subscription; the spark refreshes at 1Hz. renderInflightgains an optionalhistory?: number[]field. Spark scale: yMax =max(max(history), 1)so a zero line sits at the baseline.
Files
src/lib/render.ts—renderInflightacceptshistoryand draws the spark; center label shows the count when active.src/actions/inflight-monitor.ts— per-keyhistoryring buffer + 1s sampler.tests/render.test.ts— new/updated assertions for count rendering and the spark.
Error Handling / Edge Cases
- Spark with <2 samples renders no line (like the GPU chart).
- Sampler cleared on
onWillDisappear(no leaks); multi-key safety preserved (buffer + sampler live in the per-key map entry). - History capped at 60 samples.
Out of Scope
- No change to the GPU Graph action, the feed, or the tracker.
- No throughput-bar variant (count trend was chosen).