mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-28 16:58:31 +01:00
Align Machines staleness and Scheduler Health Help with runtime
Document recently landed monitoring-progress and stale-telemetry behaviour across unclaimed operator Help guides and repair the main-branch doc test drift introduced after #5358 merged over #5360: - docs/UNIFIED_RESOURCES.md (and mirrored frontend-modern/public/docs/UNIFIED_RESOURCES.md): document the backend health envelope on Resource, Machines (/standalone/machines) stale Pulse Agent telemetry cues, banner, expanded notice, search, and fallbacks from #5361 (keeping preview-only standaloneVms out of stable Help), supported GET /api/resources sort fields, and GET /api/resources/{id} full detail payloads. - docs/VM_DISK_MONITORING.md (and mirrored frontend-modern/public/docs/VM_DISK_MONITORING.md): explain Machines stale-telemetry indicators under "Use existing Machines readings without changing the guest" so operators inspecting an agent host during paused QEMU guest-agent reads can spot stale agent telemetry immediately. - docs/api/SCHEDULER_HEALTH.md: document single-catalog Availability health roster reporting including remote-only checks (#5357) and retired poll-planner cancellation between provider roster/cadence reads (#5358). - scripts/tests/test_navigation_help_docs.py and scripts/tests/test_watchdog_help_docs.py: update the broken monitor_polling_schedule.go token assertion from #5358 (describeInstancesForScheduler(ctx)) and bind the updated Help prose to live frontend and Go sources while preserving the docs-only CI allowlist. Contract-Neutral: Documentation and doc-regression test alignment only; no API, schema, route, or runtime contract change. Change-source: pulse-maintainer
This commit is contained in:
@@ -25,6 +25,7 @@ Every monitored entity is a `Resource` with:
|
||||
| `name` | Display name |
|
||||
| `type` | `agent` (Proxmox node, host agent or other host-class parent; `docker-host` when it carries only Docker data), `vm`, `system-container`, `app-container`, `docker-service`, `storage`, `ceph`, `physical_disk`, `pbs`, `pmg`, `network-share`, `network-endpoint`, `pod`, `k8s-cluster`, `k8s-node`, `k8s-deployment`, plus further `docker-*` and `k8s-*` types |
|
||||
| `status` | `online`, `warning`, `offline`, `unknown` (critical severity is reported separately as `critical` in the `health` object's verdict) |
|
||||
| `health` | Backend-owned canonical health envelope with a `verdict` (including `stale` and `critical`) and stable `reasons` (`code` such as `telemetry_stale` plus optional detail) |
|
||||
| `sources` | Array of contributing data sources (e.g., `["proxmox", "agent"]`) |
|
||||
| `sourceStatus` | Per-source health status |
|
||||
| `metrics` | CPU, memory, disk, network (when available) |
|
||||
@@ -93,6 +94,14 @@ The v6 UI keeps platform-shaped top-level navigation. The unified resource model
|
||||
|
||||
The unified `/workloads`, `/storage` and `/recovery` routes that briefly shipped in earlier release candidates were reverted in `v6.0.0-rc.6` and do not exist. See [Migration Guide](MIGRATION_UNIFIED_NAV.md) for the platform-shaped equivalents.
|
||||
|
||||
### Stale Pulse Agent telemetry on Machines
|
||||
|
||||
On **Machines** (`/standalone/machines`), Pulse keeps a host's last known metrics visible when its Pulse Agent stops reporting, but marks the readings clearly so stale hosts do not appear healthy:
|
||||
|
||||
- **Status and filter classification:** When backend `health.verdict` is `stale`, `telemetry_stale` is recorded, `sourceStatus.agent` is impaired, `agent.stale` is true, or `lastSeen` is older than 5 minutes, the host leaves **Healthy**, joins **Degraded**, and shows an amber **Stale** status indicator. Explicit **Offline** and awaiting-first-report states remain distinct.
|
||||
- **Table banner and row cue:** A table-level warning banner lists affected hosts and ages (`Telemetry is stale for <host> (<age>). CPU, memory, disk, and sensor readings shown are last known values until their agents report again.`). Each affected row displays an always-visible compact amber cue beneath the machine name (`Stale · <age>` or `Stale data` on desktop, and `Stale` on narrow screens).
|
||||
- **Expanded details, search, and fallbacks:** Expanding a stale machine displays an amber warning notice (`Agent has stopped reporting.`, the last report age, `Showing last known readings.`, and `Last error:` when recorded). Machine search matches stale labels, detail text, and recorded source errors. Retained RAID summaries are labelled `RAID Arrays (last known)`, and retained temperatures stay muted as last-known values.
|
||||
|
||||
## API
|
||||
|
||||
### Primary Endpoint
|
||||
@@ -116,12 +125,12 @@ Returns all unified resources. Supports query parameters:
|
||||
| `tags` | Filter by resource tag |
|
||||
| `page` | 1-based page number (default `1`) |
|
||||
| `limit` | Page size (default `50`, maximum `100`) |
|
||||
| `sort` | Sort field (default `name`) |
|
||||
| `sort` | Sort field: `name` (default), `status`, `type`, or `lastSeen` |
|
||||
| `order` | Sort direction (`asc` or `desc`, default `asc`) |
|
||||
|
||||
### Resource Details
|
||||
|
||||
Individual resource details are available via the unified state WebSocket connection, which pushes real-time updates to the frontend.
|
||||
`GET /api/resources` prunes heavy platform-specific fields (such as PMG domain statistics) to keep list responses compact. Fetch the full payload for one resource with `GET /api/resources/{id}` (URL-encoding the canonical resource ID). Real-time updates are also pushed to the frontend over the unified state WebSocket connection.
|
||||
|
||||
## Frontend Architecture
|
||||
|
||||
|
||||
@@ -541,12 +541,20 @@ History before changing anything in the guest.
|
||||
Confirm the Machines entry belongs to the **same guest**, using its existing
|
||||
identity and host details, not a similar name alone. Check the filesystem and
|
||||
its observation time: a retained History sample or an agent's recent contact
|
||||
is not proof of a current disk reading. Use available, current readings there
|
||||
as an interim view; this does not repair the missing Proxmox reading or prove
|
||||
that the two entries are linked correctly. If the guest has no existing Pulse
|
||||
Agent entry or no current filesystem readings, use its own filesystem tools
|
||||
through your normal interface. **Do not install another agent, restart services,
|
||||
restore a VM or force guest-agent checks just to recover these readings.**
|
||||
is not proof of a current disk reading. When a Pulse Agent stops reporting,
|
||||
**Machines** (`/standalone/machines`) moves that host out of **Healthy** into
|
||||
**Degraded** with an amber **Stale** status indicator, shows a table-level
|
||||
warning banner (`Telemetry is stale for ...`), places a compact amber
|
||||
`Stale · <age>` or `Stale data` cue beneath the machine name (**Stale** on
|
||||
phones), and shows an expanded warning notice (`Agent has stopped reporting.`
|
||||
with `Showing last known readings.` and any recorded `Last error:`). Explicit
|
||||
**Offline** and awaiting-first-report states remain distinct. Use available,
|
||||
current readings there as an interim view. This does not repair the missing
|
||||
Proxmox reading or prove that the two entries are linked correctly. If the guest
|
||||
has no existing Pulse Agent entry or no current filesystem readings, use its own
|
||||
filesystem tools through your normal interface. **Do not install another agent,
|
||||
restart services, restore a VM or force guest-agent checks just to recover these
|
||||
readings.**
|
||||
|
||||
This alternative does **not** relax [Backup safety](#backup-safety). A responsive
|
||||
guest, running agent services, working Machines readings or an expired cooldown
|
||||
|
||||
@@ -87,7 +87,7 @@ appear here. Neither `enabled` nor the queue depth is a health verdict.
|
||||
## 🔍 Key Fields
|
||||
|
||||
### Instances (`instances`)
|
||||
The scheduler's record of each connection's recent poll results.
|
||||
The scheduler's record of each connection's recent poll results. For Availability checks, Scheduler Health describes every enabled check from one catalog snapshot, including remote-only checks run by external agents, without reloading the catalog to look up local-only tasks.
|
||||
|
||||
* **`pollStatus`**: `lastSuccess` timestamp, the current outstanding `lastError` if present, and `consecutiveFailures`. A complete success clears the error. A partial read can record both a success and a `partial` error with no consecutive failures. Proxmox VE startup and reconnect construction failures populate `pollStatus`, breaker state, and staleness tracking immediately. TrueNAS and VMware pollers drop explicit shutdown cancellations without fabricating poll failures while still reporting genuine poll timeouts, and fence in-flight completions against active provider ownership so deleted, paused, or unreadable-config fail-closed connections cannot resurrect cached state or overwrite a replacement provider.
|
||||
* **`breaker`**: `state` (`closed`/`open`/`half_open`), `retryAt` next retry, `since` state start, `lastTransition` timestamp.
|
||||
@@ -283,7 +283,9 @@ logging finishes. When a monitor is retired during poll planning, Pulse abandons
|
||||
the returned plan once cancellation is observed instead of queuing tasks or
|
||||
running post-plan statistics and alert reconciliation, while keeping any
|
||||
still-running roster read visible in `pulse_scheduler_poll_planning_age_seconds`
|
||||
until it returns.
|
||||
until it returns. Once cancellation is observed, the retired planner also stops
|
||||
starting further provider roster or cadence reads between providers without
|
||||
pretending to cancel a callback already in flight.
|
||||
|
||||
If no result advanced, read `retry.after` beside the later snapshot's
|
||||
`updatedAt`. For an `open` or `half_open` breaker, `retryAt` is the earliest
|
||||
|
||||
@@ -25,6 +25,7 @@ Every monitored entity is a `Resource` with:
|
||||
| `name` | Display name |
|
||||
| `type` | `agent` (Proxmox node, host agent or other host-class parent; `docker-host` when it carries only Docker data), `vm`, `system-container`, `app-container`, `docker-service`, `storage`, `ceph`, `physical_disk`, `pbs`, `pmg`, `network-share`, `network-endpoint`, `pod`, `k8s-cluster`, `k8s-node`, `k8s-deployment`, plus further `docker-*` and `k8s-*` types |
|
||||
| `status` | `online`, `warning`, `offline`, `unknown` (critical severity is reported separately as `critical` in the `health` object's verdict) |
|
||||
| `health` | Backend-owned canonical health envelope with a `verdict` (including `stale` and `critical`) and stable `reasons` (`code` such as `telemetry_stale` plus optional detail) |
|
||||
| `sources` | Array of contributing data sources (e.g., `["proxmox", "agent"]`) |
|
||||
| `sourceStatus` | Per-source health status |
|
||||
| `metrics` | CPU, memory, disk, network (when available) |
|
||||
@@ -93,6 +94,14 @@ The v6 UI keeps platform-shaped top-level navigation. The unified resource model
|
||||
|
||||
The unified `/workloads`, `/storage` and `/recovery` routes that briefly shipped in earlier release candidates were reverted in `v6.0.0-rc.6` and do not exist. See [Migration Guide](MIGRATION_UNIFIED_NAV.md) for the platform-shaped equivalents.
|
||||
|
||||
### Stale Pulse Agent telemetry on Machines
|
||||
|
||||
On **Machines** (`/standalone/machines`), Pulse keeps a host's last known metrics visible when its Pulse Agent stops reporting, but marks the readings clearly so stale hosts do not appear healthy:
|
||||
|
||||
- **Status and filter classification:** When backend `health.verdict` is `stale`, `telemetry_stale` is recorded, `sourceStatus.agent` is impaired, `agent.stale` is true, or `lastSeen` is older than 5 minutes, the host leaves **Healthy**, joins **Degraded**, and shows an amber **Stale** status indicator. Explicit **Offline** and awaiting-first-report states remain distinct.
|
||||
- **Table banner and row cue:** A table-level warning banner lists affected hosts and ages (`Telemetry is stale for <host> (<age>). CPU, memory, disk, and sensor readings shown are last known values until their agents report again.`). Each affected row displays an always-visible compact amber cue beneath the machine name (`Stale · <age>` or `Stale data` on desktop, and `Stale` on narrow screens).
|
||||
- **Expanded details, search, and fallbacks:** Expanding a stale machine displays an amber warning notice (`Agent has stopped reporting.`, the last report age, `Showing last known readings.`, and `Last error:` when recorded). Machine search matches stale labels, detail text, and recorded source errors. Retained RAID summaries are labelled `RAID Arrays (last known)`, and retained temperatures stay muted as last-known values.
|
||||
|
||||
## API
|
||||
|
||||
### Primary Endpoint
|
||||
@@ -116,12 +125,12 @@ Returns all unified resources. Supports query parameters:
|
||||
| `tags` | Filter by resource tag |
|
||||
| `page` | 1-based page number (default `1`) |
|
||||
| `limit` | Page size (default `50`, maximum `100`) |
|
||||
| `sort` | Sort field (default `name`) |
|
||||
| `sort` | Sort field: `name` (default), `status`, `type`, or `lastSeen` |
|
||||
| `order` | Sort direction (`asc` or `desc`, default `asc`) |
|
||||
|
||||
### Resource Details
|
||||
|
||||
Individual resource details are available via the unified state WebSocket connection, which pushes real-time updates to the frontend.
|
||||
`GET /api/resources` prunes heavy platform-specific fields (such as PMG domain statistics) to keep list responses compact. Fetch the full payload for one resource with `GET /api/resources/{id}` (URL-encoding the canonical resource ID). Real-time updates are also pushed to the frontend over the unified state WebSocket connection.
|
||||
|
||||
## Frontend Architecture
|
||||
|
||||
|
||||
@@ -541,12 +541,20 @@ History before changing anything in the guest.
|
||||
Confirm the Machines entry belongs to the **same guest**, using its existing
|
||||
identity and host details, not a similar name alone. Check the filesystem and
|
||||
its observation time: a retained History sample or an agent's recent contact
|
||||
is not proof of a current disk reading. Use available, current readings there
|
||||
as an interim view; this does not repair the missing Proxmox reading or prove
|
||||
that the two entries are linked correctly. If the guest has no existing Pulse
|
||||
Agent entry or no current filesystem readings, use its own filesystem tools
|
||||
through your normal interface. **Do not install another agent, restart services,
|
||||
restore a VM or force guest-agent checks just to recover these readings.**
|
||||
is not proof of a current disk reading. When a Pulse Agent stops reporting,
|
||||
**Machines** (`/standalone/machines`) moves that host out of **Healthy** into
|
||||
**Degraded** with an amber **Stale** status indicator, shows a table-level
|
||||
warning banner (`Telemetry is stale for ...`), places a compact amber
|
||||
`Stale · <age>` or `Stale data` cue beneath the machine name (**Stale** on
|
||||
phones), and shows an expanded warning notice (`Agent has stopped reporting.`
|
||||
with `Showing last known readings.` and any recorded `Last error:`). Explicit
|
||||
**Offline** and awaiting-first-report states remain distinct. Use available,
|
||||
current readings there as an interim view. This does not repair the missing
|
||||
Proxmox reading or prove that the two entries are linked correctly. If the guest
|
||||
has no existing Pulse Agent entry or no current filesystem readings, use its own
|
||||
filesystem tools through your normal interface. **Do not install another agent,
|
||||
restart services, restore a VM or force guest-agent checks just to recover these
|
||||
readings.**
|
||||
|
||||
This alternative does **not** relax [Backup safety](#backup-safety). A responsive
|
||||
guest, running agent services, working Machines readings or an expired cooldown
|
||||
|
||||
@@ -295,6 +295,90 @@ class NavigationHelpDocsTest(unittest.TestCase):
|
||||
self.assertIn("clusterID := proxmox.ExtractClusterID(statuses)", cluster_go)
|
||||
self.assertIn("Proxmox cluster-id changed during membership read", cluster_go)
|
||||
|
||||
def test_machines_stale_telemetry_and_resource_detail_api_match_runtime(self):
|
||||
unified = doc_text("UNIFIED_RESOURCES.md")
|
||||
vm_disk = doc_text("VM_DISK_MONITORING.md")
|
||||
self.assertEqual(
|
||||
unified,
|
||||
(ROOT / "frontend-modern/public/docs/UNIFIED_RESOURCES.md").read_text(encoding="utf-8"),
|
||||
)
|
||||
self.assertEqual(
|
||||
vm_disk,
|
||||
(ROOT / "frontend-modern/public/docs/VM_DISK_MONITORING.md").read_text(encoding="utf-8"),
|
||||
)
|
||||
|
||||
# Keep preview-only standaloneVms out of stable user guides.
|
||||
for name, text in (("UNIFIED_RESOURCES.md", unified), ("VM_DISK_MONITORING.md", vm_disk)):
|
||||
with self.subTest(preview_guard=name):
|
||||
self.assertNotIn("/standalone/vms", text)
|
||||
self.assertNotIn("Machines VMs", text)
|
||||
|
||||
unified_norm = " ".join(unified.split())
|
||||
for phrase in (
|
||||
"| `health` | Backend-owned canonical health envelope with a `verdict` (including `stale` and `critical`) and stable `reasons` (`code` such as `telemetry_stale` plus optional detail) |",
|
||||
"### Stale Pulse Agent telemetry on Machines",
|
||||
"**Machines** (`/standalone/machines`)",
|
||||
"`health.verdict` is `stale`, `telemetry_stale` is recorded, `sourceStatus.agent` is impaired, `agent.stale` is true, or `lastSeen` is older than 5 minutes",
|
||||
"leaves **Healthy**, joins **Degraded**, and shows an amber **Stale** status indicator",
|
||||
"Explicit **Offline** and awaiting-first-report states remain distinct.",
|
||||
"`Telemetry is stale for <host> (<age>). CPU, memory, disk, and sensor readings shown are last known values until their agents report again.`",
|
||||
"`Stale · <age>` or `Stale data` on desktop, and `Stale` on narrow screens",
|
||||
"`Agent has stopped reporting.`",
|
||||
"`Showing last known readings.`",
|
||||
"`Last error:`",
|
||||
"`RAID Arrays (last known)`",
|
||||
"| `sort` | Sort field: `name` (default), `status`, `type`, or `lastSeen` |",
|
||||
"`GET /api/resources/{id}`",
|
||||
"PMG domain statistics",
|
||||
):
|
||||
with self.subTest(doc="UNIFIED_RESOURCES.md", phrase=phrase):
|
||||
self.assertIn(phrase, unified_norm)
|
||||
|
||||
vm_disk_norm = " ".join(vm_disk.split())
|
||||
for phrase in (
|
||||
"**Machines** (`/standalone/machines`) moves that host out of **Healthy** into **Degraded** with an amber **Stale** status indicator",
|
||||
"`Telemetry is stale for ...`",
|
||||
"`Stale · <age>` or `Stale data` cue beneath the machine name (**Stale** on phones)",
|
||||
"`Agent has stopped reporting.` with `Showing last known readings.` and any recorded `Last error:`",
|
||||
"Explicit **Offline** and awaiting-first-report states remain distinct.",
|
||||
):
|
||||
with self.subTest(doc="VM_DISK_MONITORING.md", phrase=phrase):
|
||||
self.assertIn(phrase, vm_disk_norm)
|
||||
|
||||
staleness_ts = source("features/standalone/standaloneStaleness.ts")
|
||||
machines_tsx = source("features/standalone/AgentsMachinesTable.tsx")
|
||||
model_ts = source("features/standalone/agentMachineTableModel.ts")
|
||||
resources_go = (ROOT / "internal/api/resourceapi/resources.go").read_text(encoding="utf-8")
|
||||
|
||||
for marker in (
|
||||
"const AGENT_REPORT_STALE_AFTER_MS = 5 * 60 * 1000;",
|
||||
"badge: age ? `Stale · ${age}` : 'Stale data',",
|
||||
"compactBadge: 'Stale',",
|
||||
"detail: `Agent has stopped reporting.${lastReportText} Showing last known readings.${errorText}`,",
|
||||
"{ variant: 'warning', label: 'Stale' }",
|
||||
"Telemetry is stale for ${list}. CPU, memory, disk, and sensor readings shown are last known values until their agents report again.",
|
||||
):
|
||||
with self.subTest(source="standaloneStaleness.ts", marker=marker):
|
||||
self.assertIn(marker, staleness_ts)
|
||||
for marker in (
|
||||
"title={lastKnownTitle() ? 'RAID Arrays (last known)' : 'RAID Arrays'}",
|
||||
'data-testid="agent-machines-stale-banner"',
|
||||
'data-agent-machine-stale-cue="true"',
|
||||
'data-testid="agent-machine-stale-notice"',
|
||||
):
|
||||
with self.subTest(source="AgentsMachinesTable.tsx", marker=marker):
|
||||
self.assertIn(marker, machines_tsx)
|
||||
self.assertIn("const staleNotice = getStandaloneMachineStaleness(machine, nowMs ?? 0);", model_ts)
|
||||
for marker in (
|
||||
"// HandleGetResource handles GET /api/resources/{id}.",
|
||||
"// PMG domain stats can be very large; keep summary-only in list.",
|
||||
'case "status":',
|
||||
'case "type":',
|
||||
'case "lastSeen":',
|
||||
):
|
||||
with self.subTest(source="resources.go", marker=marker):
|
||||
self.assertIn(marker, resources_go)
|
||||
|
||||
def test_all_changed_guides_match_their_shipped_copies(self):
|
||||
for name in (
|
||||
"README.md",
|
||||
@@ -306,6 +390,7 @@ class NavigationHelpDocsTest(unittest.TestCase):
|
||||
"METRICS_HISTORY.md",
|
||||
"KUBERNETES.md",
|
||||
"UNIFIED_RESOURCES.md",
|
||||
"VM_DISK_MONITORING.md",
|
||||
"MIGRATION_UNIFIED_NAV.md",
|
||||
"RELAY.md",
|
||||
):
|
||||
|
||||
@@ -141,7 +141,7 @@ class WatchdogHelpDocsTest(unittest.TestCase):
|
||||
"func (m *Monitor) planScheduledPolls(ctx context.Context, now time.Time)",
|
||||
"id := progress.beginPlanning(time.Now())",
|
||||
"defer progress.finishPlanning(id)",
|
||||
"descriptors := m.describeInstancesForScheduler()",
|
||||
"descriptors := m.describeInstancesForScheduler(ctx)",
|
||||
"if ctx.Err() != nil {",
|
||||
"m.taskQueue.upsertPlan(task, revision)",
|
||||
"m.state.UpdatePollStats(",
|
||||
@@ -203,6 +203,8 @@ class WatchdogHelpDocsTest(unittest.TestCase):
|
||||
'releases its queue claim during panic recovery logging stays visible under stage="running" until logging finishes',
|
||||
"When a monitor is retired during poll planning, Pulse abandons the returned plan once cancellation is observed instead of queuing tasks or running post-plan statistics and alert reconciliation",
|
||||
"keeping any still-running roster read visible in pulse_scheduler_poll_planning_age_seconds until it returns",
|
||||
"For Availability checks, Scheduler Health describes every enabled check from one catalog snapshot, including remote-only checks run by external agents, without reloading the catalog to look up local-only tasks",
|
||||
"Once cancellation is observed, the retired planner also stops starting further provider roster or cadence reads between providers without pretending to cancel a callback already in flight",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -212,6 +214,12 @@ class WatchdogHelpDocsTest(unittest.TestCase):
|
||||
with self.subTest(doc=rel_path, phrase=phrase):
|
||||
self.assertIn(phrase, text)
|
||||
|
||||
avail_poller = (ROOT / "internal/monitoring/availability_poller.go").read_text(encoding="utf-8")
|
||||
poll_providers = (ROOT / "internal/monitoring/poll_providers.go").read_text(encoding="utf-8")
|
||||
self.assertIn("func (availabilityPollProvider) describesCompleteHealthRoster() {}", avail_poller)
|
||||
self.assertIn("type completeInstanceInfoPollProvider interface {", poll_providers)
|
||||
self.assertIn("func (m *Monitor) describeInstancesForScheduler(ctx context.Context) []InstanceDescriptor {", schedule_src)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user