0.34.11
This commit is contained in:
1 parent
63cdecea6c
commit
37c197c095
17 files changed
+96
-35
No files matched your search
@@ -1,5 +1,5 @@
|
||||
// Stable plot ranges: percentages are absolute 0-100; unbounded metrics have
|
||||
// unit-appropriate zero-based floors, expanding only for real higher readings.
|
||||
// Overview charts retain stable, expanding ranges (and fixed 0-100% axes).
|
||||
// Vhost request-rate sparklines use a separate, adaptive plotting policy.
|
||||
window.rustProxyChartScale = (() => {
|
||||
const floors = { rate: 100, count: 10, ms: 100, bytes: 64 * 1024 * 1024, "bytes/s": 64 * 1024 };
|
||||
const ceilings = new Map();
|
||||
@@ -17,8 +17,28 @@ window.rustProxyChartScale = (() => {
|
||||
ceilings.set(key, result);
|
||||
return result;
|
||||
}
|
||||
// Vhost live charts show the entire session history, but their Y range
|
||||
// follows the recent typical rate. A one-off surge must not flatten the
|
||||
// subsequent request activity; the real (unclipped) peak stays in the legend.
|
||||
// The recent quantile also prevents a range that only grows over time.
|
||||
function liveRate(values) {
|
||||
const samples = (Array.isArray(values) ? values : []).map(value =>
|
||||
typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0);
|
||||
const maximum = Math.max(0, ...samples);
|
||||
const recent = samples.slice(-24).sort((a, b) => a - b);
|
||||
// Interpolation would allow a single extreme point to dominate small
|
||||
// histories. Nearest lower rank excludes that isolated maximum.
|
||||
const typical = recent.length ? recent[Math.floor((recent.length - 1) * 0.85)] : 0;
|
||||
const scale = Math.max(1, typical * 1.25);
|
||||
const points = samples.map((value, index) => {
|
||||
const x = index * 320 / Math.max(1, samples.length - 1);
|
||||
const y = 50 - Math.min(value / scale, 1) * 44;
|
||||
return `${x},${y}`;
|
||||
}).join(" ");
|
||||
return { points, peak: maximum, scale, clipped: maximum > scale };
|
||||
}
|
||||
function reset(prefix) {
|
||||
for (const key of ceilings.keys()) if (key.startsWith(prefix)) ceilings.delete(key);
|
||||
}
|
||||
return { peak, reset };
|
||||
return { peak, liveRate, reset };
|
||||
})();
|
||||
Reference in new issue
Block a user