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
test(telemetry): run background health checks with a test delay
pulse-triage[bot]b0a4d2f3928f
diff --git a/internal/telemetry/service_health_test.go b/internal/telemetry/service_health_test.goindex 342a79512a..9de4ee77fc 100644--- a/internal/telemetry/service_health_test.go+++ b/internal/telemetry/service_health_test.go@@ -221,18 +221,16 @@ func TestServiceHealthFailureCategoriesSerializeAndPersist(t *testing.T) {}func TestTelemetryStartDoesNotWaitForServiceHealth(t *testing.T) {- originalDelay := startupDelay- startupDelay = 0- defer func() { startupDelay = originalDelay }()ctx, cancel := context.WithCancel(context.Background())entered, release, started := make(chan struct{}), make(chan struct{}), make(chan struct{})+ dir := t.TempDir()t.Cleanup(func() { close(release); cancel(); Stop() })go func() {- Start(ctx, Config{Enabled: true, Version: "6.4.6", DataDir: t.TempDir(), GetServiceHealth: func() ServiceHealthObservation {+ startWithDelay(ctx, Config{Enabled: true, Version: "6.4.6", DataDir: dir, GetServiceHealth: func() ServiceHealthObservation {close(entered)<-releasereturn ServiceHealthObservation{Observed: true, Healthy: true}- }})+ }}, 0)close(started)}()select {diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.goindex 39a450124e..3501e340e3 100644--- a/internal/telemetry/telemetry.go+++ b/internal/telemetry/telemetry.go@@ -1125,6 +1125,12 @@ var (//// This is a no-op when outbound usage telemetry is disabled.func Start(ctx context.Context, cfg Config) {+ startWithDelay(ctx, cfg, startupDelay)+}++// Keep the production settling delay constant while allowing deterministic+// tests to exercise the same background runner without a two-minute sleep.+func startWithDelay(ctx context.Context, cfg Config, initialDelay time.Duration) {if !cfg.Enabled {log.Info().Msg("Outbound usage telemetry is disabled (enable via PULSE_TELEMETRY=true or Settings → System)")return@@ -1154,7 +1160,7 @@ func Start(ctx context.Context, cfg Config) {defer r.wg.Done()// Wait for the monitor to connect and populate state before the first ping.- startTimer := time.NewTimer(startupDelay)+ startTimer := time.NewTimer(initialDelay)select {case <-ctx.Done():startTimer.Stop()