Keep missing health telemetry non-green

Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-09-01 01:03:53 +01:00
parent c253495045
commit 8cd65a3f24
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -89,6 +89,13 @@ func EvaluateResourceHealth(resource Resource, alerts []ResourceHealthAlert, now
switch strings.ToLower(strings.TrimSpace(string(resource.Status))) {
case "online", "running", "ready", "healthy", "available", "active", "up":
// A positive provider status without an observation timestamp is not
// enough to prove current health. Some compatibility and synthetic
// producers do not populate SourceStatus, so keep this guard at the
// canonical verdict boundary rather than relying on that map alone.
if resource.LastSeen.IsZero() {
return healthWithReason(HealthUnknown, "telemetry_missing", "")
}
return ResourceHealth{Verdict: HealthOK, Reasons: []ResourceHealthReason{}}
case "warning", "degraded", "unhealthy", "pending":
return healthWithReason(HealthAttention, "degraded", "")
+5
View File
@@ -59,6 +59,11 @@ func TestEvaluateResourceHealthPrecedenceAndVerdicts(t *testing.T) {
resource: Resource{ID: "host-3", Type: ResourceTypeAgent, Status: StatusOnline, LastSeen: now},
want: HealthOK,
},
{
name: "positive status without telemetry cannot be healthy",
resource: Resource{ID: "host-missing", Type: ResourceTypeAgent, Status: StatusOnline},
want: HealthUnknown, code: "telemetry_missing",
},
{
name: "informational alert does not invent attention",
resource: Resource{ID: "host-info", Type: ResourceTypeAgent, Status: StatusOnline, LastSeen: now},