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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Promote structured monitored system latest signal
rcourtmanb5c9f6d7e276
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex aaa11ca7ac..7d99a6e8ee 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -238,15 +238,14 @@ Those status details are now structured as well: lifecycle-adjacent consumersmust preserve the canonical reason list from the ledger read so operators cansee which grouped source or surface degraded and when it last reported,instead of only seeing a generic warning/offline paragraph.-That same ledger read also treats `latest_included_signal_at` as the freshest-included grouped observation, with `last_seen` left only as a compatibility-alias during rollout, rather than a promise that every grouped source is-healthy at that moment. Lifecycle-adjacent consumers must not label it with-generic single-source health wording.-That same ledger read now also includes `latest_included_signal_source`, so-lifecycle-adjacent consumers can attribute the freshest grouped observation to-its canonical reporting source instead of inferring it from the broader grouped-system source set.+That same ledger read also treats the canonical `latest_included_signal`+object as the freshest included grouped observation, with+`latest_included_signal_at`, `latest_included_signal_source`, and `last_seen`+left only as rollout compatibility fields rather than promises that every+grouped source is healthy at that moment. Lifecycle-adjacent consumers must+not label it with generic single-source health wording, and should use the+canonical object when they need attribution for which grouped surface reported+most recently.Lifecycle-adjacent workspace copy must also keep the same commercial framing:infrastructure operations may point operators to Pulse Pro for billing, but itmust describe that boundary in monitored-system, plan-limit, and license-statusdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex ab6641440e..85ef868b9d 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -252,15 +252,12 @@ That canonical summary must also carry the mixed-source freshness explanationwhen the freshest grouped observation came from a different source than thedegraded one, so API consumers can show a fresh `Last Seen` value withoutmaking warning or offline state look contradictory.-That same timestamp is now canonically exposed as-`latest_included_signal_at`; `last_seen` remains a compatibility alias only-during rollout. It represents the freshest included grouped observation, not a-claim that every grouped source reported successfully at that time, and API-consumers must preserve that meaning in their labeling and presentation.-That canonical signal contract now also includes-`latest_included_signal_source`, so consumers can attribute the freshest-included grouped observation to the source that produced it instead of-guessing from the broader grouped `source` field.+That freshest grouped observation is now canonically exposed as the structured+`latest_included_signal` object. Its `at`, `source`, `name`, and `type` fields+identify exactly which included top-level surface reported most recently.+`latest_included_signal_at`, `latest_included_signal_source`, and `last_seen`+remain rollout compatibility fields only; consumers should treat the object as+the primary contract and preserve its meaning in presentation.That client contract must also fail closed when older or partial payloads omitthe nested explanation object: the frontend may normalize missing explanationfields to empty reasons/surfaces plus a safe default summary, but it must notdiff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex a244fb45ab..f657018f71 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -219,15 +219,14 @@ That same cloud-paid surface must now also render the canonical status reasonlist when present, so customers can see exactly which grouped source ortop-level surface degraded and when it last reported rather than only readinggeneric status copy beside a fresh aggregate `Last Seen` value.-That same settings surface must also label the aggregate monitored-system-signal timestamp by its real meaning. The canonical API field is now-`latest_included_signal_at`, while `last_seen` is compatibility-only during-rollout; it represents the freshest included grouped observation, not a+That same settings surface must also label the monitored-system signal by its+real meaning. The canonical API shape is now the structured+`latest_included_signal` object, while `latest_included_signal_at`,+`latest_included_signal_source`, and `last_seen` are rollout compatibility+fields only. It represents the freshest included grouped observation, not aguarantee that every grouped source is healthy, so the UI must not present it-with single-source `Last Seen` wording.-That same cloud-paid surface should also show the canonical-`latest_included_signal_source` attribution when present, so a customer can-see which grouped source most recently reported instead of reading an+with single-source `Last Seen` wording. When the canonical object is present,+the surface should use its source/name/type attribution instead of showing anunqualified aggregate timestamp.Frontend billing/admin surfaces must not synthesize `plan_version` fromsubscription lifecycle state. When a hosted billing record lacks a plan label,diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex fd052a84d0..5bee4aced7 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -376,15 +376,14 @@ adjacent consumers may read the ledger’s nested status explanation, but theymust preserve the backend-provided reason list for stale or offline groupedsources instead of reducing those mixed fresh/stale system states back to ageneric label.-That same ledger dependency also treats `latest_included_signal_at` as the-freshest grouped observation, with `last_seen` left only as a compatibility-alias during rollout, rather than a universal health timestamp, so storage- or-recovery-adjacent consumers must not present that field with bare single--source `Last Seen` wording that hides grouped stale/offline conditions.-That same dependency now also includes `latest_included_signal_source`, so-storage- or recovery-adjacent consumers can identify which grouped source most-recently reported instead of deriving attribution from the broader grouped-source field.+That same ledger dependency also treats the canonical `latest_included_signal`+object as the freshest grouped observation, with+`latest_included_signal_at`, `latest_included_signal_source`, and `last_seen`+left only as rollout compatibility fields rather than universal health+timestamps. Storage- or recovery-adjacent consumers must not present that data+with bare single-source `Last Seen` wording that hides grouped stale/offline+conditions, and should use the canonical object when they need attribution for+which grouped surface most recently reported.That same shared `internal/api/` dependency now also assumes self-hostedcommercial counting is canonical at the top-level monitored-system boundary:shared setup, deploy, entitlement, and API-backed monitoring helpers may notdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 8c1690e9db..938e0ef68c 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -184,11 +184,11 @@ grouped source reported more recently than the degraded one, so consumers donot present a fresh `Last Seen` timestamp beside warning or offline statewithout the canonical explanation of which grouped source is still reportingand which one drifted stale or disconnected.-That same monitored-system contract now also owns attribution for the freshest-included grouped signal. Unified resources must expose not just the timestamp-of that latest included observation but also the canonical source that-produced it, so consumers can say which grouped source most recently reported-instead of showing an unowned aggregate timestamp.+That same monitored-system contract now also owns the structured freshest-+signal model. Unified resources must expose the latest included grouped signal+as one canonical object carrying its timestamp, source, display name, and type+so consumers can say exactly which top-level grouped surface most recently+reported instead of reconstructing attribution from separate fields.The unified-resource runtime now also owns the durable change timeline for thecanonical resource view. `internal/unifiedresources/monitor_adapter.go` feedsdiff --git a/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts b/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.tsindex 7cab734084..3870bc9bfd 100644--- a/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts+++ b/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts@@ -40,6 +40,12 @@ describe('MonitoredSystemLedgerAPI', () => {summary: 'All included top-level collection paths currently report online status.',reasons: [],},+ latest_included_signal: {+ name: 'server-1',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',latest_included_signal_source: 'agent',last_seen: '2026-01-01T00:00:00Z',@@ -78,6 +84,11 @@ describe('MonitoredSystemLedgerAPI', () => {name: 'server-1',type: 'host',status: 'online',+ latest_included_signal: {+ name: 'server-1',+ type: 'host',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',last_seen: '2026-01-01T00:00:00Z',source: 'agent',@@ -103,6 +114,12 @@ describe('MonitoredSystemLedgerAPI', () => {name: 'server-1',type: 'host',status: 'warning',+ latest_included_signal: {+ name: 'server-1',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',latest_included_signal_source: 'agent',last_seen: '2026-01-01T00:00:00Z',@@ -125,6 +142,12 @@ describe('MonitoredSystemLedgerAPI', () => {name: 'Tower',type: 'host',status: 'warning',+ latest_included_signal: {+ name: 'tower.local',+ type: 'docker-host',+ source: 'docker',+ at: '2026-03-23T11:59:50Z',+ },latest_included_signal_at: '2026-03-23T11:59:50Z',latest_included_signal_source: 'docker',last_seen: '2026-03-23T11:59:50Z',@@ -139,9 +162,15 @@ describe('MonitoredSystemLedgerAPI', () => {expect(result.systems[0]?.latest_included_signal_at).toBe('2026-03-23T11:59:50Z');expect(result.systems[0]?.latest_included_signal_source).toBe('docker');+ expect(result.systems[0]?.latest_included_signal).toEqual({+ name: 'tower.local',+ type: 'docker-host',+ source: 'docker',+ at: '2026-03-23T11:59:50Z',+ });});- it('falls back to the deprecated last_seen alias for older payloads', async () => {+ it('falls back to legacy latest signal fields for older payloads', async () => {vi.mocked(apiFetchJSON).mockResolvedValueOnce({systems: [{@@ -160,6 +189,12 @@ describe('MonitoredSystemLedgerAPI', () => {expect(result.systems[0]?.latest_included_signal_at).toBe('2026-03-23T11:59:50Z');expect(result.systems[0]?.latest_included_signal_source).toBeUndefined();+ expect(result.systems[0]?.latest_included_signal).toEqual({+ name: 'Tower',+ type: 'host',+ source: undefined,+ at: '2026-03-23T11:59:50Z',+ });});it('preserves canonical status explanation reasons from the API contract', async () => {@@ -183,6 +218,12 @@ describe('MonitoredSystemLedgerAPI', () => {},],},+ latest_included_signal: {+ name: 'tower.local',+ type: 'docker-host',+ source: 'docker',+ at: '2026-03-23T11:59:50Z',+ },latest_included_signal_at: '2026-03-23T11:59:50Z',latest_included_signal_source: 'docker',last_seen: '2026-03-23T11:59:50Z',@@ -215,6 +256,12 @@ describe('MonitoredSystemLedgerAPI', () => {name: 'server-1',type: 'host',status: 'degraded',+ latest_included_signal: {+ name: 'server-1',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',latest_included_signal_source: 'agent',last_seen: '2026-01-01T00:00:00Z',diff --git a/frontend-modern/src/api/monitoredSystemLedger.ts b/frontend-modern/src/api/monitoredSystemLedger.tsindex 03ae4d15e4..4a20673439 100644--- a/frontend-modern/src/api/monitoredSystemLedger.ts+++ b/frontend-modern/src/api/monitoredSystemLedger.ts@@ -46,6 +46,7 @@ export interface MonitoredSystemLedgerEntry {type: string;status: MonitoredSystemLedgerStatus;status_explanation?: MonitoredSystemLedgerStatusExplanation;+ latest_included_signal?: MonitoredSystemLedgerLatestSignal;latest_included_signal_at: string; // freshest included observation, RFC3339 or emptylatest_included_signal_source?: string;last_seen?: string; // deprecated compatibility alias@@ -53,6 +54,13 @@ export interface MonitoredSystemLedgerEntry {explanation?: MonitoredSystemLedgerExplanation;}+export interface MonitoredSystemLedgerLatestSignal {+ name: string;+ type: string;+ source?: string;+ at: string;+}+export interface MonitoredSystemLedgerResponse {systems: MonitoredSystemLedgerEntry[];total: number;@@ -76,13 +84,17 @@ function normalizeMonitoredSystemLedgerEntry(): MonitoredSystemLedgerEntry {const explanation = entry.explanation;const status = normalizeMonitoredSystemLedgerStatus(entry.status);+ const latestIncludedSignal = normalizeMonitoredSystemLedgerLatestSignal(+ entry.latest_included_signal,+ entry,+ );return {...entry,status,- latest_included_signal_at:- entry.latest_included_signal_at?.trim() || entry.last_seen?.trim() || '',+ latest_included_signal: latestIncludedSignal,+ latest_included_signal_at: latestIncludedSignal.at,latest_included_signal_source: normalizeMonitoredSystemLedgerSource(- entry.latest_included_signal_source ?? (entry.source !== 'multiple' ? entry.source : ''),+ latestIncludedSignal.source,),status_explanation: {summary: entry.status_explanation?.summary ?? defaultMonitoredSystemStatusExplanation(status),@@ -165,3 +177,17 @@ function normalizeMonitoredSystemLedgerSource(return undefined;}}++function normalizeMonitoredSystemLedgerLatestSignal(+ signal: MonitoredSystemLedgerLatestSignal | undefined,+ entry: MonitoredSystemLedgerEntry,+): MonitoredSystemLedgerLatestSignal {+ return {+ name: signal?.name?.trim() || entry.name || 'Unnamed source',+ type: signal?.type?.trim() || entry.type || 'system',+ source: normalizeMonitoredSystemLedgerSource(+ signal?.source ?? entry.latest_included_signal_source ?? (entry.source !== 'multiple' ? entry.source : ''),+ ),+ at: signal?.at?.trim() || entry.latest_included_signal_at?.trim() || entry.last_seen?.trim() || '',+ };+}diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsxindex 57b25a9db8..32a5be104d 100644--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx@@ -77,11 +77,11 @@ function monitoredSystemSourceLabel(source: string | undefined): string {}function latestIncludedSignalLabel(system: MonitoredSystemLedgerEntry): string {- if (!system.latest_included_signal_at) {+ if (!system.latest_included_signal?.at) {return '—';}- const relative = formatRelativeTime(system.latest_included_signal_at, { compact: true });- const source = monitoredSystemSourceLabel(system.latest_included_signal_source);+ const relative = formatRelativeTime(system.latest_included_signal.at, { compact: true });+ const source = monitoredSystemSourceLabel(system.latest_included_signal.source);if (source === '') {return relative;}diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsxindex 75e47d1f0c..b267032337 100644--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx@@ -79,6 +79,12 @@ describe('MonitoredSystemLedgerPanel', () => {summary: 'All included top-level collection paths currently report online status.',reasons: [],},+ latest_included_signal: {+ name: 'host-1',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',latest_included_signal_source: 'agent',last_seen: '2026-01-01T00:00:00Z',@@ -144,6 +150,12 @@ describe('MonitoredSystemLedgerPanel', () => {summary: 'All included top-level collection paths currently report online status.',reasons: [],},+ latest_included_signal: {+ name: 'server-a',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',latest_included_signal_source: 'agent',last_seen: '2026-01-01T00:00:00Z',@@ -181,6 +193,12 @@ describe('MonitoredSystemLedgerPanel', () => {},],},+ latest_included_signal: {+ name: 'server-b',+ type: 'pbs-server',+ source: 'pbs',+ at: '2026-01-02T00:00:00Z',+ },latest_included_signal_at: '2026-01-02T00:00:00Z',latest_included_signal_source: 'pbs',last_seen: '2026-01-02T00:00:00Z',@@ -268,6 +286,12 @@ describe('MonitoredSystemLedgerPanel', () => {summary: 'All included top-level collection paths currently report online status.',reasons: [],},+ latest_included_signal: {+ name: 'server-a',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ },latest_included_signal_at: '2026-01-01T00:00:00Z',latest_included_signal_source: 'agent',last_seen: '2026-01-01T00:00:00Z',diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex cc638dda53..b7f95aa0aa 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -594,6 +594,12 @@ func TestContract_MonitoredSystemLedgerJSONSnapshot(t *testing.T) {},},},+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{+ Name: "Tower",+ Type: "host",+ Source: "agent",+ At: "2026-03-18T17:30:00Z",+ },LatestIncludedSignalAt: "2026-03-18T17:30:00Z",LatestIncludedSignalSource: "agent",LastSeen: "2026-03-18T17:30:00Z",@@ -646,6 +652,12 @@ func TestContract_MonitoredSystemLedgerJSONSnapshot(t *testing.T) {}]},+ "latest_included_signal":{+ "name":"Tower",+ "type":"host",+ "source":"agent",+ "at":"2026-03-18T17:30:00Z"+ },"latest_included_signal_at":"2026-03-18T17:30:00Z","latest_included_signal_source":"agent","last_seen":"2026-03-18T17:30:00Z",diff --git a/internal/api/monitored_system_ledger.go b/internal/api/monitored_system_ledger.goindex 648acb2468..6fe7f7f19e 100644--- a/internal/api/monitored_system_ledger.go+++ b/internal/api/monitored_system_ledger.go@@ -17,6 +17,7 @@ type MonitoredSystemLedgerEntry struct {Type string `json:"type"`Status string `json:"status"` // "online", "warning", "offline", "unknown"StatusExplanation MonitoredSystemLedgerStatusExplanation `json:"status_explanation"`+ LatestIncludedSignal MonitoredSystemLedgerLatestSignal `json:"latest_included_signal"`LatestIncludedSignalAt string `json:"latest_included_signal_at"` // freshest included observation, RFC3339 or emptyLatestIncludedSignalSource string `json:"latest_included_signal_source,omitempty"`LastSeen string `json:"last_seen,omitempty"` // deprecated compatibility alias for latest_included_signal_at@@ -24,6 +25,13 @@ type MonitoredSystemLedgerEntry struct {Explanation MonitoredSystemLedgerExplanation `json:"explanation"`}+type MonitoredSystemLedgerLatestSignal struct {+ Name string `json:"name"`+ Type string `json:"type"`+ Source string `json:"source"`+ At string `json:"at"`+}+type MonitoredSystemLedgerStatusExplanation struct {Summary string `json:"summary"`Reasons []MonitoredSystemLedgerStatusReason `json:"reasons"`@@ -79,6 +87,12 @@ func (r MonitoredSystemLedgerResponse) NormalizeCollections() MonitoredSystemLed}func (e MonitoredSystemLedgerEntry) NormalizeCollections() MonitoredSystemLedgerEntry {+ if e.LatestIncludedSignal.Name == "" {+ e.LatestIncludedSignal.Name = "Unnamed source"+ }+ if e.LatestIncludedSignal.Type == "" {+ e.LatestIncludedSignal.Type = "system"+ }if e.StatusExplanation.Reasons == nil {e.StatusExplanation.Reasons = []MonitoredSystemLedgerStatusReason{}}@@ -124,8 +138,9 @@ func (r *Router) handleMonitoredSystemLedger(w http.ResponseWriter, req *http.ReType: system.Type,Status: status,StatusExplanation: monitoredSystemLedgerStatusExplanation(system.StatusExplanation, status),+ LatestIncludedSignal: monitoredSystemLedgerLatestSignal(system.LatestIncludedSignal),LatestIncludedSignalAt: formatLastSeen(system.LastSeen),- LatestIncludedSignalSource: normalizeMonitoredSystemLedgerSource(system.LatestIncludedSignalSource),+ LatestIncludedSignalSource: normalizeMonitoredSystemLedgerSource(system.LatestIncludedSignal.Source),LastSeen: formatLastSeen(system.LastSeen),Source: system.Source,Explanation: monitoredSystemLedgerExplanation(system.Explanation),@@ -215,6 +230,17 @@ func normalizeMonitoredSystemLedgerSource(source string) string {}}+func monitoredSystemLedgerLatestSignal(+ signal unifiedresources.MonitoredSystemLatestSignal,+) MonitoredSystemLedgerLatestSignal {+ return MonitoredSystemLedgerLatestSignal{+ Name: signal.Name,+ Type: signal.Type,+ Source: normalizeMonitoredSystemLedgerSource(signal.Source),+ At: formatLastSeen(signal.At),+ }+}+func formatLastSeen(t time.Time) string {if t.IsZero() {return ""diff --git a/internal/api/monitored_system_ledger_test.go b/internal/api/monitored_system_ledger_test.goindex 7fd9be5d09..f723c0b7bb 100644--- a/internal/api/monitored_system_ledger_test.go+++ b/internal/api/monitored_system_ledger_test.go@@ -19,6 +19,12 @@ func TestMonitoredSystemLedgerEntryTypes(t *testing.T) {Summary: "All included top-level collection paths currently report online status.",Reasons: []MonitoredSystemLedgerStatusReason{},},+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{+ Name: "server-1",+ Type: "host",+ Source: "agent",+ At: "2025-01-01T00:00:00Z",+ },LatestIncludedSignalAt: "2025-01-01T00:00:00Z",LatestIncludedSignalSource: "agent",LastSeen: "2025-01-01T00:00:00Z",@@ -53,6 +59,9 @@ func TestMonitoredSystemLedgerEntryTypes(t *testing.T) {if decoded.LatestIncludedSignalAt != "2025-01-01T00:00:00Z" {t.Errorf("latest included signal mismatch: %+v", decoded)}+ if decoded.LatestIncludedSignal.Name != "server-1" || decoded.LatestIncludedSignal.Type != "host" || decoded.LatestIncludedSignal.At != "2025-01-01T00:00:00Z" {+ t.Errorf("latest included signal payload mismatch: %+v", decoded.LatestIncludedSignal)+ }if decoded.LatestIncludedSignalSource != "agent" {t.Errorf("latest included signal source mismatch: %+v", decoded)}@@ -198,6 +207,12 @@ func TestHandleMonitoredSystemLedgerHTTP(t *testing.T) {Summary: "All included top-level collection paths currently report online status.",Reasons: []MonitoredSystemLedgerStatusReason{},},+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{+ Name: "test-host",+ Type: "host",+ Source: "agent",+ At: "2025-01-01T00:00:00Z",+ },LatestIncludedSignalAt: "2025-01-01T00:00:00Z",LatestIncludedSignalSource: "agent",LastSeen: "2025-01-01T00:00:00Z",@@ -245,6 +260,9 @@ func TestHandleMonitoredSystemLedgerHTTP(t *testing.T) {if decoded.Systems[0].LatestIncludedSignalAt != "2025-01-01T00:00:00Z" {t.Errorf("expected latest included signal timestamp, got %+v", decoded.Systems[0])}+ if decoded.Systems[0].LatestIncludedSignal.Source != "agent" {+ t.Errorf("expected latest included signal payload, got %+v", decoded.Systems[0].LatestIncludedSignal)+ }if decoded.Systems[0].LatestIncludedSignalSource != "agent" {t.Errorf("expected latest included signal source, got %+v", decoded.Systems[0])}diff --git a/internal/unifiedresources/monitored_systems.go b/internal/unifiedresources/monitored_systems.goindex ed28170b63..67b7b1d4cb 100644--- a/internal/unifiedresources/monitored_systems.go+++ b/internal/unifiedresources/monitored_systems.go@@ -61,17 +61,26 @@ type MonitoredSystemStatusReason struct {Summary string}+// MonitoredSystemLatestSignal captures the freshest included grouped signal+// that contributed to the monitored-system runtime view.+type MonitoredSystemLatestSignal struct {+ Name string+ Type string+ Source string+ At time.Time+}+// MonitoredSystemRecord describes a counted top-level monitored system after// canonical cross-view deduplication.type MonitoredSystemRecord struct {- Name string- Type string- Status ResourceStatus- StatusExplanation MonitoredSystemStatusExplanation- LastSeen time.Time- LatestIncludedSignalSource string- Source string- Explanation MonitoredSystemGroupingExplanation+ Name string+ Type string+ Status ResourceStatus+ StatusExplanation MonitoredSystemStatusExplanation+ LastSeen time.Time+ LatestIncludedSignal MonitoredSystemLatestSignal+ Source string+ Explanation MonitoredSystemGroupingExplanation}// MonitoredSystemCount returns the number of top-level monitored systems after@@ -176,14 +185,14 @@ func monitoredSystemRecord(group monitoredSystemGroup) MonitoredSystemRecord {status := monitoredSystemStatus(group.resources)latestSignal := monitoredSystemLatestObservation(group.resources)record := MonitoredSystemRecord{- Name: monitoredSystemDisplayName(group.resources, resource),- Type: monitoredSystemType(resource),- Status: status,- StatusExplanation: monitoredSystemStatusExplanation(group.resources, status),- LastSeen: latestSignal.LastSeen,- LatestIncludedSignalSource: latestSignal.Source,- Source: monitoredSystemSource(group.resources),- Explanation: normalizeMonitoredSystemGroupingExplanation(group.explanation),+ Name: monitoredSystemDisplayName(group.resources, resource),+ Type: monitoredSystemType(resource),+ Status: status,+ StatusExplanation: monitoredSystemStatusExplanation(group.resources, status),+ LastSeen: latestSignal.LastSeen,+ LatestIncludedSignal: monitoredSystemLatestSignal(latestSignal),+ Source: monitoredSystemSource(group.resources),+ Explanation: normalizeMonitoredSystemGroupingExplanation(group.explanation),}if record.Name == "" {record.Name = "Unnamed system"@@ -201,9 +210,7 @@ func monitoredSystemRecord(group monitoredSystemGroup) MonitoredSystemRecord {if record.Source == "" {record.Source = "unknown"}- if record.LatestIncludedSignalSource == "" && record.Source != "multiple" {- record.LatestIncludedSignalSource = record.Source- }+ record.LatestIncludedSignal = normalizeMonitoredSystemLatestSignal(record.LatestIncludedSignal)if record.Explanation.Summary == "" {record.Explanation = monitoredSystemStandaloneExplanation(group.resources)}@@ -231,6 +238,19 @@ func normalizeMonitoredSystemStatusExplanation(return explanation}+func normalizeMonitoredSystemLatestSignal(signal MonitoredSystemLatestSignal) MonitoredSystemLatestSignal {+ if strings.TrimSpace(signal.Name) == "" {+ signal.Name = "Unnamed source"+ }+ if strings.TrimSpace(signal.Type) == "" {+ signal.Type = "system"+ }+ if strings.TrimSpace(signal.Source) == "" {+ signal.Source = "unknown"+ }+ return signal+}+func monitoredSystemStandaloneExplanation(resources []*Resource) MonitoredSystemGroupingExplanation {surfaces := monitoredSystemGroupingSurfaces(resources)resource := preferredMonitoredSystemResource(resources)@@ -605,6 +625,7 @@ func monitoredSystemStatusSummary(type monitoredSystemObservation struct {Name string+ Type stringSource stringLastSeen time.Time}@@ -670,6 +691,10 @@ func monitoredSystemLatestObservationMatching(if name == "" {name = "Unnamed source"}+ resourceType := monitoredSystemType(resource)+ if resourceType == "" {+ resourceType = "system"+ }if len(resource.SourceStatus) > 0 {sourceKeys := make([]DataSource, 0, len(resource.SourceStatus))@@ -688,6 +713,7 @@ func monitoredSystemLatestObservationMatching(if monitoredSystemObservationIsLater(latest.LastSeen, latest.Source, sourceStatus.LastSeen, string(source)) {latest = monitoredSystemObservation{Name: name,+ Type: resourceType,Source: string(source),LastSeen: sourceStatus.LastSeen,}@@ -701,6 +727,7 @@ func monitoredSystemLatestObservationMatching(monitoredSystemObservationIsLater(latest.LastSeen, latest.Source, resource.LastSeen, primarySource) {latest = monitoredSystemObservation{Name: name,+ Type: resourceType,Source: primarySource,LastSeen: resource.LastSeen,}@@ -709,6 +736,15 @@ func monitoredSystemLatestObservationMatching(return latest}+func monitoredSystemLatestSignal(observation monitoredSystemObservation) MonitoredSystemLatestSignal {+ return MonitoredSystemLatestSignal{+ Name: observation.Name,+ Type: observation.Type,+ Source: observation.Source,+ At: observation.LastSeen,+ }+}+func monitoredSystemObservationIsLater(currentAt time.Time,currentSource string,diff --git a/internal/unifiedresources/registry_test.go b/internal/unifiedresources/registry_test.goindex 663036033f..44b7b64062 100644--- a/internal/unifiedresources/registry_test.go+++ b/internal/unifiedresources/registry_test.go@@ -300,9 +300,18 @@ func TestMonitoredSystemsExplainsStaleGroupedSourceWhileLastSeenStaysFresh(t *teif !system.LastSeen.Equal(dockerResource.LastSeen) {t.Fatalf("expected grouped last_seen %s, got %s", dockerResource.LastSeen, system.LastSeen)}- if system.LatestIncludedSignalSource != string(SourceDocker) {+ if system.LatestIncludedSignal.Source != string(SourceDocker) {t.Fatalf("expected latest included signal source docker, got %+v", system)}+ if system.LatestIncludedSignal.Name != "tower.local" {+ t.Fatalf("expected latest included signal name tower.local, got %+v", system)+ }+ if system.LatestIncludedSignal.Type != "docker-host" {+ t.Fatalf("expected latest included signal type docker-host, got %+v", system)+ }+ if !system.LatestIncludedSignal.At.Equal(dockerResource.LastSeen) {+ t.Fatalf("expected latest included signal at %s, got %+v", dockerResource.LastSeen, system)+ }if system.StatusExplanation.Summary == "" {t.Fatal("expected grouped monitored system status explanation summary")}