LB buckets column + health cascade; VPP dump fix; maglevc strictness
SPA (cmd/frontend/web): - New "lb buckets" column backed by a 1s-debounced GetVPPLBState fetch loop with leading+trailing edge coalesce. - Per-frontend health icon (✅/⚠️/❗/‼️/❓) in the Zippy header, gated by a settling flag that suppresses ‼️ until the next lb-state reconciliation after a backend transition or weight change. - In-place leaf merge on lb-state so stable bucket values (e.g. "0") don't retrigger the Flash animation on every refresh. - Zippy cards remember open state in a cookie, default closed on fresh load; fixed-width frontend-title-name + reserved icon slot so headers line up across all cards. - Clock-drift watchdog in sse.ts that forces a fresh EventSource on laptop-wake so the broker emits a resync instead of hanging on a dead half-open socket. Frontend service (cmd/frontend): - maglevClient.lbStateLoop, trigger on backend transitions + vpp-connect, best-effort fetch on refreshAll. - Admin handlers explicitly wake the lb-state loop after lifecycle ops and set-weight (the latter emits no transition event on the maglevd side, so the WatchEvents path wouldn't have caught it). - /favicon.ico served from embedded web/public IPng logo. VPP integration: - internal/vpp/lbstate.go: dumpASesForVIP drops Pfx from the dump request (setting it silently wipes IPv4 replies in the LB plugin) and filters results by prefix on the response side instead, which also demuxes multi-VIP-on-same-port cases correctly. maglevc: - Walk now returns the unconsumed token tail; dispatch and the question listener reject unknown commands with a targeted error instead of dumping the full command tree prefixed with garbage. - On '?', echo the current line (including the '?') before the help list so the output reads like birdc. Checker / prober: - internal/checker: ±10% jitter on NextInterval so probes across restart don't all fire on the same tick. - internal/prober: HTTP User-Agent now carries the build version and project URL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Show, type Component } from "solid-js";
|
||||
import { Show, createMemo, type Component } from "solid-js";
|
||||
import type { BackendSnapshot, PoolBackendSnapshot } from "../types";
|
||||
import StatusBadge from "../components/StatusBadge";
|
||||
import ProbeHeartbeat from "../components/ProbeHeartbeat";
|
||||
import Flash from "../components/Flash";
|
||||
import BackendActionsMenu from "../components/BackendActionsMenu";
|
||||
import { lastTransitionAge } from "../stores/state";
|
||||
import { lastTransitionAge, lbBucketsFor, state as appState } from "../stores/state";
|
||||
import { isAdmin } from "../stores/mode";
|
||||
|
||||
type Props = {
|
||||
@@ -27,6 +27,18 @@ type Props = {
|
||||
|
||||
const BackendRow: Component<Props> = (props) => {
|
||||
const b = () => props.backend;
|
||||
// Subscribed lookup: lbBucketsFor reads from the reactive store, so
|
||||
// the cell re-renders the moment a "lb-state" SSE event mutates the
|
||||
// map. A missing entry (VPP disconnected, backend not yet programmed)
|
||||
// renders as an em-dash; an explicit 0 means "in VPP, drained".
|
||||
// createMemo guarantees Flash only sees a new value when the leaf
|
||||
// actually changed — without it, any spurious upstream re-run (e.g.
|
||||
// a sibling backend's transition triggering recomputeDerivedState)
|
||||
// would pop the bucket cell on every backend in the table.
|
||||
const bucketsLabel = createMemo<number | "—">(() => {
|
||||
const v = lbBucketsFor(appState.byName[props.maglevd], props.frontend, b().name);
|
||||
return v === undefined ? "—" : v;
|
||||
});
|
||||
return (
|
||||
<tr
|
||||
class="backend-row"
|
||||
@@ -50,6 +62,9 @@ const BackendRow: Component<Props> = (props) => {
|
||||
<td class="numeric">
|
||||
<Flash value={props.poolBackend.effective_weight} />
|
||||
</td>
|
||||
<td class="numeric">
|
||||
<Flash value={bucketsLabel()} />
|
||||
</td>
|
||||
<td class="age">{lastTransitionAge(b().last_transition)}</td>
|
||||
<Show when={isAdmin}>
|
||||
<td class="actions">
|
||||
|
||||
@@ -44,7 +44,7 @@ const DebugPanel: Component = () => {
|
||||
});
|
||||
|
||||
return (
|
||||
<Zippy title="Event stream">
|
||||
<Zippy id="debug-events" title="Event stream">
|
||||
<ol class="event-tail" ref={olRef}>
|
||||
<For each={filtered()}>
|
||||
{(ev) => (
|
||||
|
||||
@@ -5,7 +5,7 @@ import StatusBadge from "../components/StatusBadge";
|
||||
import Flash from "../components/Flash";
|
||||
import Zippy from "../components/Zippy";
|
||||
import { isAdmin } from "../stores/mode";
|
||||
import { formatVIPAddress } from "../stores/state";
|
||||
import { formatVIPAddress, frontendHealthIcon } from "../stores/state";
|
||||
|
||||
type Props = {
|
||||
snap: StateSnapshot;
|
||||
@@ -26,8 +26,15 @@ const FrontendCard: Component<Props> = (props) => {
|
||||
const backendByName = () => Object.fromEntries(props.snap.backends.map((b) => [b.name, b]));
|
||||
const fe = () => props.frontend;
|
||||
|
||||
// The icon span has a fixed width so the rest of the title doesn't
|
||||
// jiggle horizontally when the verdict changes (✅ ↔ ⚠️ ↔ ❗ etc.).
|
||||
// The role/aria-label gives the meaning without depending on the
|
||||
// emoji glyph reading well to a screen reader.
|
||||
const title = (
|
||||
<span class="frontend-title">
|
||||
<span class="frontend-title-icon" aria-label="health" role="img">
|
||||
{frontendHealthIcon(props.snap, fe())}
|
||||
</span>
|
||||
<span class="frontend-title-name">{fe().name}</span>
|
||||
<Flash value={fe().state ?? "unknown"}>
|
||||
<StatusBadge state={fe().state ?? "unknown"} />
|
||||
@@ -40,7 +47,7 @@ const FrontendCard: Component<Props> = (props) => {
|
||||
);
|
||||
|
||||
return (
|
||||
<Zippy title={title} open>
|
||||
<Zippy id={`frontend-${props.snap.maglevd.name}-${fe().name}`} title={title}>
|
||||
<table class="backend-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -50,6 +57,7 @@ const FrontendCard: Component<Props> = (props) => {
|
||||
<th class="col-state">state</th>
|
||||
<th class="col-weight numeric">weight</th>
|
||||
<th class="col-effective numeric">effective</th>
|
||||
<th class="col-buckets numeric">lb buckets</th>
|
||||
<th class="col-age">last transition</th>
|
||||
<Show when={isAdmin}>
|
||||
<th class="col-actions actions" />
|
||||
|
||||
@@ -77,7 +77,7 @@ const VPPInfoPanel: Component<Props> = (props) => {
|
||||
);
|
||||
|
||||
return (
|
||||
<Zippy title={title}>
|
||||
<Zippy id={`vpp-${props.name}`} title={title}>
|
||||
<Show when={props.info} fallback={<p class="empty">No VPP information available.</p>}>
|
||||
{(i) => (
|
||||
<dl class="kv">
|
||||
|
||||
Reference in New Issue
Block a user