routing improvements - dynamic (wip)
This commit is contained in:
@@ -231,6 +231,7 @@
|
||||
<section data-tab="overview"><h2>Tracker hive</h2><div id="hive" class="empty">loading…</div></section>
|
||||
<section data-tab="overview"><h2>Nodes & coverage</h2><div id="nodes" class="empty">loading…</div></section>
|
||||
<section data-tab="overview"><h2>Model usage (RPM)</h2><div id="stats" class="empty">loading…</div></section>
|
||||
<section data-tab="overview" class="wide"><h2>Routing (learned)</h2><div id="routing" class="empty">loading…</div></section>
|
||||
<section data-tab="overview" class="wide"><h2>Call wall</h2><div id="call-wall" class="empty">loading...</div></section>
|
||||
<section data-tab="chat" class="wide chat-section">
|
||||
<div class="chat-app">
|
||||
@@ -502,6 +503,42 @@ function callWallMaxQueue(rec) {
|
||||
return nodeQueues.length ? Math.max(...nodeQueues) : 0;
|
||||
}
|
||||
|
||||
function renderRouting(routing) {
|
||||
const el = $("routing");
|
||||
if (!el) return;
|
||||
const models = (routing && routing.models) || {};
|
||||
const entries = Object.entries(models);
|
||||
if (!entries.length) {
|
||||
el.innerHTML = '<div class="empty">no routable models yet</div>';
|
||||
return;
|
||||
}
|
||||
const cfg = (routing && routing.config) || {};
|
||||
let html = `<div class="dim" style="margin-bottom:6px">` +
|
||||
`explore share: <b>${esc(String(cfg.explore_share ?? "?"))}</b> · ` +
|
||||
`traffic ∝ tps^<b>${esc(String(cfg.weight_alpha ?? "?"))}</b> · ` +
|
||||
`half-life: <b>${esc(String(cfg.stats_half_life_seconds ?? "?"))}s</b></div>`;
|
||||
for (const [model, info] of entries) {
|
||||
const routes = info.routes || [];
|
||||
html += `<div style="margin-top:6px"><b>${esc(model)}</b> ` +
|
||||
`<span class="dim">(epoch ${esc(String(info.epoch ?? 0))} · ${routes.length} route${routes.length === 1 ? "" : "s"})</span></div>`;
|
||||
html += table(["route", "tps", "coeff", "share", "samples", "status"], routes.map(r => {
|
||||
const hops = (r.hops || []).map(h => `${short(h.node_id, 12)}[${h.shard}]`).join(" → ");
|
||||
const statusCls = r.status === "proven" ? "ok" : r.status === "stale" ? "warn" : "dim";
|
||||
const coeff = (r.coefficient === null || r.coefficient === undefined)
|
||||
? "—" : Number(r.coefficient).toFixed(2) + "×";
|
||||
return [
|
||||
esc(hops || short(r.signature, 40)),
|
||||
`<span class="num">${esc(r.tps === null || r.tps === undefined ? "—" : tps(r.tps))}</span>`,
|
||||
`<span class="num">${esc(coeff)}</span>`,
|
||||
`<span class="num">${esc(Math.round((r.expected_share || 0) * 100) + "%")}</span>`,
|
||||
`<span class="num">${esc(String(r.samples ?? 0))}</span>`,
|
||||
`<span class="${statusCls}">${esc(r.status || "?")}</span>`,
|
||||
];
|
||||
}));
|
||||
}
|
||||
el.innerHTML = html;
|
||||
}
|
||||
|
||||
function renderCallWall(consoleData, stats) {
|
||||
const events = (consoleData && consoleData.events) || [];
|
||||
const nowSec = Date.now() / 1000;
|
||||
@@ -1448,12 +1485,13 @@ $("call-wall").addEventListener("click", (event) => {
|
||||
|
||||
async function refresh() {
|
||||
$("self-url").textContent = location.host;
|
||||
const [raft, map, stats, models, consoleData, adminData] = await Promise.all([
|
||||
const [raft, map, stats, models, consoleData, routing, adminData] = await Promise.all([
|
||||
fetchJson("/v1/raft/status"),
|
||||
fetchJson("/v1/network/map"),
|
||||
fetchJson("/v1/stats"),
|
||||
fetchJson("/v1/models"),
|
||||
fetchJson("/v1/console"),
|
||||
fetchJson("/v1/routing"),
|
||||
isAdmin ? Promise.all([
|
||||
fetchJson("/v1/billing/summary"),
|
||||
fetchJson("/v1/billing/settlements"),
|
||||
@@ -1474,6 +1512,7 @@ async function refresh() {
|
||||
renderSettlements(settlements);
|
||||
renderFraud(wallets, summary);
|
||||
renderStats(stats);
|
||||
renderRouting(routing);
|
||||
renderCallWall(consoleData, stats);
|
||||
renderConsole(consoleData);
|
||||
renderNodeThroughput(stats);
|
||||
|
||||
Reference in New Issue
Block a user