Commit Graph

28 Commits

Author SHA1 Message Date
pulse-triage[bot]
0840845673 Compose reviewed monitoring repairs with current upstream without losing either fence
Preserve exact reviewed tip b5b1fa9777 and upstream a85bdcdc9a additively. Retain both alert threshold test sets. Combine upstream mock-mode epoch fencing with reviewed structural-revision checks and Docker departure ownership; add a regression that a current revision cannot revive an ended epoch. Resolve the monitoring contract to describe both boundaries, without rewriting accepted history.

Publication remains deferred for genuine final-content browser receipts and independent CodeQL disposition. Composition checks do not establish native recovery, deployment, exact-head hosted acceptance or release readiness.

Change-source: pulse-maintainer
2026-10-07 14:13:28 +01:00
rcourtman
06b7f5a0b9 Keep fixture alerts from outliving a mock-mode switch
SetMockMode(false) switched the mock package off and then cleared active
alerts, but every path that evaluates mode-dependent data checked the
mode once, up front. A mock alert pass (started from the ticker with go,
so passes overlap), a frontend or ingest refresh evaluating a GetState
snapshot, a backup-age check over fixture recovery rollups, or a
connection check over the mock ledger could already hold fixture data
when the switch happened. Its evaluations then landed after the clear,
in live mode, where nothing evaluates or resolves fixture resources, so
the alerts stayed until the 24-hour stale sweep.

A pass-level lock around checkMockAlerts was tried and reverted: it left
the other paths open and made the mock-mode API wait behind a whole pass
of synchronous event-log writes.

The monitor now owns a mock-mode epoch fence. The mock pass, backup-age
and snapshot checks, connection checks, Docker pruning and the
resource-store refresh take a scope before reading anything
mode-dependent and send each alert-manager call through it. SetMockMode,
now serialized, flips the mode, ends the epoch, waits only for calls
already admitted, and then clears. Unified metrics are evaluated one
resource per call, so the wait covers single calls, not passes.

Registry rebuilds are tracked rather than waited on. A refresh evaluates
the registry it read back only if no rebuild from an ended epoch
overlapped it, and the readers that open or remove alerts from the
inventory use current state until a clean rebuild in the new epoch
replaces the previous mode's registry. The mock supplemental fixture
sources now serve nothing outside mock mode: the router swaps them for
the real pollers only after the switch, refreshing between sources, so
a single switch to live mode used to raise fixture vSphere incidents.

The new tests park a real evaluation at a fixed point (a held lock or a
blocking supplier), switch modes and release it. Against the unfenced
code the mock pass left about 40 fixture alerts, the frontend refresh 5
vSphere incidents and the backup check 137 backup-age alerts in live
mode, and a mock-mode connection observation counted toward a live
connection's confirmation. The drain, republish and pruning tests fail
against a fence without its wait, overlap check or registry tracking.
Switching mock mode with several tenant monitors running remains
uncovered and is noted in the monitoring contract.
2026-10-07 12:03:38 +01:00
pulse-triage[bot]
e420801b2a Use the published authentication mechanism in the poll assertion
The transport status reports api-key-plain, not the auth.login_ex RPC method name. Align the regression oracle with the existing API without changing authentication or runtime source.

Change-source: pulse-maintainer
2026-10-06 04:27:11 +01:00
pulse-triage[bot]
4b4c8a6fed Bind the app stats fixture to pinned TLS and persisted History
Use the synthetic server's exact certificate pin for its self-signed leaf. Verify the first live app sample through persisted chart reads and prove repeated resource reads do not renew History; keep short-poll aggregation distinct from native sixty-second acceptance.

Change-source: pulse-maintainer
2026-10-06 04:24:26 +01:00
pulse-triage[bot]
b052aedb0f Preserve fractional TrueNAS app stats across reused sessions
Decode percentage-valued CPU JSON numbers before projecting stats, so fractional and idle 0.0 events do not discard all readings and the authenticated session. Connect repeated GetApps and provider polls to canonical CPU, memory and network History; retain malformed-event disposal and recovery controls. Native event and source trace supplied by deltabeat in Pulse #2400.

