v0.32.6_fix2
This commit is contained in:
1 parent
e1ac899ec0
commit
fc8711d4d8
39 files changed
+695
-232
No files matched your search
+13
-15
@@ -230,18 +230,17 @@ function renderStatus(s, systemSample = false) {
|
||||
const now = performance.now();
|
||||
const transformed = s.transform_metrics || {};
|
||||
const counters = { total: Number(m.requests) || 0, h1: Number(m.http1_requests) || 0, h2: Number(m.http2_requests) || 0, h3: Number(m.http3_requests) || 0, transform: (Number(transformed.applied) || 0) + (Number(transformed.cache_hits) || 0) };
|
||||
const rates = { total: 0, h1: 0, h2: 0, h3: 0, transform: 0 };
|
||||
if (previous) {
|
||||
const elapsed = Math.max(.001, (now - previous.time) / 1000);
|
||||
for (const key of ["total", "h1", "h2", "h3", "transform"]) if (counters[key] >= previous[key]) rates[key] = (counters[key] - previous[key]) / elapsed;
|
||||
const keys = ["total", "h1", "h2", "h3", "transform"]; const rateSample = rustProxyRateSampling.difference(previous, keys.map(key => counters[key]), now, rustProxyRateSampling.cadence("overview_seconds"));
|
||||
const pausedRate = previous !== null && rateSample.deltas === null; previous = rateSample.next;
|
||||
const rates = Object.fromEntries(keys.map((key, i) => [key, rateSample.deltas ? rateSample.deltas[i] / rateSample.seconds : 0]));
|
||||
if (!pausedRate) {
|
||||
samples.push(rates.total); samples = samples.slice(-30);
|
||||
for (const key of ["h1", "h2", "h3"]) { protocolSamples[key].push(rates[key]); protocolSamples[key] = protocolSamples[key].slice(-30); }
|
||||
}
|
||||
previous = { time: now, ...counters };
|
||||
samples.push(rates.total); samples = samples.slice(-30);
|
||||
for (const key of ["h1", "h2", "h3"]) { protocolSamples[key].push(rates[key]); protocolSamples[key] = protocolSamples[key].slice(-30); }
|
||||
websocketProtocolSamples.h1.push(Number(m.websocket_h1_active) || 0); websocketProtocolSamples.h1 = websocketProtocolSamples.h1.slice(-30);
|
||||
websocketProtocolSamples.h2.push(Number(m.websocket_h2_active) || 0); websocketProtocolSamples.h2 = websocketProtocolSamples.h2.slice(-30);
|
||||
websocketProtocolSamples.h3.push(Number(m.websocket_h3_active) || 0); websocketProtocolSamples.h3 = websocketProtocolSamples.h3.slice(-30);
|
||||
transformSamples.push(rates.transform); transformSamples = transformSamples.slice(-30);
|
||||
if (!pausedRate) { transformSamples.push(rates.transform); transformSamples = transformSamples.slice(-30); }
|
||||
const peak = Math.max(1, ...samples, ...transformSamples);
|
||||
const points = values => values.map((n, i) => `${i * 600 / Math.max(1, values.length - 1)},${120 - n / peak * 105}`).join(" ");
|
||||
$("sparkline").setAttribute("points", points(samples));
|
||||
@@ -249,12 +248,11 @@ function renderStatus(s, systemSample = false) {
|
||||
$("sparkline-h2").setAttribute("points", points(protocolSamples.h2));
|
||||
$("sparkline-h3").setAttribute("points", points(protocolSamples.h3));
|
||||
$("sparkline-transform").setAttribute("points", points(transformSamples));
|
||||
$("request-rate").textContent = `${rates.total.toFixed(1)} req/s`;
|
||||
$("rate-total").textContent = `${rates.total.toFixed(1)}/s`; $("rate-h1").textContent = `${rates.h1.toFixed(1)}/s`; $("rate-h2").textContent = `${rates.h2.toFixed(1)}/s`; $("rate-h3").textContent = `${rates.h3.toFixed(1)}/s`; $("rate-transform").textContent = `${rates.transform.toFixed(1)}/s`;
|
||||
$("metric-http-proto-total").textContent = `${rates.total.toFixed(1)}/s`;
|
||||
$("metric-http-proto-h1").textContent = `${rates.h1.toFixed(1)}/s`;
|
||||
$("metric-http-proto-h2").textContent = `${rates.h2.toFixed(1)}/s`;
|
||||
$("metric-http-proto-h3").textContent = `${rates.h3.toFixed(1)}/s`;
|
||||
const rateText = key => pausedRate ? "-" : `${rates[key].toFixed(1)}/s`;
|
||||
$("request-rate").textContent = pausedRate ? "- req/s" : `${rates.total.toFixed(1)} req/s`;
|
||||
$("rate-total").textContent = rateText("total"); $("rate-h1").textContent = rateText("h1"); $("rate-h2").textContent = rateText("h2"); $("rate-h3").textContent = rateText("h3"); $("rate-transform").textContent = rateText("transform");
|
||||
$("metric-http-proto-total").textContent = rateText("total"); $("metric-http-proto-h1").textContent = rateText("h1");
|
||||
$("metric-http-proto-h2").textContent = rateText("h2"); $("metric-http-proto-h3").textContent = rateText("h3");
|
||||
$("http-protocol-h1").setAttribute("points", sparklinePoints(protocolSamples.h1, 300, 60, 5));
|
||||
$("http-protocol-h2").setAttribute("points", sparklinePoints(protocolSamples.h2, 300, 60, 5));
|
||||
$("http-protocol-h3").setAttribute("points", sparklinePoints(protocolSamples.h3, 300, 60, 5));
|
||||
@@ -302,7 +300,7 @@ function stopLive() {
|
||||
}
|
||||
function startLive() {
|
||||
if (!authenticated || document.hidden || typeof EventSource === "undefined") return;
|
||||
const seconds = window.rustProxyRefresh?.current().overview_seconds || 2;
|
||||
const seconds = window.rustProxyRefresh?.current().overview_seconds || 3;
|
||||
if (liveEvents && liveInterval === seconds) return;
|
||||
stopLive();
|
||||
liveInterval = seconds;
|
||||
|
||||
Reference in new issue
Block a user