/* ============================================ SYSTEM HEALTH — Queue gauges + service status ============================================ */ function SystemHealthScreen() { // Gauge values const textQueueDepth = 14; const textQueueMax = 50; const imgQueueDepth = 32; const imgQueueMax = 50; return ( <>

System Health

Real-time worker, queue, and service status · auto-refreshes every 5 s

All systems operational
{/* Service / pipeline status grid */} {[ { name: "Qdrant Vector Store", env: "production", status: "ok", p50: "12 ms", p95: "38 ms", up: "99.99%", ep: "qdrant.bjp.local:6333", err: "—" }, { name: "Embedding Service", env: "managed", status: "ok", p50: "84 ms", p95: "212 ms", up: "99.97%", ep: "emb-api.bjp.cloud", err: "2 d ago" }, { name: "Claude API · Inference", env: "managed", status: "ok", p50: "318 ms", p95: "1.21 s", up: "99.94%", ep: "api.anthropic.com", err: "—" }, { name: "Vision OCR Service", env: "managed", status: "warn", p50: "1.84 s", p95: "4.20 s", up: "98.72%", ep: "vision.openai.com", err: "12 min ago" }, { name: "Document Worker Pool", env: "local", status: "ok", p50: "—", p95: "—", up: "99.91%", ep: "worker-pool-04", err: "—" }, { name: "Redis Queue Broker", env: "production", status: "ok", p50: "1 ms", p95: "4 ms", up: "100.0%", ep: "redis.bjp.local:6379", err: "—" }, { name: "Postgres · Metadata", env: "production", status: "ok", p50: "4 ms", p95: "18 ms", up: "99.98%", ep: "pg.bjp.local:5432", err: "—" }, { name: "Object Store (S3)", env: "managed", status: "ok", p50: "42 ms", p95: "104 ms", up: "99.99%", ep: "s3.ap-southeast-1", err: "—" }, ].map((s, i) => ( ))}
Service Status Latency P50 Latency P95 Uptime 30d Endpoint Last error
{s.name}
{s.env}
{s.status === "ok" && Healthy} {s.status === "warn" && Degraded} {s.status === "down" && Down} {s.p50} {s.p95} {s.up} {s.ep} {s.err}
{/* Worker utilization */} {[ { name: "worker-pool-01 · text", v: 78 }, { name: "worker-pool-02 · text", v: 84 }, { name: "worker-pool-03 · text", v: 62 }, { name: "worker-pool-04 · text", v: 71 }, { name: "worker-img-01 · vision", v: 92 }, { name: "worker-img-02 · vision", v: 88 }, ].map(w => (
{w.name} 85 ? "var(--orange-700)" : "var(--ink-700)", fontWeight: 600 }}>{w.v}%
85 ? undefined : "blue"} />
))}
{/* Recent events */}
{[ ["14:23", "INFO", "ingestion", "Document ING-26-0140 reached 89% (embedding stage)"], ["14:22", "INFO", "query", "Session 6f3a · retrieved 4 chunks · 0.913 max similarity"], ["14:18", "WARN", "vision", "OCR latency p95 exceeded 4s threshold (4.20s)"], ["14:16", "INFO", "ingestion", "ING-26-0141 entered processing — Fanuc-31i-B"], ["14:12", "INFO", "worker", "worker-pool-03 completed batch of 8 chunks"], ["13:58", "ERROR", "vision", "Image decode failure on page 28 — ABB-IRB-6700"], ["13:42", "INFO", "ingestion", "ING-26-0136 completed — Welding Consumables (218 chunks)"], ["13:31", "INFO", "ingestion", "ING-26-0135 completed — Pneumatics FRL (540 chunks)"], ["13:14", "INFO", "queue", "Image queue depth reached 32 / 50"], ["12:48", "INFO", "embed", "Embedding service connection re-established (was: 2 d ago)"], ].map(([t, lv, src, msg], i) => (
{t} {lv} {src} {msg}
))}
); } function QueueGauge({ title, subtitle, depth, max, status, rate, oldest }) { // semi-circular gauge — SVG Y goes down, so we negate sin to draw the top half const pct = Math.min(1, Math.max(0, depth / max)); const r = 100, cx = 130, cy = 130; // Polar angle: π at the left endpoint, 0 at the right. As depth fills, sweep from π toward 0. const polar = (a) => ({ x: cx + r * Math.cos(a), y: cy - r * Math.sin(a) }); const startA = Math.PI; const endA = Math.PI - pct * Math.PI; const p1 = polar(startA); // left endpoint (cx - r, cy) const p2 = polar(endA); // current value endpoint const pEnd = polar(0); // right endpoint (cx + r, cy) // sweep-flag = 0 makes the arc go through the TOP half in SVG's Y-down system const large = pct > 0.5 ? 1 : 0; const statusColor = status === "healthy" ? "var(--status-ok)" : status === "elevated" ? "var(--orange-500)" : "var(--status-danger)"; const statusBadge = status === "healthy" ? "complete" : status === "elevated" ? "pending" : "failed"; return ( {status === "healthy" ? "HEALTHY" : status === "elevated" ? "ELEVATED" : "CRITICAL"}}>
{/* Background arc — full top semicircle (sweep-flag 1 = clockwise in SVG screen coords = top half from left to right) */} {/* Foreground arc — from left endpoint, along top, to current value */} {pct > 0.001 && ( )} {/* Ticks */} {[0, 0.25, 0.5, 0.75, 1].map(t => { const a = Math.PI - t * Math.PI; const inner = { x: cx + (r - 10) * Math.cos(a), y: cy - (r - 10) * Math.sin(a) }; const outer = { x: cx + (r + 8) * Math.cos(a), y: cy - (r + 8) * Math.sin(a) }; return ; })} {/* Center value */} {depth} / {max} items {/* Min/max labels under the arc endpoints */} 0 {max}
Throughput
{rate}
Oldest in queue
{oldest}
Capacity headroom
{Math.round((1 - depth / max) * 100)}%
); } window.SystemHealthScreen = SystemHealthScreen;