v0.35.2
This commit is contained in:
1 parent
09414dfb09
commit
f4606cce18
36 files changed
+641
-74
No files matched your search
@@ -8,10 +8,12 @@ window.rustProxyExtraOverview = (() => {
|
||||
"extra_response_latency", "extra_backend_unhealthy",
|
||||
"extra_total_rps", "extra_active_exchanges", "extra_h1_share", "extra_h3_share",
|
||||
"extra_cache_miss_rate", "extra_backend_active",
|
||||
"extra_backends_healthy", "extra_error_share", "extra_rejected_rate", "extra_cert_expiry",
|
||||
];
|
||||
const bounded = new Set([
|
||||
"extra_process_fds", "extra_cache_memory", "extra_cold_queue_memory", "extra_cold_storage",
|
||||
"extra_h1_share", "extra_h2_share", "extra_h3_share",
|
||||
"extra_backends_healthy", "extra_cert_expiry",
|
||||
]);
|
||||
const histories = new Map(), lastCounter = new Map(), lastValue = new Map();
|
||||
const lastUnits = new Map(), lastSegments = new Map();
|
||||
@@ -98,11 +100,36 @@ window.rustProxyExtraOverview = (() => {
|
||||
unit: "count", detail: ""
|
||||
};
|
||||
}
|
||||
if (id === "extra_backends_healthy") {
|
||||
const members = Array.isArray(status.backend_pools)
|
||||
? status.backend_pools.flatMap(pool => (pool.members || []).map(member => ({ pool: pool.id, ...member }))) : null;
|
||||
if (!members) return { value: null, unit: "count", detail: "" };
|
||||
const monitored = members.filter(member => member.health_check_enabled !== false && member.health_mode !== "off");
|
||||
const down = monitored.filter(member => member.status === "down" || member.healthy === false);
|
||||
const up = monitored.length - down.length;
|
||||
return {
|
||||
value: monitored.length ? `${fmt(up)} / ${fmt(monitored.length)}` : null, unit: "text",
|
||||
meterPercent: monitored.length ? up / monitored.length * 100 : null,
|
||||
detail: !monitored.length ? t("overviewExtraBackendsNone")
|
||||
: down.length ? `${t("overviewExtraBackendsDown")}: ${down.slice(0, 3).map(member => `${member.pool}/${member.id}`).join(", ")}${down.length > 3 ? " …" : ""}`
|
||||
: t("overviewExtraBackendsAllUp"),
|
||||
};
|
||||
}
|
||||
if (id === "extra_cert_expiry") {
|
||||
const inventory = typeof certificateInventory !== "undefined" && certificateInventory instanceof Map ? [...certificateInventory.values()] : [];
|
||||
const dated = inventory.filter(cert => Number.isFinite(Number(cert?.days_remaining)))
|
||||
.sort((a, b) => Number(a.days_remaining) - Number(b.days_remaining));
|
||||
if (!dated.length) return { value: null, unit: "days", detail: t("overviewExtraCertNone") };
|
||||
const nearest = dated[0], days = Number(nearest.days_remaining);
|
||||
const name = (Array.isArray(nearest.covered_hosts) && nearest.covered_hosts[0]) || (Array.isArray(nearest.hosts) && nearest.hosts[0]) || nearest.id;
|
||||
return { value: days, unit: "days", meterPercent: Math.max(0, Math.min(100, days / 90 * 100)), detail: `${name} · ${fmt(dated.length)} ${t("overviewExtraCertCount")}` };
|
||||
}
|
||||
if (id === "extra_cache_memory") return ramBudget(c.resident_bytes, c.hot_limit_bytes);
|
||||
if (id === "extra_cold_queue_memory") return ramBudget(c.cold_queue_bytes, c.cold_queue_limit_bytes);
|
||||
if (id === "extra_cold_storage") return ramBudget(c.cold_bytes, c.cold_limit_bytes);
|
||||
if (!["extra_tls_error_rate", "extra_request_error_rate", "extra_cache_hit_rate", "extra_h2_share",
|
||||
"extra_total_rps", "extra_h1_share", "extra_h3_share", "extra_cache_miss_rate"].includes(id))
|
||||
"extra_total_rps", "extra_h1_share", "extra_h3_share", "extra_cache_miss_rate",
|
||||
"extra_error_share", "extra_rejected_rate"].includes(id))
|
||||
return { value: null, unit: "count", detail: "" };
|
||||
const fields = ({
|
||||
extra_tls_error_rate: [m.tls_handshake_errors],
|
||||
@@ -113,8 +140,10 @@ window.rustProxyExtraOverview = (() => {
|
||||
extra_h3_share: [m.http3_requests, m.requests],
|
||||
extra_total_rps: [m.requests],
|
||||
extra_cache_miss_rate: [c.misses],
|
||||
extra_error_share: [m.errors, m.requests],
|
||||
extra_rejected_rate: [m.rejected_requests, m.rejected_connections],
|
||||
})[id].map(positive);
|
||||
const unit = ["extra_cache_hit_rate", "extra_h2_share", "extra_h1_share", "extra_h3_share"].includes(id)
|
||||
const unit = ["extra_cache_hit_rate", "extra_h2_share", "extra_h1_share", "extra_h3_share", "extra_error_share"].includes(id)
|
||||
? "percent" : "rate";
|
||||
if (fields.some(v => v === null)) {
|
||||
lastCounter.delete(id);
|
||||
@@ -124,6 +153,12 @@ window.rustProxyExtraOverview = (() => {
|
||||
const result = elapsedDelta(id, fields, now);
|
||||
if (!result) return { value: null, unit, detail: "", slices: null };
|
||||
const { deltas, seconds } = result;
|
||||
if (id === "extra_rejected_rate") return {
|
||||
value: (deltas[0] + deltas[1]) / seconds, unit, detail: `${t("overviewExtraRejectedDetail")}: ${fmt(fields[0])} / ${fmt(fields[1])}`
|
||||
};
|
||||
if (id === "extra_error_share") return {
|
||||
value: deltas[1] > 0 ? Math.min(100, deltas[0] / deltas[1] * 100) : 0, unit, detail: `${t("overviewExtraErrorShareDetail")}: ${fmt(deltas[0])} / ${fmt(deltas[1])}`
|
||||
};
|
||||
if (unit === "rate") return { value: deltas[0] / seconds, unit, detail: "" };
|
||||
const sum = id === "extra_cache_hit_rate" ? deltas[0] + deltas[1] : deltas[1];
|
||||
return {
|
||||
@@ -137,6 +172,8 @@ window.rustProxyExtraOverview = (() => {
|
||||
if (unit === "bytes") return fmtBytes(value);
|
||||
if (unit === "ms") return `${fmt(value, 1)} ms`;
|
||||
if (unit === "rate") return `${fmt(value, 1)}/s`;
|
||||
if (unit === "days") return `${fmt(value)} ${t("overviewExtraDaysUnit")}`;
|
||||
if (unit === "text") return String(value);
|
||||
return fmt(value);
|
||||
}
|
||||
function points(id, history, unit) {
|
||||
|
||||
Reference in new issue
Block a user