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.

Add update funnel telemetry

rcourtmand6a21eba9850
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md
index f8ce16c28f..132519e912 100644
--- a/docs/PRIVACY.md
+++ b/docs/PRIVACY.md
@@ -80,6 +80,10 @@ Every field is listed below with the reason it exists — nothing else leaves yo
| Multi-tenant | `true`/`false` | See whether multi-tenant/runtime-org features are being used |
| Paid license | `true`/`false` | Distinguish free from paid posture without sending the exact commercial tier |
| Has API tokens | `true`/`false` | See whether token-based automation/integration is being used without sending token counts |
+| Update attempts 30d | `2` | Count update attempts recorded in the current 30-day telemetry window without sending download URLs, logs, or command output |
+| Update successes 30d | `1` | Count successful update attempts in the current 30-day telemetry window |
+| Update failures 30d | `1` | Count failed or rolled-back update attempts in the current 30-day telemetry window without sending raw errors, logs, URLs, or command output |
+| Update last failure category | `download` | Send only a coarse category for the latest update failure, such as `download`, `signature`, `checksum`, `disk_space`, `extract`, `backup`, `apply`, `restart`, `rolled_back`, or `unknown` |
| Pulse Intelligence loop configured | `true`/`false` | See whether Assistant, Patrol, governed actions, or external-agent access is configured so adoption can be measured without sending configuration details |
| Pulse Intelligence loop active 30d | `true`/`false` | See whether Assistant, Patrol, external-agent, or governed-action activity occurred in the current 30-day telemetry window |
| Pulse Intelligence complete operations loop 30d | `true`/`false` | See whether Patrol issue activity reached an approved or rejected governed-action decision without sending prompts, findings, resource identifiers, command text, or action output |
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index ef9650270d..4ce529aa1c 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -137,6 +137,13 @@ proof that an agent install, update, registration, profile rollout, or fleet
command completed. External-agent/MCP readiness is optional collaboration
setup for agents outside the app, not a first-party Patrol control completion
gate and not a lifecycle setup stage.
+Server update funnel telemetry is lifecycle-adjacent only. The updater's local
+history may feed anonymous 30-day attempt, success, failure, and coarse failure
+category counters, but those counters are adoption analytics, not proof that a
+particular agent update, profile rollout, host command, registration, or fleet
+operation succeeded. Lifecycle surfaces must keep reading update readiness and
+continuity from the updater, installer, connection ledger, and agent runtime
+state instead of inferring it from anonymous telemetry.
1. `frontend-modern/src/api/agentProfiles.ts` shared with `api-contracts`: the agent profiles frontend client is both an agent lifecycle control surface and a canonical API payload contract boundary.
2. `frontend-modern/src/api/nodes.ts` shared with `api-contracts`: the shared Proxmox node client is both an agent lifecycle setup/install control surface and a canonical API payload contract boundary.
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 9244b03d69..4a3999ac04 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -3687,7 +3687,12 @@ published-release truth from raw build strings.
That same preview contract now includes the complete anonymous telemetry
payload shape, including aggregate self-hosted adoption counters for monitored
platforms, workloads, storage, and availability targets plus coarse feature
-booleans and content-free Patrol, Assistant, and external-agent usage counters.
+booleans, content-free update funnel counters, and content-free Patrol,
+Assistant, and external-agent usage counters. Update funnel fields may expose
+only 30-day attempt, success, and failure counts plus one coarse latest failure
+category; browser preview and outbound ping payloads must not expose updater
+logs, raw errors, download URLs, local paths, command output, checksums,
+signatures, or hostnames.
The frontend `TelemetryPingPreview` type in
`frontend-modern/src/api/settings.ts` must mirror every browser-visible JSON
field from `internal/telemetry.Ping`, including the resolved operations-loop,
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index ca51de46c8..fc903cbb18 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -613,6 +613,15 @@ alerts. Those counts may describe scale and feature adoption, but they must not
include hostnames, resource IDs, infrastructure identifiers, credentials,
prompts, chat messages, command text, action output, token values, or personal
information.
+That same anonymous telemetry floor now also permits content-free update
+funnel counters derived from local update history inside the same rotating
+30-day telemetry window: update attempts, successful updates, failed or
+rolled-back updates, and the latest coarse failure category. The category may
+identify only the governed class (`download`, `signature`, `checksum`,
+`disk_space`, `extract`, `backup`, `apply`, `restart`, `rolled_back`,
+`cancelled`, or `unknown`). It must not export raw updater error text,
+download URLs, command output, log lines, paths, hostnames, release asset URLs,
+checksums, signatures, or operator-entered values.
That same anonymous telemetry floor now also permits only content-free Pulse
Patrol control and governed Pulse Intelligence operations adoption flags and
counters inside the same rotating 30-day telemetry window:
@@ -659,8 +668,9 @@ without issue-backed Patrol evidence and a real decision/outcome signal.
The public privacy disclosure table is the operator-facing inventory for that
same payload. `docs/PRIVACY.md` and
`frontend-modern/public/docs/PRIVACY.md` must name every
-`pulse_intelligence_*` field exported by `internal/telemetry.Ping` using Patrol
-control and governed-operation vocabulary, including source-specific Assistant,
+`update_*` and `pulse_intelligence_*` field exported by
+`internal/telemetry.Ping` using update-funnel, Patrol control, and
+governed-operation vocabulary, including source-specific Assistant,
direct external-agent, and `pulse-mcp` governed-operation booleans, workflow
starter counts including primary Patrol control and legacy Pro entry-point counts,
Patrol-control completed/resolved booleans, paid Patrol-control cohort booleans,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index e2d4bbf929..86ad7975f1 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -1251,6 +1251,12 @@ recovery scope, or a storage/recovery-owned secret source.
approved-action-decision, rejected-action-decision, external-agent,
Assistant, or Patrol usage counters are not backup inventory, restore
capability, recovery freshness, or storage ownership evidence.
+ Content-free update funnel counters under shared `internal/api/` are also
+ adjacent-only. Update attempts, successes, failures, rolled-back counts, and
+ coarse failure categories are release-adoption evidence, not backup
+ coverage, storage-health proof, restore readiness, recovery-job state, or
+ evidence that any storage or recovery endpoint was read, changed, or
+ verified.
External-agent activity may be counted for narrow tokens that satisfy the
called manifest capability scope, including read-only context calls. That
keeps MCP collaboration measurable, but storage and recovery must not treat
diff --git a/frontend-modern/public/docs/PRIVACY.md b/frontend-modern/public/docs/PRIVACY.md
index f8ce16c28f..132519e912 100644
--- a/frontend-modern/public/docs/PRIVACY.md
+++ b/frontend-modern/public/docs/PRIVACY.md
@@ -80,6 +80,10 @@ Every field is listed below with the reason it exists — nothing else leaves yo
| Multi-tenant | `true`/`false` | See whether multi-tenant/runtime-org features are being used |
| Paid license | `true`/`false` | Distinguish free from paid posture without sending the exact commercial tier |
| Has API tokens | `true`/`false` | See whether token-based automation/integration is being used without sending token counts |
+| Update attempts 30d | `2` | Count update attempts recorded in the current 30-day telemetry window without sending download URLs, logs, or command output |
+| Update successes 30d | `1` | Count successful update attempts in the current 30-day telemetry window |
+| Update failures 30d | `1` | Count failed or rolled-back update attempts in the current 30-day telemetry window without sending raw errors, logs, URLs, or command output |
+| Update last failure category | `download` | Send only a coarse category for the latest update failure, such as `download`, `signature`, `checksum`, `disk_space`, `extract`, `backup`, `apply`, `restart`, `rolled_back`, or `unknown` |
| Pulse Intelligence loop configured | `true`/`false` | See whether Assistant, Patrol, governed actions, or external-agent access is configured so adoption can be measured without sending configuration details |
| Pulse Intelligence loop active 30d | `true`/`false` | See whether Assistant, Patrol, external-agent, or governed-action activity occurred in the current 30-day telemetry window |
| Pulse Intelligence complete operations loop 30d | `true`/`false` | See whether Patrol issue activity reached an approved or rejected governed-action decision without sending prompts, findings, resource identifiers, command text, or action output |
diff --git a/frontend-modern/src/api/__tests__/settings.test.ts b/frontend-modern/src/api/__tests__/settings.test.ts
index cddc4ee175..86560b15cb 100644
--- a/frontend-modern/src/api/__tests__/settings.test.ts
+++ b/frontend-modern/src/api/__tests__/settings.test.ts
@@ -50,6 +50,10 @@ const mockTelemetryPreviewPayload = {
multi_tenant: false,
paid_license: false,
has_api_tokens: true,
+ update_attempts_30d: 0,
+ update_successes_30d: 0,
+ update_failures_30d: 0,
+ update_last_failure_category: undefined,
pulse_intelligence_loop_configured: false,
pulse_intelligence_loop_active_30d: false,
pulse_intelligence_complete_operations_loop_30d: false,
diff --git a/frontend-modern/src/api/settings.ts b/frontend-modern/src/api/settings.ts
index ec84908435..d3920466a8 100644
--- a/frontend-modern/src/api/settings.ts
+++ b/frontend-modern/src/api/settings.ts
@@ -51,6 +51,10 @@ export interface TelemetryPingPreview {
multi_tenant: boolean;
paid_license: boolean;
has_api_tokens: boolean;
+ update_attempts_30d: number;
+ update_successes_30d: number;
+ update_failures_30d: number;
+ update_last_failure_category?: string;
pulse_intelligence_loop_configured: boolean;
pulse_intelligence_loop_active_30d: boolean;
pulse_intelligence_complete_operations_loop_30d: boolean;
diff --git a/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts b/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts
index 6f053dafa6..6ab507276b 100644
--- a/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts
@@ -56,6 +56,10 @@ const buildTelemetryPreviewPayload = (
multi_tenant: false,
paid_license: false,
has_api_tokens: true,
+ update_attempts_30d: 0,
+ update_successes_30d: 0,
+ update_failures_30d: 0,
+ update_last_failure_category: undefined,
pulse_intelligence_loop_configured: false,
pulse_intelligence_loop_active_30d: false,
pulse_intelligence_complete_operations_loop_30d: false,
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index c126e6a5c7..35a423740b 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -41,6 +41,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/notifications"
"github.com/rcourtman/pulse-go-rewrite/internal/recovery"
"github.com/rcourtman/pulse-go-rewrite/internal/relay"
+ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"
"github.com/rcourtman/pulse-go-rewrite/internal/truenas"
"github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"
"github.com/rcourtman/pulse-go-rewrite/internal/updates"
@@ -15013,6 +15014,65 @@ func TestContract_ExternalAgentActivityUsesRouteSpecificMarkers(t *testing.T) {
}
}
+// TestContract_UpdateFunnelTelemetryStaysContentFree pins the server-owned
+// update funnel telemetry path. Update history may feed anonymous adoption
+// analysis, but only as aggregate 30-day counts and a coarse failure category,
+// and the operator preview type must expose the same JSON fields.
+func TestContract_UpdateFunnelTelemetryStaysContentFree(t *testing.T) {
+ pingType := reflect.TypeOf(telemetry.Ping{})
+ for _, field := range []string{
+ `UpdateAttempts30d:update_attempts_30d`,
+ `UpdateSuccesses30d:update_successes_30d`,
+ `UpdateFailures30d:update_failures_30d`,
+ `UpdateLastFailureCategory:update_last_failure_category,omitempty`,
+ } {
+ name, tag, _ := strings.Cut(field, ":")
+ sf, ok := pingType.FieldByName(name)
+ if !ok {
+ t.Fatalf("telemetry.Ping missing %s", name)
+ }
+ if got := sf.Tag.Get("json"); got != tag {
+ t.Fatalf("telemetry.Ping.%s json tag = %q, want %q", name, got, tag)
+ }
+ }
+
+ serverSource, err := os.ReadFile(filepath.Join("..", "..", "pkg", "server", "server.go"))
+ if err != nil {
+ t.Fatalf("read server.go: %v", err)
+ }
+ if !strings.Contains(string(serverSource), "router.ApplyUpdateTelemetrySnapshot(&snap, now)") {
+ t.Error("server telemetry snapshot must route update-history rollups through Router.ApplyUpdateTelemetrySnapshot before preview/send")
+ }
+
+ routerSource, err := os.ReadFile("telemetry_pulse_intelligence.go")
+ if err != nil {
+ t.Fatalf("read telemetry_pulse_intelligence.go: %v", err)
+ }
+ for _, fragment := range []string{
+ "func (r *Router) ApplyUpdateTelemetrySnapshot(s *telemetry.Snapshot, now time.Time)",
+ "telemetry.ApplyUpdateTelemetrySnapshot(s, r.updateHistory, now)",
+ } {
+ if !strings.Contains(string(routerSource), fragment) {
+ t.Errorf("router-owned update telemetry boundary missing %s", fragment)
+ }
+ }
+
+ settingsSource, err := os.ReadFile(filepath.Join("..", "..", "frontend-modern", "src", "api", "settings.ts"))
+ if err != nil {
+ t.Fatalf("read frontend settings API type: %v", err)
+ }
+ for _, fragment := range []string{
+ "update_attempts_30d: number;",
+ "update_successes_30d: number;",
+ "update_failures_30d: number;",
+ "update_last_failure_category?: string;",
+ } {
+ if !strings.Contains(string(settingsSource), fragment) {
+ t.Errorf("TelemetryPingPreview must mirror update funnel field %s", fragment)
+ }
+ }
+}
+
// TestContract_ExecutorPostCompletionCallback pins the seam the SSE
// bridge depends on. The executor must expose SetOnActionCompleted
// and the action_audit hot path must dispatch the callback for every
diff --git a/internal/api/telemetry_pulse_intelligence.go b/internal/api/telemetry_pulse_intelligence.go
index dc70f5db8c..a6a5251e68 100644
--- a/internal/api/telemetry_pulse_intelligence.go
+++ b/internal/api/telemetry_pulse_intelligence.go
@@ -9,6 +9,15 @@ import (
"github.com/rs/zerolog/log"
)
+// ApplyUpdateTelemetrySnapshot adds router-owned, content-free update funnel
+// counters to the anonymous telemetry snapshot.
+func (r *Router) ApplyUpdateTelemetrySnapshot(s *telemetry.Snapshot, now time.Time) {
+ if r == nil || s == nil {
+ return
+ }
+ telemetry.ApplyUpdateTelemetrySnapshot(s, r.updateHistory, now)
+}
+
// GetPulseIntelligenceActionTelemetry returns count-only action-governance
// telemetry for the anonymous Pulse Intelligence loop. It deliberately drops
// command text, approval actors/reasons, action outputs, and resource IDs.
diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.go
index 9c99887ff7..c599f4bce9 100644
--- a/internal/telemetry/telemetry.go
+++ b/internal/telemetry/telemetry.go
@@ -28,6 +28,7 @@
// - Whether multi-tenant mode is enabled
// - Whether a paid license is active
// - Whether any API tokens are configured
+// - Coarse update funnel counters and last failure category over the current install-ID rotation window
// - Patrol, Assistant, and external-agent usage counters over the current install-ID rotation window:
// configured/active/governed-action/approved-execution/resolved-loop state,
// Patrol control completed-loop and resolved-loop proof reported through
@@ -63,6 +64,7 @@ import (
"os"
"path/filepath"
"runtime"
+ "strings"
"sync"
"time"
@@ -165,6 +167,11 @@ type Ping struct {
MultiTenant bool `json:"multi_tenant"`
PaidLicense bool `json:"paid_license"`
HasAPITokens bool `json:"has_api_tokens"`
+ UpdateAttempts30d int `json:"update_attempts_30d"`
+ UpdateSuccesses30d int `json:"update_successes_30d"`
+ UpdateFailures30d int `json:"update_failures_30d"`
+ // Last coarse update failure category; never raw error text.
+ UpdateLastFailureCategory string `json:"update_last_failure_category,omitempty"`
// Pulse Intelligence usage (30-day counts/booleans — no prompts, commands, outputs, resource IDs, or token values)
PulseIntelligenceLoopConfigured bool `json:"pulse_intelligence_loop_configured"`
@@ -263,6 +270,10 @@ type Snapshot struct {
MultiTenant bool
PaidLicense bool
HasAPITokens bool
+ UpdateAttempts30d int
+ UpdateSuccesses30d int
+ UpdateFailures30d int
+ UpdateLastFailureCategory string
PulseIntelligenceLoopConfigured bool
PulseIntelligenceLoopActive30d bool
PulseIntelligenceCompleteOperationsLoop30d bool
@@ -334,6 +345,74 @@ type PulseIntelligenceActionSnapshot struct {
ApprovedActionSuccesses30d int
}
+// ApplyUpdateTelemetrySnapshot adds content-free update funnel counters from
+// local update history. It reports only aggregate counts and one coarse failure
+// category over the install-ID rotation window.
+func ApplyUpdateTelemetrySnapshot(s *Snapshot, history *updates.UpdateHistory, now time.Time) {
+ if s == nil || history == nil {
+ return
+ }
+ if now.IsZero() {
+ now = time.Now()
+ }
+ since := now.UTC().Add(-installIDRotationWindow)
+ entries := history.ListEntries(updates.HistoryFilter{Action: "update"})
+ var lastFailure *updates.UpdateHistoryEntry
+ for i := range entries {
+ entry := entries[i]
+ if entry.Timestamp.IsZero() || entry.Timestamp.UTC().Before(since) {
+ continue
+ }
+ s.UpdateAttempts30d++
+ switch entry.Status {
+ case updates.StatusSuccess:
+ s.UpdateSuccesses30d++
+ case updates.StatusFailed, updates.StatusRolledBack:
+ s.UpdateFailures30d++
+ if lastFailure == nil || entry.Timestamp.After(lastFailure.Timestamp) {
+ candidate := entry
+ lastFailure = &candidate
+ }
+ }
+ }
+ if lastFailure != nil {
+ s.UpdateLastFailureCategory = classifyUpdateFailureCategory(*lastFailure)
+ }
+}
+
+func classifyUpdateFailureCategory(entry updates.UpdateHistoryEntry) string {
+ switch entry.Status {
+ case updates.StatusRolledBack:
+ return "rolled_back"
+ case updates.StatusCancelled:
+ return "cancelled"
+ }
+ text := ""
+ if entry.Error != nil {
+ text = strings.ToLower(strings.TrimSpace(entry.Error.Code + " " + entry.Error.Message + " " + entry.Error.Details))
+ }
+ switch {
+ case strings.Contains(text, "signature"):
+ return "signature"
+ case strings.Contains(text, "checksum"):
+ return "checksum"
+ case strings.Contains(text, "download"):
+ return "download"
+ case strings.Contains(text, "disk space") || strings.Contains(text, "insufficient disk"):
+ return "disk_space"
+ case strings.Contains(text, "extract") || strings.Contains(text, "archive"):
+ return "extract"
+ case strings.Contains(text, "backup"):
+ return "backup"
+ case strings.Contains(text, "apply"):
+ return "apply"
+ case strings.Contains(text, "restart"):
+ return "restart"
+ default:
+ return "unknown"
+ }
+}
+
const (
PulseIntelligenceProActivationValueProofNotStarted = "not_started"
PulseIntelligenceProActivationValueProofInProgress = "in_progress"
@@ -691,6 +770,10 @@ func applySnapshot(base Ping, fn SnapshotFunc) Ping {
ping.MultiTenant = s.MultiTenant
ping.PaidLicense = s.PaidLicense
ping.HasAPITokens = s.HasAPITokens
+ ping.UpdateAttempts30d = s.UpdateAttempts30d
+ ping.UpdateSuccesses30d = s.UpdateSuccesses30d
+ ping.UpdateFailures30d = s.UpdateFailures30d
+ ping.UpdateLastFailureCategory = s.UpdateLastFailureCategory
ping.PulseIntelligenceLoopConfigured = s.PulseIntelligenceLoopConfigured
ping.PulseIntelligenceLoopActive30d = s.PulseIntelligenceLoopActive30d
ping.PulseIntelligenceCompleteOperationsLoop30d = s.PulseIntelligenceCompleteOperationsLoop30d
diff --git a/internal/telemetry/telemetry_test.go b/internal/telemetry/telemetry_test.go
index 98486252a0..59c0db4206 100644
--- a/internal/telemetry/telemetry_test.go
+++ b/internal/telemetry/telemetry_test.go
@@ -16,6 +16,7 @@ import (
"context"
"github.com/google/uuid"
+ "github.com/rcourtman/pulse-go-rewrite/internal/updates"
)
func TestGetOrCreateInstallID_CreatesNew(t *testing.T) {
@@ -351,6 +352,10 @@ func TestApplySnapshot(t *testing.T) {
ActiveAlerts: 2,
PaidLicense: true,
HasAPITokens: true,
+ UpdateAttempts30d: 4,
+ UpdateSuccesses30d: 2,
+ UpdateFailures30d: 1,
+ UpdateLastFailureCategory: "download",
PulseIntelligenceLoopConfigured: true,
PulseIntelligenceLoopActive30d: true,
PulseIntelligenceCompleteOperationsLoop30d: true,
@@ -442,6 +447,10 @@ func TestApplySnapshot(t *testing.T) {
if !ping.HasAPITokens {
t.Fatal("HasAPITokens should be true")
}
+ if ping.UpdateAttempts30d != 4 || ping.UpdateSuccesses30d != 2 || ping.UpdateFailures30d != 1 ||
+ ping.UpdateLastFailureCategory != "download" {
+ t.Fatalf("update telemetry counters not applied: %#v", ping)
+ }
if !ping.PulseIntelligenceLoopConfigured || !ping.PulseIntelligenceLoopActive30d ||
!ping.PulseIntelligenceCompleteOperationsLoop30d ||
!ping.PulseIntelligenceApprovedExecutionLoop30d ||
@@ -506,6 +515,66 @@ func TestApplySnapshot(t *testing.T) {
}
}
+func TestApplyUpdateTelemetrySnapshotSummarizesHistory(t *testing.T) {
+ history, err := updates.NewUpdateHistory(t.TempDir())
+ if err != nil {
+ t.Fatalf("NewUpdateHistory: %v", err)
+ }
+ now := time.Date(2026, 6, 28, 14, 0, 0, 0, time.UTC)
+ ctx := context.Background()
+ entries := []updates.UpdateHistoryEntry{
+ {
+ EventID: "old-success",
+ Timestamp: now.Add(-(installIDRotationWindow + time.Hour)),
+ Action: "update",
+ Status: updates.StatusSuccess,
+ },
+ {
+ EventID: "recent-success",
+ Timestamp: now.Add(-2 * time.Hour),
+ Action: "update",
+ Status: updates.StatusSuccess,
+ },
+ {
+ EventID: "recent-failed-download",
+ Timestamp: now.Add(-time.Hour),
+ Action: "update",
+ Status: updates.StatusFailed,
+ Error: &updates.UpdateError{
+ Message: "failed to download update: upstream timed out",
+ Details: "raw details stay local",
+ },
+ },
+ {
+ EventID: "recent-check",
+ Timestamp: now.Add(-30 * time.Minute),
+ Action: "check",
+ Status: updates.StatusSuccess,
+ },
+ }
+ for _, entry := range entries {
+ if _, err := history.CreateEntry(ctx, entry); err != nil {
+ t.Fatalf("CreateEntry(%s): %v", entry.EventID, err)
+ }
+ }
+
+ var snap Snapshot
+ ApplyUpdateTelemetrySnapshot(&snap, history, now)
+
+ if snap.UpdateAttempts30d != 2 {
+ t.Fatalf("UpdateAttempts30d = %d, want 2", snap.UpdateAttempts30d)
+ }
+ if snap.UpdateSuccesses30d != 1 {
+ t.Fatalf("UpdateSuccesses30d = %d, want 1", snap.UpdateSuccesses30d)
+ }
+ if snap.UpdateFailures30d != 1 {
+ t.Fatalf("UpdateFailures30d = %d, want 1", snap.UpdateFailures30d)
+ }
+ if snap.UpdateLastFailureCategory != "download" {
+ t.Fatalf("UpdateLastFailureCategory = %q, want download", snap.UpdateLastFailureCategory)
+ }
+}
+
func TestPulseIntelligenceTelemetryFieldsAreDisclosed(t *testing.T) {
pingType := reflect.TypeOf(Ping{})
fieldLabels := make([]string, 0)
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 45bc563d04..b36dfc0256 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -547,6 +547,9 @@ func Run(ctx context.Context, version string) error {
}
now := time.Now().UTC()
+ if router != nil {
+ router.ApplyUpdateTelemetrySnapshot(&snap, now)
+ }
var actionSnapshot telemetry.PulseIntelligenceActionSnapshot
if router != nil {
actionSnapshot = router.GetPulseIntelligenceActionTelemetry(now.Add(-telemetry.PulseIntelligenceTelemetryWindow))