0.31.1: make dashboard metrics honest

- Container card now compares compose-only counts across hosts: agents
  report compose_running in /agent/system (pre-0.31.1 agents fall back to
  the all-containers number); card retitled, ResourceBar stat labelled
  'Containers (all)'.
- Uptime is sampled every 5 min (background loop + opportunistic on read)
  and charted as daily averages instead of a once-a-day snapshot; no
  sample is written when no compose containers exist (was: fake 100%).
  Legacy daily entries in uptime.jsonl still count; file pruned at startup.
- Funnel stage 'monitored' is now per-stack and real: stacks with an
  enabled local auto-update policy (was: global webhook-exists toggle).
  Frontend label renamed to 'Auto-managed'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
menzelj
2026-06-12 08:13:16 +00:00
co-authored by Claude Fable 5
parent 1609b8bcc3
commit 11effdc2ca
7 changed files with 127 additions and 41 deletions
+12 -5
View File
@@ -207,7 +207,7 @@ const FUNNEL_STAGES = [
{ key: "running", label: "Running" },
{ key: "healthy", label: "Healthy" },
{ key: "updated", label: "Up to date" },
{ key: "monitored", label: "Monitored" },
{ key: "monitored", label: "Auto-managed" },
] as const;
function StackHealthCard({
@@ -302,14 +302,19 @@ function ContainerCountCard({
const hosts: { name: string; count: number }[] = [
{ name: "local", count: localRunning ?? 0 },
...online.map((a, i) => ({ name: a.name, count: remote[i].data?.containers_running ?? 0 })),
// compose_running keeps the bars comparable with the local compose-only
// count; pre-0.31.1 agents only report the all-containers number.
...online.map((a, i) => ({
name: a.name,
count: remote[i].data?.compose_running ?? remote[i].data?.containers_running ?? 0,
})),
];
const total = hosts.reduce((s, h) => s + h.count, 0);
const max = Math.max(...hosts.map((h) => h.count), 1);
return (
<div className="sp-card sp-rise flex flex-col p-5 sm:p-6" style={{ animationDelay: "60ms" }}>
<h2 className="sp-label">Containers running</h2>
<h2 className="sp-label">Compose containers running</h2>
{loading ? (
<div className="mt-3 space-y-3">
<div className="sp-skeleton h-14 w-28" />
@@ -379,7 +384,9 @@ function UptimeCard({
<UptimeChart data={values} />
)}
</div>
<p className="mt-2 text-xs text-sp-text-3">Daily share of compose containers running, this host.</p>
<p className="mt-2 text-xs text-sp-text-3">
Share of compose containers running on this host, sampled every 5 min (daily average).
</p>
</div>
);
}
@@ -552,7 +559,7 @@ function ResourceBar({
/>
<Stat
icon={<Container className="h-5 w-5" />}
label="Containers"
label="Containers (all)"
value={`${containersRunning} / ${containersTotal}`}
/>
<Stat icon={<Server className="h-5 w-5" />} label="Docker" value={dockerVersion || "—"} />