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
+9 -2
View File
@@ -66,7 +66,7 @@ def _map_docker(exc: DockerError):
raise HTTPException(status_code=code, detail=exc.detail or exc.error)
raise exc # falls through to the global 502 DockerError handler
AGENT_VERSION = "0.31.0"
AGENT_VERSION = "0.31.1"
# --------------------------------------------------------------------------- #
@@ -210,7 +210,7 @@ def _disk_info() -> tuple[int, int]:
def _system_info() -> dict:
docker_version = ""
host_os = ""
running = total = 0
running = total = compose_running = 0
try:
client = get_client()
docker_version = safe_call(client.version).get("Version", "")
@@ -218,6 +218,12 @@ def _system_info() -> dict:
host_os = info.get("OperatingSystem", "")
running = info.get("ContainersRunning", 0)
total = info.get("Containers", 0)
# Running compose-managed containers — the dashboard's container card
# compares this across hosts; counting everything would include this
# agent itself and skew the bars.
compose_running = len(
safe_call(client.api.containers, filters={"label": compose_service.COMPOSE_LABEL})
)
except DockerError as exc:
docker_version = f"unavailable ({exc.error})"
mem_total, mem_used = _mem_info()
@@ -233,6 +239,7 @@ def _system_info() -> dict:
"disk_used": disk_used,
"containers_running": running,
"containers_total": total,
"compose_running": compose_running,
}