From e737704e68dfdc94d2b5fb158538a01746f6b7e9 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Mon, 23 Feb 2026 15:05:39 +0100 Subject: [PATCH] fix: skip stopped apps in telemetry to avoid zero-value averages on hub Deployed-but-stopped apps were included in telemetry reports with all-zero memory/CPU values, dragging down hub-side averages. Now isStackRunning() filters to only running/starting/unhealthy/restarting states. Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 5 +++++ controller/internal/report/telemetry.go | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a95bfee..5b5f32a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Changelog +### v0.28.4 — Telemetry: Skip Stopped Apps (2026-02-23) + +#### Fixed +- **Stopped apps no longer send zero-value telemetry to hub** (`report/telemetry.go`) — Previously, deployed-but-stopped apps were included in the telemetry report with all-zero memory/CPU values, which dragged down hub-side averages. Now `buildAppTelemetry` checks `isStackRunning()` and only includes apps in running, starting, unhealthy, or restarting states. + ### v0.28.3 — Catch-All Page, Deploy Controls, Dashboard Open (2026-02-23) #### Added diff --git a/controller/internal/report/telemetry.go b/controller/internal/report/telemetry.go index 30f4b5c..04498d5 100644 --- a/controller/internal/report/telemetry.go +++ b/controller/internal/report/telemetry.go @@ -27,7 +27,7 @@ func buildAppTelemetrySection(stackMgr *stacks.Manager, metricsStore *metrics.Me // 2. Collect non-protected container names for log scan var containerNames []string for _, s := range allStacks { - if s.Protected || !s.Deployed { + if s.Protected || !s.Deployed || !isStackRunning(s.State) { continue } for _, c := range s.Containers { @@ -58,7 +58,7 @@ func buildAppTelemetry(allStacks []stacks.Stack, telemetry []metrics.ContainerTe var result []AppTelemetry for _, s := range allStacks { - if s.Protected || !s.Deployed { + if s.Protected || !s.Deployed || !isStackRunning(s.State) { continue } @@ -118,6 +118,18 @@ func buildAppTelemetry(allStacks []stacks.Stack, telemetry []metrics.ContainerTe return result } +// isStackRunning returns true if the stack has containers actively running +// (running, starting, or unhealthy but still up). Stopped, exited, deploying +// etc. are excluded to avoid sending zero-value telemetry to the hub. +func isStackRunning(state stacks.ContainerState) bool { + switch state { + case stacks.StateRunning, stacks.StateStarting, stacks.StateUnhealthy, stacks.StateRestarting: + return true + default: + return false + } +} + // BuildAppTelemetryForDebug runs the full telemetry collection pipeline // (metrics query + log scan) and returns per-app telemetry data. // Used by the debug endpoint to preview telemetry without pushing to hub.