Change-source: pulse-maintainer
2026-10-06 04:22:13 +01:00
pulse-triage[bot]
33260be25b docs(monitoring): record physical-disk SMART replay-guard contract
The unified physical-disk sync now anchors SMART history to the source
observation time and drops exact replays, so the monitoring and
agent-lifecycle contract sections record the disk-history behaviour and its
focused proof. The proof lives in monitor_host_agents_test.go alongside the
other unified-sync rebuild tests.

Change-source: pulse-maintainer
2026-09-20 16:04:16 +01:00
pulse-triage[bot]
abaca8f9c0 fix(monitoring): anchor and guard unified physical-disk SMART writes
syncUnifiedPhysicalDiskMetrics stamped every SMART sample with the registry rebuild wall clock and wrote through the unguarded buffered path, so each read-side rebuild re-issued the same physical-disk observation as fresh rows (#1966). writeSMARTMetrics now anchors both the in-memory history and the persisted batch to the source observation time and drops exact replays through the existing unified guard; the unified sync passes unifiedResourceObservedAt. Adds a two-rebuild focused proof and updates the TrueNAS disk fixture to a current observation time.

Change-source: pulse-maintainer
2026-09-20 16:02:52 +01:00
pulse-triage[bot]
9ad20f432a test(monitoring): use recent observation times in sync proofs
The unified syncs now timestamp history with the source observation time, so the TrueNAS and VMware fixtures must carry a current collectedAt for the in-memory and chart windows to retain the samples. The previous fixed 2026-03 fixtures represented data older than the 24h history retention and would be trimmed. No production behaviour changes.

Change-source: pulse-maintainer
2026-09-20 15:50:30 +01:00
pulse-triage[bot]
23c84ed813 fix(monitoring): anchor unified sync samples to source observation time
The replay guard added in df44238797 only suppressed repeats for storage, whose samples already carry the provider LastSeen. The agent, VM and app-container syncs still stamped every write with the rebuild wall clock, so dedupeUnifiedMetricWrites could never match and each read-side registry rebuild re-issued the whole batch as fresh rows. That is the same WAL churn described in #1966, still live for VMware/TrueNAS VMs, TrueNAS apps and supplemental agents.

Resolve each resource's observation time from its metric source (unifiedResourceObservedAt) and use it for both the in-memory history point and the store write, matching the storage path. Proxmox and libvirt VMs already have native history writers, so exclude libvirt VMs from the unified VM sync to avoid writing a second timeline for the same series.

Contract sections recorded in monitoring.md and agent-lifecycle.md; focused proof added in monitor_polling_test.go and monitor_host_agents_test.go. Local Go compilation is unavailable this turn (module cache read-only, toolchain snapshot missing); the canonical completion guard passes and gofmt is clean.

Change-source: pulse-maintainer
2026-09-20 15:48:01 +01:00
pulse-triage[bot]
a91b6da37d Deduplicate rebuilt PBS storage samples
Canonical registry rebuilds were assigning fresh timestamps to unchanged PBS datastore values, so unrelated poll completions wrote duplicate history rows. Preserve the metric source observation time so repeated rebuilds collapse onto the one upstream sample.

Change-source: pulse-maintainer
2026-09-04 09:05:39 +01:00
rcourtman
6eaea2fc3a fix(monitoring): clear poll lastError on success so healthy connections drop stale error banners
recordTaskResult reset the failure counters on a successful poll but left
LastErrorAt/LastErrorMessage/LastErrorCategory in place forever. The
connections aggregator surfaces that field as a live error banner on
Settings -> Infrastructure and derives the Unauthorized state from it, so
one transient cluster outage (or startup blip) pinned a red "no healthy
nodes available" banner onto a connection that polls fine, and a single
past 401 could pin a healthy connection to Unauthorized.

LastError now means "current outstanding failure since the last success":
recorded on failure, cleared on success. Connections that are genuinely
failing (no successful poll) keep their banner.

Refs #1493
2026-06-10 16:19:24 +01:00
rcourtman
b707512e38 Clear all errcheck and gofmt violations so make lint gates on real findings
golangci-lint run ./... failed on ~190 pre-existing errcheck violations and
5 unformatted files, burying any new regression in noise. Fix all of them:

- Test files that hand-rolled mock-mode set/restore (vmware, truenas, and
  friends) now use the canonical setMockModeForTest/testutil.SetMockMode
  helper instead of drift copies that ignored SetEnabled errors.
- internal/mock and internal/monitoring tests get package-local
  mustSetEnabled/mustSetMockEnabled/mustSetMonitorMockMode helpers that
  fail the test on toggle errors.
- pkg/auth/sqlite_manager.go, pkg/metrics/store.go, pkg/server/server.go:
  rollbacks in defers use the explicit-discard idiom, migration renames and
  rollup commits log failures, the hosted reaper goroutine logs an error
  exit, shutdown mock-disable logs failures.
- Remaining test sites check errors with t.Fatalf/t.Errorf or explicitly
  discard best-effort calls (restore-chmods, handler-closure unmarshals)
  per existing repo style.
- gofmt: internal/api/maintenance_verification.go, internal/ai/demo.go and
  three findings test files.

Only dupl findings remain (44 pre-existing production-code duplication
pairs) — those need real refactors, not mechanical fixes.

Full test suites pass for every touched package.
2026-06-09 21:42:21 +01:00
rcourtman
bfafe559f6 Classify agentless machine availability targets 2026-05-25 21:38:43 +01:00
rcourtman
497390ff95 Scope TrueNAS resources by appliance
Scope TrueNAS child source IDs under the system source key so duplicate pool, dataset, app, VM, share, and disk names from different appliances do not merge.

Use the resulting hierarchy for per-system TrueNAS overview counts and scoped mock metric targets.
2026-05-21 00:59:00 +01:00
rcourtman
d6ca8b12e6 Add agentless availability targets
Refs #1460
2026-05-06 10:35:34 +01:00
rcourtman
81fef82bdd Restore RC backend proof regressions 2026-04-09 20:15:17 +01:00
rcourtman
bbcb153140 Unify mock chart history timelines 2026-04-01 01:04:06 +01:00
rcourtman
3ac9ca2a15 Project VMware activity onto canonical timelines 2026-03-30 21:29:54 +01:00
rcourtman
412c9821fc Implement VMware metrics history floor 2026-03-30 20:13:53 +01:00
rcourtman
aab6b5e69d feat(truenas): sync api-backed disk history 2026-03-29 18:35:47 +01:00
rcourtman
16f976537f feat(truenas): project system telemetry through canonical host history 2026-03-29 17:56:42 +01:00
rcourtman
e14ddcf348 feat(truenas): project app stats through canonical workload history 2026-03-29 17:17:57 +01:00
rcourtman
778a2577b6 feat: Pulse v6 release 2026-03-18 16:06:30 +00:00
rcourtman
4f824ab148 style: Apply gofmt to 37 files
Standardize code formatting across test files and monitor.go.
No functional changes.
2025-12-02 17:21:48 +00:00
rcourtman
062df9cd44 test: Add rescheduleTask tests for monitoring package
Add comprehensive tests for the rescheduleTask function covering:
- Nil taskQueue handling (early return)
- Successful task outcome (regular rescheduling)
- Transient failure with backoff
- Non-transient failure routing to dead letter queue
- Exceeded retry attempts routing to dead letter queue
- No outcome uses default interval
- PBS and PMG instance type intervals
- Adaptive polling max interval capping
- Existing interval preservation

Coverage: rescheduleTask 32.1% → 58.9%
Coverage: monitoring package 52.8% → 53.5%
2025-12-02 12:38:50 +00:00
rcourtman
e32621040a test: Add describeInstancesForScheduler tests
Add 6 tests for instance descriptor generation:
- No clients returns nil
- PVE only with sorted order
- PBS only
- PMG only
- All types combined
- Nil scheduler/stalenessTracker safety

Coverage: 60.7% → 62.5%
2025-12-02 02:11:14 +00:00
rcourtman
09b87c0dea test: Add recordTaskResult tests
Add 6 tests for polling task result recording:
- Nil monitor safety check
- Success case resets counters
- Failure case increments counters
- Consecutive failures tracking
- Success resets failure state
- Nil internal maps don't panic

Coverage: 53.7% → 97.6%
2025-12-02 02:06:08 +00:00
rcourtman
61a7c2829c Honor configured PVE polling interval in scheduler 2025-11-20 22:00:56 +00:00