Archived
dashboard: a session extreme says how old it is, and a restart clears it
The tile detail lines keep the session's best figure when the window empties, which is deliberate: a lane that goes quiet for a minute is the same lane, and blanking its best would throw away the one figure still true. But an extreme with no window beside it is indistinguishable from a fresh one, so a best from before a gap -- or from before an engine restart -- reads as the lane's current best. A review flagged the label as honest but undated; the age is what makes it honest. Record when each extreme was set and, when it stands alone and is at least a second old, name the span: "best 500 t/s - 5m 00s ago". Below a second the clause is noise, and a figure set on this poll is current, so it stays silent. A restart is a different discontinuity from a quiet minute and now gets its own path. The previous process's requests are gone and its configuration may differ, so nothing from it should carry over -- yet the extremes were the one figure that did, while every other number on the page already refuses to pool across a restart: the acceptance window drops its rings when the counters go backwards, and the history resets its base when request ids restart. The poll now compares started_at, which is the process's identity, and clears the extremes when it changes. A gap still keeps them. Verified: dashboard_test 241 checks over 8 cases, no failures. 18 checks execute the shipped noteSample, triple, acceptTriple, resetWindows and newEngineRun sliced out of the page: the clause appears only when the extreme stands alone, tracks the newest extreme rather than the first, stays silent under a second, survives a gap with its age, and is gone after a restart along with the extreme itself. Not tested: the page in a real browser. Found by an independent review pass on the previous changeset. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
1 parent
4e35a00493
commit
72ab60ed64
1 file changed
+38
-5
@@ -1696,8 +1696,18 @@ function setMetric(key, value, text) {
|
||||
* of diluting it; the engine's prefill rate is itself already windowed. */
|
||||
const RECENT_S = 15; /* the `recent` window in seconds, for a figure sampled every poll */
|
||||
const RECENT_PREFILL_S = 5; /* prefill's is shorter, so a several-second prefill shows up in it */
|
||||
const extAt = {}, winAt = {};
|
||||
let lastActiveC = 0;
|
||||
const extAt = {}, winAt = {}, extAtS = {}; /* extAtS: the poll at which each extreme was set */
|
||||
let lastActiveC = 0, lastStart = null;
|
||||
/* A new engine process is a different discontinuity from a quiet minute: the previous run's
|
||||
* requests are gone and its configuration may differ, so nothing from it carries over. Every
|
||||
* other figure already refuses to pool across a restart -- accWindow drops its rings, histIngest
|
||||
* resets its base -- and the session extremes are no different, since a best from a run that no
|
||||
* longer exists is not this lane's best. */
|
||||
function newEngineRun() {
|
||||
resetWindows();
|
||||
for (const k in extAt) delete extAt[k];
|
||||
for (const k in extAtS) delete extAtS[k];
|
||||
}
|
||||
/* Whether the server streams its KV (--kv-resident). Settled at bringup, so it cannot change under
|
||||
* a running page: the cells that name a memory tier read it instead of guessing. */
|
||||
let kvStreamOn = false;
|
||||
@@ -1706,7 +1716,12 @@ let kvStreamOn = false;
|
||||
function noteSample(key, c, value, capS, win) {
|
||||
if (value == null || !finite(value)) return;
|
||||
const e = extAt[key] || (extAt[key] = {});
|
||||
if (!(c in e) || value > e[c]) e[c] = value;
|
||||
if (!(c in e) || value > e[c]) {
|
||||
e[c] = value;
|
||||
/* When the extreme was set, so a figure that outlives its window can say how old it is. */
|
||||
const t = extAtS[key] || (extAtS[key] = {});
|
||||
t[c] = nowS;
|
||||
}
|
||||
if (win === false) return;
|
||||
const w = winAt[key] || (winAt[key] = {});
|
||||
const s = w[c] || (w[c] = []);
|
||||
@@ -1726,7 +1741,16 @@ function triple(key, c, label, fmt, showNow) {
|
||||
const s = (winAt[key] || {})[c];
|
||||
const tag = typeof c === "number" && c > 1 ? "@c" + c : "";
|
||||
let out = label + " " + fmt(e[c]);
|
||||
if (!s || !s.length) return out;
|
||||
if (!s || !s.length) {
|
||||
/* The extreme outlives the window by design, so the age is what makes it honest: without it a
|
||||
* figure from before a gap -- or from before an engine restart, which the page treats as a
|
||||
* discontinuity everywhere else -- reads as the lane's current best. */
|
||||
const t = (extAtS[key] || {})[c];
|
||||
/* Only once it is actually stale: an extreme set on this poll is current, and "0 ms ago"
|
||||
* would be noise. A second is the resolution dur() itself reports below. */
|
||||
if (typeof t === "number" && nowS - t >= 1) out += " \u00b7 " + dur(nowS - t) + " ago";
|
||||
return out;
|
||||
}
|
||||
let sum = 0;
|
||||
for (const p of s) sum += p.v;
|
||||
const recent = sum / s.length;
|
||||
@@ -1745,7 +1769,11 @@ function acceptTriple(c, showNow) {
|
||||
if (!e || !(c in e)) return "";
|
||||
const tag = typeof c === "number" && c > 1 ? "@c" + c : "";
|
||||
let out = "highest " + pct(e[c], 0);
|
||||
if (!ring || !ring.length) return out;
|
||||
if (!ring || !ring.length) {
|
||||
const t = (extAtS["accept"] || {})[c];
|
||||
if (typeof t === "number" && nowS - t >= 1) out += " \u00b7 " + dur(nowS - t) + " ago";
|
||||
return out;
|
||||
}
|
||||
let R = 0, A = 0;
|
||||
for (const d of ring) { R += d.dr; A += d.da; }
|
||||
if (R <= 0) return out;
|
||||
@@ -3849,6 +3877,11 @@ async function poll() {
|
||||
const r = await api("stats");
|
||||
if (!r.ok) throw new Error(r.status);
|
||||
const s = await r.json();
|
||||
/* A new engine process: started_at is its identity, so a change is a discontinuity rather
|
||||
* than a new measurement. Checked before update() so the new run's samples land in fresh
|
||||
* windows. */
|
||||
if (lastStart !== null && s.started_at !== lastStart) newEngineRun();
|
||||
lastStart = s.started_at;
|
||||
const now = performance.now();
|
||||
update(s, prevAt ? (now - prevAt) / 1000 : 0);
|
||||
prev = s; prevAt = now;
|
||||
|
||||
Reference in new issue
Block a user