Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep unknown linked-agent observation times explicitly last-known

pulse-triage[bot]80d8ad0f59aa
diff --git a/internal/unifiedresources/metrics_test.go b/internal/unifiedresources/metrics_test.go
index eb15796b2a..0e5616d115 100644
--- a/internal/unifiedresources/metrics_test.go
+++ b/internal/unifiedresources/metrics_test.go
@@ -575,7 +575,3 @@ func TestGuestMemoryMetricObservationFollowsSelectedSource(t *testing.T) {
t.Fatalf("cross-source selection lost agent receipt or trusts supplied provenance: %+v", merged.Memory)
}
}
-
-// Proxmox guest adapters must publish the node-independent identity key so
-// canonical ID derivation survives live migration (#1669); guests without an
-// instance+VMID stay keyless and fall back to source-specific derivation.
diff --git a/internal/unifiedresources/views.go b/internal/unifiedresources/views.go
index 2a7c0ed9ba..4219d0469e 100644
--- a/internal/unifiedresources/views.go
+++ b/internal/unifiedresources/views.go
@@ -101,6 +101,10 @@ func linkedAgentMemoryFromResource(r *Resource) (models.Memory, bool) {
// Guest-row LastSeen can be renewed by PVE alone. The surviving agent
// sample keeps the agent source's timestamp after host/guest correlation.
memory.Observation = models.MemoryObservation{State: "current", Source: "agent", ObservedAt: status.LastSeen}
+ if status.LastSeen.IsZero() || status.LastSeen.After(time.Now()) {
+ memory.Observation.State = "last-known"
+ memory.Observation.ObservedAt = time.Time{}
+ }
return memory, memory.HasKnownUsage()
}
diff --git a/internal/unifiedresources/views_test.go b/internal/unifiedresources/views_test.go
index 6178105d65..4840036535 100644
--- a/internal/unifiedresources/views_test.go
+++ b/internal/unifiedresources/views_test.go
@@ -35,6 +35,13 @@ func TestLinkedAgentMemoryObservationUsesItsOwnSourceTime(t *testing.T) {
}
})
}
+ for _, unknownTime := range []time.Time{{}, time.Now().Add(time.Hour)} {
+ resource.SourceStatus[SourceAgent] = SourceStatus{Status: "online", LastSeen: unknownTime}
+ memory, ok := linkedAgentMemoryFromResource(resource)
+ if !ok || memory.Observation.State != "last-known" || !memory.Observation.ObservedAt.IsZero() {
+ t.Fatalf("unknown/future receipt manufactured a current reading: %+v", memory)
+ }
+ }
resource.SourceStatus[SourceAgent] = SourceStatus{Status: "offline", LastSeen: observedAt}
if _, ok := linkedAgentMemoryFromResource(resource); ok {
t.Fatal("provenance made an offline agent sample selectable")