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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user