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.

feat: add multi-tenancy foundation (directory-per-tenant)

rcourtman289d95374ff5
diff --git a/coverage_summary.txt b/coverage_summary.txt
new file mode 100644
index 0000000000..962740f096
--- /dev/null
+++ b/coverage_summary.txt
@@ -0,0 +1,3873 @@
+github.com/rcourtman/pulse-go-rewrite/cmd/hashpw/main.go:18: run 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/hashpw/main.go:35: main 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:79: String 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:83: Set 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:88: main 0.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:101: run 86.1%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:393: cleanupDockerAgent 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:402: healthHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:427: startHealthServer 90.9%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:501: loadConfig 96.4%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:686: gatherTags 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:705: gatherCSV 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:724: defaultInt 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:736: parseLogLevel 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:744: defaultLogLevel 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:754: resolveEnableCommands 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:791: resolveToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:795: resolveTokenInternal 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:829: initDockerWithRetry 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:869: initKubernetesWithRetry 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/main.go:922: applyRemoteSettings 0.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-agent/service_stub.go:10: runAsWindowsService 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:39: String 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:43: Set 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:48: main 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:72: run 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:142: parseConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:227: gatherTags 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:246: parseLogLevel 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/main.go:263: defaultLogLevel 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse-host-agent/service_stub.go:10: runAsWindowsService 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/bootstrap.go:27: showBootstrapToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/config.go:168: getPassphrase 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/config.go:289: init 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/main.go:31: runServer 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/main.go:36: init 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/main.go:59: main 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/metrics_server.go:16: startMetricsServer 92.3%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:88: init 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:96: getMockEnvPath 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:110: setMockMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:138: getDefaultMockConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:157: parseMockEnv 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:173: writeMockEnv 100.0%
+github.com/rcourtman/pulse-go-rewrite/cmd/pulse/mock.go:222: getMockStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:74: HostAgentSearchPaths 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:97: EnsureHostAgentBinaries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:149: DownloadAndInstallHostAgentBinaries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:192: findMissingHostAgentBinaries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:203: hostAgentBinaryExists 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:215: normalizeVersionTag 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:224: extractHostAgentBinaries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:297: writeHostAgentFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:329: copyHostAgentFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentbinaries/host_agent.go:353: normalizeExecutableMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:26: DefaultPolicy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:202: compile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:208: compilePatterns 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:229: Evaluate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:266: IsBlocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:271: NeedsApproval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/policy.go:276: IsAutoApproved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:46: NewServer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:55: HandleWebSocket 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:197: readLoop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:267: pingLoop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:313: sendMessage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:322: ExecuteCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:376: ReadFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:426: GetConnectedAgents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:438: IsAgentConnected 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentexec/server.go:446: GetAgentForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/restart_unix.go:15: restartProcess 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:92: New 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:124: RunLoop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:157: CheckAndUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:217: getServerVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:252: isUnraid 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:258: verifyBinaryMagic 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:305: unraidPersistentPath 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:310: performUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:318: performUpdateWithExecPath 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:479: GetUpdatedFromVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/agentupdate/update.go:504: determineArch 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:22: NewAlertManagerAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:27: GetActiveAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:43: GetRecentlyResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:67: GetAlertsByResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:85: GetAlertHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:112: convertAlertFromManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:138: convertAlertFromModels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:164: inferResourceType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_adapter.go:192: formatDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_provider.go:51: SetAlertProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_provider.go:58: buildAlertContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_provider.go:134: buildTargetAlertContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_provider.go:158: formatAlertForAI 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_provider.go:175: formatTimeAgo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_provider.go:216: GenerateAlertInvestigationPrompt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_threshold_adapter.go:14: NewAlertThresholdAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_threshold_adapter.go:19: GetNodeCPUThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_threshold_adapter.go:31: GetNodeMemoryThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_threshold_adapter.go:43: GetGuestMemoryThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_threshold_adapter.go:55: GetGuestDiskThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_threshold_adapter.go:67: GetStorageThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:37: NewAlertTriggeredAnalyzer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:50: Start 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:76: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:95: SetEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:103: IsEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:110: OnAlertFired 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:164: analyzeResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:228: analyzeResourceByAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:280: analyzeNodeFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:311: analyzeGuestFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:356: analyzeDockerFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:388: analyzeUpdateAlertFromAlert 97.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:483: classifyContainerUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:657: analyzeStorageFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:679: analyzeGenericResourceFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:701: resourceKeyFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/alert_triggered.go:715: CleanupOldCooldowns 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:83: NewStore 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:115: CreateApproval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:162: GetApproval 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:183: GetPendingApprovals 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:200: GetApprovalsByExecution 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:215: Approve 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:256: Deny 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:287: StoreExecution 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:308: GetExecution 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:326: DeleteExecution 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:335: CleanupExpired 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:375: GetStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:405: approvalsFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:409: executionsFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:413: load 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:437: save 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:462: StartCleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:466: cleanupLoop 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:525: AssessRiskLevel 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:555: truncateCommand 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:569: SetStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/approval/store.go:576: GetStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:67: DefaultConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:76: NewStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:114: Learn 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:168: GetBaseline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:182: GetResourceBaseline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:206: IsAnomaly 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:255: CheckAnomaly 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:326: CheckResourceAnomalies 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:401: formatAnomalyDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:432: formatRatio 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:456: GetAllAnomalies 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:494: CalculateTrend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:574: formatTrendDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:594: formatDays 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:622: floatToStr 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:646: ResourceCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:665: GetAllBaselines 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:697: Save 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:709: saveToDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:731: loadFromDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:747: computeMean 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:758: computeStdDev 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:772: computePercentiles 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline/store.go:793: percentile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline_adapter.go:13: NewBaselineStoreAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline_adapter.go:21: CheckAnomaly 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline_adapter.go:35: GetBaseline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline_exports.go:17: DefaultBaselineConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/baseline_exports.go:22: NewBaselineStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:33: NewAgenticLoop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:50: UpdateTools 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:56: Execute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:61: ExecuteWithTools 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:65: executeWithTools 58.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:363: Abort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:370: AnswerQuestion 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:389: waitForApprovalDecision 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:409: pruneMessagesForModel 26.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:437: truncateToolResultForModel 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/agentic.go:447: convertToProviderMessages 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:80: NewPatrolService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:88: SetFindingsStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:95: IsRunning 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:102: GetLastResult 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:109: Subscribe 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:118: Unsubscribe 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:126: broadcast 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:140: RunPatrol 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:146: RunPatrolWithResult 76.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:256: buildPatrolPrompt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:307: parseFindings 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:329: parseFindingBlock 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:385: generateFindingID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:392: CreatePatrolSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/patrol.go:411: GetSessionID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:77: NewService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:120: GetState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:128: Evaluate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:136: GetConnectedAgents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:140: ExecuteCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:145: Start 95.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:193: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:204: Restart 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:243: IsRunning 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:250: ExecuteStream 71.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:315: ListSessions 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:328: CreateSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:341: DeleteSession 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:354: GetMessages 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:367: AbortSession 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:381: AnswerQuestion 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:396: SummarizeSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:401: GetSessionDiff 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:406: ForkSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:411: RevertSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:416: UnrevertSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:421: GetBaseURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:427: SetAlertProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:435: SetFindingsProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:443: SetBaselineProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:451: SetPatternProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:459: SetMetricsHistory 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:467: SetBackupProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:475: SetStorageProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:483: SetDiskHealthProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:491: SetUpdatesProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:499: SetAgentProfileManager 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:507: SetFindingsManager 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:515: SetMetadataUpdater 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:523: UpdateControlSettings 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:536: createProvider 69.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:593: applyChatContextSettings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:598: buildSystemPrompt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:631: filterToolsForPrompt 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:646: classifyRunCommand 20.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:668: parseRunCommandDecision 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:704: filterOutRunCommand 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/service.go:716: Execute 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:33: NewSessionStore 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:45: sessionPath 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:50: List 76.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:89: Create 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:115: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:134: Delete 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:150: GetMessages 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:163: AddMessage 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:192: UpdateLastMessage 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:212: readSession 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:231: writeSession 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:246: generateTitle 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/session.go:276: EnsureSession 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/tools.go:9: ConvertMCPToolsToProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/tools.go:54: ConvertProviderToolCallToMCP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/chat/tools.go:62: FormatToolResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/config.go:18: NewDefaultConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:58: NewBuilder 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:69: WithMetricsHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:75: WithKnowledge 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:81: WithFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:87: WithBaseline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:93: BuildForInfrastructure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:205: computeNodeTrends 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:234: computeGuestTrends 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:267: computeStorageTrends 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:291: computeStoragePredictions 88.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:345: formatPredictionBasis 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:351: buildDockerHostContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:372: buildHostContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:403: enrichWithNotes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:415: enrichWithAnomalies 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:456: formatAnomalyDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:476: computeGuestMetricSamples 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:511: filterRecentPoints 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/builder.go:523: MergeContexts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:12: FormatResourceContext 97.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:131: formatTrendLine 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:165: formatRate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:185: formatMetricSamples 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:216: DownsampleMetrics 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:245: FormatInfrastructureContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:334: FormatCompactSummary 96.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:381: hasGrowingTrend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:391: formatResourceType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:415: formatDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:439: FormatBackupStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:452: FormatNodeForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:475: FormatGuestForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/formatter.go:501: FormatStorageForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:11: ComputeTrend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:62: applyTrendSanityChecks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:130: computeStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:166: linearRegression 96.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:227: classifyTrend 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:263: ComputePercentiles 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:306: TrendSummary 94.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:341: formatFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:345: floatToString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:359: intToString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:369: padLeft 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/context/trends.go:376: trimTrailingZeros 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:85: DefaultConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:95: NewDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:133: RecordEvent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:159: detectCorrelations 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:204: calculateConfidence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:218: formatCorrelationDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:239: GetCorrelations 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:259: GetCorrelationsForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:275: GetDependencies 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:295: GetDependsOn 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:314: PredictCascade 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:357: FormatForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:389: trimEvents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:407: saveToDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:449: loadFromDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:499: generateEventID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:504: intToStr 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:516: correlationKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:520: formatDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation/detector.go:538: formatConfidence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation_exports.go:37: NewCorrelationDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation_exports.go:42: DefaultCorrelationConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/pricing.go:15: EstimateUSD 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/pricing.go:35: PricingAsOf 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/pricing.go:71: lookupPrice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/pricing.go:95: matchPattern 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/resolve.go:7: ResolveProviderAndModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/resolve.go:22: normalizeModelForProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/resolve.go:40: inferProviderAndModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:55: NewStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:67: SetPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:89: Record 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:102: Clear 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:112: ListEvents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:136: GetSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:255: Flush 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:272: trimLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:286: scheduleSaveLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:329: SetOnSaveError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:336: GetPersistenceStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:400: summarizeUseCases 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost/store.go:463: summarizeTargets 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost_persistence.go:14: NewCostPersistenceAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost_persistence.go:19: SaveUsageHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/cost_persistence.go:39: LoadUsageHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/demo.go:14: IsDemoMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/demo.go:29: IsMockResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/demo.go:52: InjectDemoFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/demo.go:191: injectDemoRunHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/demo.go:291: GenerateDemoAIResponse 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/demo.go:444: GenerateDemoAIStream 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/dryrun/simulator.go:31: NewSimulator 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/dryrun/simulator.go:38: Simulate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/dryrun/simulator.go:57: initPatterns 96.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/dryrun/simulator.go:390: reverseAction 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/dryrun/simulator.go:412: Simulate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:70: IsActive 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:75: IsDismissed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:80: IsSnoozed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:85: IsResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:132: NewFindingsStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:143: SetPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:170: scheduleSave 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:220: ForceSave 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:247: SetOnSaveError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:257: GetPersistenceStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:267: Add 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:332: Resolve 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:352: Acknowledge 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:370: Snooze 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:392: Unsnooze 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:422: Dismiss 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:457: Undismiss 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:490: SetUserNote 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:507: Suppress 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:528: IsSuppressed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:535: isSuppressedInternal 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:560: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:573: GetByResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:589: GetActive 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:613: GetSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:642: GetAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:660: ClearAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:673: Cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:701: GetDismissedForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:787: HasIssues 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:792: IsHealthy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:799: AddSuppressionRule 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:828: GetSuppressionRules 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:871: DeleteSuppressionRule 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:904: GetDismissedFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings.go:919: MatchesSuppressionRule 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings_persistence.go:14: NewFindingsPersistenceAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings_persistence.go:19: SaveFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings_persistence.go:54: LoadFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings_tools_adapter.go:13: NewFindingsMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings_tools_adapter.go:21: GetActiveFindings 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/findings_tools_adapter.go:52: GetDismissedFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:167: NewIntelligence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:174: SetSubsystems 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:198: SetStateProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:205: GetSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:251: GetResourceIntelligence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:323: FormatContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:373: FormatGlobalContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:411: RecordLearning 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:423: CheckBaselinesForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:450: CreatePredictionFinding 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:474: countFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:495: getTopFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:518: severityOrder 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:533: getUpcomingRisks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:556: getLearningStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:592: calculateOverallHealth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:672: calculateResourceHealth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:766: scoreToGrade 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:781: generateHealthPrediction 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:803: getResourcesAtRisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:882: detectCurrentAnomalies 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:891: formatBaselinesForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:913: formatAnomaliesForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:929: formatAnomalyDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/intelligence.go:939: absFloatIntel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:48: NewStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:68: guestFilePath 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:79: GetKnowledge 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:149: SaveNote 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:222: DeleteNote 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:244: GetNotesByCategory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:260: FormatForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:308: saveToFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:347: ListGuests 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/knowledge/store.go:367: FormatAllForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:28: AnalyzeKubernetesCluster 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:71: findKubernetesCluster 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:80: kubernetesClusterDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:93: buildKubernetesClusterContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:174: summarizeKubernetesNodes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:205: summarizeKubernetesPods 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:256: summarizeKubernetesDeployments 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:292: formatPodIssues 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:306: formatPodRestarts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:331: formatPodIssueLine 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:339: isKubernetesPodHealthy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:365: isKubernetesDeploymentHealthy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:382: kubernetesPodReason 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:422: truncateKubernetesMessage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/kubernetes_analysis.go:429: formatKubernetesAge 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:76: NewChangeDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:101: DetectChanges 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:173: detectResourceChanges 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:264: GetChangesForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:279: GetRecentChanges 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:293: GetChangesSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:308: trimChanges 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:316: saveToDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:341: loadFromDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:380: generateChangeID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:385: formatDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:398: formatUnit 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:405: formatBytes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:423: formatFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:433: intToString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:445: formatCreateDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:449: formatDeleteDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:453: formatStatusDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:457: formatMigrationDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:461: formatCPUChangeDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:469: formatMemoryChangeDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/changes.go:477: formatBackupDescription 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:99: NewIncidentStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:134: RecordAlertFired 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:161: RecordAlertAcknowledged 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:189: RecordAlertUnacknowledged 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:212: RecordAlertResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:242: RecordAnalysis 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:271: RecordCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:311: RecordRunbook 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:346: RecordNote 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:381: GetTimelineByAlertID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:397: GetTimelineByAlertAt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:431: ListIncidentsByResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:453: FormatForAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:480: FormatForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:511: FormatForPatrol 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:574: newIncidentFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:599: updateIncidentFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:615: ensureIncidentForAlertLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:625: addEventLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:646: findOpenIncidentByAlertIDLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:659: findLatestIncidentByAlertIDLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:672: findIncidentByIDLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:685: trimLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:714: saveAsync 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:725: saveToDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:758: loadFromDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:789: cloneIncident 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:821: generateIncidentID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:828: generateIncidentEventID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/incidents.go:833: formatAlertSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:74: NewRemediationLog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:98: Log 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:123: LogCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:145: GetForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:160: GetForFinding 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:174: GetSimilar 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:211: GetSuccessfulRemediations 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:226: GetRecentRemediations 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:240: GetRecentRemediationStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:280: FormatForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:300: GetRemediationStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:329: trimRecords 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:336: saveToDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:361: loadFromDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:400: generateRecordID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:405: truncateOutput 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:412: extractKeywords 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:435: countMatches 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:451: GetByID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:464: MarkRolledBack 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory/remediation.go:493: GetRollbackable 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory_exports.go:54: NewChangeDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/memory_exports.go:59: NewRemediationLog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metadata_provider.go:25: SetMetadataProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metadata_provider.go:34: SetResourceURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:17: NewMetricsHistoryAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:25: GetNodeMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:34: GetGuestMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:43: GetAllGuestMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:52: GetAllStorageMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:61: convertMetricPoints 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/metrics_history_adapter.go:76: convertMetricsMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:55: DefaultPatrolThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:68: CalculatePatrolThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:75: CalculatePatrolThresholdsWithMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:125: clampThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:162: GetInterval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:175: DefaultPatrolConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:300: NewPatrolService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:315: SetIncidentStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:322: GetIncidentStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:330: SetChatPatrol 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:339: SetConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:363: SetThresholdProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:377: SetProactiveMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:393: GetProactiveMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:400: GetThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:408: SetFindingsPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:424: SetRunHistoryPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:439: SetKnowledgeStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:447: SetMetricsHistoryProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:456: SetBaselineStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:464: GetBaselineStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:471: GetMetricsHistoryProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:478: SetChangeDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:486: SetRemediationLog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:494: GetRemediationLog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:501: SetPatternDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:509: GetPatternDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:516: SetCorrelationDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:524: GetCorrelationDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:531: GetChangeDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:538: GetConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:545: GetFindings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:552: GetIntelligence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:581: GetStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:621: SubscribeToStream 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:640: UnsubscribeFromStream 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:649: broadcast 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:676: appendStreamContent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:689: setStreamPhase 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:701: GetCurrentStreamOutput 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:708: Start 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:727: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:741: patrolLoop 9.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:807: runPatrol 70.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1085: joinParts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1101: generateFindingID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1106: runHeuristicAnalysis 79.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1196: analyzeNode 91.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1288: analyzeGuest 93.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1401: analyzeDockerHost 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1580: analyzeStorage 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1626: autoResolveStaleFindings 63.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1654: GetFindingsForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1659: GetFindingsSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1665: ResolveFinding 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1695: DismissFinding 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1731: GetRunHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1740: GetAllFindings 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1763: GetFindingsHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1777: ForcePatrol 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1782: analyzePBSInstance 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:1960: analyzeHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2151: analyzeKubernetesCluster 86.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2332: cleanThinkingTokens 97.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2421: runAIAnalysis 76.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2517: getPatrolSystemPrompt 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2599: buildInfrastructureSummary 28.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2751: buildEnrichedContext 19.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2859: stateToSnapshots 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2915: GetNodeMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2923: GetGuestMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2931: GetAllGuestMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2939: GetAllStorageMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2952: GetNotes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2968: FormatAllForContext 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2980: CheckAnomaly 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2987: GetBaseline 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:2996: convertToContextPoints 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3012: convertToContextMetricsMap 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3025: buildPatrolPrompt 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3100: recordEvent 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3121: checkAnomalies 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3171: validateAIFindings 97.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3252: isActionableFinding 82.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3322: parseAIFindings 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3345: parseFindingBlock 97.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3432: normalizeFindingKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3452: formatDurationPatrol 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3463: formatBytes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol.go:3477: formatBytesInt64 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:24: NewPatrolHistoryPersistenceAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:29: SavePatrolRunHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:64: LoadPatrolRunHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:121: NewPatrolRunHistoryStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:133: SetPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:159: Add 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:176: GetAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:186: GetRecent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:200: Count 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:208: scheduleSaveLocked 96.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:253: SetOnSaveError 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:260: GetPersistenceStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patrol_history_persistence.go:267: FlushPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/pattern_exports.go:37: NewPatternDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/pattern_exports.go:42: DefaultPatternConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:93: DefaultConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:103: NewDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:141: RecordEvent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:173: RecordFromAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:188: GetPredictions 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:231: GetPredictionsForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:243: GetPatterns 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:258: computePattern 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:335: trimEvents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:351: saveToDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:381: loadFromDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:432: FormatForContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:463: generateEventID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:468: intToStr 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:480: patternKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:484: mapAlertToEventType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:505: averageDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:516: stddevDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:529: formatPatternBasis 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/patterns/detector.go:561: formatDays 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:34: NewAnthropicClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:41: NewAnthropicClientWithBaseURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:59: Name 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:126: Chat 86.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:361: TestConnection 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:366: modelsEndpoint 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:376: ListModels 79.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:436: SupportsThinking 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic.go:471: ChatStream 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:82: GenerateOAuthSession 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:107: GetAuthorizationURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:128: ExchangeCodeForTokens 80.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:201: CreateAPIKeyFromOAuth 76.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:244: RefreshAccessToken 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:324: NewAnthropicOAuthClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:331: NewAnthropicOAuthClientWithBaseURL 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:351: SetTokenRefreshCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:356: Name 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:361: ensureValidToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:371: forceRefreshToken 84.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:398: Chat 73.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:634: TestConnection 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:639: modelsEndpoint 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/anthropic_oauth.go:649: ListModels 81.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/factory.go:11: NewFromConfig 73.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/factory.go:77: NewForProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/factory.go:138: NewForModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:32: NewGeminiClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:53: Name 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:142: Chat 89.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:444: TestConnection 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:450: SupportsThinking 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:462: ChatStream 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/gemini.go:708: ListModels 86.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:56: GetNotableCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:64: NewNotableModelsCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:85: Refresh 79.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:150: IsNotable 42.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:219: getModelFamilyAliases 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:245: getProviderIDs 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:254: normalizeKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:259: normalizeModelID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:291: isRecentlyReleased 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/notable_models.go:312: parseFlexibleDate 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:23: NewOllamaClient 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:45: Name 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:113: Chat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:261: SupportsThinking 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:280: ChatStream 70.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:455: TestConnection 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/ollama.go:476: ListModels 72.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:34: NewOpenAIClient 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:75: Name 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:179: isDeepSeek 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:184: isDeepSeekReasoner 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:189: requiresMaxCompletionTokens 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:196: isGPT52NonChat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:205: Chat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:491: TestConnection 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:496: modelsEndpoint 69.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:527: SupportsThinking 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:587: ChatStream 68.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/providers/openai.go:859: ListModels 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/resource_context.go:31: SetResourceProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/resource_context.go:39: buildUnifiedResourceContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/resource_context.go:305: min 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/routing.go:36: Error 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/routing.go:45: ForAI 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/routing.go:70: routeToAgent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/routing.go:299: extractVMIDFromTargetID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/routing.go:323: findClusterPeerAgent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:109: NewService 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:140: acquireExecutionSlot 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:163: enforceBudget 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:192: SetStateProvider 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:216: GetStateProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:223: GetPatrolService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:230: GetRemediationLog 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:241: GetAlertTriggeredAnalyzer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:248: GetAIConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:255: GetCostSummary 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:288: ListCostEvents 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:299: ClearCostHistory 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:311: SetPatrolThresholdProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:335: SetMetricsHistoryProvider 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:346: SetBaselineStore 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:357: SetChangeDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:368: SetRemediationLog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:379: SetIncidentStore 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:390: SetPatternDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:401: SetCorrelationDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:412: SetLicenseChecker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:419: HasLicenseFeature 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:432: GetLicenseState 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:453: StartPatrol 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:513: StopPatrol 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:529: ReconfigurePatrol 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:577: enrichRequestFromFinding 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:650: lookupNodeForVMID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:669: lookupGuestsByVMID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:715: extractVMIDFromCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:759: formatApprovalNeededToolResult 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:777: formatPolicyBlockedToolResult 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:791: parseApprovalNeededMarker 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:820: approvalNeededFromToolCall 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:852: LoadConfig 80.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:955: IsEnabled 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:966: GetConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:977: GetDebugContext 85.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1063: IsAutonomous 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1115: getModelForRequest 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1176: Execute 81.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1376: ExecuteStream 81.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1765: getToolInputDisplay 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1789: logRemediation 89.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1869: isActionableCommand 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:1911: generateRemediationSummary 94.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2071: hasAgentForTarget 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2154: getTools 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2271: executeTool 65.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2545: getGuestID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2557: GetGuestKnowledge 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2565: SaveGuestNote 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2573: DeleteGuestNote 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2581: fetchURL 89.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2638: parseAndValidateFetchURL 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2691: isBlockedFetchHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2699: isBlockedFetchIP 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2718: sanitizeError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2754: executeOnAgent 93.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2876: RunCommand 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:2924: buildSystemPrompt 88.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3233: formatContextKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3278: buildUserAnnotationsContext 94.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3346: TestConnection 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3385: ListModels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3390: ListModelsWithCache 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3455: buildModelsCacheKey 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3475: providerDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3493: Reload 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3498: buildRemediationContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3550: buildIncidentContext 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3569: RecordIncidentAnalysis 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3583: RecordIncidentRunbook 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3596: extractAlertID 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3610: truncateString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3623: buildEnrichedResourceContext 33.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/service.go:3901: absFloat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:27: NewAlertManagerMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:35: GetActiveAlerts 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:66: NewStorageMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:74: GetStorage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:83: GetCephClusters 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:97: NewBackupMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:105: GetBackups 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:114: GetPBSInstances 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:128: NewDiskHealthMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:136: GetHosts 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:164: NewMetricsHistoryMCPAdapter 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:175: GetResourceMetrics 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:203: GetAllMetricsSummary 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:237: computeSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:270: mergeMetricsByTimestamp 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:300: computeStats 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:316: computeTrend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:370: NewBaselineMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:378: GetBaseline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:397: GetAllBaselines 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:456: NewPatternMCPAdapter 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:464: GetPatterns 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:490: GetPredictions 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:515: getResourceName 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:552: NewFindingsManagerMCPAdapter 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:560: ResolveFinding 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:568: DismissFinding 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:588: NewMetadataUpdaterMCPAdapter 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:596: SetResourceURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:624: NewUpdatesMCPAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:632: GetPendingUpdates 82.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:686: TriggerUpdateCheck 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:705: UpdateContainer 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:724: IsUpdateActionsEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/adapters.go:732: trimContainerName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:179: NewPulseToolExecutor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:207: SetContext 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:214: SetControlLevel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:219: SetProtectedGuests 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:226: SetMetadataUpdater 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:231: SetFindingsManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:236: SetMetricsHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:241: SetBaselineProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:246: SetPatternProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:251: SetAlertProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:256: SetFindingsProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:261: SetBackupProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:266: SetStorageProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:271: SetDiskHealthProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:276: SetAgentProfileManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:281: SetUpdatesProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:286: ListTools 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:301: isToolAvailable 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:343: ExecuteTool 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/executor.go:353: registerTools 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/protocol.go:212: NewTextContent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/protocol.go:220: NewErrorResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/protocol.go:228: NewTextResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/protocol.go:237: NewJSONResult 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/registry.go:27: NewToolRegistry 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/registry.go:35: Register 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/registry.go:47: ListTools 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/registry.go:64: Execute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:17: registerControlTools 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:140: executeRunCommand 41.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:231: executeControlGuest 23.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:342: executeControlDocker 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:428: findAgentForCommand 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:453: resolveGuest 54.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:490: resolveDockerContainer 39.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:556: findAgentForNode 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:588: findAgentForDockerHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:615: getAgentHostnameForDockerHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:637: createApprovalRecord 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:663: isPreApproved 20.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:691: formatApprovalNeeded 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:704: formatPolicyBlocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:715: formatTargetHostRequired 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:741: formatCommandSuggestion 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:752: formatControlApprovalNeeded 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:767: formatDockerApprovalNeeded 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:782: formatControlSuggestion 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_control.go:790: formatDockerSuggestion 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:11: registerInfrastructureTools 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:677: executeListBackups 70.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:786: executeListStorage 75.9%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:870: executeGetDiskHealth 85.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:942: executeListDockerUpdates 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:968: executeCheckDockerUpdates 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1009: executeUpdateDockerContainer 61.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1078: resolveDockerHostID 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1095: getDockerHostName 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1112: formatDockerUpdateApprovalNeeded 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1127: trimLeadingSlash 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1135: executeGetTemperatures 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1211: executeGetCephStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1274: executeGetReplication 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1341: containsAny 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1353: executeListSnapshots 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1428: executeListPBSJobs 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1541: executeListBackupTasks 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1613: executeGetNetworkStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1706: executeGetDiskIOStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1759: executeGetClusterStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1845: executeGetSwarmStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1883: executeListDockerServices 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:1948: executeListDockerTasks 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:2006: executeListRecentTasks 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:2068: executeListPhysicalDisks 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:2157: executeGetHostRAIDStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:2251: executeGetHostCephDetails 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:2399: executeGetResourceDisks 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_infrastructure.go:2544: executeGetConnectionHealth 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:12: registerPatrolTools 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:262: executeGetMetrics 73.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:356: executeGetBaselines 32.8%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:461: executeGetPatterns 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:482: executeListAlerts 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:527: executeListFindings 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:652: executeResolveFinding 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:679: executeDismissFinding 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_patrol.go:713: executeListResolvedAlerts 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_pmg.go:9: registerPMGTools 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_pmg.go:103: executeGetPMGStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_pmg.go:162: executeGetMailStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_pmg.go:218: executeGetMailQueues 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_pmg.go:274: executeGetSpamStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:13: registerProfileTools 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:73: executeGetAgentScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:138: executeSetAgentScope 73.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:259: resolveAgentFromHostname 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:283: resolveAgentLabel 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:301: firstNonEmpty 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:311: formatSettingsSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_profiles.go:327: detectAgentModules 96.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:22: registerQueryTools 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:265: executeGetCapabilities 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:302: executeGetURLContent 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:341: executeListInfrastructure 35.6%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:526: executeGetTopology 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:764: executeSetResourceURL 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:799: executeGetResource 51.2%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:962: executeSearchResources 70.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:1146: intArg 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:1163: registerKubernetesTools 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:1283: executeGetKubernetesClusters 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:1330: executeGetKubernetesNodes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:1392: executeGetKubernetesPods 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ai/tools/tools_query.go:1485: executeGetKubernetesDeployments 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:74: normalizePoweredOffSeverity 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:109: Clone 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:137: cloneMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:149: cloneMetadataValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:488: SetMetricHooks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:557: NewManager 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:733: SetLicenseChecker 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:740: addRecentlyResolvedUnlocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:748: addRecentlyResolvedWithPrimaryLock 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:755: SetAlertCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:762: SetResolvedCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:769: SetAcknowledgedCallback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:776: SetUnacknowledgedCallback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:783: SetEscalateCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:790: safeCallResolvedCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:815: safeCallAcknowledgedCallback 25.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:835: safeCallUnacknowledgedCallback 25.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:855: safeCallEscalateCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:879: checkFlappingLocked 95.2%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:928: dispatchAlert 71.9%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1015: isMonitorOnlyAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1032: ensureValidHysteresis 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1051: UpdateConfig 96.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1111: normalizeStorageDefaults 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1127: normalizeDockerThreshold 84.6%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1155: normalizeDockerDefaults 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1197: normalizePMGDefaults 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1249: normalizeSnapshotDefaults 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1277: normalizeBackupDefaults 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1291: normalizeNodeDefaults 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1308: normalizeHostDefaults 78.8%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1357: normalizeGeneralSettings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1373: normalizeTimeThresholds 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1399: migrateActivationState 11.1%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1419: validateHysteresisThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1430: validateQuietHoursTimezone 20.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1445: normalizeOverrides 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1456: normalizeMetricTimeThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1487: NormalizeMetricTimeThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1493: NormalizeDockerIgnoredPrefixes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1524: applyGlobalOfflineSettingsLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1606: reevaluateActiveAlertsLocked 80.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1862: ReevaluateGuestAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1935: getThresholdForMetric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:1962: getThresholdForMetricFromConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2006: isInQuietHours 96.2%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2059: quietHoursCategoryForAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2087: shouldSuppressNotification 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2122: ShouldSuppressResolvedNotification 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2144: shouldNotifyAfterCooldown 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2163: GetConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2170: CheckGuest 96.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2511: CheckNode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2599: RegisterHostAgentHostname 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2614: UnregisterHostAgentHostname 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2631: hasHostAgentForNode 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2642: hostResourceID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2650: hostDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2663: hostInstanceName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2673: sanitizeHostComponent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2705: sanitizeRAIDDevice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2711: hostDiskResourceID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:2725: CheckHost 88.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3045: HandleHostOnline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3064: HandleHostRemoved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3081: HandleHostOffline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3188: clearHostMetricAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3201: clearHostDiskAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3222: cleanupHostDiskAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3246: clearHostRAIDAlerts 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3264: CheckPBS 98.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3388: CheckPMG 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3494: dockerInstanceName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3506: dockerContainerDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3522: dockerResourceID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3538: dockerServiceDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3553: dockerServiceResourceID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3588: matchesDockerIgnoredPrefix 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3613: CheckDockerHost 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3669: evaluateDockerContainer 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3796: evaluateDockerService 83.6%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3936: clearDockerServiceAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3942: HandleDockerHostOnline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3960: HandleDockerHostRemoved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:3972: HandleDockerHostOffline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4073: checkDockerContainerState 67.4%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4172: clearDockerContainerStateAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4180: checkDockerContainerHealth 94.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4238: clearDockerContainerHealthAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4244: checkDockerContainerRestartLoop 95.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4347: checkDockerContainerOOMKill 96.2%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4422: checkDockerContainerMemoryLimit 74.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4504: clearDockerContainerMetricAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4515: checkDockerContainerImageUpdate 90.6%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4639: cleanupDockerContainerAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4675: clearDockerHostContainerAlerts 90.5%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4713: CheckStorage 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4814: BuildGuestKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:4824: CheckSnapshotsForInstance 72.6%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5111: CheckBackups 71.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5509: checkZFSPoolHealth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5691: clearAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5718: getTimeThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5735: getMetricTimeThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5769: getBaseTimeThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5784: getGlobalMetricTimeThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5815: canonicalResourceTypeKeys 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:5863: checkMetric 71.9%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6196: sanitizeAlertKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6241: abs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6251: namespaceMatchesInstance 94.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6298: AcknowledgeAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6334: UnacknowledgeAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6365: preserveAlertState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6406: removeActiveAlertNoLock 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6419: GetActiveAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6432: NotifyExistingAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6447: GetRecentlyResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6475: GetResolvedAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6491: GetAlertHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6496: GetAlertHistorySince 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6505: ClearAlertHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6511: OnAlertHistory 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6518: checkNodeOffline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6604: clearNodeOfflineAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6646: checkPBSOffline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6714: clearPBSOfflineAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6756: checkPMGOffline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6824: clearPMGOfflineAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:6867: checkPMGQueueDepths 90.5%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7043: checkPMGOldestMessage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7122: checkPMGNodeQueues 85.1%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7280: isQueueOutlier 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7290: scaleThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7302: calculateMedianInt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7326: createOrUpdateNodeAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7370: checkPMGQuarantineBacklog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7429: checkQuarantineMetric 93.1%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7546: calculateTrimmedBaseline 96.9%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7610: checkPMGAnomalies 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7700: checkAnomalyMetric 89.6%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7862: checkStorageOffline 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7931: clearStorageOfflineAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:7973: checkGuestPoweredOff 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8078: clearGuestPoweredOffAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8120: ClearAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8139: Cleanup 91.8%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8351: convertLegacyThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8365: cloneThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8373: cloneStringPtr 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8381: cloneThresholdConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8397: applyThresholdOverride 91.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8475: ensureHysteresisThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8491: parsePulseTags 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8507: applyRelaxedGuestThresholds 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8534: suppressGuestAlerts 96.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8580: guestHasMonitorOnlyAlerts 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8600: checkRateLimit 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8631: escalationChecker 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8650: checkEscalations 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8693: Stop 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8708: SaveActiveAlerts 73.1%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8757: saveActiveAlertsAsync 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8777: LoadActiveAlerts 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8936: CleanupAlertsForNodes 92.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:8991: ClearActiveAlerts 92.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9028: periodicSaveAlerts 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9046: trackingMapCleanup 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9064: cleanupStaleMaps 98.9%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9228: hasKnownFirmwareBug 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9251: CheckDiskHealth 98.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9397: clearAlertNoLock 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9423: clearSnapshotAlertsForInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9429: clearSnapshotAlertsForInstanceLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9441: clearBackupAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/alerts.go:9447: clearBackupAlertsLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:12: evaluateFilterCondition 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:39: extractGuestMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:75: evaluateGuestCondition 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:124: evaluateNumericCondition 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:151: evaluateVMCondition 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:157: evaluateContainerCondition 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:163: evaluateFilterStack 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:193: getGuestThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/filter_evaluation.go:336: tryLegacyOverrideMigration 84.6%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:49: NewHistoryManager 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:83: OnAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:90: AddAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:111: GetHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:131: GetAllHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:150: loadHistory 76.2%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:191: saveHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:196: saveHistoryWithRetry 85.3%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:265: startPeriodicSave 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:283: cleanupRoutine 44.4%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:308: cleanOldEntries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:334: RemoveAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:356: ClearAllHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:372: Stop 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:385: GetStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/alerts/history.go:407: getFileSize 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:26: NewMCPAgentProfileManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:34: ApplyAgentScope 78.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:120: AssignProfile 73.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:158: GetAgentScope 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:206: assignProfile 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:244: validateSettings 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:255: formatValidationIssues 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:269: saveVersion 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:290: logChange 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:296: requireLicense 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/agent_profiles_tools.go:303: buildScopeProfileName 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:73: NewAIHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:88: Start 86.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:135: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:144: Restart 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:154: IsRunning 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:159: GetService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:164: GetAIConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:168: loadAIConfig 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:188: HandleChat 82.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:318: HandleSessions 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:335: HandleCreateSession 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:352: HandleDeleteSession 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:367: HandleMessages 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:384: HandleAbort 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:399: HandleStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:411: HandleSummarize 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:429: HandleDiff 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:447: HandleFork 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:465: HandleRevert 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:483: HandleUnrevert 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:508: HandleAnswerQuestion 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:544: SetAlertProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:551: SetFindingsProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:558: SetBaselineProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:565: SetPatternProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:572: SetMetricsHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:579: SetAgentProfileManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:586: SetStorageProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:593: SetBackupProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:600: SetDiskHealthProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:607: SetUpdatesProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:614: SetFindingsManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:621: SetMetadataUpdater 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handler.go:628: UpdateControlSettings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:43: NewAISettingsHandler 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:58: GetAIService 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:63: SetConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:71: SetStateProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:76: SetResourceProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:81: SetMetadataProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:86: StartPatrol 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:91: IsAIEnabled 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:96: SetPatrolThresholdProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:101: SetPatrolFindingsPersistence 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:109: SetPatrolRunHistoryPersistence 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:117: SetMetricsHistoryProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:122: SetBaselineStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:127: SetChangeDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:132: SetRemediationLog 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:137: SetIncidentStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:142: SetPatternDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:147: SetCorrelationDetector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:152: StopPatrol 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:157: GetAlertTriggeredAnalyzer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:162: SetLicenseChecker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:168: SetOnModelChange 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:174: SetOnControlSettingsChange 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:262: HandleGetAISettings 52.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:330: HandleUpdateAISettings 32.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:736: HandleTestAIConnection 68.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:775: HandleTestProvider 47.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:844: HandleListModels 68.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:944: HandleExecute 44.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1057: HandleAnalyzeKubernetesCluster 22.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1119: HandleExecuteStream 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1387: HandleRunCommand 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1466: HandleGetGuestKnowledge 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1485: HandleSaveGuestNote 58.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1515: HandleDeleteGuestNote 58.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1541: HandleExportGuestKnowledge 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1564: HandleImportGuestKnowledge 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1639: HandleClearGuestKnowledge 32.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1690: HandleDebugContext 42.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1712: HandleGetConnectedAgents 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1767: HandleInvestigateAlert 10.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:1991: SetAlertProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2002: HandleOAuthStart 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2048: HandleOAuthExchange 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2181: HandleOAuthCallback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2274: HandleOAuthDisconnect 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2349: HandleGetPatrolStatus 36.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2412: HandleGetIntelligence 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2463: HandlePatrolStream 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2512: previewTitle 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2529: previewResourceName 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2560: redactFindingsForPreview 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2590: redactPatrolRunHistory 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2604: HandleGetPatrolFindings 36.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2640: HandleForcePatrol 17.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2681: HandleAcknowledgeFinding 12.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2736: HandleSnoozeFinding 26.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2802: HandleResolveFinding 12.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2857: HandleDismissFinding 28.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2925: HandleSuppressFinding 12.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:2979: HandleClearAllFindings 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3019: HandleGetFindingsHistory 14.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3061: HandleGetPatrolRunHistory 35.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3100: HandleGetAICostSummary 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3135: HandleResetAICostHistory 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3181: HandleExportAICostHistory 7.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3285: HandleGetSuppressionRules 21.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3313: HandleAddSuppressionRule 9.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3390: HandleDeleteSuppressionRule 14.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3436: HandleGetDismissedFindings 21.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3468: HandleListAIChatSessions 58.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3514: HandleGetAIChatSession 45.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3558: HandleSaveAIChatSession 42.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3645: HandleDeleteAIChatSession 48.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3694: getAuthUsername 44.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3723: HandleListApprovals 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3765: HandleGetApproval 57.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3798: HandleApproveCommand 62.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3869: HandleDenyCommand 69.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:3923: HandleRollback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:4031: HandleGetRollbackable 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:4080: HandleDryRunSimulate 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_handlers.go:4106: truncateForLog 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:17: HandleGetPatterns 18.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:100: HandleGetPredictions 17.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:185: HandleGetCorrelations 17.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:274: HandleGetRecentChanges 16.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:363: HandleGetBaselines 18.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:447: HandleGetRemediations 15.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:574: remediationStatsFromRecords 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:609: HandleGetAnomalies 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ai_intelligence_handlers.go:850: HandleGetLearningStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:58: NewAlertHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:66: SetMonitor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:73: validateAlertID 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:102: GetAlertConfig 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:111: UpdateAlertConfig 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:164: ActivateAlerts 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:226: GetActiveAlerts 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:235: GetAlertHistory 56.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:400: GetAlertIncidentTimeline 56.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:469: SaveAlertIncidentNote 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:524: ClearAlertHistory 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:536: UnacknowledgeAlert 73.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:605: AcknowledgeAlert 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:692: AcknowledgeAlertByBody 73.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:738: UnacknowledgeAlertByBody 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:782: ClearAlertByBody 70.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:824: ClearAlert 70.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:880: BulkAcknowledgeAlerts 82.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:945: BulkClearAlerts 64.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/alerts.go:1004: HandleAlerts 69.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:24: NewAuditHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:29: HandleListAuditEvents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:110: HandleVerifyAuditEvent 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:175: HandleGetWebhooks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:189: HandleUpdateWebhooks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:227: validateWebhookURL 95.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:287: isPrivateOrReservedIP 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:308: isPersistentLogger 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:315: HandleExportAuditEvents 94.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/audit_handlers.go:391: HandleAuditSummary 92.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:34: InitSessionStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:41: GetSessionStore 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:50: detectProxy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:64: isConnectionSecure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:71: getCookieSettings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:105: generateSessionToken 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:116: ValidateSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:121: ValidateAndExtendSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:126: CheckProxyAuth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:185: CheckAuth 74.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:534: RequireAuth 78.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:573: RequireAdmin 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:635: RequirePermission 53.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:700: RequireScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:709: respondMissingScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:724: ensureScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:736: attachAPITokenRecord 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:745: getAPITokenRecordFromRequest 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:757: adminBypassEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/auth.go:780: refreshOIDCSessionTokens 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/bootstrap_token.go:23: generateBootstrapToken 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/bootstrap_token.go:31: loadOrCreateBootstrapToken 78.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/bootstrap_token.go:67: initializeBootstrapToken 92.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/bootstrap_token.go:109: bootstrapTokenValid 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/bootstrap_token.go:120: clearBootstrapToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/bootstrap_token.go:142: handleValidateBootstrapToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:45: sanitizeInstallerURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:67: sanitizeSetupAuthToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:108: NewConfigHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:130: SetMonitor 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:135: SetConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:143: cleanupExpiredCodes 23.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:166: ValidateSetupToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:190: markAutoRegistered 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:200: clearAutoRegistered 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:210: isRecentlyAutoRegistered 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:229: findInstanceNameByHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:249: sanitizeErrorMessage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:266: normalizePVEUser 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:279: shouldSkipClusterAutoDetection 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:293: maybeRefreshClusterInfo 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:429: isContainerSSHRestricted 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:439: deriveSchemeAndPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:470: ensureHostHasPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:496: validateNodeAPI 54.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:605: findExistingGuestURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:615: findExistingIPOverride 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:626: extractIPFromHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:655: ipsOnSameNetwork 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:694: findPreferredIP 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:720: defaultDetectPVECluster 20.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:954: GetAllNodesForAPI 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1050: HandleGetNodes 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1187: validateIPAddress 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1199: validatePort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1208: extractHostAndPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1237: defaultPortForNodeType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1251: normalizeNodeHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1299: extractHostIP 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1317: resolveHostnameToIP 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1352: disambiguateNodeName 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1391: HandleAddNode 31.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:1893: HandleTestConnection 28.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:2192: HandleUpdateNode 29.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:2562: HandleDeleteNode 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:2685: HandleRefreshClusterNodes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:2801: HandleTestNodeConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:2953: HandleTestNode 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3135: getNodeStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3166: HandleGetSystemSettings 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3216: HandleVerifyTemperatureSSH 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3295: generateNodeID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3311: HandleExportConfig 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3353: HandleImportConfig 46.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3461: HandleDiscoverServers 35.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:3588: HandleSetupScript 88.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:4653: generateSetupCode 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:4667: HandleSetupScriptURL 94.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:4768: HandleGetMockMode 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:4796: HandleUpdateMockMode 42.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:4884: HandleAutoRegister 38.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:5515: handleSecureAutoRegister 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:5693: getOrGenerateSSHKeys 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:5731: generateOrLoadSSHKey 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_handlers.go:5810: HandleAgentInstallCommand 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:26: NewConfigProfileHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:34: SetAIHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:39: ServeHTTP 59.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:141: ListProfiles 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:156: CreateProfile 64.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:245: getUsernameFromRequest 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:253: UpdateProfile 69.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:357: DeleteProfile 59.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:428: ListAssignments 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:443: AssignProfile 67.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:515: UnassignProfile 74.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:585: GetProfile 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:605: GetConfigSchema 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:612: ValidateConfig 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:625: GetChangeLog 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:655: GetDeploymentStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:685: UpdateDeploymentStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:749: GetProfileVersions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:775: RollbackProfile 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:876: saveVersionHistory 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/config_profiles.go:891: logChange 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:34: csrfSessionKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:38: csrfTokenHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:62: InitCSRFStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:80: GetCSRFStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:88: backgroundWorker 33.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:102: GenerateCSRFToken 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:127: ValidateCSRFToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:144: DeleteCSRFToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:153: cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:167: save 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:178: saveUnsafe 78.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/csrf_store.go:221: load 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/demo_middleware.go:13: DemoModeMiddleware 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:91: isFallbackMemorySource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:316: handleDiagnostics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:352: writeDiagnosticsResponse 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:363: computeDiagnostics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:564: copyStringSlice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:571: buildDiscoveryDiagnostic 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:648: buildAPITokenDiagnostic 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:789: buildDockerAgentDiagnostic 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:929: buildAlertsDiagnostic 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1007: fingerprintPublicKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1019: resolveUserName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1027: resolveGroupName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1035: countLegacySSHKeys 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1056: hasLegacyThresholds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1066: preferredDockerHostName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1079: formatTimeMaybe 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1086: normalizeVersionLabel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1102: checkVMDiskMonitoring 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1367: checkPhysicalDisks 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1466: contains 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1475: containsFold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1489: interfaceToStringSlice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/diagnostics.go:1508: buildAIChatDiagnostic 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:42: normalizeCommandStatus 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:59: NewDockerAgentHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:64: SetMonitor 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:69: HandleReport 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:130: HandleDockerHostActions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:171: HandleCommandAck 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:236: HandleDeleteHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:334: HandleAllowReenroll 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:365: HandleUnhideHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:397: HandleMarkPendingUninstall 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:429: HandleSetCustomDisplayName 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:476: HandleContainerUpdate 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_agents.go:538: HandleCheckUpdates 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:19: NewDockerMetadataHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:26: Store 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:31: HandleGetMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:74: HandleUpdateMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:143: HandleDeleteMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:167: HandleGetHostMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:210: HandleUpdateHostMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/docker_metadata.go:294: HandleDeleteHostMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/frontend_embed.go:28: getFrontendDevProxy 35.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/frontend_embed.go:57: getFrontendFS 42.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/frontend_embed.go:72: serveFrontendHandler 72.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/guest_metadata.go:19: NewGuestMetadataHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/guest_metadata.go:26: Reload 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/guest_metadata.go:31: Store 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/guest_metadata.go:36: HandleGetMetadata 73.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/guest_metadata.go:79: HandleUpdateMetadata 52.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/guest_metadata.go:148: HandleDeleteMetadata 46.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:38: NewHostAgentHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:43: SetMonitor 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:48: HandleReport 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:109: HandleLookup 97.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:205: HandleDeleteHost 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:241: HandleConfig 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:262: canReadConfig 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:271: resolveConfigHost 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:292: signHostConfig 25.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:335: getConfigSigningKey 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:352: isConfigSignatureRequired 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:357: handleGetConfig 58.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:403: tokenID 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:410: ensureHostTokenMatch 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:437: handlePatchConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:476: HandleUninstall 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:521: HandleLink 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_agents.go:570: HandleUnlink 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_metadata.go:19: NewHostMetadataHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_metadata.go:26: Store 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_metadata.go:31: HandleGetMetadata 42.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_metadata.go:74: HandleUpdateMetadata 42.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/host_metadata.go:143: HandleDeleteMetadata 46.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:20: initHTTPMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:55: recordAPIRequest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:68: classifyStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:79: normalizeRoute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:110: normalizeSegment 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:123: isNumeric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/http_metrics.go:135: looksLikeUUID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:23: NewKubernetesAgentHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:28: SetMonitor 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:33: HandleReport 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:84: HandleClusterActions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:119: HandleDeleteCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:151: HandleAllowReenroll 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:179: HandleUnhideCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:211: HandleMarkPendingUninstall 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/kubernetes_agents.go:243: HandleSetCustomDisplayName 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:21: NewLicenseHandlers 47.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:62: initAuditLoggerIfLicensed 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:86: Service 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:92: HandleLicenseStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:113: HandleLicenseFeatures 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:160: HandleActivateLicense 90.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:232: HandleClearLicense 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:259: RequireLicenseFeature 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/license_handlers.go:280: LicenseGatedEmptyResponse 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/log_redact.go:3: safePrefixForLog 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/metadata_provider.go:17: NewMetadataProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/metadata_provider.go:30: SetGuestURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/metadata_provider.go:50: SetDockerURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/metadata_provider.go:70: SetHostURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:28: Error 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:33: ErrorHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:97: writeErrorResponse 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:121: WriteHeader 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:129: Write 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:136: StatusCode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:144: Hijack 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/middleware.go:153: Flush 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:16: NewAlertMonitorWrapper 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:23: GetAlertManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:27: GetConfigPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:31: GetIncidentStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:35: GetNotificationManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:39: SyncAlertState 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:43: GetState 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:53: NewNotificationMonitorWrapper 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:60: GetNotificationManager 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:64: GetConfigPersistence 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/monitor_wrappers.go:68: GetState 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notification_queue.go:21: NewNotificationQueueHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notification_queue.go:28: GetDLQ 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notification_queue.go:59: GetQueueStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notification_queue.go:83: RetryDLQItem 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notification_queue.go:130: DeleteDLQItem 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notification_queue.go:177: HandleNotificationQueue 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:58: NewNotificationHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:65: SetMonitor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:70: GetEmailConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:81: UpdateEmailConfig 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:130: GetAppriseConfig 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:140: UpdateAppriseConfig 64.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:184: GetWebhooks 73.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:230: CreateWebhook 68.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:280: UpdateWebhook 72.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:374: DeleteWebhook 53.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:402: TestNotification 64.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:522: GetWebhookTemplates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:530: GetWebhookHistory 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:545: redactSecretsFromURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:608: GetEmailProviders 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:616: TestWebhook 68.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:732: GetNotificationHealth 76.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:776: countEnabledWebhooks 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/notifications.go:787: HandleNotifications 61.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:19: handleOIDCLogin 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:96: handleOIDCCallback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:312: getOIDCService 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:338: sanitizeOIDCReturnTo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:349: redirectOIDCError 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:362: addQueryParam 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:376: extractStringClaim 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:403: extractStringSliceClaim 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:434: matchesValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:447: matchesDomain 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:466: intersects 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:482: ensureOIDCConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_handlers.go:492: buildRedirectURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:48: NewOIDCService 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:114: Matches 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:155: newStateEntry 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:182: consumeState 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:186: authCodeURL 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:197: exchangeCode 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:206: contextWithHTTPClient 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:221: RefreshToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:265: newOIDCHTTPClient 86.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:305: hashCABundle 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:333: newOIDCStateStore 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:358: cleanup 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:371: Stop 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:375: Put 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:381: Consume 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:398: generateRandomURLString 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/oidc_service.go:406: generatePKCEPair 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/profile_suggestions.go:24: NewProfileSuggestionHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/profile_suggestions.go:45: HandleSuggestProfile 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/profile_suggestions.go:161: parseAISuggestion 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/profile_suggestions.go:238: buildConfigSchemaDoc 45.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rate_limit_config.go:25: InitializeRateLimiters 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rate_limit_config.go:54: GetRateLimiterForEndpoint 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rate_limit_config.go:120: UniversalRateLimitMiddleware 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rate_limit_config.go:177: ResetRateLimitForIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rate_limit_config.go:200: Reset 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ratelimit.go:19: NewRateLimiter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ratelimit.go:46: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ratelimit.go:52: Allow 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ratelimit.go:83: cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/ratelimit.go:106: Middleware 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:26: NewRBACHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:31: HandleRoles 45.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:148: HandleGetUsers 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:166: HandleUserRoleActions 51.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:242: HandleRBACChangelog 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:291: HandleRoleEffective 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/rbac_handlers.go:333: HandleUserEffectivePermissions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:40: InitRecoveryTokenStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:55: GetRecoveryTokenStore 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:63: GenerateRecoveryToken 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:94: ValidateRecoveryTokenConstantTime 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:143: cleanupRoutine 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:159: cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:181: saveUnsafe 73.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/recovery_tokens.go:212: load 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/reporting_handlers.go:20: NewReportingHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/reporting_handlers.go:25: HandleGenerateReport 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/reporting_handlers.go:108: sanitizeFilename 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:24: NewResourceHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:31: SetStateProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:36: Store 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:49: HandleGetResources 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:119: HandleGetResource 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:144: HandleGetResourceStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:165: PopulateFromSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:217: parseResourceTypes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:230: parsePlatformTypes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/resource_handlers.go:243: parseStatuses 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:92: pulseBinDir 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:99: isDirectLoopbackRequest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:120: NewRouter 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:198: setupRoutes 40.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1445: routeAISessions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1489: routeApprovals 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1522: routeQuestions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1548: handleAgentWebSocket 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1556: handleVerifyTemperatureSSH 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1590: handleSSHConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1621: extractSetupToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1634: extractBearerToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1652: Handler 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1660: SetMonitor 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1723: SetConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1746: StartPatrol 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1889: StopPatrol 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1897: StartAIChat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:1938: wireAIChatProviders 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2085: GetGuestMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2090: GetNodeMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2095: GetAllGuestMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2104: convertMetricPoints 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2120: GetBaseline 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2131: GetAllBaselines 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2166: GetPatterns 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2192: GetPredictions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2220: IsDockerUpdateActionsEnabled 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2228: StopAIChat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2238: RestartAIChat 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2250: startBaselineLearning 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2285: learnBaselines 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2361: GetAlertTriggeredAnalyzer 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2370: WireAlertTriggeredAI 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2388: reloadSystemSettings 38.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2419: ServeHTTP 57.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2742: capturePublicURLFromRequest 76.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2839: firstForwardedValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2847: sanitizeForwardedHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2869: isLoopbackHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2885: shouldAppendForwardedPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2901: canCapturePublicURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2913: isRequestAuthenticated 82.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2960: handleHealth 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2980: handleSchedulerHealth 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:2998: handleChangePassword 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3263: handleLogout 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3314: establishSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3354: establishOIDCSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3396: handleLogin 41.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3564: handleResetLockout 20.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3620: handleState 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3657: handleVersion 54.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3725: handleAgentVersion 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3744: handleServerInfo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3768: handleStorage 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:3814: handleCharts 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4179: handleStorageCharts 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4219: handleMetricsStoreStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4261: handleMetricsHistory 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4397: handleConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4418: handleBackups 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4448: handleBackupsPVE 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4476: handleBackupsPBS 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4504: handleSnapshots 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4532: handleWebSocket 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4541: handleSimpleStats 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4758: handleSocketIO 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4797: forwardUpdateProgress 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4821: backgroundUpdateChecker 63.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4846: handleDownloadInstallScript 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4874: handleDownloadContainerAgentInstallScript 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4890: handleDownloadAgent 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4953: handleDownloadHostAgentInstallScript 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4982: handleDownloadHostAgentInstallScriptPS 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:4999: handleDownloadHostAgentUninstallScript 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5015: handleDownloadHostAgentUninstallScriptPS 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5032: handleDownloadHostAgent 28.6%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5101: tryServeHostAgentBinary 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5135: hostAgentSearchCandidates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5166: dedupeStrings 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5182: sortedHostAgentKeys 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5200: cachedSHA256 69.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5248: serveChecksum 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5265: handleDiagnosticsDockerPrepareToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5348: handleDownloadDockerInstallerScript 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5375: resolvePublicURL 94.4%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5408: fileExists 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/router.go:5413: normalizeDockerAgentArch 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:25: NewSAMLServiceManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:33: GetService 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:40: InitializeProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:58: RemoveProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:65: handleSAMLLogin 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:129: handleSAMLACS 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:271: handleSAMLMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:325: handleSAMLLogout 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:372: handleSAMLSLO 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:388: establishSAMLSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:440: getSAMLSessionInfo 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:459: clearSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:472: redirectSAMLError 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:486: extractSAMLProviderID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:502: getSSOProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:510: InitializeSAMLProviders 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_handlers.go:531: RefreshSAMLProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:50: NewSAMLService 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:75: newSAMLHTTPClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:87: loadIDPMetadata 63.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:123: fetchIDPMetadataFromURL 69.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:147: parseIDPMetadataXML 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:163: buildManualMetadata 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:225: addIDPCertificate 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:269: initServiceProvider 76.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:338: loadSPCredentials 71.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:408: MakeAuthRequest 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:435: ProcessResponse 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:519: extractAttribute 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:530: GetMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:543: MakeLogoutRequest 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:571: RefreshMetadata 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:585: ProviderID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:590: GetSPEntityID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/saml_service.go:601: GetIDPEntityID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:18: generateCSRFToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:23: validateCSRFToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:28: CheckCSRF 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:105: clearCSRFCookie 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:118: issueNewCSRFCookie 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:147: GetClientIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:185: loadTrustedProxyCIDRs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:229: extractRemoteIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:239: firstValidForwardedIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:256: isTrustedProxyIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:279: isPrivateIP 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:319: isTrustedNetwork 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:348: RecordFailedLogin 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:372: ClearFailedLogins 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:379: GetLockoutInfo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:399: ResetLockout 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:410: SecurityHeadersWithConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:486: LogAuditEvent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:497: TrackUserSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:508: GetSessionUsername 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security.go:532: InvalidateUserSessions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_oidc.go:13: handleOIDCConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_oidc.go:24: handleGetOIDCConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_oidc.go:34: handleUpdateOIDCConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_oidc.go:136: makeOIDCResponse 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:20: detectServiceName 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:40: validateBcryptHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:51: isRunningAsRoot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:55: ensureSettingsWriteScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:78: WriteHeader 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:85: Write 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:90: handleQuickSecuritySetupFixed 47.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:519: HandleRegenerateAPIToken 6.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_setup_fix.go:637: HandleValidateAPIToken 10.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_tokens.go:27: toAPITokenDTO 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_tokens.go:39: normalizeRequestedScopes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_tokens.go:84: handleListAPITokens 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_tokens.go:110: handleCreateAPIToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/security_tokens.go:174: handleDeleteAPIToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:24: sessionHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:70: NewSessionStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:88: backgroundWorker 33.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:102: CreateSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:129: CreateOIDCSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:164: CreateSAMLSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:191: GetSAMLSessionInfo 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:208: GetSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:223: UpdateOIDCTokens 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:247: InvalidateSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:252: SetTokenRefreshing 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:263: ValidateSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:276: ValidateAndExtendSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:301: DeleteSession 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:310: cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:324: save 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:331: saveUnsafe 78.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/session_store.go:384: load 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:37: validateProviderID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:45: sanitizeProviderName 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:61: validateURL 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:112: handleSSOProviders 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:124: handleSSOProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:152: handleListSSOProviders 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:171: handleGetSSOProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:187: handleCreateSSOProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:295: handleUpdateSSOProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:401: handleDeleteSSOProvider 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:438: saveSSOConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:445: providerToResponse 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:552: handleTestSSOProvider 73.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:607: testSAMLConnection 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:720: testOIDCConnection 81.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:853: handleMetadataPreview 80.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:971: newTestHTTPClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:982: fetchSAMLMetadataFromURL 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:1011: parseSAMLMetadataXML 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:1027: extractCertificateInfo 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:1061: base64Decode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/sso_handlers.go:1071: formatXML 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:43: NewSystemSettingsHandler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:62: SetMonitor 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:74: SetConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:81: firstValueForKeys 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:90: hasAnyKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:99: discoveryConfigMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:119: validateSystemSettings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:375: HandleGetSystemSettings 81.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:422: HandleUpdateSystemSettings 46.2%
+github.com/rcourtman/pulse-go-rewrite/internal/api/system_settings.go:779: HandleSSHConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/unified_agent.go:15: handleDownloadUnifiedInstallScript 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/unified_agent.go:46: handleDownloadUnifiedInstallScriptPS 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/unified_agent.go:75: normalizeUnifiedAgentArch 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/unified_agent.go:108: handleDownloadUnifiedAgent 52.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/unified_agent.go:191: proxyInstallScriptFromGitHub 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:20: NewUpdateDetectionHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:44: HandleGetInfraUpdates 37.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:85: HandleGetInfraUpdateForResource 42.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:113: HandleGetInfraUpdatesSummary 35.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:161: HandleTriggerInfraUpdateCheck 15.8%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:243: HandleGetInfraUpdatesForHost 54.5%
+github.com/rcourtman/pulse-go-rewrite/internal/api/update_detection.go:274: collectDockerUpdates 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:38: NewUpdateHandlers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:65: HandleCheckUpdates 76.9%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:90: HandleApplyUpdate 61.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:136: HandleUpdateStatus 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:189: HandleUpdateStream 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:238: cleanupRateLimits 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:247: doCleanupRateLimits 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:260: getClientIP 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:288: HandleGetUpdatePlan 59.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:331: HandleListUpdateHistory 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/api/updates.go:363: HandleGetUpdateHistoryEntry 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/buffer/buffer.go:15: New 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/buffer/buffer.go:23: Push 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/buffer/buffer.go:36: Pop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/buffer/buffer.go:51: Peek 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/buffer/buffer.go:63: Len 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/buffer/buffer.go:70: IsEmpty 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ceph/collector.go:125: IsAvailable 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ceph/collector.go:132: Collect 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ceph/collector.go:167: runCephCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ceph/collector.go:182: parseStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ceph/collector.go:315: parseDF 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ceph/collector.go:353: boolToInt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:115: GetAvailableModels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:120: NewDefaultAIConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:142: IsConfigured 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:171: HasProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:194: GetConfiguredProviders 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:215: GetAPIKeyForProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:251: GetBaseURLForProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:276: IsUsingOAuth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:282: ParseModelString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:308: FormatModelString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:314: GetBaseURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:330: GetModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:372: GetChatModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:381: GetPatrolModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:391: GetAutoFixModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:399: ClearOAuthTokens 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:406: ClearAPIKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:412: GetPatrolInterval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:446: PresetToMinutes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:468: IsPatrolEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:481: IsAlertTriggeredAnalysisEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:491: GetRequestTimeout 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:501: GetControlLevel 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:513: IsControlEnabled 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:519: IsAutonomous 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:524: IsValidControlLevel 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/ai.go:534: GetProtectedGuests 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:67: ensureScopes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:80: Clone 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:91: NewAPITokenRecord 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:110: NewHashedAPITokenRecord 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:130: tokenPrefix 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:138: tokenSuffix 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:146: HasAPITokens 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:151: APITokenCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:156: ActiveAPITokenHashes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:167: HasAPITokenHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:178: IsEnvMigrationSuppressed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:188: SuppressEnvMigration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:196: PrimaryAPITokenHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:204: PrimaryAPITokenHint 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:219: ValidateAPIToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:236: UpsertAPIToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:250: RemoveAPIToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:262: SortAPITokens 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:279: normalizeScopes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:289: HasScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/api_tokens.go:303: IsKnownScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:29: normalizeHostPort 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:59: CreateProxmoxConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:66: CreateProxmoxConfigWithHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:70: createProxmoxConfigWithHost 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:92: CreatePBSConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:105: CreatePMGConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:118: CreateProxmoxConfigFromFields 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:135: CreatePMGConfigFromFields 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/client_helpers.go:150: StripDefaultPort 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:54: IsPasswordHashed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:202: DefaultDiscoveryConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:217: CloneDiscoveryConfig 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:232: NormalizeDiscoveryConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:273: sanitizeCIDRList 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:298: UnmarshalJSON 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:395: IsValidDiscoveryEnvironment 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:404: splitAndTrim 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:467: EffectiveIP 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:526: Load 77.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:1493: SaveOIDCConfig 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:1510: Validate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:1588: detectPublicURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/config.go:1645: getOutboundIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/detect_root.go:15: detectAppRoot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:45: NewDockerMetadataStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:68: Load 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:124: save 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:162: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:173: GetAll 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:186: GetHostMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:197: GetAllHostMetadata 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:210: SetHostMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:227: Set 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:243: Delete 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/docker_metadata.go:254: ReplaceAll 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/export.go:37: ExportConfig 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/config/export.go:133: ImportConfig 77.2%
+github.com/rcourtman/pulse-go-rewrite/internal/config/export.go:251: encryptWithPassphrase 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/config/export.go:291: decryptWithPassphrase 89.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:34: NewGuestMetadataStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:56: Load 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:83: save 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:115: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:133: GetWithLegacyMigration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:197: GetAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:210: Set 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:226: Delete 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/guest_metadata.go:237: ReplaceAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:32: NewHostMetadataStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:54: Load 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:85: save 78.6%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:133: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:144: GetAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:157: Set 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:173: Delete 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/host_metadata.go:184: ReplaceAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/import_transaction.go:25: newImportTransaction 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/import_transaction.go:43: StageFile 76.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/import_transaction.go:92: Commit 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/config/import_transaction.go:170: Rollback 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/config/import_transaction.go:189: Cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:36: NewOIDCConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:43: Clone 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:70: ApplyDefaults 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:109: DefaultRedirectURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:118: Validate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:153: normaliseList 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:172: parseDelimited 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:185: parseMappings 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/oidc.go:205: MergeFromEnv 95.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:61: ReadFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:62: WriteFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:65: Rename 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:68: Remove 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:69: Stat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:70: MkdirAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:77: NewConfigPersistence 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:88: newConfigPersistence 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:137: DataDir 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:142: EnsureConfigDir 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:146: beginTransaction 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:152: endTransaction 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:162: writeConfigFileLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:183: LoadAPITokens 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:212: LoadEnvTokenSuppressions 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:237: SaveEnvTokenSuppressions 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:254: SaveAPITokens 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:285: SaveAlertConfig 77.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:434: LoadAlertConfig 85.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:652: SaveEmailConfig 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:688: LoadEmailConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:728: SaveAppriseConfig 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:763: LoadAppriseConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:806: SaveWebhooks 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:840: LoadWebhooks 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:902: MigrateWebhooksIfNeeded 94.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1006: DefaultSystemSettings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1023: SaveNodesConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1029: SaveNodesConfigAllowEmpty 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1033: saveNodesConfig 91.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1142: LoadNodesConfig 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1388: SaveSystemSettings 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1417: SaveOIDCConfig 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1450: LoadOIDCConfig 94.1%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1480: SaveSSOConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1525: LoadSSOConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1560: migrateFromLegacyOIDCConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1621: SaveAIConfig 81.2%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1651: LoadAIConfig 94.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1728: SaveAIFindings 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1759: SetFileSystem 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1766: LoadAIFindings 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1865: SaveAIUsageHistory 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1896: LoadAIUsageHistory 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1933: SavePatrolRunHistory 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:1964: LoadPatrolRunHistory 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2003: LoadSystemSettings 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2029: updateEnvFile 88.6%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2101: IsEncryptionEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2108: cleanupOldBackups 81.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2153: LoadGuestMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2161: LoadDockerMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2169: LoadAgentProfiles 64.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2202: SaveAgentProfiles 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2227: LoadAgentProfileAssignments 64.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2260: SaveAgentProfileAssignments 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2285: LoadAgentProfileVersions 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2319: SaveAgentProfileVersions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2345: LoadProfileDeploymentStatus 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2379: SaveProfileDeploymentStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2405: LoadProfileChangeLogs 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2431: SaveProfileChangeLogs 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2449: AppendProfileChangeLog 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2511: SaveAIChatSessions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2542: LoadAIChatSessions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2578: SaveAIChatSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2591: DeleteAIChatSession 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2602: GetAIChatSessionsForUser 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/persistence.go:2625: CleanupOldAIChatSessions 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:115: NewSSOConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:123: GetProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:136: GetEnabledProviders 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:158: GetDefaultProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:173: HasEnabledProviders 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:178: AddProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:193: UpdateProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:207: RemoveProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:225: Validate 89.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:262: validateProvider 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:278: validateOIDCProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:291: validateSAMLProvider 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:325: Clone 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:343: cloneProvider 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:388: MigrateFromOIDCConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/sso.go:432: ToLegacyOIDCConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:45: NewConfigWatcher 90.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:149: SetMockReloadCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:157: SetAPITokenReloadCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:164: Start 72.2%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:196: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:205: ReloadConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:210: watchForChanges 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:215: handleEvents 89.7%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:279: pollForChanges 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:332: calculateFileHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:342: reloadConfig 91.1%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:490: reloadAPITokens 92.5%
+github.com/rcourtman/pulse-go-rewrite/internal/config/watcher.go:576: reloadMockConfig 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/crypto/crypto.go:34: NewCryptoManagerAt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/crypto/crypto.go:52: getOrCreateKeyAt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/crypto/crypto.go:207: Encrypt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/crypto/crypto.go:239: Decrypt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/crypto/crypto.go:265: EncryptString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/crypto/crypto.go:274: DecryptString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:17: BuildScanner 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:30: ApplyConfigToProfile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:133: shouldPruneContainerNetworks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:137: isLikelyContainerPhase 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:142: parseCIDRs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:161: parseCIDRMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:170: environmentFromOverride 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/config_override.go:190: filterPhasesForEnvironment 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:52: StartedAt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:56: CompletedAt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:60: Subnet 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:64: ServerCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:68: ErrorCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:72: Duration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:76: BlocklistLength 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:80: Status 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:132: init 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:137: NewService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:166: Start 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:202: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:207: scanLoop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:225: appendHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:241: GetHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:260: performScan 98.9%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:470: GetCachedResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:485: IsScanning 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:492: ForceRefresh 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:516: SetInterval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:524: SetSubnet 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/discovery/service.go:552: GetStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:113: New 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:262: normalizeTargets 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:301: normalizeContainerStates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:331: normalizeRuntime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:351: connectRuntime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:393: tryRuntimeCandidate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:411: buildRuntimeCandidates 96.9%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:514: detectRuntime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:552: Run 96.8%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:611: stopTimer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:620: collectOnce 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:639: flushBuffer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:664: sendReport 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:707: sendReportToTarget 97.6%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:780: handleCommand 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:794: handleCheckUpdatesCommand 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:816: handleStopCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:848: disableSelf 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:864: disableSystemdService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:890: stopSystemdService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:920: removeFileIfExists 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:930: sendCommandAck 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:971: primaryTarget 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:978: httpClientFor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:991: newHTTPClient 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:1013: Close 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:1017: readMachineID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:1035: isHexString 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:1044: readSystemUptime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/agent.go:1053: detectHostRemovedError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/cleanup.go:13: cleanupOrphanedBackups 18.5%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:20: buildReport 94.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:173: collectContainers 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:222: pruneStaleCPUSamples 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:239: collectContainer 98.8%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:460: getImageRepoDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:507: matchesImageReference 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:537: extractPodmanMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:597: calculateContainerCPUPercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:714: calculateCPUPercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:737: calculateMemoryUsage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:768: safeFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:775: parseTime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:791: trimLeadingSlash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:799: randomDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:812: summarizeBlockIO 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/collect.go:855: maskSensitiveEnvVars 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/container_update.go:29: handleUpdateContainerCommand 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/container_update.go:86: updateContainerWithProgress 80.9%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:63: NewRegistryChecker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:68: newRegistryCheckerWithConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:92: SetEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:99: Enabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:106: ShouldCheck 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:118: MarkChecked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:125: ForceCheck 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:136: CheckImageUpdate 95.8%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:234: digestsDiffer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:255: fetchDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:329: resolveManifestList 69.2%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:409: getAuthToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:427: fetchAuthToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:458: getCached 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:472: cacheDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:482: cacheError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:493: CleanupCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:506: parseImageReference 73.1%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/registry.go:562: isValidDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/self_update.go:20: checkForUpdates 95.7%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/self_update.go:111: isUnraid 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/self_update.go:118: resolveSymlink 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/self_update.go:123: verifyELFMagic 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/self_update.go:142: determineSelfUpdateArch 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/self_update.go:171: selfUpdate 85.1%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/signature.go:24: verifySignature 88.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/signature.go:73: verifyFileSignature 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:22: normalizeSwarmScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:36: resolvedSwarmScope 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:50: collectSwarmData 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:154: collectSwarmDataFromManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:216: mapSwarmService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:279: mapSwarmTask 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:332: serviceMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:347: buildContainerIndex 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:362: lookupContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:378: deriveSwarmTasksFromContainers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:446: deriveSwarmServicesFromData 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:543: copyStringMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/swarm.go:554: isTaskCompletedState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/dockeragent/system.go:10: readProcUptime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:46: Error 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:56: Unwrap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:61: Is 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:83: NewMonitorError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:95: WithNode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:101: WithStatusCode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:113: isRetryable 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:131: WrapConnectionError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:136: WrapAuthError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:141: WrapAPIError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:146: IsRetryableError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/errors/errors.go:157: IsAuthError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:104: New 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:262: Run 52.6%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:303: runOnce 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:307: process 76.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:332: flushBuffer 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:356: buildReport 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:424: sendReport 79.2%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:475: applyRemoteConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:500: normalisePlatform 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:512: collectTemperatures 64.3%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:610: collectRAIDArrays 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:633: collectCephStatus 65.2%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:754: collectSMARTData 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:794: runProxmoxSetup 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:841: isLXCContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:875: GetReliableMachineID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:917: isHexString 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:931: getPrimaryMACIdentifier 68.4%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/agent.go:967: isLikelyVirtualInterfaceName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:39: NewCommandClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:108: Run 36.8%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:153: connectAndHandle 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:218: buildWebSocketURL 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:240: sendRegistration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:258: waitForRegistration 84.6%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:283: pingLoop 41.7%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:309: handleMessages 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:351: handleExecuteCommand 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:389: wrapCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:399: executeCommand 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/commands.go:463: Close 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:57: NewProxmoxSetup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:74: Run 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:127: RunAll 55.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:166: runForType 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:208: detectProxmoxType 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:222: detectProxmoxTypes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:239: setupToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:249: setupPVEToken 76.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:279: setupPBSToken 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:317: parseTokenValue 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:343: parsePBSTokenValue 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:363: getHostURL 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:409: getIPThatReachesPulse 54.2%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:457: getIPForHostname 53.8%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:484: selectBestIP 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:540: scoreIPv4 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:583: registerWithPulse 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:621: isAlreadyRegistered 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:627: isTypeRegistered 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:679: stateFileForType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:691: markAsRegistered 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostagent/proxmox_setup.go:703: markTypeAsRegistered 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:45: Collect 95.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:89: collectCPUUsage 63.6%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:108: collectDisks 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:212: collectNetwork 85.2%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:263: isLoopback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:274: collectDiskIO 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/collector.go:313: isPartition 68.8%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:36: summarizeZFSPools 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:56: disksFromZpoolStats 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:121: fallbackZFSDisks 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:175: findZpool 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:193: fetchZpoolStats 33.3%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:215: parseZpoolList 95.8%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:258: uniqueZFSPools 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:277: bestZFSMountpoints 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:297: zfsMountpointScore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:308: zfsPoolFromDevice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:319: calculatePercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:326: clampPercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/hostmetrics/zfs.go:337: bestZFSPoolDatasets 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:86: New 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:193: buildRESTConfig 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:251: computeClusterID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:257: discoverClusterMetadata 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:271: Run 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:287: runOnce 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:302: flushReports 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:315: namespaceAllowed 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:336: collectReport 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:376: collectNodes 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:405: isNodeReady 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:414: rolesFromNodeLabels 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:434: dedupeStrings 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:451: toNodeResources 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:463: collectPods 85.3%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:544: isProblemPod 73.3%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:574: summarizeContainerState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:587: ownerRef 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:599: collectDeployments 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:641: desiredReplicas 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:648: isProblemDeployment 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/kubernetesagent/agent.go:656: sendReport 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/license/features.go:127: TierHasFeature 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/features.go:141: GetTierDisplayName 37.5%
+github.com/rcourtman/pulse-go-rewrite/internal/license/features.go:161: GetFeatureDisplayName 17.6%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:22: SetPublicKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:80: IsExpired 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:88: IsLifetime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:94: DaysRemaining 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:106: ExpiresAt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:115: HasFeature 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:127: AllFeatures 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:158: NewService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:165: SetLicenseChangeCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:172: Activate 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:191: Clear 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:203: Current 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:210: IsValid 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:228: HasFeature 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:256: isDemoMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:261: isDevMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:276: GetLicenseState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:302: GetLicenseStateString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:310: RequireFeature 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:318: Status 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:381: ValidateLicense 92.5%
+github.com/rcourtman/pulse-go-rewrite/internal/license/license.go:475: GenerateLicenseForTesting 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:38: NewPersistence 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:62: loadPersistentKey 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:73: ensurePersistentKey 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:108: Save 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:113: SaveWithGracePeriod 73.7%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:157: Load 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:168: LoadWithMetadata 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:209: Delete 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:219: Exists 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:226: encrypt 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:249: decrypt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:254: decryptWithKey 78.6%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:281: deriveKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:286: deriveKeyFrom 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/license/persistence.go:292: getMachineID 55.6%
+github.com/rcourtman/pulse-go-rewrite/internal/license/pubkey.go:24: InitPublicKey 89.5%
+github.com/rcourtman/pulse-go-rewrite/internal/license/pubkey.go:61: decodePublicKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:69: init 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:75: Init 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:105: IsLevelEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:110: WithRequestID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:121: parseLevel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:134: selectWriter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:151: newConsoleWriter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:158: isTerminal 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:175: newRollingFileWriter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:204: Write 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:225: openOrCreateLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:245: rotateLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:263: closeLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:273: cleanupOldFiles 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/logging/logging.go:303: compressAndRemove 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mdadm/mdadm.go:28: CollectArrays 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mdadm/mdadm.go:59: isMdadmAvailable 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mdadm/mdadm.go:68: listArrayDevices 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mdadm/mdadm.go:91: collectArrayDetail 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mdadm/mdadm.go:104: parseDetail 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mdadm/mdadm.go:218: getRebuildSpeed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/alert_history.go:12: GenerateAlertHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:16: titleCase 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:276: generateVirtualDisks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:331: GenerateMockData 95.1%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:524: generateReplicationJobs 94.4%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:609: formatSecondsAsClock 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:616: ptrTime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:620: ptrFloat64 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:624: generateNodes 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:701: generateNode 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:772: generateNodeTemperature 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:833: generateRealisticIO 98.3%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:930: generateVM 98.6%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1069: generateGuestNetworkInfo 96.2%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1120: generateGuestOSMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1142: generateKubernetesClusters 87.1%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1210: generateKubernetesNodes 89.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1273: generateKubernetesPods 98.4%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1391: generateKubernetesDeployments 94.1%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1432: clusterHasIssues 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1454: kubernetesPodHealthy 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1470: kubernetesDeploymentHealthy 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1478: generateDockerHosts 93.3%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1697: generateHosts 97.1%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:1904: generateDockerContainers 96.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2095: generateDockerPorts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2128: generateDockerNetworks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2148: generateDockerLabels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2208: formatDurationForStatus 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2238: clampFloat 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2248: randomHexString 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2261: humanizeHostDisplayName 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2274: generateContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2387: generateGuestName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2393: generateLastBackupTime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2416: generateTags 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2440: generateZFSPoolWithIssues 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2539: generateStorage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2804: generateCephClusters 83.1%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2944: maxInt 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:2952: generateBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3072: extractPMGBackups 85.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3114: generatePBSInstances 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3182: generatePBSBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3286: generatePMGInstances 67.9%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3456: generateSnapshots 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3530: UpdateMetrics 92.4%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3742: updateKubernetesClusters 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3810: updateDockerHosts 63.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3957: serviceKey 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:3964: recalculateDockerServiceHealth 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:4062: ensureDockerSwarmInfo 76.5%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:4102: updateHosts 76.3%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:4166: fluctuateFloat 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:4178: fluctuateInt 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:4193: generateDisksForNode 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/generator.go:4271: generateDockerServicesAndTasks 90.3%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:28: init 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:37: IsMockEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:42: SetEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:46: setEnabled 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:67: setEnvFlag 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:75: enableMockMode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:107: disableMockMode 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:122: startUpdateLoopLocked 84.6%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:144: stopUpdateLoopLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:157: updateMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:170: GetConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:177: LoadMockConfig 37.8%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:254: SetMockConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:280: GetMockState 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:295: UpdateAlertSnapshots 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:321: GetMockAlertHistory 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/mock/integration.go:335: cloneState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:9: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:14: ToFrontend 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:65: ToFrontend 82.6%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:139: ToFrontend 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:217: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:307: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:317: ToFrontend 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:444: timeToUnixMillis 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:452: ToFrontend 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:462: ToFrontend 95.2%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:528: ToFrontend 89.7%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:621: ToFrontend 89.5%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:666: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:671: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:684: ToFrontend 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:721: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:725: hostSensorSummaryToFrontend 78.6%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:758: copyStringFloatMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:769: toDockerHostCommandFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:807: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:832: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:865: ToFrontend 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:917: zeroIfNegative 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/converters.go:979: ConvertResourceToFrontend 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1230: NewState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1267: syncBackupsLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1276: UpdateActiveAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1283: UpdateRecentlyResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1290: UpdateNodes 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1304: UpdateNodesForInstance 68.6%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1374: UpdateVMs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1382: UpdateVMsForInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1426: UpdateContainers 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1435: backupKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1442: namespaceMatchesInstance 84.2%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1492: SyncGuestBackupTimes 95.7%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1591: UpdateContainersForInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1635: UpsertDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1671: RemoveDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1690: ClearAllDockerHosts 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1701: SetDockerHostStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1722: SetDockerHostHidden 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1739: SetDockerHostPendingUninstall 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1756: SetDockerHostCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1773: SetDockerHostCustomDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1790: TouchDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1807: RemoveStaleDockerHosts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1830: GetDockerHosts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1840: AddRemovedDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1862: RemoveRemovedDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1876: GetRemovedDockerHosts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1886: UpsertKubernetesCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1924: RemoveKubernetesCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1940: SetKubernetesClusterStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1960: SetKubernetesClusterHidden 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1976: SetKubernetesClusterPendingUninstall 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:1992: SetKubernetesClusterCustomDisplayName 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2009: GetKubernetesClusters 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2019: AddRemovedKubernetesCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2041: RemoveRemovedKubernetesCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2055: GetRemovedKubernetesClusters 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2065: UpsertHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2090: GetHosts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2100: RemoveHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2118: ClearAllHosts 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2130: LinkNodeToHostAgent 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2146: UnlinkNodesFromHostAgent 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2167: LinkHostAgentToNode 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2226: UnlinkHostAgent 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2263: UpsertCephCluster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2288: SetHostStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2306: TouchHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2323: SetHostCommandsEnabled 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2341: UpdateStorage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2349: UpdatePhysicalDisks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2385: UpdateStorageForInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2421: UpdateCephClustersForInstance 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2454: UpdatePBSInstances 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2462: UpdatePBSInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2484: UpdatePMGInstances 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2493: UpdatePMGInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2514: UpdateBackupTasksForInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2548: UpdateStorageBackupsForInstance 93.1%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2606: UpdateReplicationJobsForInstance 75.9%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2655: UpdateGuestSnapshotsForInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2689: SetConnectionHealth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2696: RemoveConnectionHealth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2703: UpdatePBSBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2737: UpdatePMGBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2763: GetContainers 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/models.go:2773: UpdateContainerDockerStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profile_validation.go:133: Error 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profile_validation.go:150: NewProfileValidator 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profile_validation.go:159: Validate 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profile_validation.go:205: validateValue 48.1%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profile_validation.go:305: GetConfigKeyDefinitions 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profile_validation.go:310: GetConfigKeyDefinition 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/profiles.go:74: MergedConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/state_snapshot.go:36: GetSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/models/state_snapshot.go:91: ToFrontend 61.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/backoff.go:15: nextDelay 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ceph.go:16: isCephStorageType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ceph.go:26: pollCephCluster 13.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ceph.go:66: buildCephClusterModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ceph.go:158: summarizeCephHealth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ceph.go:191: extractCephCheckSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ceph.go:233: countServiceDaemons 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:30: newCircuitBreaker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:55: allow 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:82: recordSuccess 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:94: recordFailure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:110: trip 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:132: State 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/circuit_breaker.go:137: stateDetails 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_disk_usage.go:17: clampToInt64 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_disk_usage.go:24: storageSupportsContainerVolumes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_disk_usage.go:39: isRootVolumeForContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_disk_usage.go:64: collectContainerRootUsage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:29: ensureContainerRootDiskEntry 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:63: convertContainerDiskInfo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:135: sanitizeRootFSDevice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:147: parseContainerRawIPs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:159: collectIPsFromInterface 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:193: sanitizeGuestAddressStrings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:244: dedupeStringsPreserveOrder 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:268: parseContainerConfigNetworks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:331: parseContainerMountMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:385: mergeContainerNetworkInterface 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:430: extractContainerRootDeviceFromConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:467: extractContainerOSType 61.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:497: extractContainerOSTemplate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:520: isOCITemplate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/container_parsing.go:569: isOCIContainerByConfig 58.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/diagnostic_snapshots.go:88: makeNodeSnapshotKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/diagnostic_snapshots.go:92: makeGuestSnapshotKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/diagnostic_snapshots.go:96: logNodeMemorySource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/diagnostic_snapshots.go:169: recordNodeSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/diagnostic_snapshots.go:190: recordGuestSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/diagnostic_snapshots.go:212: GetDiagnosticSnapshots 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:47: newDockerHostCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:69: markDispatched 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:76: markInProgress 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:85: markAcknowledged 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:95: markCompleted 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:105: markFailed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:113: hasExpired 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:121: queueDockerStopCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:170: QueueDockerContainerUpdateCommand 76.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:235: QueueDockerCheckUpdatesCommand 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:285: getDockerCommandPayload 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:323: acknowledgeDockerCommand 97.2%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_commands.go:393: normalizeDockerHostID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:46: CheckContainersForDocker 82.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:131: containerNeedsDockerCheck 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:160: checkDockerParallel 77.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:223: NewAgentDockerChecker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:231: CheckDockerInContainer 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:265: SetDockerChecker 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_detection.go:277: GetDockerChecker 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:16: tokenHintFromRecord 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:35: resolveDockerHostIdentifier 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:73: findMatchingDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:136: dockerHostIDExists 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:149: generateDockerHostIdentifier 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:190: dockerHostSuffixCandidates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:221: sanitizeDockerHostSuffix 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:259: fallbackDockerHostID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/docker_host_identity.go:277: uniqueNonEmptyStrings 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/fs_filters.go:7: readOnlyFilesystemReason 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/fs_filters.go:13: shouldIgnoreReadOnlyFilesystem 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:48: tryReserveGuestMetadataFetch 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:66: scheduleNextGuestMetadataFetch 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:83: deferGuestMetadataRetry 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:96: acquireGuestMetadataSlot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:108: releaseGuestMetadataSlot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:119: retryGuestAgentCall 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:148: fetchGuestAgentMetadata 63.6%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:313: guestMetadataCacheKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:317: clearGuestMetadataCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:330: cloneStringSlice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:339: cloneGuestNetworkInterfaces 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:353: processGuestNetworkInterfaces 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:419: parseInterfaceStat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:434: extractGuestOSInfo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:475: isGuestAgentOSInfoUnsupportedError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:496: stringValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/guest_metadata.go:523: anyToInt64 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/host_agent_temps.go:20: getHostAgentTemperature 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/host_agent_temps.go:27: getHostAgentTemperatureByID 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/host_agent_temps.go:88: convertHostSensorsToTemperature 85.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/host_agent_temps.go:252: isHostAgentTemperatureRecent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/host_agent_temps.go:260: mergeTemperatureData 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:22: normalizeKubernetesClusterIdentifier 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:41: ApplyKubernetesReport 61.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:221: RemoveKubernetesCluster 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:287: AllowKubernetesClusterReenroll 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:307: UnhideKubernetesCluster 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:321: MarkKubernetesClusterPendingUninstall 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:335: SetKubernetesClusterCustomDisplayName 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:348: evaluateKubernetesAgents 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/kubernetes_agents.go:374: cleanupRemovedKubernetesClusters 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:59: getPollMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:66: newPollMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:283: RecordNodeResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:325: RecordQueueWait 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:337: UpdateQueueSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:362: UpdateDeadLetterCounts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:399: SetBreakerState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:421: RecordResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:463: ResetQueueDepth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:478: SetQueueDepth 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:489: IncInFlight 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:497: DecInFlight 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:504: decrementPending 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:519: storeLastSuccess 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:525: lastSuccessFor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:532: updateStaleness 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:537: storeNodeLastSuccess 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:543: lastNodeSuccessFor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:550: updateNodeStaleness 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:556: splitInstanceKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:567: breakerStateToValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:580: sanitizeInstanceLabels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:584: makeMetricKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:592: makeNodeMetricKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:601: normalizeLabel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:609: normalizeNodeLabel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics.go:617: classifyError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:43: NewMetricsHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:54: Reset 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:64: AddGuestMetric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:104: AddNodeMetric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:132: appendMetric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:159: GetGuestMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:202: GetNodeMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:237: GetAllGuestMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:272: AddStorageMetric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:303: GetAllStorageMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:335: Cleanup 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/metrics_history.go:369: cleanupMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:25: mockMetricsSamplerConfigFromEnv 61.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:54: hashSeed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:72: pickTrendClass 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:85: generateSeededSeries 97.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:141: seedMockMetricsHistory 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:255: recordMockStateToMetricsHistory 95.1%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:346: startMockMetricsSampler 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/mock_metrics_history.go:396: stopMockMetricsSampler 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:107: getNodeDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:150: getInstanceConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:162: mergeNVMeTempsIntoDisks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:334: mergeHostAgentSMARTIntoDisks 4.2%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:436: lookupClusterEndpointLabel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:464: normalizeEndpointHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:496: isLikelyIPAddress 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:515: ensureClusterEndpointURL 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:533: clusterEndpointEffectiveURL 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:572: newRealExecutor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:576: Execute 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:682: schedulerKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:686: timePtr 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:811: safePercentage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:823: safeFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:841: makeGuestID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:846: parseDurationEnv 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:865: parseIntEnv 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:883: clampUint64ToInt64 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:890: cloneStringFloatMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:901: cloneStringMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:912: convertDockerServices 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:975: convertDockerTasks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1017: normalizeAgentVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1029: convertDockerSwarmInfo 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1048: shouldRunBackupPoll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1104: getNodeRRDMetrics 78.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1178: RemoveDockerHost 58.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1255: RemoveHostAgent 69.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1376: LinkHostAgent 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1401: UnlinkHostAgent 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1430: GetHostAgentConfig 85.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1471: getAgentProfileCache 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1520: InvalidateAgentProfileCache 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1528: UpdateHostAgentConfig 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1566: HideDockerHost 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1586: UnhideDockerHost 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1612: MarkDockerHostPendingUninstall 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1632: SetDockerHostCustomDisplayName 73.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1668: AllowDockerHostReenroll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1704: GetDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1720: GetDockerHosts 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1731: RebuildTokenBindings 47.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1807: ClearUnauthenticatedAgents 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1835: QueueDockerHostStop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1840: FetchDockerCommandForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1845: AcknowledgeDockerHostCommand 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:1850: ApplyDockerReport 67.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2309: ApplyHostReport 68.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2672: findLinkedProxmoxEntity 40.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2766: linkNodeToHostAgent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2776: recoverFromPanic 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2787: cleanupRemovedDockerHosts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2818: cleanupGuestMetadataCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2838: cleanupDiagnosticSnapshots 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2868: cleanupRRDCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2886: evaluateDockerAgents 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2922: evaluateHostAgents 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2981: sortContent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:2990: enrichContainerMetadata 52.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3252: GetConnectionStatuses 94.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3322: checkContainerizedTempMonitoring 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3349: New 63.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3803: SetExecutor 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3819: buildInstanceInfoCache 73.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3894: getExecutor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3901: clampInterval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3914: effectivePVEPollingInterval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3931: baseIntervalForInstanceType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:3955: getConfiguredHostIPs 62.2%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4044: consolidateDuplicateClusters 90.2%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4138: Start 36.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4326: retryFailedConnections 74.1%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4497: poll 80.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4546: syncAlertsToState 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4586: SyncAlertState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4591: pruneStaleDockerAlerts 64.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4662: startTaskWorkers 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4677: taskWorker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4699: derivePollTimeout 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4719: taskExecutionTimeout 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4730: executeScheduledTask 47.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4819: rescheduleTask 58.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4904: sendToDeadLetter 92.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4950: classifyDLQReason 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4960: updateDeadLetterMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4975: updateBreakerMetric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4984: randomFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:4991: updateQueueDepthMetric 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5000: allowExecution 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5011: ensureBreaker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5038: recordTaskResult 97.6%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5126: SchedulerHealth 89.1%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5395: isTransientError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5408: shouldTryPortlessFallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5429: retryPVEPortFallback 75.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:5496: pollPVEInstance 33.6%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:6308: pollVMsAndContainersEfficient 54.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7207: pollBackupTasks 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7251: pollReplicationStatus 73.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7395: formatSeconds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7405: copyFloatPointer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7416: matchesDatastoreExclude 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7464: pollPBSInstance 66.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:7840: pollPMGInstance 80.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8134: GetState 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8149: SetMockMode 95.1%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8205: resetStateLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8214: GetStartTime 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8219: GetDiscoveryService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8224: StartDiscoveryService 72.2%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8256: StopDiscoveryService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8268: EnableTemperatureMonitoring 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8275: DisableTemperatureMonitoring 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8282: GetGuestMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8287: GetNodeMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8292: GetStorageMetrics 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8297: GetAlertManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8302: GetIncidentStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8308: SetAlertTriggeredAICallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8324: handleAlertFired 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8346: handleAlertResolved 58.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8370: handleAlertAcknowledged 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8377: handleAlertUnacknowledged 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8386: broadcastStateUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8405: SetResourceStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8413: GetNotificationManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8418: GetConfigPersistence 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8423: GetMetricsStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8429: GetMetricsHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8436: shouldSkipNodeMetrics 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8456: updateResourceStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8479: getResourcesForBroadcast 62.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8586: pollStorageBackupsWithNodes 73.1%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8831: shouldPreserveBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8841: shouldPreservePBSBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8849: storageNamesForNode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8880: preserveFailedStorageBackups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8918: buildGuestLookups 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:8976: enrichWithPersistedMetadata 95.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9021: persistGuestIdentity 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9054: calculateBackupOperationTimeout 76.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9091: pollGuestSnapshots 71.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9321: collectSnapshotSizes 72.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9416: extractSnapshotName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9435: Stop 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9461: recordAuthFailure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9503: resetAuthFailures 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9524: removeFailedPVENode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9568: removeFailedPBSNode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9587: removeFailedPMGInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9621: pollPBSBackups 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9789: buildPBSBackupCache 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9812: normalizePBSNamespacePath 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9819: namespacePathsForDatastore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9837: fetchPBSBackupSnapshots 77.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9904: convertPBSSnapshots 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:9965: checkMockAlerts 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:10075: isLegacyHostAgent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:10081: isLegacyDockerAgent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:10088: convertAgentSMARTToModels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:10109: convertAgentCephToModels 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor.go:10211: convertAgentCephToGlobalCluster 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:24: describeInstancesForScheduler 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:119: buildScheduledTasks 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:151: convertPoolInfoToModel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:190: pollVMsWithNodes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:881: pollContainersWithNodes 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:1191: pollStorageWithNodes 51.3%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:1669: shouldAttemptFallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:1677: fetchNodeStorageFallback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/monitor_polling.go:1720: pollPVENode 39.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ratetracker.go:28: NewRateTracker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ratetracker.go:37: CalculateRates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/ratetracker.go:102: Clear 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:26: NewReloadableMonitor 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:43: Start 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:57: Reload 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:64: watchReload 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:83: doReload 78.9%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:125: GetMonitor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:132: GetConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:142: GetState 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/reload.go:147: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:83: DefaultSchedulerConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:103: NewAdaptiveScheduler 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:133: BuildPlan 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:226: FilterDue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:241: DispatchDue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:262: LastScheduled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:274: StalenessScore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:288: newAdaptiveIntervalSelector 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:299: SelectInterval 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:373: clampFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/scheduler.go:385: Enqueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:30: NewStalenessTracker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:40: SetBounds 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:52: UpdateSuccess 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:74: UpdateError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:89: SetChangeHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:111: StalenessScore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:148: setSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:155: mergeSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:181: snapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:188: trackerKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/staleness_tracker.go:202: Snapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/storage_filters.go:12: isInherentlySharedStorageType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/storage_filters.go:45: storageContentQueryable 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:15: key 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:21: Len 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:23: Less 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:33: Swap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:39: Push 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:45: Pop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:65: NewTaskQueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:75: Upsert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:92: Remove 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:106: WaitNext 97.4%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:183: Size 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:197: Snapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/task_queue.go:229: PeekAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:33: NewTemperatureCollectorWithPort 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:59: CollectTemperature 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:143: runSSHCommand 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:211: logMissingSSHKey 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:225: disableLegacySSHOnAuthFailure 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:260: normalizeSMARTEntries 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:300: parseSensorsJSON 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:452: parseCPUTemps 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:572: parseNVMeTemps 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:614: parseGPUTemps 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:656: parseNouveauGPUTemps 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:692: extractTempInput 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:712: extractCoreNumber 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:724: parseRPiTemperature 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:752: extractHostname 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/monitoring/temperature.go:770: ensureHostKey 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:31: NewEnhancedEmailManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:46: SendEmailWithRetry 82.4%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:88: checkRateLimit 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:112: sendEmailOnce 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:151: sendViaProvider 94.4%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:196: sendTLS 16.7%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:258: sendStartTLS 35.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:322: TestConnection 39.1%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_enhanced.go:373: sendPlain 67.9%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_providers.go:15: GetEmailProviders 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:13: titleCase 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:31: EmailTemplate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:38: singleAlertTemplate 93.8%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:206: groupedAlertTemplate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:379: formatDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:390: pluralize 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:398: formatMetricValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/email_template.go:412: formatMetricThreshold 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:59: createSecureWebhookClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:150: copyEmailConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:159: copyWebhookConfigs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:187: copyAppriseConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:196: annotateResolvedMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:207: NormalizeAppriseConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:272: defaultAppriseExec 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:347: NewNotificationManager 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:403: SetPublicURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:421: GetPublicURL 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:428: SetEmailConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:448: SetAppriseConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:455: GetAppriseConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:462: SetCooldown 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:473: SetNotifyOnResolve 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:485: GetNotifyOnResolve 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:492: SetGroupingWindow 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:503: SetGroupingOptions 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:512: AddWebhook 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:519: UpdateWebhook 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:533: DeleteWebhook 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:547: GetWebhooks 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:561: GetEmailConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:568: GetQueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:575: SendAlert 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:630: SendResolvedAlert 73.9%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:672: CancelAlert 85.2%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:727: sendGroupedAlerts 94.4%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:771: enqueueNotifications 39.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:857: enqueueResolvedNotifications 33.3%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:937: sendNotificationsDirect 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:966: sendResolvedNotificationsDirect 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1004: sendGroupedEmail 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1016: sendResolvedEmail 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1029: sendGroupedApprise 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1068: buildApprisePayload 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1113: buildResolvedNotificationContent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1188: resolveAppriseNotificationType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1204: sendAppriseViaCLI 70.6%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1242: sendAppriseViaHTTP 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1341: sendResolvedApprise 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1381: sendEmail 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1397: sendHTMLEmailWithError 89.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1465: sendHTMLEmail 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1522: sendGroupedWebhook 4.1%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1737: sendResolvedWebhook 68.8%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1781: checkWebhookRateLimit 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1821: sendWebhookRequest 52.9%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:1966: sendWebhook 32.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2093: convertWebhookCustomFields 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2105: ensurePushoverCustomFieldAliases 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2125: isEmptyInterface 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2139: prepareWebhookData 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2203: templateFuncMap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2224: generatePayloadFromTemplateWithService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2255: renderWebhookURL 95.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2293: formatWebhookDuration 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2308: extractTelegramChatID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2337: isNumeric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2347: ValidateWebhookURL 90.6%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2432: isPrivateIP 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2458: isNumericIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2469: UpdateAllowedPrivateCIDRs 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2523: isIPInAllowlist 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2543: addWebhookDelivery 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2558: GetWebhookHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2568: buildNotificationTestAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2589: GetQueueStats 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2601: SendTestNotification 30.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2664: SendTestAppriseWithConfig 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2689: SendTestWebhook 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2723: SendTestNotificationWithConfig 52.4%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2793: normalizeQueueType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2800: resolvedTimeFromAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2825: ProcessQueuedNotification 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2891: cleanupOldNotificationRecords 31.2%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/notifications.go:2926: Stop 84.6%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:63: NewNotificationQueue 77.3%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:124: initSchema 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:173: Enqueue 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:240: UpdateStatus 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:270: IncrementAttempt 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:283: IncrementAttemptAndSetStatus 85.7%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:302: GetPending 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:336: scanNotification 90.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:387: ScheduleRetry 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:416: MoveToDLQ 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:421: GetDLQ 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:454: RecordAudit 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:488: GetQueueStats 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:522: processQueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:539: SetProcessor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:546: processBatch 88.2%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:577: processNotification 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:650: cleanupOldEntries 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:664: performCleanup 87.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:708: Stop 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:724: calculateBackoff 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/queue.go:734: CancelByAlertIDs 81.1%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:70: SendEnhancedWebhook 76.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:131: shouldSendWebhook 97.3%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:203: sendWebhookWithRetry 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:345: isRetryableWebhookError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:384: sendWebhookOnceWithResponse 86.2%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:447: sendWebhookOnce 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_enhanced.go:455: TestEnhancedWebhook 60.8%
+github.com/rcourtman/pulse-go-rewrite/internal/notifications/webhook_templates.go:15: GetWebhookTemplates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/client.go:46: New 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/client.go:78: Fetch 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/client.go:147: isConfigSignatureRequired 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/client.go:151: resolveHostID 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:36: DecodeEd25519PrivateKey 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:58: SignConfigPayload 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:73: VerifyConfigPayloadSignature 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:102: canonicalConfigPayload 88.9%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:131: trustedConfigPublicKeys 67.5%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:195: marshalSortedMap 86.4%
+github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig/signature.go:231: marshalCanonicalValue 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:13: FromNode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:104: FromVM 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:184: FromContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:270: FromHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:449: FromDockerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:603: FromDockerContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:691: FromKubernetesCluster 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:742: FromKubernetesNode 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:794: FromKubernetesPod 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:853: FromKubernetesDeployment 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:897: FromPBSInstance 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:938: FromStorage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:986: mapNodeStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:997: mapGuestStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:1010: mapHostStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:1023: mapDockerHostStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:1034: mapDockerContainerStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:1049: mapKubernetesClusterStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:1060: mapKubernetesPodStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/converters.go:1073: mapPBSStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:174: GetPlatformData 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:182: SetPlatformData 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:193: IsInfrastructure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:204: IsWorkload 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:214: EffectiveDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:222: CPUPercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:230: MemoryPercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/resource.go:243: DiskPercent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:26: NewStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:38: Upsert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:70: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:85: GetAll 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:97: GetByType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:111: GetByPlatform 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:125: GetInfrastructure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:139: GetWorkloads 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:153: GetChildren 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:170: FindContainerHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:214: Remove 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:233: IsSuppressed 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:242: GetPreferredID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:253: GetStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:293: GetPreferredResourceFor 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:313: IsSamePhysicalMachine 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:339: HasPreferredSourceForHostname 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:375: ShouldSkipAPIPolling 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:382: GetAgentMonitoredHostnames 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:411: GetPollingRecommendations 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:439: findDuplicate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:499: preferredResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:518: sourceScore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:531: addToIndexes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:552: removeFromIndexes 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:579: removeFromSlice 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:591: isNonUniqueIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:614: MarkStale 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:635: PruneStale 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:654: Query 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:674: OfType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:680: FromPlatform 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:686: WithStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:692: WithParent 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:698: InCluster 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:704: WithAlerts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:711: SortBy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:718: Limit 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:724: Offset 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:730: Execute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:763: Count 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:776: matches 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:839: sortResources 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:909: GetTopByCPU 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:950: GetTopByMemory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:991: GetTopByDisk 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:1032: GetRelated 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:1092: GetResourceSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/resources/store.go:1177: PopulateFromSnapshot 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/collector.go:13: CollectLocal 88.2%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:26: Parse 94.9%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:122: isCPUChip 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:139: parseCPUTemps 92.9%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:227: extractNVMeCompositeTemp 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:244: parseGPUTemps 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:272: extractTempInput 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:296: parseFansAndOther 81.5%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:370: normalizeSensorKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/parser.go:387: extractNumericValue 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:46: CollectPower 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:65: collectRALP 21.2%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:149: readRAPLEnergy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:189: readUint64File 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:198: readStringFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:211: collectAMDEnergy 9.4%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:287: findAMDEnergyHwmon 42.9%
+github.com/rcourtman/pulse-go-rewrite/internal/sensors/power.go:316: readAMDEnergy 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/smartctl/collector.go:67: CollectLocal 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/smartctl/collector.go:96: listBlockDevices 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/smartctl/collector.go:131: matchesDeviceExclude 94.7%
+github.com/rcourtman/pulse-go-rewrite/internal/smartctl/collector.go:170: collectDeviceSMART 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/smartctl/collector.go:255: detectDiskType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/smartctl/collector.go:275: formatWWN 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:82: Error 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:86: Unwrap 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:94: WithTimeout 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:103: WithKeyscanFunc 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:112: NewManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:132: Ensure 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:137: EnsureWithPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:172: EnsureWithEntries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:233: Path 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:237: ensureKnownHostsFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:256: appendHostKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:274: sanitizeKeyscanOutput 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:291: normalizeHostEntry 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:311: findHostKeyLine 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:343: hostLineMatches 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:356: hostFieldMatches 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:368: HostFieldMatches 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:372: hostCandidates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts/manager.go:399: defaultKeyscan 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/system/container.go:27: InContainer 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/system/container.go:68: DetectDockerContainerName 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/system/container.go:88: isHexString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/system/container.go:99: DetectLXCCTID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/system/container.go:136: isNumeric 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/system/container.go:149: isTruthy 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/types/metrics.go:12: GetTimestamp 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:40: DefaultManagerConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:50: NewManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:64: ProcessDockerContainerUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:119: CheckImageUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:128: GetUpdates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:145: GetUpdatesForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:150: GetUpdatesForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:155: GetSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:160: GetTotalCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:165: DeleteUpdatesForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:170: AddRegistryConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:176: CleanupStale 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:205: IsEmpty 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:210: Matches 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:233: Enabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:240: SetEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:247: AlertDelayHours 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/manager.go:254: GetUpdatesReadyForAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:54: NewRegistryChecker 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:77: AddRegistryConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:90: ParseImageReference 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:131: CheckImageUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:200: fetchDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:273: getAuthToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:336: getCached 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:350: cacheDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:360: cacheError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:371: CleanupCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:384: CacheSize 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/registry.go:393: isValidDigest 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:19: NewStore 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:28: UpsertUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:57: GetUpdatesForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:72: GetUpdatesForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:84: GetAllUpdates 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:96: DeleteUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:127: DeleteUpdatesForResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:161: DeleteUpdatesForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:176: GetSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:213: Count 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updatedetection/store.go:220: CountForHost 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:28: NewInstallShAdapter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:37: SupportsApply 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:42: GetDeploymentType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:47: PrepareUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:70: Execute 78.2%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:215: Rollback 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:282: executeRollback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:347: detectServiceName 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:365: downloadBinary 63.3%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:470: stopService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:476: startService 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:482: restoreConfig 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:494: installBinary 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:516: waitForHealth 62.5%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:538: downloadInstallScript 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:594: parseProgress 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:619: readLastLines 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:653: NewDockerUpdater 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:657: SupportsApply 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:661: GetDeploymentType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:665: PrepareUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:679: Execute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:683: Rollback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:691: NewAURUpdater 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:695: SupportsApply 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:699: GetDeploymentType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:703: PrepareUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:717: Execute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/adapter_installsh.go:721: Rollback 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:101: NewUpdateHistory 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:128: CreateEntry 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:161: UpdateEntry 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:198: GetEntry 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:212: ListEntries 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:244: GetLatestSuccessful 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:258: loadCache 91.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:304: appendToFile 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:325: rewriteFile 50.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/history.go:361: addToCache 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:93: NewManager 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:118: SetHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:123: GetProgressChannel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:128: Close 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:136: GetSSEBroadcaster 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:141: GetQueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:146: AddSSEClient 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:154: RemoveSSEClient 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:161: GetSSECachedStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:169: CheckForUpdates 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:174: CheckForUpdatesWithChannel 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:363: ApplyUpdate 5.5%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:559: GetStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:568: GetCachedUpdateInfo 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:588: getLatestReleaseForChannel 60.4%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:778: resolveChannel 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:794: getLatestReleaseFromFeed 78.8%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:872: createHistoryEntry 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:884: updateHistoryEntry 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:896: completeHistoryEntry 70.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:919: inferVersionFromDownloadURL 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:934: downloadFile 73.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:968: verifyChecksum 80.8%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1070: extractTarball 70.6%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1135: createBackup 70.6%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1203: restoreBackup 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1265: applyUpdateFiles 41.6%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1422: updateStatus 90.9%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1454: sseHeartbeatLoop 60.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1466: sanitizeError 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1482: statusDelayForStage 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1496: configuredStageDelay 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1514: cleanupOldTempDirs 57.1%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1558: copyFileSafe 76.5%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1594: copyDirSafe 64.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/manager.go:1647: isPreV4Installation 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/mock_updater.go:13: NewMockUpdater 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/mock_updater.go:17: SupportsApply 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/mock_updater.go:21: GetDeploymentType 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/mock_updater.go:25: PrepareUpdate 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/mock_updater.go:42: Execute 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/mock_updater.go:65: Rollback 0.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:44: NewUpdateQueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:53: Enqueue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:87: MarkRunning 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:101: MarkCompleted 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:141: Cancel 81.8%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:161: GetCurrentJob 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:168: IsRunning 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:175: GetHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:186: addToHistory 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/queue.go:196: generateJobID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:33: NewSSEBroadcaster 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:54: AddClient 86.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:91: RemoveClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:106: Broadcast 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:122: GetCachedStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:129: GetClientCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:136: broadcastLoop 77.8%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:159: sendToClient 61.1%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:205: cleanupLoop 20.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:236: SendHeartbeat 76.5%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/sse.go:270: Close 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/updater.go:63: NewUpdaterRegistry 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/updater.go:70: Register 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/updater.go:75: Get 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:43: ParseVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:67: String 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:84: Compare 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:116: IsNewerThan 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:121: IsPrerelease 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:126: GetCurrentVersion 42.1%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:182: normalizeVersionString 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:203: normalizeGitDescribeVersion 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:222: sanitizePrereleaseIdentifier 95.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:259: detectChannelFromVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:268: getGitVersion 75.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:285: isDockerEnvironment 72.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:309: isSourceBuildEnvironment 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:326: fileExists 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:333: GetDeploymentType 36.4%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:382: dockerUpdatesAllowed 66.7%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:389: envBool 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:400: compareInts 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/updates/version.go:411: extractRCNumber 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/helpers.go:14: GenerateID 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/helpers.go:19: WriteJSONResponse 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/helpers.go:31: ParseBool 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/helpers.go:41: GetenvTrim 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/helpers.go:53: NormalizeVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/helpers.go:72: CompareVersions 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/utils/paths.go:8: GetDataDir 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:22: isValidPrivateOrigin 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:51: normalizeForwardedProto 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:78: SetAllowedOrigins 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:85: checkOrigin 97.4%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:184: safeSend 80.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:198: cloneAlertData 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:212: cloneAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:235: cloneMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:247: cloneMetadataValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:306: SetStateGetter 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:313: NewHub 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:328: Run 54.2%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:462: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:467: HandleWebSocket 83.3%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:508: dispatchToClients 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:531: popCoalescedMessage 87.5%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:546: runBroadcastSequencer 95.5%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:595: BroadcastState 90.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:622: BroadcastAlert 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:632: BroadcastAlertResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:642: GetClientCount 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:649: Broadcast 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:658: BroadcastMessage 40.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:681: sendPing 100.0%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:690: readPump 57.6%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:759: writePump 58.6%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:816: sanitizeData 71.4%
+github.com/rcourtman/pulse-go-rewrite/internal/websocket/hub.go:832: sanitizeValue 81.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/agents/docker/report.go:141: AgentKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:75: SetLogger 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:83: GetLogger 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:107: Log 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:129: NewConsoleLogger 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:134: Log 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:156: Query 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:161: Count 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:166: GetWebhookURLs 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:171: UpdateWebhookURLs 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/audit.go:176: Close 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/export.go:53: NewExporter 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/export.go:58: Export 81.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/export.go:103: exportCSV 76.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/export.go:166: exportJSON 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/export.go:204: GenerateSummary 96.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/signer.go:34: NewSigner 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/signer.go:81: Sign 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/signer.go:94: Verify 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/signer.go:105: canonicalForm 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/signer.go:122: SigningEnabled 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/signer.go:128: ExportKey 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:36: NewSQLiteLogger 67.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:119: initSchema 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:162: Log 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:219: Query 94.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:299: Count 70.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:345: GetWebhookURLs 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:353: UpdateWebhookURLs 86.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:384: VerifySignature 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:389: Close 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:407: loadWebhookURLs 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:417: retentionWorker 77.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:440: cleanupOldEvents 76.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:475: GetRetentionDays 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/sqlite_logger.go:480: SetRetentionDays 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:42: NewWebhookDelivery 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:61: Start 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:70: Stop 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:78: Enqueue 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:91: UpdateURLs 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:98: GetURLs 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:107: worker 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:125: drainQueue 37.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:143: deliverToAll 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:161: deliverWithRetry 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:200: deliver 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/audit/webhook.go:240: QueueLength 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:25: WithUser 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:30: GetUser 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:38: WithAPIToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:43: GetAPIToken 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:51: GetAPITokenContextKey 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:59: Authorize 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:67: SetAuthorizer 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:77: SetAdminUser 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/authorizer.go:87: GetAuthorizer 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/password.go:19: HashPassword 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/password.go:28: CheckPasswordHash 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/password.go:34: ValidatePasswordComplexity 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:19: NewPolicyEvaluator 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:25: Authorize 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:30: AuthorizeWithAttributes 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:53: getUserEffectivePermissions 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:69: filterMatching 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:91: evaluateWithDenyPrecedence 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:115: evaluateConditions 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:139: substituteVariables 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:153: SetAdminUser 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:165: NewRBACAuthorizer 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:172: Authorize 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:184: AuthorizeWithAttributes 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/policy_evaluator.go:196: SetAdminUser 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:24: GetEffect 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:128: SetManager 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:135: GetManager 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:142: HasPermission 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:149: GetExtendedManager 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:164: MatchesResource 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac.go:193: MatchesAction 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:21: NewFileManager 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:42: initBuiltInRoles 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:104: rolesFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:108: assignmentsFile 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:112: load 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:140: saveRoles 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:154: saveAssignments 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:169: GetRoles 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:181: GetRole 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:190: SaveRole 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:209: DeleteRole 88.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:227: GetUserAssignments 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:239: GetUserAssignment 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:248: AssignRole 78.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:280: UpdateUserRoles 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:301: RemoveRole 92.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/rbac_manager.go:325: GetUserPermissions 93.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:33: NewSQLiteManager 64.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:100: initSchema 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:158: initBuiltInRoles 82.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:241: Close 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:246: GetRoles 82.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:287: loadRolePermissions 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:320: GetRole 88.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:353: SaveRole 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:358: SaveRoleWithContext 82.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:452: getRoleUnsafe 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:478: DeleteRole 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:483: DeleteRoleWithContext 82.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:517: GetUserAssignments 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:545: getUserAssignmentUnsafe 86.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:578: GetUserAssignment 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:587: AssignRole 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:610: UpdateUserRoles 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:615: UpdateUserRolesWithContext 78.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:671: RemoveRole 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:684: GetUserPermissions 93.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:712: GetRoleWithInheritance 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:727: collectInheritedPermissions 81.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:753: checkCircularInheritanceUnsafe 93.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:782: GetRolesWithInheritance 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:801: collectRoleChain 77.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:821: GetChangeLogs 70.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:845: GetChangeLogsForEntity 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:864: scanChangeLogs 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:888: logChangeUnsafe 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:900: migrateFromFiles 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/sqlite_manager.go:949: nullString 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/token.go:15: GenerateAPIToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/token.go:25: HashAPIToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/token.go:31: CompareAPIToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/auth/token.go:37: IsAPITokenHashed 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:52: friendlyPhaseName 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:70: AddError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:116: NewScanner 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:126: NewScannerWithProfile 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:212: DiscoverServers 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:217: DiscoverServersWithCallback 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:222: DiscoverServersWithCallbacks 50.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:382: discoverAtPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:399: buildServerFromProbe 76.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:446: populateServerHostname 64.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:481: scanWorkerWithProgress 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:502: runPhaseWithProgress 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:614: resolveProfile 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:661: collectExtraTargets 26.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:686: expandPhaseIPs 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:708: shouldSkipPhase 20.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:726: buildEnvironmentInfo 88.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:753: ensurePolicyDefaults 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:772: cloneProfile 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:804: clonePhase 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:813: copyMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:824: max 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:831: newProxmoxProbeResult 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:841: addConfidence 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:865: recordEndpoint 60.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:875: endpointFinding 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:883: finalize 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:903: probeProxmoxService 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:946: applyProductMatchers 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:953: applySharedHeuristics 80.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1006: applyPVEHeuristics 69.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1033: applyPMGHeuristics 88.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1092: applyPBSHeuristics 39.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1171: defaultProductsForPort 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1182: fetchNodeHostname 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1212: performTLSProbe 93.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1238: probeVersionEndpoint 90.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1283: probeAPIEndpoint 71.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1311: cloneHeader 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1325: inferTypeFromCertificate 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1338: inferTypeFromMetadata 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/discovery.go:1383: generateIPs 86.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:35: LookPath 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:37: CommandCombinedOutput 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:41: Stat 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:42: ReadFile 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:44: Interfaces 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:83: String 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:111: DefaultScanPolicy 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:143: DetectEnvironment 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:147: detectEnvironment 70.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:205: detectContainer 51.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:275: detectNativeEnvironment 81.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:301: detectDockerEnvironment 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:376: detectLXCEnvironment 38.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:446: isDockerHostMode 69.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:475: isLXCPrivileged 58.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:508: getAllLocalSubnets 75.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:563: detectHostNetworkFromContainer 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:604: getDefaultGateway 78.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:648: parseHexIP 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:667: tryCommonSubnets 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:689: addFallbackSubnets 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:711: countKernelRoutes 86.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/envdetect/envdetect.go:738: profileWithWarning 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/probe_test_helpers.go:11: ProbeProxmoxService 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/discovery/probe_test_helpers.go:15: ProbeAPIEndpoint 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/fsfilters/filters.go:24: ReadOnlyFilesystemReason 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/fsfilters/filters.go:53: ShouldIgnoreReadOnlyFilesystem 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/fsfilters/filters.go:117: ShouldSkipFilesystem 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/fsfilters/filters.go:195: MatchesUserExclude 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/alert_metrics.go:69: RecordAlertFired 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/alert_metrics.go:75: RecordAlertResolved 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/alert_metrics.go:85: RecordAlertAcknowledged 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/alert_metrics.go:90: RecordAlertSuppressed 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:47: DefaultConfig 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:84: NewStore 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:128: initSchema 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:168: Write 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:187: flushLocked 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:202: writeBatch 55.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:243: Query 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:275: QueryAll 81.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:307: selectTier 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:321: backgroundWorker 78.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:352: Flush 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:359: runRollup 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:375: rollupTier 81.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:419: rollupCandidate 61.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:469: runRetention 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:506: Close 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/metrics/store.go:536: GetStats 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:51: NewClient 94.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:141: authenticate 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:154: authenticateJSON 92.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:180: authenticateForm 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:201: handleAuthResponse 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:230: Error 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:237: shouldFallbackToForm 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:248: request 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:323: get 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:328: post 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:340: CreateUser 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:365: SetUserACL 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:385: CreateUserToken 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:429: SetupMonitoringAccess 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:492: GetVersion 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:514: GetNodeName 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:544: GetNodeStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:581: GetDatastores 98.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:818: ListNamespaces 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:856: ListBackupGroups 89.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:898: ListBackupSnapshots 88.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/pbs/client.go:933: ListAllBackups 93.1%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:130: NewClient 67.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:204: authenticate 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:242: authenticateForm 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:263: handleAuthResponse 91.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:295: Error 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:302: shouldFallbackToForm 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:312: ensureAuth 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:329: request 68.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:384: getJSON 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:400: GetVersion 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:408: GetMailStatistics 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:418: GetMailCount 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:431: GetSpamScores 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:439: GetClusterStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:451: GetQuarantineStatus 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:460: GetQueueStatus 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/client.go:470: ListBackups 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/json_types.go:14: UnmarshalJSON 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/json_types.go:49: Float64 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/json_types.go:56: UnmarshalJSON 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/json_types.go:98: Int64 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/pmg/json_types.go:102: Int 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/ceph.go:118: GetCephStatus 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/ceph.go:137: GetCephDF 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:24: UnmarshalJSON 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:56: coerceUint64 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:152: NewClient 87.1%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:234: authenticate 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:247: authenticateJSON 76.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:273: authenticateForm 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:294: handleAuthResponse 90.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:323: Error 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:330: shouldFallbackToForm 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:341: request 69.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:439: get 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:502: UnmarshalJSON 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:568: EffectiveAvailable 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:623: GetMHzString 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:640: GetNodes 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:659: GetNodeStatus 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:678: GetNodeRRDData 90.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:716: GetLXCRRDData 90.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:857: GetNodeNetworkInterfaces 72.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:881: GetContainerConfig 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:942: GetVMs 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:961: GetContainers 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:980: GetStorage 84.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1010: GetAllStorage 84.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1054: GetNodeTasks 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1073: GetBackupTasks 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1104: GetContainerInterfaces 72.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1128: GetStorageContent 88.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1166: GetVMSnapshots 84.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1194: GetContainerSnapshots 84.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1235: GetClusterStatus 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1254: IsClusterMember 45.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1283: GetVMConfig 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1302: GetVMAgentInfo 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1322: GetVMAgentVersion 52.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1378: UnmarshalJSON 94.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1412: parseUint64Flexible 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1482: GetVMFSInfo 73.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1589: GetVMNetworkInterfaces 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1610: GetVMStatus 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1631: GetContainerStatus 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1673: GetClusterResources 81.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1753: UnmarshalJSON 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1806: GetZFSPoolStatus 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1825: GetZFSPoolDetail 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1861: UnmarshalJSON 95.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1921: parseWearoutValue 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1968: clampWearoutConsumed 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:1990: GetDisks 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/client.go:2021: GetNodePendingUpdates 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:49: isVMSpecificError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:76: sanitizeEndpointError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:132: NewClusterClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:164: getEndpointFingerprint 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:172: initialHealthCheck 54.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:280: getHealthyClient 54.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:486: markUnhealthyWithError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:506: clearEndpointError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:516: recoverUnhealthyNodes 80.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:656: executeWithFailover 59.2%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:805: applyRateLimitCooldown 71.4%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:818: calculateRateLimitBackoff 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:829: isTransientRateLimitError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:853: extractStatusCode 85.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:867: isNotImplementedError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:887: GetHealthStatus 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:906: GetHealthStatusWithErrors 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:923: GetNodes 91.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:953: GetNodeStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:966: GetNodeRRDData 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:979: GetLXCRRDData 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:992: GetVMs 72.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1016: GetContainers 72.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1040: GetStorage 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1053: GetAllStorage 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1066: GetBackupTasks 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1079: GetReplicationStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1092: GetStorageContent 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1106: GetCephStatus 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1120: GetCephDF 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1133: GetVMSnapshots 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1146: GetContainerSnapshots 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1159: GetVMStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1172: GetVMConfig 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1185: GetVMAgentInfo 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1199: GetVMAgentVersion 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1213: GetVMFSInfo 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1227: GetVMNetworkInterfaces 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1241: GetClusterResources 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1255: GetContainerStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1269: GetContainerConfig 87.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1283: GetContainerInterfaces 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1297: IsClusterMember 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1311: GetZFSPoolStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1325: GetZFSPoolsWithDetails 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1339: GetDisks 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1364: GetNodePendingUpdates 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1390: GetClusterStatus 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1408: IsQuorate 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/cluster_client.go:1426: isAuthError 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:51: GetReplicationStatus 84.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:82: enrichReplicationJobStatus 66.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:211: parseReplicationJob 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:302: decodeRaw 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:313: firstNonNilRaw 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:322: stringFromAny 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:359: intFromAny 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:415: boolFromAny 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:445: floatFromAny 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:481: parseReplicationTime 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:541: parseDurationSeconds 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:573: parseHHMMSSToSeconds 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/replication.go:598: copyFloat 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/zfs.go:13: GetZFSPoolsWithDetails 93.8%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/zfs.go:76: ConvertToModelZFSPool 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/proxmox/zfs.go:139: convertDeviceRecursive 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:15: NewCSVGenerator 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:20: Generate 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:48: writeHeader 80.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:70: writeSummary 76.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:115: writeData 86.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:184: formatValue 66.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/csv.go:192: formatBytes 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/engine.go:25: NewReportEngine 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/engine.go:34: Generate 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/engine.go:111: queryMetrics 0.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/engine.go:192: GetResourceTypeDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/engine.go:212: GetMetricTypeDisplayName 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/engine.go:234: GetMetricUnit 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:17: NewPDFGenerator 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:22: Generate 92.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:56: writeHeader 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:119: writeSummary 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:176: writeCharts 90.5%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:309: writeDataTable 75.7%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/pdf.go:430: writeFooter 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/reporting.go:37: SetEngine 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/reporting/reporting.go:42: GetEngine 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:49: SetBusinessHooks 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:56: Run 63.6%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:322: startMetricsServer 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:347: ShouldAutoImport 83.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:361: PerformAutoImport 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:406: NormalizeImportPayload 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/server/server.go:423: LooksLikeBase64 93.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/dnscache.go:22: GetDNSResolver 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/dnscache.go:30: initDNSResolver 75.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/dnscache.go:54: SetDNSCacheTTL 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/dnscache.go:70: DialContextWithCache 90.9%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/fingerprint.go:20: FetchFingerprint 77.3%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/fingerprint.go:68: FingerprintVerifier 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/fingerprint.go:94: CreateHTTPClient 100.0%
+github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil/fingerprint.go:99: CreateHTTPClientWithTimeout 100.0%
+total: (statements) 69.2%
diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.go
index 1e344ddd8f..47210da84a 100644
--- a/internal/api/ai_handler.go
+++ b/internal/api/ai_handler.go
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"net/http"
+ "sync"
"sync/atomic"
"time"
@@ -12,12 +13,14 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/ai/chat"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rs/zerolog/log"
)
// AIPersistence interface for loading/saving AI config
type AIPersistence interface {
LoadAIConfig() (*config.AIConfig, error)
+ DataDir() string
}
// AIService interface for the AI chat service - enables mocking in tests
@@ -57,10 +60,16 @@ type AIService interface {
// AIHandler handles all AI endpoints using direct AI integration
type AIHandler struct {
- config *config.Config
- persistence AIPersistence
- service AIService
- agentServer *agentexec.Server
+ mtPersistence *config.MultiTenantPersistence
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyConfig *config.Config
+ legacyPersistence AIPersistence
+ legacyService AIService
+ agentServer *agentexec.Server
+ services map[string]AIService
+ servicesMu sync.RWMutex
+ stateProviders map[string]AIStateProvider
+ stateProvidersMu sync.RWMutex
}
// newChatService is the factory function for creating the AI service.
@@ -70,13 +79,176 @@ var newChatService = func(cfg chat.Config) AIService {
}
// NewAIHandler creates a new AI handler
-func NewAIHandler(cfg *config.Config, persistence AIPersistence, agentServer *agentexec.Server) *AIHandler {
+func NewAIHandler(mtp *config.MultiTenantPersistence, mtm *monitoring.MultiTenantMonitor, agentServer *agentexec.Server) *AIHandler {
+ var defaultConfig *config.Config
+ var defaultPersistence AIPersistence
+
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil && m != nil {
+ defaultConfig = m.GetConfig()
+ }
+ }
+ if mtp != nil {
+ if p, err := mtp.GetPersistence("default"); err == nil {
+ defaultPersistence = p
+ }
+ }
+
return &AIHandler{
- config: cfg,
- persistence: persistence,
- agentServer: agentServer,
- // service will be initialized in Start()
+ mtPersistence: mtp,
+ mtMonitor: mtm,
+ legacyConfig: defaultConfig,
+ legacyPersistence: defaultPersistence,
+ agentServer: agentServer,
+ services: make(map[string]AIService),
+ stateProviders: make(map[string]AIStateProvider),
+ }
+}
+
+// GetService returns the AI service for the current context
+func (h *AIHandler) GetService(ctx context.Context) AIService {
+ orgID := GetOrgID(ctx)
+ if orgID == "default" || orgID == "" {
+ return h.legacyService
+ }
+
+ h.servicesMu.RLock()
+ svc, exists := h.services[orgID]
+ h.servicesMu.RUnlock()
+
+ if exists {
+ return svc
+ }
+
+ h.servicesMu.Lock()
+ defer h.servicesMu.Unlock()
+
+ // Double check
+ if svc, exists = h.services[orgID]; exists {
+ return svc
+ }
+
+ // Create and start service for this tenant
+ svc = h.initTenantService(ctx, orgID)
+ if svc != nil {
+ h.services[orgID] = svc
+ }
+ return svc
+}
+
+// RemoveTenantService stops and removes the AI service for a specific tenant.
+// This should be called when a tenant is offboarded to free resources.
+func (h *AIHandler) RemoveTenantService(ctx context.Context, orgID string) error {
+ if orgID == "default" || orgID == "" {
+ return nil // Don't remove legacy service
+ }
+
+ h.servicesMu.Lock()
+ defer h.servicesMu.Unlock()
+
+ svc, exists := h.services[orgID]
+ if !exists {
+ return nil // Nothing to remove
+ }
+
+ if svc != nil {
+ if err := svc.Stop(ctx); err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Error stopping AI service for removed tenant")
+ }
+ }
+
+ delete(h.services, orgID)
+ log.Info().Str("orgID", orgID).Msg("Removed AI service for tenant")
+ return nil
+}
+
+func (h *AIHandler) initTenantService(ctx context.Context, orgID string) AIService {
+ if h.mtPersistence == nil {
+ return nil
+ }
+
+ persistence, err := h.mtPersistence.GetPersistence(orgID)
+ if err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Failed to get persistence for AI service")
+ return nil
+ }
+
+ // We need the config to get the data directory
+ aiCfg, _ := persistence.LoadAIConfig()
+
+ dataDir := h.getDataDir(aiCfg, persistence.DataDir())
+
+ // Create chat config
+ chatCfg := chat.Config{
+ AIConfig: aiCfg,
+ DataDir: dataDir,
+ AgentServer: h.agentServer,
+ }
+
+ // Get monitor for state provider
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ chatCfg.StateProvider = m
+ }
+ }
+
+ svc := newChatService(chatCfg)
+ if err := svc.Start(ctx); err != nil {
+ log.Error().Str("orgID", orgID).Err(err).Msg("Failed to start AI service for tenant")
+ }
+
+ return svc
+}
+
+func (h *AIHandler) getDataDir(aiCfg *config.AIConfig, baseDir string) string {
+ dataDir := baseDir
+ if dataDir == "" {
+ dataDir = "data"
+ }
+ return dataDir
+}
+
+func (h *AIHandler) getConfig(ctx context.Context) *config.Config {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return m.GetConfig()
+ }
+ }
+ return h.legacyConfig
+}
+
+func (h *AIHandler) getPersistence(ctx context.Context) AIPersistence {
+ orgID := GetOrgID(ctx)
+ if h.mtPersistence != nil {
+ if p, err := h.mtPersistence.GetPersistence(orgID); err == nil {
+ return p
+ }
+ }
+ return h.legacyPersistence
+}
+
+// loadAIConfig loads AI config for the current context
+func (h *AIHandler) loadAIConfig(ctx context.Context) *config.AIConfig {
+ p := h.getPersistence(ctx)
+ if p == nil {
+ return nil
+ }
+ cfg, err := p.LoadAIConfig()
+ if err != nil {
+ return nil
}
+ return cfg
+}
+
+// SetMultiTenantPersistence updates the persistence manager
+func (h *AIHandler) SetMultiTenantPersistence(mtp *config.MultiTenantPersistence) {
+ h.mtPersistence = mtp
+}
+
+// SetMultiTenantMonitor updates the monitor manager
+func (h *AIHandler) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
}
// StateProvider interface for infrastructure state
@@ -87,7 +259,7 @@ type AIStateProvider interface {
// Start initializes and starts the AI chat service
func (h *AIHandler) Start(ctx context.Context, stateProvider AIStateProvider) error {
log.Info().Msg("AIHandler.Start called")
- aiCfg := h.loadAIConfig()
+ aiCfg := h.loadAIConfig(ctx)
if aiCfg == nil {
log.Info().Msg("AI config is nil, AI is disabled")
return nil
@@ -98,17 +270,19 @@ func (h *AIHandler) Start(ctx context.Context, stateProvider AIStateProvider) er
}
// Determine data directory
- dataDir := "/tmp/pulse-ai"
+ persistence := h.getPersistence(ctx)
+ dataDir := h.getDataDir(aiCfg, persistence.DataDir())
- log.Info().Bool("enabled", aiCfg.Enabled).Str("model", aiCfg.Model).Msg("Starting AI chat service")
- h.service = newChatService(chat.Config{
+ // Create chat config
+ chatCfg := chat.Config{
AIConfig: aiCfg,
+ DataDir: dataDir,
StateProvider: stateProvider,
AgentServer: h.agentServer,
- DataDir: dataDir,
- })
+ }
- if err := h.service.Start(ctx); err != nil {
+ h.legacyService = newChatService(chatCfg)
+ if err := h.legacyService.Start(ctx); err != nil {
log.Error().Err(err).Msg("Failed to start AI chat service")
return err
}
@@ -133,8 +307,8 @@ func (h *AIHandler) Start(ctx context.Context, stateProvider AIStateProvider) er
// Stop stops the AI chat service
func (h *AIHandler) Stop(ctx context.Context) error {
- if h.service != nil {
- return h.service.Stop(ctx)
+ if h.legacyService != nil {
+ return h.legacyService.Stop(ctx)
}
return nil
}
@@ -142,39 +316,24 @@ func (h *AIHandler) Stop(ctx context.Context) error {
// Restart restarts the AI chat service with updated configuration
// Call this when model or other settings change
func (h *AIHandler) Restart(ctx context.Context) error {
- if h.service == nil || !h.service.IsRunning() {
+ if h.legacyService == nil || !h.legacyService.IsRunning() {
return nil // Not running, nothing to restart
}
// Load fresh config from persistence to get latest settings
- newCfg := h.loadAIConfig()
- return h.service.Restart(ctx, newCfg)
+ newCfg := h.loadAIConfig(ctx)
+ return h.legacyService.Restart(ctx, newCfg)
}
// IsRunning returns whether AI is running
-func (h *AIHandler) IsRunning() bool {
- return h.service != nil && h.service.IsRunning()
-}
-
-// GetService returns the underlying AI chat service
-func (h *AIHandler) GetService() AIService {
- return h.service
-}
-
// GetAIConfig returns the current AI configuration
-func (h *AIHandler) GetAIConfig() *config.AIConfig {
- return h.loadAIConfig()
+func (h *AIHandler) GetAIConfig(ctx context.Context) *config.AIConfig {
+ return h.loadAIConfig(ctx)
}
-func (h *AIHandler) loadAIConfig() *config.AIConfig {
- if h.persistence == nil {
- return nil
- }
- cfg, err := h.persistence.LoadAIConfig()
- if err != nil {
- log.Warn().Err(err).Msg("Failed to load AI config")
- return nil
- }
- return cfg
+// IsRunning returns true if the AI chat service is running
+func (h *AIHandler) IsRunning(ctx context.Context) bool {
+ svc := h.GetService(ctx)
+ return svc != nil && svc.IsRunning()
}
// ChatRequest represents a chat request
@@ -208,10 +367,16 @@ func (h *AIHandler) HandleChat(w http.ResponseWriter, r *http.Request) {
// Auth already handled by RequireAuth wrapper - no need to check again
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
// Parse request
var req ChatRequest
@@ -296,7 +461,7 @@ func (h *AIHandler) HandleChat(w http.ResponseWriter, r *http.Request) {
}
// Stream from AI chat service
- err := h.service.ExecuteStream(ctx, chat.ExecuteRequest{
+ err := svc.ExecuteStream(ctx, chat.ExecuteRequest{
Prompt: req.Prompt,
SessionID: req.SessionID,
Model: req.Model,
@@ -316,12 +481,19 @@ func (h *AIHandler) HandleChat(w http.ResponseWriter, r *http.Request) {
// HandleSessions handles GET /api/ai/sessions - list sessions
func (h *AIHandler) HandleSessions(w http.ResponseWriter, r *http.Request) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- sessions, err := h.service.ListSessions(r.Context())
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ sessions, err := svc.ListSessions(ctx)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -333,12 +505,19 @@ func (h *AIHandler) HandleSessions(w http.ResponseWriter, r *http.Request) {
// HandleCreateSession handles POST /api/ai/sessions - create session
func (h *AIHandler) HandleCreateSession(w http.ResponseWriter, r *http.Request) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- session, err := h.service.CreateSession(r.Context())
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ session, err := svc.CreateSession(ctx)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -350,12 +529,19 @@ func (h *AIHandler) HandleCreateSession(w http.ResponseWriter, r *http.Request)
// HandleDeleteSession handles DELETE /api/ai/sessions/{id}
func (h *AIHandler) HandleDeleteSession(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- if err := h.service.DeleteSession(r.Context(), sessionID); err != nil {
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ if err := svc.DeleteSession(ctx, sessionID); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
@@ -365,12 +551,19 @@ func (h *AIHandler) HandleDeleteSession(w http.ResponseWriter, r *http.Request,
// HandleMessages handles GET /api/ai/sessions/{id}/messages
func (h *AIHandler) HandleMessages(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- messages, err := h.service.GetMessages(r.Context(), sessionID)
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ messages, err := svc.GetMessages(ctx, sessionID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -382,12 +575,19 @@ func (h *AIHandler) HandleMessages(w http.ResponseWriter, r *http.Request, sessi
// HandleAbort handles POST /api/ai/sessions/{id}/abort
func (h *AIHandler) HandleAbort(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- if err := h.service.AbortSession(r.Context(), sessionID); err != nil {
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ if err := svc.AbortSession(ctx, sessionID); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
@@ -398,7 +598,7 @@ func (h *AIHandler) HandleAbort(w http.ResponseWriter, r *http.Request, sessionI
// HandleStatus handles GET /api/ai/status
func (h *AIHandler) HandleStatus(w http.ResponseWriter, r *http.Request) {
status := map[string]interface{}{
- "running": h.IsRunning(),
+ "running": h.IsRunning(r.Context()),
"engine": "direct",
}
@@ -409,12 +609,19 @@ func (h *AIHandler) HandleStatus(w http.ResponseWriter, r *http.Request) {
// HandleSummarize handles POST /api/ai/sessions/{id}/summarize
// Compresses context when nearing model limits
func (h *AIHandler) HandleSummarize(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- result, err := h.service.SummarizeSession(r.Context(), sessionID)
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ result, err := svc.SummarizeSession(ctx, sessionID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -427,12 +634,19 @@ func (h *AIHandler) HandleSummarize(w http.ResponseWriter, r *http.Request, sess
// HandleDiff handles GET /api/ai/sessions/{id}/diff
// Returns file changes made during the session
func (h *AIHandler) HandleDiff(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- diff, err := h.service.GetSessionDiff(r.Context(), sessionID)
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ diff, err := svc.GetSessionDiff(ctx, sessionID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -445,12 +659,19 @@ func (h *AIHandler) HandleDiff(w http.ResponseWriter, r *http.Request, sessionID
// HandleFork handles POST /api/ai/sessions/{id}/fork
// Creates a branch point in the conversation
func (h *AIHandler) HandleFork(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- session, err := h.service.ForkSession(r.Context(), sessionID)
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ session, err := svc.ForkSession(ctx, sessionID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -463,12 +684,19 @@ func (h *AIHandler) HandleFork(w http.ResponseWriter, r *http.Request, sessionID
// HandleRevert handles POST /api/ai/sessions/{id}/revert
// Reverts file changes from the session
func (h *AIHandler) HandleRevert(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- result, err := h.service.RevertSession(r.Context(), sessionID)
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ result, err := svc.RevertSession(ctx, sessionID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -481,12 +709,19 @@ func (h *AIHandler) HandleRevert(w http.ResponseWriter, r *http.Request, session
// HandleUnrevert handles POST /api/ai/sessions/{id}/unrevert
// Restores previously reverted changes
func (h *AIHandler) HandleUnrevert(w http.ResponseWriter, r *http.Request, sessionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
- result, err := h.service.UnrevertSession(r.Context(), sessionID)
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ result, err := svc.UnrevertSession(ctx, sessionID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -506,7 +741,8 @@ type AnswerQuestionRequest struct {
// HandleAnswerQuestion handles POST /api/ai/question/{questionID}/answer
func (h *AIHandler) HandleAnswerQuestion(w http.ResponseWriter, r *http.Request, questionID string) {
- if !h.IsRunning() {
+ ctx := r.Context()
+ if !h.IsRunning(ctx) {
http.Error(w, "AI is not running", http.StatusServiceUnavailable)
return
}
@@ -531,7 +767,13 @@ func (h *AIHandler) HandleAnswerQuestion(w http.ResponseWriter, r *http.Request,
Int("answers_count", len(answers)).
Msg("AIHandler: Received answer to question")
- if err := h.service.AnswerQuestion(r.Context(), questionID, answers); err != nil {
+ svc := h.GetService(ctx)
+ if svc == nil {
+ http.Error(w, "AI service not available", http.StatusServiceUnavailable)
+ return
+ }
+
+ if err := svc.AnswerQuestion(ctx, questionID, answers); err != nil {
log.Error().Err(err).Str("questionID", questionID).Msg("Failed to answer question")
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -542,91 +784,91 @@ func (h *AIHandler) HandleAnswerQuestion(w http.ResponseWriter, r *http.Request,
// SetAlertProvider sets the alert provider for MCP tools
func (h *AIHandler) SetAlertProvider(provider chat.MCPAlertProvider) {
- if h.service != nil {
- h.service.SetAlertProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetAlertProvider(provider)
}
}
// SetFindingsProvider sets the findings provider for MCP tools
func (h *AIHandler) SetFindingsProvider(provider chat.MCPFindingsProvider) {
- if h.service != nil {
- h.service.SetFindingsProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetFindingsProvider(provider)
}
}
// SetBaselineProvider sets the baseline provider for MCP tools
func (h *AIHandler) SetBaselineProvider(provider chat.MCPBaselineProvider) {
- if h.service != nil {
- h.service.SetBaselineProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetBaselineProvider(provider)
}
}
// SetPatternProvider sets the pattern provider for MCP tools
func (h *AIHandler) SetPatternProvider(provider chat.MCPPatternProvider) {
- if h.service != nil {
- h.service.SetPatternProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetPatternProvider(provider)
}
}
// SetMetricsHistory sets the metrics history provider for MCP tools
func (h *AIHandler) SetMetricsHistory(provider chat.MCPMetricsHistoryProvider) {
- if h.service != nil {
- h.service.SetMetricsHistory(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetMetricsHistory(provider)
}
}
// SetAgentProfileManager sets the agent profile manager for MCP tools
func (h *AIHandler) SetAgentProfileManager(manager chat.AgentProfileManager) {
- if h.service != nil {
- h.service.SetAgentProfileManager(manager)
+ if h.legacyService != nil {
+ h.legacyService.SetAgentProfileManager(manager)
}
}
// SetStorageProvider sets the storage provider for MCP tools
func (h *AIHandler) SetStorageProvider(provider chat.MCPStorageProvider) {
- if h.service != nil {
- h.service.SetStorageProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetStorageProvider(provider)
}
}
// SetBackupProvider sets the backup provider for MCP tools
func (h *AIHandler) SetBackupProvider(provider chat.MCPBackupProvider) {
- if h.service != nil {
- h.service.SetBackupProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetBackupProvider(provider)
}
}
// SetDiskHealthProvider sets the disk health provider for MCP tools
func (h *AIHandler) SetDiskHealthProvider(provider chat.MCPDiskHealthProvider) {
- if h.service != nil {
- h.service.SetDiskHealthProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetDiskHealthProvider(provider)
}
}
// SetUpdatesProvider sets the updates provider for MCP tools
func (h *AIHandler) SetUpdatesProvider(provider chat.MCPUpdatesProvider) {
- if h.service != nil {
- h.service.SetUpdatesProvider(provider)
+ if h.legacyService != nil {
+ h.legacyService.SetUpdatesProvider(provider)
}
}
// SetFindingsManager sets the findings manager for MCP tools
func (h *AIHandler) SetFindingsManager(manager chat.FindingsManager) {
- if h.service != nil {
- h.service.SetFindingsManager(manager)
+ if h.legacyService != nil {
+ h.legacyService.SetFindingsManager(manager)
}
}
// SetMetadataUpdater sets the metadata updater for MCP tools
func (h *AIHandler) SetMetadataUpdater(updater chat.MetadataUpdater) {
- if h.service != nil {
- h.service.SetMetadataUpdater(updater)
+ if h.legacyService != nil {
+ h.legacyService.SetMetadataUpdater(updater)
}
}
// UpdateControlSettings updates control settings in the service
func (h *AIHandler) UpdateControlSettings(cfg *config.AIConfig) {
- if h.service != nil {
- h.service.UpdateControlSettings(cfg)
+ if h.legacyService != nil {
+ h.legacyService.UpdateControlSettings(cfg)
}
}
diff --git a/internal/api/ai_handlers.go b/internal/api/ai_handlers.go
index 4be57f06e6..6bfc27534a 100644
--- a/internal/api/ai_handlers.go
+++ b/internal/api/ai_handlers.go
@@ -25,38 +25,155 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/ai/providers"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/license"
+ "github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/utils"
"github.com/rs/zerolog/log"
)
// AISettingsHandler handles AI settings endpoints
type AISettingsHandler struct {
- config *config.Config
- persistence *config.ConfigPersistence
- aiService *ai.Service
+ mtPersistence *config.MultiTenantPersistence
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyConfig *config.Config
+ legacyPersistence *config.ConfigPersistence
+ legacyAIService *ai.Service
+ aiServices map[string]*ai.Service
+ aiServicesMu sync.RWMutex
agentServer *agentexec.Server
onModelChange func() // Called when model or other AI chat-affecting settings change
onControlSettingsChange func() // Called when control level or protected guests change
+
+ // Providers to be applied to new services
+ stateProvider ai.StateProvider
+ resourceProvider ai.ResourceProvider
+ metadataProvider ai.MetadataProvider
+ patrolThresholdProvider ai.ThresholdProvider
+ metricsHistoryProvider ai.MetricsHistoryProvider
+ baselineStore *ai.BaselineStore
+ changeDetector *ai.ChangeDetector
+ remediationLog *ai.RemediationLog
+ incidentStore *memory.IncidentStore
+ patternDetector *ai.PatternDetector
+ correlationDetector *ai.CorrelationDetector
+ licenseChecker ai.LicenseChecker
}
// NewAISettingsHandler creates a new AI settings handler
-func NewAISettingsHandler(cfg *config.Config, persistence *config.ConfigPersistence, agentServer *agentexec.Server) *AISettingsHandler {
- aiService := ai.NewService(persistence, agentServer)
- if err := aiService.LoadConfig(); err != nil {
- log.Warn().Err(err).Msg("Failed to load AI config on startup")
+func NewAISettingsHandler(mtp *config.MultiTenantPersistence, mtm *monitoring.MultiTenantMonitor, agentServer *agentexec.Server) *AISettingsHandler {
+ var defaultConfig *config.Config
+ var defaultPersistence *config.ConfigPersistence
+ var defaultAIService *ai.Service
+
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil && m != nil {
+ defaultConfig = m.GetConfig()
+ }
+ }
+ if mtp != nil {
+ if p, err := mtp.GetPersistence("default"); err == nil {
+ defaultPersistence = p
+ }
+ }
+
+ if defaultPersistence != nil {
+ defaultAIService = ai.NewService(defaultPersistence, agentServer)
+ if err := defaultAIService.LoadConfig(); err != nil {
+ log.Warn().Err(err).Msg("Failed to load AI config on startup")
+ }
}
return &AISettingsHandler{
- config: cfg,
- persistence: persistence,
- aiService: aiService,
- agentServer: agentServer,
+ mtPersistence: mtp,
+ mtMonitor: mtm,
+ legacyConfig: defaultConfig,
+ legacyPersistence: defaultPersistence,
+ legacyAIService: defaultAIService,
+ aiServices: make(map[string]*ai.Service),
+ agentServer: agentServer,
}
}
// GetAIService returns the underlying AI service
-func (h *AISettingsHandler) GetAIService() *ai.Service {
- return h.aiService
+func (h *AISettingsHandler) GetAIService(ctx context.Context) *ai.Service {
+ orgID := GetOrgID(ctx)
+ if orgID == "default" || orgID == "" {
+ return h.legacyAIService
+ }
+
+ h.aiServicesMu.RLock()
+ svc, exists := h.aiServices[orgID]
+ h.aiServicesMu.RUnlock()
+
+ if exists {
+ return svc
+ }
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+
+ // Double check
+ if svc, exists = h.aiServices[orgID]; exists {
+ return svc
+ }
+
+ // Create new service for this tenant
+ persistence, err := h.mtPersistence.GetPersistence(orgID)
+ if err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Failed to get persistence for AI service")
+ return h.legacyAIService
+ }
+
+ svc = ai.NewService(persistence, h.agentServer)
+ if err := svc.LoadConfig(); err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Failed to load AI config for tenant")
+ }
+
+ h.aiServices[orgID] = svc
+ return svc
+}
+
+// RemoveTenantService removes the AI settings service for a specific tenant.
+func (h *AISettingsHandler) RemoveTenantService(orgID string) {
+ if orgID == "default" || orgID == "" {
+ return
+ }
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ delete(h.aiServices, orgID)
+ log.Debug().Str("orgID", orgID).Msg("Removed AI settings service for tenant")
+}
+
+// getConfig returns the config for the current context
+func (h *AISettingsHandler) getConfig(ctx context.Context) *config.Config {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return m.GetConfig()
+ }
+ }
+ return h.legacyConfig
+}
+
+// GetPersistence returns the persistence for the current context
+func (h *AISettingsHandler) getPersistence(ctx context.Context) *config.ConfigPersistence {
+ orgID := GetOrgID(ctx)
+ if h.mtPersistence != nil {
+ if p, err := h.mtPersistence.GetPersistence(orgID); err == nil {
+ return p
+ }
+ }
+ return h.legacyPersistence
+}
+
+// SetMultiTenantPersistence updates the persistence manager
+func (h *AISettingsHandler) SetMultiTenantPersistence(mtp *config.MultiTenantPersistence) {
+ h.mtPersistence = mtp
+}
+
+// SetMultiTenantMonitor updates the monitor manager
+func (h *AISettingsHandler) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
}
// SetConfig updates the configuration reference used by the handler.
@@ -64,103 +181,217 @@ func (h *AISettingsHandler) SetConfig(cfg *config.Config) {
if cfg == nil {
return
}
- h.config = cfg
+ h.legacyConfig = cfg
}
// SetStateProvider sets the state provider for infrastructure context
func (h *AISettingsHandler) SetStateProvider(sp ai.StateProvider) {
- h.aiService.SetStateProvider(sp)
+ h.stateProvider = sp
+ h.legacyAIService.SetStateProvider(sp)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetStateProvider(sp)
+ }
}
// SetResourceProvider sets the resource provider for unified infrastructure context (Phase 2)
func (h *AISettingsHandler) SetResourceProvider(rp ai.ResourceProvider) {
- h.aiService.SetResourceProvider(rp)
+ h.resourceProvider = rp
+ h.legacyAIService.SetResourceProvider(rp)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetResourceProvider(rp)
+ }
}
// SetMetadataProvider sets the metadata provider for AI URL discovery
func (h *AISettingsHandler) SetMetadataProvider(mp ai.MetadataProvider) {
- h.aiService.SetMetadataProvider(mp)
+ h.metadataProvider = mp
+ h.legacyAIService.SetMetadataProvider(mp)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetMetadataProvider(mp)
+ }
}
// StartPatrol starts the background AI patrol service
func (h *AISettingsHandler) StartPatrol(ctx context.Context) {
- h.aiService.StartPatrol(ctx)
+ h.GetAIService(ctx).StartPatrol(ctx)
}
// IsAIEnabled returns true if AI features are enabled
-func (h *AISettingsHandler) IsAIEnabled() bool {
- return h.aiService.IsEnabled()
+func (h *AISettingsHandler) IsAIEnabled(ctx context.Context) bool {
+ return h.GetAIService(ctx).IsEnabled()
}
// SetPatrolThresholdProvider sets the threshold provider for the patrol service
func (h *AISettingsHandler) SetPatrolThresholdProvider(provider ai.ThresholdProvider) {
- h.aiService.SetPatrolThresholdProvider(provider)
+ h.patrolThresholdProvider = provider
+ h.legacyAIService.SetPatrolThresholdProvider(provider)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetPatrolThresholdProvider(provider)
+ }
}
// SetPatrolFindingsPersistence enables findings persistence for the patrol service
func (h *AISettingsHandler) SetPatrolFindingsPersistence(persistence ai.FindingsPersistence) error {
- if patrol := h.aiService.GetPatrolService(); patrol != nil {
- return patrol.SetFindingsPersistence(persistence)
+ var firstErr error
+ if patrol := h.legacyAIService.GetPatrolService(); patrol != nil {
+ if err := patrol.SetFindingsPersistence(persistence); err != nil {
+ firstErr = err
+ }
+ }
+ // Also apply to active services
+ h.aiServicesMu.RLock()
+ defer h.aiServicesMu.RUnlock()
+ for orgID, svc := range h.aiServices {
+ if patrol := svc.GetPatrolService(); patrol != nil {
+ if err := patrol.SetFindingsPersistence(persistence); err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Failed to set findings persistence for tenant")
+ if firstErr == nil {
+ firstErr = err
+ }
+ }
+ }
}
- return nil
+ return firstErr
}
// SetPatrolRunHistoryPersistence enables patrol run history persistence for the patrol service
func (h *AISettingsHandler) SetPatrolRunHistoryPersistence(persistence ai.PatrolHistoryPersistence) error {
- if patrol := h.aiService.GetPatrolService(); patrol != nil {
- return patrol.SetRunHistoryPersistence(persistence)
+ var firstErr error
+ if patrol := h.legacyAIService.GetPatrolService(); patrol != nil {
+ if err := patrol.SetRunHistoryPersistence(persistence); err != nil {
+ firstErr = err
+ }
}
- return nil
+ // Also apply to active services
+ h.aiServicesMu.RLock()
+ defer h.aiServicesMu.RUnlock()
+ for orgID, svc := range h.aiServices {
+ if patrol := svc.GetPatrolService(); patrol != nil {
+ if err := patrol.SetRunHistoryPersistence(persistence); err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Failed to set run history persistence for tenant")
+ if firstErr == nil {
+ firstErr = err
+ }
+ }
+ }
+ }
+ return firstErr
}
// SetMetricsHistoryProvider sets the metrics history provider for enriched AI context
func (h *AISettingsHandler) SetMetricsHistoryProvider(provider ai.MetricsHistoryProvider) {
- h.aiService.SetMetricsHistoryProvider(provider)
+ h.metricsHistoryProvider = provider
+ h.legacyAIService.SetMetricsHistoryProvider(provider)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetMetricsHistoryProvider(provider)
+ }
}
// SetBaselineStore sets the baseline store for anomaly detection
func (h *AISettingsHandler) SetBaselineStore(store *ai.BaselineStore) {
- h.aiService.SetBaselineStore(store)
+ h.baselineStore = store
+ h.legacyAIService.SetBaselineStore(store)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetBaselineStore(store)
+ }
}
// SetChangeDetector sets the change detector for operational memory
func (h *AISettingsHandler) SetChangeDetector(detector *ai.ChangeDetector) {
- h.aiService.SetChangeDetector(detector)
+ h.changeDetector = detector
+ h.legacyAIService.SetChangeDetector(detector)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetChangeDetector(detector)
+ }
}
// SetRemediationLog sets the remediation log for tracking fix attempts
func (h *AISettingsHandler) SetRemediationLog(remLog *ai.RemediationLog) {
- h.aiService.SetRemediationLog(remLog)
+ h.remediationLog = remLog
+ h.legacyAIService.SetRemediationLog(remLog)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetRemediationLog(remLog)
+ }
}
// SetIncidentStore sets the incident store for alert timelines.
func (h *AISettingsHandler) SetIncidentStore(store *memory.IncidentStore) {
- h.aiService.SetIncidentStore(store)
+ h.incidentStore = store
+ h.legacyAIService.SetIncidentStore(store)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetIncidentStore(store)
+ }
}
// SetPatternDetector sets the pattern detector for failure prediction
func (h *AISettingsHandler) SetPatternDetector(detector *ai.PatternDetector) {
- h.aiService.SetPatternDetector(detector)
+ h.patternDetector = detector
+ h.legacyAIService.SetPatternDetector(detector)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetPatternDetector(detector)
+ }
}
// SetCorrelationDetector sets the correlation detector for multi-resource correlation
func (h *AISettingsHandler) SetCorrelationDetector(detector *ai.CorrelationDetector) {
- h.aiService.SetCorrelationDetector(detector)
+ h.correlationDetector = detector
+ h.legacyAIService.SetCorrelationDetector(detector)
+
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.SetCorrelationDetector(detector)
+ }
}
// StopPatrol stops the background AI patrol service
func (h *AISettingsHandler) StopPatrol() {
- h.aiService.StopPatrol()
+ h.legacyAIService.StopPatrol()
+ h.aiServicesMu.Lock()
+ defer h.aiServicesMu.Unlock()
+ for _, svc := range h.aiServices {
+ svc.StopPatrol()
+ }
}
// GetAlertTriggeredAnalyzer returns the alert-triggered analyzer for wiring into alert callbacks
-func (h *AISettingsHandler) GetAlertTriggeredAnalyzer() *ai.AlertTriggeredAnalyzer {
- return h.aiService.GetAlertTriggeredAnalyzer()
+func (h *AISettingsHandler) GetAlertTriggeredAnalyzer(ctx context.Context) *ai.AlertTriggeredAnalyzer {
+ return h.GetAIService(ctx).GetAlertTriggeredAnalyzer()
}
// SetLicenseChecker sets the license checker for Pro feature gating
func (h *AISettingsHandler) SetLicenseChecker(checker ai.LicenseChecker) {
- h.aiService.SetLicenseChecker(checker)
+ h.GetAIService(context.Background()).SetLicenseChecker(checker)
}
// SetOnModelChange sets a callback to be invoked when model settings change
@@ -265,7 +496,9 @@ func (h *AISettingsHandler) HandleGetAISettings(w http.ResponseWriter, r *http.R
return
}
- settings, err := h.persistence.LoadAIConfig()
+ ctx := r.Context()
+ persistence := h.getPersistence(ctx)
+ settings, err := persistence.LoadAIConfig()
if err != nil {
log.Error().Err(err).Msg("Failed to load AI settings")
http.Error(w, "Failed to load AI settings", http.StatusInternalServerError)
@@ -334,13 +567,13 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
}
// Require admin authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Check proxy auth admin status if applicable
- if h.config.ProxyAuthSecret != "" {
- if valid, username, isAdmin := CheckProxyAuth(h.config, r); valid && !isAdmin {
+ if h.getConfig(r.Context()).ProxyAuthSecret != "" {
+ if valid, username, isAdmin := CheckProxyAuth(h.getConfig(r.Context()), r); valid && !isAdmin {
log.Warn().
Str("ip", r.RemoteAddr).
Str("path", r.URL.Path).
@@ -355,7 +588,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
}
// Load existing settings
- settings, err := h.persistence.LoadAIConfig()
+ settings, err := h.getPersistence(r.Context()).LoadAIConfig()
if err != nil {
log.Error().Err(err).Msg("Failed to load existing AI settings")
settings = config.NewDefaultAIConfig()
@@ -407,7 +640,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
if req.PatrolAutoFix != nil {
// Auto-fix requires Pro license with ai_autofix feature
- if *req.PatrolAutoFix && !h.aiService.HasLicenseFeature(ai.FeatureAIAutoFix) {
+ if *req.PatrolAutoFix && !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAutoFix) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
json.NewEncoder(w).Encode(map[string]interface{}{
@@ -423,7 +656,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
if req.UseProactiveThresholds != nil {
// Proactive thresholds require Pro license with ai_patrol feature
- if *req.UseProactiveThresholds && !h.aiService.HasLicenseFeature(ai.FeatureAIPatrol) {
+ if *req.UseProactiveThresholds && !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIPatrol) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -445,7 +678,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
// Legacy: autonomous_mode now maps to control_level for backwards compatibility
if *req.AutonomousMode {
// Autonomous mode requires Pro license with ai_autofix feature
- if !h.aiService.HasLicenseFeature(ai.FeatureAIAutoFix) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAutoFix) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
json.NewEncoder(w).Encode(map[string]interface{}{
@@ -533,7 +766,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
}
// Enabling background patrol requires Pro license
- if minutes > 0 && !h.aiService.HasLicenseFeature(ai.FeatureAIPatrol) {
+ if minutes > 0 && !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIPatrol) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -553,7 +786,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
switch preset {
case "15min", "1hr", "6hr", "12hr", "daily":
// Enabling background patrol requires Pro license
- if !h.aiService.HasLicenseFeature(ai.FeatureAIPatrol) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIPatrol) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -586,7 +819,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
// Handle alert-triggered analysis toggle
if req.AlertTriggeredAnalysis != nil {
// Alert analysis requires Pro license with ai_alerts feature
- if *req.AlertTriggeredAnalysis && !h.aiService.HasLicenseFeature(ai.FeatureAIAlerts) {
+ if *req.AlertTriggeredAnalysis && !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAlerts) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -621,7 +854,7 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
}
// "autonomous" requires Pro license (same as autonomous_mode)
if *req.ControlLevel == config.ControlLevelAutonomous {
- if !h.aiService.HasLicenseFeature(ai.FeatureAIAutoFix) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAutoFix) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -644,22 +877,22 @@ func (h *AISettingsHandler) HandleUpdateAISettings(w http.ResponseWriter, r *htt
}
// Save settings
- if err := h.persistence.SaveAIConfig(*settings); err != nil {
+ if err := h.getPersistence(r.Context()).SaveAIConfig(*settings); err != nil {
log.Error().Err(err).Msg("Failed to save AI settings")
http.Error(w, "Failed to save settings", http.StatusInternalServerError)
return
}
// Reload the AI service with new settings
- if err := h.aiService.Reload(); err != nil {
+ if err := h.GetAIService(r.Context()).Reload(); err != nil {
log.Warn().Err(err).Msg("Failed to reload AI service after settings update")
}
// Reconfigure patrol service with new settings (applies interval changes immediately)
- h.aiService.ReconfigurePatrol()
+ h.GetAIService(r.Context()).ReconfigurePatrol()
// Update alert-triggered analyzer if available
- if analyzer := h.aiService.GetAlertTriggeredAnalyzer(); analyzer != nil {
+ if analyzer := h.GetAIService(r.Context()).GetAlertTriggeredAnalyzer(); analyzer != nil {
analyzer.SetEnabled(settings.AlertTriggeredAnalysis)
}
@@ -740,7 +973,7 @@ func (h *AISettingsHandler) HandleTestAIConnection(w http.ResponseWriter, r *htt
}
// Require admin authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -753,12 +986,12 @@ func (h *AISettingsHandler) HandleTestAIConnection(w http.ResponseWriter, r *htt
Model string `json:"model,omitempty"`
}
- err := h.aiService.TestConnection(ctx)
+ err := h.GetAIService(r.Context()).TestConnection(ctx)
if err != nil {
testResult.Success = false
testResult.Message = err.Error()
} else {
- cfg := h.aiService.GetConfig()
+ cfg := h.GetAIService(r.Context()).GetConfig()
testResult.Success = true
testResult.Message = "Connection successful"
if cfg != nil {
@@ -779,7 +1012,7 @@ func (h *AISettingsHandler) HandleTestProvider(w http.ResponseWriter, r *http.Re
}
// Require admin authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -801,7 +1034,7 @@ func (h *AISettingsHandler) HandleTestProvider(w http.ResponseWriter, r *http.Re
testResult.Provider = provider
// Load config and create provider for testing
- cfg := h.aiService.GetConfig()
+ cfg := h.GetAIService(r.Context()).GetConfig()
if cfg == nil {
testResult.Success = false
testResult.Message = "AI not configured"
@@ -848,7 +1081,7 @@ func (h *AISettingsHandler) HandleListModels(w http.ResponseWriter, r *http.Requ
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -868,7 +1101,7 @@ func (h *AISettingsHandler) HandleListModels(w http.ResponseWriter, r *http.Requ
Cached bool `json:"cached"`
}
- models, cached, err := h.aiService.ListModelsWithCache(ctx)
+ models, cached, err := h.GetAIService(r.Context()).ListModelsWithCache(ctx)
if err != nil {
// Return error but don't fail the request - frontend can show a fallback
resp := Response{
@@ -948,12 +1181,12 @@ func (h *AISettingsHandler) HandleExecute(w http.ResponseWriter, r *http.Request
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Check if AI is enabled
- if !h.aiService.IsEnabled() {
+ if !h.GetAIService(r.Context()).IsEnabled() {
http.Error(w, "AI is not enabled or configured", http.StatusBadRequest)
return
}
@@ -976,7 +1209,7 @@ func (h *AISettingsHandler) HandleExecute(w http.ResponseWriter, r *http.Request
// Fine-grained license checks based on UseCase
useCase := strings.ToLower(strings.TrimSpace(req.UseCase))
if useCase == "autofix" || useCase == "remediation" {
- if !h.aiService.HasLicenseFeature(ai.FeatureAIAutoFix) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAutoFix) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -988,7 +1221,7 @@ func (h *AISettingsHandler) HandleExecute(w http.ResponseWriter, r *http.Request
return
}
} else if useCase == "patrol" {
- if !h.aiService.HasLicenseFeature(ai.FeatureAIPatrol) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIPatrol) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -1023,7 +1256,7 @@ func (h *AISettingsHandler) HandleExecute(w http.ResponseWriter, r *http.Request
useCase = "chat"
}
- resp, err := h.aiService.Execute(ctx, ai.ExecuteRequest{
+ resp, err := h.GetAIService(r.Context()).Execute(ctx, ai.ExecuteRequest{
Prompt: req.Prompt,
TargetType: req.TargetType,
TargetID: req.TargetID,
@@ -1061,11 +1294,11 @@ func (h *AISettingsHandler) HandleAnalyzeKubernetesCluster(w http.ResponseWriter
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- if !h.aiService.IsEnabled() {
+ if !h.GetAIService(r.Context()).IsEnabled() {
http.Error(w, "AI is not enabled or configured", http.StatusBadRequest)
return
}
@@ -1085,7 +1318,7 @@ func (h *AISettingsHandler) HandleAnalyzeKubernetesCluster(w http.ResponseWriter
ctx, cancel := context.WithTimeout(r.Context(), 180*time.Second)
defer cancel()
- resp, err := h.aiService.AnalyzeKubernetesCluster(ctx, req.ClusterID)
+ resp, err := h.GetAIService(r.Context()).AnalyzeKubernetesCluster(ctx, req.ClusterID)
if err != nil {
switch {
case errors.Is(err, ai.ErrKubernetesClusterNotFound):
@@ -1140,12 +1373,12 @@ func (h *AISettingsHandler) HandleExecuteStream(w http.ResponseWriter, r *http.R
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Check if AI is enabled
- if !h.aiService.IsEnabled() {
+ if !h.GetAIService(r.Context()).IsEnabled() {
http.Error(w, "AI is not enabled or configured", http.StatusBadRequest)
return
}
@@ -1162,7 +1395,7 @@ func (h *AISettingsHandler) HandleExecuteStream(w http.ResponseWriter, r *http.R
// Fine-grained license checks based on UseCase (before SSE headers)
useCase := strings.ToLower(strings.TrimSpace(req.UseCase))
if useCase == "autofix" || useCase == "remediation" {
- if !h.aiService.HasLicenseFeature(ai.FeatureAIAutoFix) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAutoFix) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -1174,7 +1407,7 @@ func (h *AISettingsHandler) HandleExecuteStream(w http.ResponseWriter, r *http.R
return
}
} else if useCase == "patrol" {
- if !h.aiService.HasLicenseFeature(ai.FeatureAIPatrol) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIPatrol) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -1327,7 +1560,7 @@ func (h *AISettingsHandler) HandleExecuteStream(w http.ResponseWriter, r *http.R
}()
// Execute with streaming
- resp, err := h.aiService.ExecuteStream(ctx, ai.ExecuteRequest{
+ resp, err := h.GetAIService(r.Context()).ExecuteStream(ctx, ai.ExecuteRequest{
Prompt: req.Prompt,
TargetType: req.TargetType,
TargetID: req.TargetID,
@@ -1391,12 +1624,12 @@ func (h *AISettingsHandler) HandleRunCommand(w http.ResponseWriter, r *http.Requ
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Gated for AI Auto-Fix (Pro feature)
- if !h.aiService.HasLicenseFeature(ai.FeatureAIAutoFix) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(ai.FeatureAIAutoFix) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusPaymentRequired)
_ = json.NewEncoder(w).Encode(map[string]interface{}{
@@ -1442,7 +1675,7 @@ func (h *AISettingsHandler) HandleRunCommand(w http.ResponseWriter, r *http.Requ
ctx, cancel := context.WithTimeout(r.Context(), 300*time.Second)
defer cancel()
- resp, err := h.aiService.RunCommand(ctx, ai.RunCommandRequest{
+ resp, err := h.GetAIService(r.Context()).RunCommand(ctx, ai.RunCommandRequest{
Command: req.Command,
TargetType: req.TargetType,
TargetID: req.TargetID,
@@ -1470,7 +1703,7 @@ func (h *AISettingsHandler) HandleGetGuestKnowledge(w http.ResponseWriter, r *ht
return
}
- knowledge, err := h.aiService.GetGuestKnowledge(guestID)
+ knowledge, err := h.GetAIService(r.Context()).GetGuestKnowledge(guestID)
if err != nil {
http.Error(w, "Failed to get knowledge: "+err.Error(), http.StatusInternalServerError)
return
@@ -1502,7 +1735,7 @@ func (h *AISettingsHandler) HandleSaveGuestNote(w http.ResponseWriter, r *http.R
return
}
- if err := h.aiService.SaveGuestNote(req.GuestID, req.GuestName, req.GuestType, req.Category, req.Title, req.Content); err != nil {
+ if err := h.GetAIService(r.Context()).SaveGuestNote(req.GuestID, req.GuestName, req.GuestType, req.Category, req.Title, req.Content); err != nil {
http.Error(w, "Failed to save note: "+err.Error(), http.StatusInternalServerError)
return
}
@@ -1528,7 +1761,7 @@ func (h *AISettingsHandler) HandleDeleteGuestNote(w http.ResponseWriter, r *http
return
}
- if err := h.aiService.DeleteGuestNote(req.GuestID, req.NoteID); err != nil {
+ if err := h.GetAIService(r.Context()).DeleteGuestNote(req.GuestID, req.NoteID); err != nil {
http.Error(w, "Failed to delete note: "+err.Error(), http.StatusInternalServerError)
return
}
@@ -1545,7 +1778,7 @@ func (h *AISettingsHandler) HandleExportGuestKnowledge(w http.ResponseWriter, r
return
}
- knowledge, err := h.aiService.GetGuestKnowledge(guestID)
+ knowledge, err := h.GetAIService(r.Context()).GetGuestKnowledge(guestID)
if err != nil {
http.Error(w, "Failed to get knowledge: "+err.Error(), http.StatusInternalServerError)
return
@@ -1599,10 +1832,10 @@ func (h *AISettingsHandler) HandleImportGuestKnowledge(w http.ResponseWriter, r
// If not merging, we need to delete existing notes first
if !importData.Merge {
- existing, err := h.aiService.GetGuestKnowledge(importData.GuestID)
+ existing, err := h.GetAIService(r.Context()).GetGuestKnowledge(importData.GuestID)
if err == nil && existing != nil {
for _, note := range existing.Notes {
- _ = h.aiService.DeleteGuestNote(importData.GuestID, note.ID)
+ _ = h.GetAIService(r.Context()).DeleteGuestNote(importData.GuestID, note.ID)
}
}
}
@@ -1613,7 +1846,7 @@ func (h *AISettingsHandler) HandleImportGuestKnowledge(w http.ResponseWriter, r
if note.Category == "" || note.Title == "" || note.Content == "" {
continue
}
- if err := h.aiService.SaveGuestNote(
+ if err := h.GetAIService(r.Context()).SaveGuestNote(
importData.GuestID,
importData.GuestName,
importData.GuestType,
@@ -1663,7 +1896,7 @@ func (h *AISettingsHandler) HandleClearGuestKnowledge(w http.ResponseWriter, r *
}
// Get existing knowledge and delete all notes
- existing, err := h.aiService.GetGuestKnowledge(req.GuestID)
+ existing, err := h.GetAIService(r.Context()).GetGuestKnowledge(req.GuestID)
if err != nil {
http.Error(w, "Failed to get knowledge: "+err.Error(), http.StatusInternalServerError)
return
@@ -1671,7 +1904,7 @@ func (h *AISettingsHandler) HandleClearGuestKnowledge(w http.ResponseWriter, r *
deleted := 0
for _, note := range existing.Notes {
- if err := h.aiService.DeleteGuestNote(req.GuestID, note.ID); err != nil {
+ if err := h.GetAIService(r.Context()).DeleteGuestNote(req.GuestID, note.ID); err != nil {
log.Warn().Err(err).Str("note_id", note.ID).Msg("Failed to delete note")
continue
}
@@ -1701,7 +1934,7 @@ func (h *AISettingsHandler) HandleDebugContext(w http.ResponseWriter, r *http.Re
}
// Get the debug context from the service
- debugInfo := h.aiService.GetDebugContext(req)
+ debugInfo := h.GetAIService(r.Context()).GetDebugContext(req)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(debugInfo)
@@ -1786,12 +2019,12 @@ func (h *AISettingsHandler) HandleInvestigateAlert(w http.ResponseWriter, r *htt
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Check if AI is enabled
- if !h.aiService.IsEnabled() {
+ if !h.GetAIService(r.Context()).IsEnabled() {
http.Error(w, "AI is not enabled or configured", http.StatusBadRequest)
return
}
@@ -1923,7 +2156,7 @@ func (h *AISettingsHandler) HandleInvestigateAlert(w http.ResponseWriter, r *htt
}
}()
- resp, err := h.aiService.ExecuteStream(ctx, ai.ExecuteRequest{
+ resp, err := h.GetAIService(r.Context()).ExecuteStream(ctx, ai.ExecuteRequest{
Prompt: investigationPrompt,
TargetType: targetType,
TargetID: targetID,
@@ -1963,7 +2196,7 @@ func (h *AISettingsHandler) HandleInvestigateAlert(w http.ResponseWriter, r *htt
safeWrite([]byte("data: " + string(data) + "\n\n"))
if req.AlertID != "" {
- h.aiService.RecordIncidentAnalysis(req.AlertID, "AI alert investigation completed", map[string]interface{}{
+ h.GetAIService(r.Context()).RecordIncidentAnalysis(req.AlertID, "AI alert investigation completed", map[string]interface{}{
"model": resp.Model,
"tool_calls": len(resp.ToolCalls),
"input_tokens": resp.InputTokens,
@@ -1978,7 +2211,7 @@ func (h *AISettingsHandler) HandleInvestigateAlert(w http.ResponseWriter, r *htt
Msg("AI alert investigation completed")
if req.AlertID != "" {
- h.aiService.RecordIncidentAnalysis(req.AlertID, "AI investigation completed", map[string]interface{}{
+ h.GetAIService(r.Context()).RecordIncidentAnalysis(req.AlertID, "AI investigation completed", map[string]interface{}{
"model": resp.Model,
"input_tokens": resp.InputTokens,
"output_tokens": resp.OutputTokens,
@@ -1989,7 +2222,7 @@ func (h *AISettingsHandler) HandleInvestigateAlert(w http.ResponseWriter, r *htt
// SetAlertProvider sets the alert provider for AI context
func (h *AISettingsHandler) SetAlertProvider(ap ai.AlertProvider) {
- h.aiService.SetAlertProvider(ap)
+ h.GetAIService(context.Background()).SetAlertProvider(ap)
}
// oauthSessions stores active OAuth sessions (state -> session)
@@ -2127,7 +2360,7 @@ func (h *AISettingsHandler) HandleOAuthExchange(w http.ResponseWriter, r *http.R
}
// Load existing settings
- settings, err := h.persistence.LoadAIConfig()
+ settings, err := h.getPersistence(r.Context()).LoadAIConfig()
if err != nil {
log.Error().Err(err).Msg("Failed to load AI settings for OAuth")
settings = config.NewDefaultAIConfig()
@@ -2153,14 +2386,14 @@ func (h *AISettingsHandler) HandleOAuthExchange(w http.ResponseWriter, r *http.R
}
// Save settings
- if err := h.persistence.SaveAIConfig(*settings); err != nil {
+ if err := h.getPersistence(r.Context()).SaveAIConfig(*settings); err != nil {
log.Error().Err(err).Msg("Failed to save OAuth tokens")
http.Error(w, "Failed to save OAuth credentials", http.StatusInternalServerError)
return
}
// Reload the AI service with new settings
- if err := h.aiService.Reload(); err != nil {
+ if err := h.GetAIService(r.Context()).Reload(); err != nil {
log.Warn().Err(err).Msg("Failed to reload AI service after OAuth setup")
}
@@ -2233,7 +2466,7 @@ func (h *AISettingsHandler) HandleOAuthCallback(w http.ResponseWriter, r *http.R
}
// Load existing settings
- settings, err := h.persistence.LoadAIConfig()
+ settings, err := h.getPersistence(r.Context()).LoadAIConfig()
if err != nil {
log.Error().Err(err).Msg("Failed to load AI settings for OAuth")
settings = config.NewDefaultAIConfig()
@@ -2253,14 +2486,14 @@ func (h *AISettingsHandler) HandleOAuthCallback(w http.ResponseWriter, r *http.R
settings.ClearAPIKey()
// Save settings
- if err := h.persistence.SaveAIConfig(*settings); err != nil {
+ if err := h.getPersistence(r.Context()).SaveAIConfig(*settings); err != nil {
log.Error().Err(err).Msg("Failed to save OAuth tokens")
http.Redirect(w, r, "/settings?ai_oauth_error=save_failed", http.StatusTemporaryRedirect)
return
}
// Reload the AI service with new settings
- if err := h.aiService.Reload(); err != nil {
+ if err := h.GetAIService(r.Context()).Reload(); err != nil {
log.Warn().Err(err).Msg("Failed to reload AI service after OAuth setup")
}
@@ -2278,12 +2511,12 @@ func (h *AISettingsHandler) HandleOAuthDisconnect(w http.ResponseWriter, r *http
}
// Require admin authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Load existing settings
- settings, err := h.persistence.LoadAIConfig()
+ settings, err := h.getPersistence(r.Context()).LoadAIConfig()
if err != nil {
log.Error().Err(err).Msg("Failed to load AI settings for OAuth disconnect")
http.Error(w, "Failed to load settings", http.StatusInternalServerError)
@@ -2298,14 +2531,14 @@ func (h *AISettingsHandler) HandleOAuthDisconnect(w http.ResponseWriter, r *http
settings.AuthMethod = config.AuthMethodAPIKey
// Save settings
- if err := h.persistence.SaveAIConfig(*settings); err != nil {
+ if err := h.getPersistence(r.Context()).SaveAIConfig(*settings); err != nil {
log.Error().Err(err).Msg("Failed to save settings after OAuth disconnect")
http.Error(w, "Failed to save settings", http.StatusInternalServerError)
return
}
// Reload the AI service
- if err := h.aiService.Reload(); err != nil {
+ if err := h.GetAIService(r.Context()).Reload(); err != nil {
log.Warn().Err(err).Msg("Failed to reload AI service after OAuth disconnect")
}
@@ -2352,7 +2585,7 @@ func (h *AISettingsHandler) HandleGetPatrolStatus(w http.ResponseWriter, r *http
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
// Patrol not initialized
response := PatrolStatusResponse{
@@ -2371,13 +2604,13 @@ func (h *AISettingsHandler) HandleGetPatrolStatus(w http.ResponseWriter, r *http
// Determine license status for Pro feature gating
// GetLicenseState returns accurate state: none, active, expired, grace_period
- licenseStatus, _ := h.aiService.GetLicenseState()
+ licenseStatus, _ := h.GetAIService(r.Context()).GetLicenseState()
// Check specifically for ai_patrol feature using canonical license constant
- hasPatrolFeature := h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ hasPatrolFeature := h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIPatrol)
response := PatrolStatusResponse{
Running: status.Running,
- Enabled: h.aiService.IsEnabled(),
+ Enabled: h.GetAIService(r.Context()).IsEnabled(),
LastPatrolAt: status.LastPatrolAt,
NextPatrolAt: status.NextPatrolAt,
LastDurationMs: status.LastDuration.Milliseconds(),
@@ -2415,7 +2648,7 @@ func (h *AISettingsHandler) HandleGetIntelligence(w http.ResponseWriter, r *http
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
// Return empty intelligence when not initialized
response := map[string]interface{}{
@@ -2466,7 +2699,7 @@ func (h *AISettingsHandler) HandlePatrolStream(w http.ResponseWriter, r *http.Re
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2607,7 +2840,7 @@ func (h *AISettingsHandler) HandleGetPatrolFindings(w http.ResponseWriter, r *ht
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
// Return empty findings
if err := utils.WriteJSONResponse(w, []interface{}{}); err != nil {
@@ -2625,7 +2858,7 @@ func (h *AISettingsHandler) HandleGetPatrolFindings(w http.ResponseWriter, r *ht
findings = patrol.GetAllFindings()
}
- if !h.aiService.HasLicenseFeature(license.FeatureAIPatrol) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIPatrol) {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
findings = redactFindingsForPreview(findings)
@@ -2644,11 +2877,11 @@ func (h *AISettingsHandler) HandleForcePatrol(w http.ResponseWriter, r *http.Req
}
// Require admin authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2685,11 +2918,11 @@ func (h *AISettingsHandler) HandleAcknowledgeFinding(w http.ResponseWriter, r *h
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2740,11 +2973,11 @@ func (h *AISettingsHandler) HandleSnoozeFinding(w http.ResponseWriter, r *http.R
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2806,11 +3039,11 @@ func (h *AISettingsHandler) HandleResolveFinding(w http.ResponseWriter, r *http.
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2861,11 +3094,11 @@ func (h *AISettingsHandler) HandleDismissFinding(w http.ResponseWriter, r *http.
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2929,11 +3162,11 @@ func (h *AISettingsHandler) HandleSuppressFinding(w http.ResponseWriter, r *http
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -2983,7 +3216,7 @@ func (h *AISettingsHandler) HandleClearAllFindings(w http.ResponseWriter, r *htt
}
// Require authentication (already wrapped by RequireAuth in router)
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -2993,7 +3226,7 @@ func (h *AISettingsHandler) HandleClearAllFindings(w http.ResponseWriter, r *htt
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -3023,11 +3256,11 @@ func (h *AISettingsHandler) HandleGetFindingsHistory(w http.ResponseWriter, r *h
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
// Return empty history
if err := utils.WriteJSONResponse(w, []interface{}{}); err != nil {
@@ -3046,7 +3279,7 @@ func (h *AISettingsHandler) HandleGetFindingsHistory(w http.ResponseWriter, r *h
findings := patrol.GetFindingsHistory(startTime)
- if !h.aiService.HasLicenseFeature(license.FeatureAIPatrol) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIPatrol) {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
findings = redactFindingsForPreview(findings)
@@ -3064,7 +3297,7 @@ func (h *AISettingsHandler) HandleGetPatrolRunHistory(w http.ResponseWriter, r *
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
// Return empty history
if err := utils.WriteJSONResponse(w, []interface{}{}); err != nil {
@@ -3085,7 +3318,7 @@ func (h *AISettingsHandler) HandleGetPatrolRunHistory(w http.ResponseWriter, r *
runs := patrol.GetRunHistory(limit)
- if !h.aiService.HasLicenseFeature(license.FeatureAIPatrol) {
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIPatrol) {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
runs = redactPatrolRunHistory(runs)
@@ -3114,8 +3347,8 @@ func (h *AISettingsHandler) HandleGetAICostSummary(w http.ResponseWriter, r *htt
}
var summary cost.Summary
- if h.aiService != nil {
- summary = h.aiService.GetCostSummary(days)
+ if h.GetAIService(r.Context()) != nil {
+ summary = h.GetAIService(r.Context()).GetCostSummary(days)
} else {
summary = cost.Summary{
Days: days,
@@ -3138,14 +3371,14 @@ func (h *AISettingsHandler) HandleResetAICostHistory(w http.ResponseWriter, r *h
return
}
- if h.aiService == nil {
+ if h.GetAIService(r.Context()) == nil {
http.Error(w, "AI service unavailable", http.StatusServiceUnavailable)
return
}
backupFile := ""
- if h.persistence != nil {
- configDir := h.persistence.DataDir()
+ if h.getPersistence(r.Context()) != nil {
+ configDir := h.getPersistence(r.Context()).DataDir()
if strings.TrimSpace(configDir) != "" {
usagePath := filepath.Join(configDir, "ai_usage_history.json")
if _, err := os.Stat(usagePath); err == nil {
@@ -3161,7 +3394,7 @@ func (h *AISettingsHandler) HandleResetAICostHistory(w http.ResponseWriter, r *h
}
}
- if err := h.aiService.ClearCostHistory(); err != nil {
+ if err := h.GetAIService(r.Context()).ClearCostHistory(); err != nil {
log.Error().Err(err).Msg("Failed to clear AI cost history")
http.Error(w, "Failed to clear AI cost history", http.StatusInternalServerError)
return
@@ -3184,7 +3417,7 @@ func (h *AISettingsHandler) HandleExportAICostHistory(w http.ResponseWriter, r *
return
}
- if h.aiService == nil {
+ if h.GetAIService(r.Context()) == nil {
http.Error(w, "AI service unavailable", http.StatusServiceUnavailable)
return
}
@@ -3208,7 +3441,7 @@ func (h *AISettingsHandler) HandleExportAICostHistory(w http.ResponseWriter, r *
return
}
- events := h.aiService.ListCostEvents(days)
+ events := h.GetAIService(r.Context()).ListCostEvents(days)
filename := fmt.Sprintf("pulse-ai-usage-%s-%dd.%s", time.Now().UTC().Format("20060102"), days, format)
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%q", filename))
@@ -3289,11 +3522,11 @@ func (h *AISettingsHandler) HandleGetSuppressionRules(w http.ResponseWriter, r *
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, []interface{}{}); err != nil {
log.Error().Err(err).Msg("Failed to write suppression rules response")
@@ -3317,11 +3550,11 @@ func (h *AISettingsHandler) HandleAddSuppressionRule(w http.ResponseWriter, r *h
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -3394,11 +3627,11 @@ func (h *AISettingsHandler) HandleDeleteSuppressionRule(w http.ResponseWriter, r
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
http.Error(w, "Patrol service not available", http.StatusServiceUnavailable)
return
@@ -3440,11 +3673,11 @@ func (h *AISettingsHandler) HandleGetDismissedFindings(w http.ResponseWriter, r
}
// Require authentication
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := h.GetAIService(r.Context()).GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, []interface{}{}); err != nil {
log.Error().Err(err).Msg("Failed to write dismissed findings response")
@@ -3471,14 +3704,14 @@ func (h *AISettingsHandler) HandleListAIChatSessions(w http.ResponseWriter, r *h
return
}
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
// Get username from auth context
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
- sessions, err := h.persistence.GetAIChatSessionsForUser(username)
+ sessions, err := h.getPersistence(r.Context()).GetAIChatSessionsForUser(username)
if err != nil {
log.Error().Err(err).Msg("Failed to load chat sessions")
http.Error(w, "Failed to load chat sessions", http.StatusInternalServerError)
@@ -3517,7 +3750,7 @@ func (h *AISettingsHandler) HandleGetAIChatSession(w http.ResponseWriter, r *htt
return
}
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -3528,9 +3761,9 @@ func (h *AISettingsHandler) HandleGetAIChatSession(w http.ResponseWriter, r *htt
return
}
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
- sessionsData, err := h.persistence.LoadAIChatSessions()
+ sessionsData, err := h.getPersistence(r.Context()).LoadAIChatSessions()
if err != nil {
log.Error().Err(err).Msg("Failed to load chat sessions")
http.Error(w, "Failed to load chat sessions", http.StatusInternalServerError)
@@ -3561,7 +3794,7 @@ func (h *AISettingsHandler) HandleSaveAIChatSession(w http.ResponseWriter, r *ht
return
}
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -3572,7 +3805,7 @@ func (h *AISettingsHandler) HandleSaveAIChatSession(w http.ResponseWriter, r *ht
return
}
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
// Parse request body
var session config.AIChatSession
@@ -3585,7 +3818,7 @@ func (h *AISettingsHandler) HandleSaveAIChatSession(w http.ResponseWriter, r *ht
session.ID = sessionID
// Check ownership if session exists
- existingData, err := h.persistence.LoadAIChatSessions()
+ existingData, err := h.getPersistence(r.Context()).LoadAIChatSessions()
if err != nil {
log.Error().Err(err).Msg("Failed to load chat sessions")
http.Error(w, "Failed to load chat sessions", http.StatusInternalServerError)
@@ -3624,7 +3857,7 @@ func (h *AISettingsHandler) HandleSaveAIChatSession(w http.ResponseWriter, r *ht
session.Title = "New conversation"
}
- if err := h.persistence.SaveAIChatSession(&session); err != nil {
+ if err := h.getPersistence(r.Context()).SaveAIChatSession(&session); err != nil {
log.Error().Err(err).Msg("Failed to save chat session")
http.Error(w, "Failed to save chat session", http.StatusInternalServerError)
return
@@ -3648,7 +3881,7 @@ func (h *AISettingsHandler) HandleDeleteAIChatSession(w http.ResponseWriter, r *
return
}
- if !CheckAuth(h.config, w, r) {
+ if !CheckAuth(h.getConfig(r.Context()), w, r) {
return
}
@@ -3659,10 +3892,10 @@ func (h *AISettingsHandler) HandleDeleteAIChatSession(w http.ResponseWriter, r *
return
}
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
// Check ownership
- existingData, err := h.persistence.LoadAIChatSessions()
+ existingData, err := h.getPersistence(r.Context()).LoadAIChatSessions()
if err != nil {
log.Error().Err(err).Msg("Failed to load chat sessions")
http.Error(w, "Failed to load chat sessions", http.StatusInternalServerError)
@@ -3676,7 +3909,7 @@ func (h *AISettingsHandler) HandleDeleteAIChatSession(w http.ResponseWriter, r *
}
}
- if err := h.persistence.DeleteAIChatSession(sessionID); err != nil {
+ if err := h.getPersistence(r.Context()).DeleteAIChatSession(sessionID); err != nil {
log.Error().Err(err).Msg("Failed to delete chat session")
http.Error(w, "Failed to delete chat session", http.StatusInternalServerError)
return
@@ -3727,13 +3960,13 @@ func (h *AISettingsHandler) HandleListApprovals(w http.ResponseWriter, r *http.R
}
// Check license
- licenseState, hasFeatures := h.aiService.GetLicenseState()
- if !h.aiService.HasLicenseFeature(license.FeatureAIAutoFix) {
+ licenseState, hasFeatures := h.GetAIService(r.Context()).GetLicenseState()
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIAutoFix) {
log.Warn().
Str("license_state", licenseState).
Bool("license_features_available", hasFeatures).
Str("feature", license.FeatureAIAutoFix).
- Str("data_path", h.config.DataPath).
+ Str("data_path", h.getConfig(r.Context()).DataPath).
Msg("AI Auto-Fix feature not available for approvals")
writeErrorResponse(w, http.StatusForbidden, "license_required", "AI Auto-Fix feature requires Pro license", map[string]string{
"license_state": licenseState,
@@ -3802,13 +4035,13 @@ func (h *AISettingsHandler) HandleApproveCommand(w http.ResponseWriter, r *http.
}
// Check license
- licenseState, hasFeatures := h.aiService.GetLicenseState()
- if !h.aiService.HasLicenseFeature(license.FeatureAIAutoFix) {
+ licenseState, hasFeatures := h.GetAIService(r.Context()).GetLicenseState()
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIAutoFix) {
log.Warn().
Str("license_state", licenseState).
Bool("license_features_available", hasFeatures).
Str("feature", license.FeatureAIAutoFix).
- Str("data_path", h.config.DataPath).
+ Str("data_path", h.getConfig(r.Context()).DataPath).
Msg("AI Auto-Fix feature not available for approvals")
writeErrorResponse(w, http.StatusForbidden, "license_required", "AI Auto-Fix feature requires Pro license", map[string]string{
"license_state": licenseState,
@@ -3834,7 +4067,7 @@ func (h *AISettingsHandler) HandleApproveCommand(w http.ResponseWriter, r *http.
return
}
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
if username == "" {
username = "anonymous"
}
@@ -3896,7 +4129,7 @@ func (h *AISettingsHandler) HandleDenyCommand(w http.ResponseWriter, r *http.Req
return
}
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
if username == "" {
username = "anonymous"
}
@@ -3927,13 +4160,13 @@ func (h *AISettingsHandler) HandleRollback(w http.ResponseWriter, r *http.Reques
}
// Check license
- licenseState, hasFeatures := h.aiService.GetLicenseState()
- if !h.aiService.HasLicenseFeature(license.FeatureAIAutoFix) {
+ licenseState, hasFeatures := h.GetAIService(r.Context()).GetLicenseState()
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIAutoFix) {
log.Warn().
Str("license_state", licenseState).
Bool("license_features_available", hasFeatures).
Str("feature", license.FeatureAIAutoFix).
- Str("data_path", h.config.DataPath).
+ Str("data_path", h.getConfig(r.Context()).DataPath).
Msg("AI Auto-Fix feature not available for rollback")
writeErrorResponse(w, http.StatusForbidden, "license_required", "AI Auto-Fix feature requires Pro license", map[string]string{
"license_state": licenseState,
@@ -3954,7 +4187,7 @@ func (h *AISettingsHandler) HandleRollback(w http.ResponseWriter, r *http.Reques
}
// Get remediation log
- remLog := h.aiService.GetRemediationLog()
+ remLog := h.GetAIService(r.Context()).GetRemediationLog()
if remLog == nil {
writeErrorResponse(w, http.StatusServiceUnavailable, "not_initialized", "Remediation log not available", nil)
return
@@ -3983,7 +4216,7 @@ func (h *AISettingsHandler) HandleRollback(w http.ResponseWriter, r *http.Reques
return
}
- username := getAuthUsername(h.config, r)
+ username := getAuthUsername(h.getConfig(r.Context()), r)
if username == "" {
username = "anonymous"
}
@@ -4035,13 +4268,13 @@ func (h *AISettingsHandler) HandleGetRollbackable(w http.ResponseWriter, r *http
}
// Check license
- licenseState, hasFeatures := h.aiService.GetLicenseState()
- if !h.aiService.HasLicenseFeature(license.FeatureAIAutoFix) {
+ licenseState, hasFeatures := h.GetAIService(r.Context()).GetLicenseState()
+ if !h.GetAIService(r.Context()).HasLicenseFeature(license.FeatureAIAutoFix) {
log.Warn().
Str("license_state", licenseState).
Bool("license_features_available", hasFeatures).
Str("feature", license.FeatureAIAutoFix).
- Str("data_path", h.config.DataPath).
+ Str("data_path", h.getConfig(r.Context()).DataPath).
Msg("AI Auto-Fix feature not available for rollbackable list")
writeErrorResponse(w, http.StatusForbidden, "license_required", "AI Auto-Fix feature requires Pro license", map[string]string{
"license_state": licenseState,
@@ -4051,7 +4284,7 @@ func (h *AISettingsHandler) HandleGetRollbackable(w http.ResponseWriter, r *http
return
}
- remLog := h.aiService.GetRemediationLog()
+ remLog := h.GetAIService(r.Context()).GetRemediationLog()
if remLog == nil {
writeErrorResponse(w, http.StatusServiceUnavailable, "not_initialized", "Remediation log not available", nil)
return
diff --git a/internal/api/ai_intelligence_handlers.go b/internal/api/ai_intelligence_handlers.go
index 0c116ca359..1a9e530427 100644
--- a/internal/api/ai_intelligence_handlers.go
+++ b/internal/api/ai_intelligence_handlers.go
@@ -20,8 +20,8 @@ func (h *AISettingsHandler) HandleGetPatterns(w http.ResponseWriter, r *http.Req
return
}
- // AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ aiService := h.GetAIService(r.Context())
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"patterns": []interface{}{},
"message": "AI is not enabled",
@@ -31,7 +31,7 @@ func (h *AISettingsHandler) HandleGetPatterns(w http.ResponseWriter, r *http.Req
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"patterns": []interface{}{},
@@ -75,7 +75,7 @@ func (h *AISettingsHandler) HandleGetPatterns(w http.ResponseWriter, r *http.Req
})
}
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIPatrol)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
@@ -103,8 +103,9 @@ func (h *AISettingsHandler) HandleGetPredictions(w http.ResponseWriter, r *http.
return
}
+ aiService := h.GetAIService(r.Context())
// AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"predictions": []interface{}{},
"message": "AI is not enabled",
@@ -114,7 +115,7 @@ func (h *AISettingsHandler) HandleGetPredictions(w http.ResponseWriter, r *http.
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"predictions": []interface{}{},
@@ -160,7 +161,7 @@ func (h *AISettingsHandler) HandleGetPredictions(w http.ResponseWriter, r *http.
})
}
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIPatrol)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
@@ -188,8 +189,9 @@ func (h *AISettingsHandler) HandleGetCorrelations(w http.ResponseWriter, r *http
return
}
+ aiService := h.GetAIService(r.Context())
// AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"correlations": []interface{}{},
"message": "AI is not enabled",
@@ -199,7 +201,7 @@ func (h *AISettingsHandler) HandleGetCorrelations(w http.ResponseWriter, r *http
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"correlations": []interface{}{},
@@ -249,7 +251,7 @@ func (h *AISettingsHandler) HandleGetCorrelations(w http.ResponseWriter, r *http
})
}
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIPatrol)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
@@ -277,8 +279,9 @@ func (h *AISettingsHandler) HandleGetRecentChanges(w http.ResponseWriter, r *htt
return
}
+ aiService := h.GetAIService(r.Context())
// AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"changes": []interface{}{},
"message": "AI is not enabled",
@@ -288,7 +291,7 @@ func (h *AISettingsHandler) HandleGetRecentChanges(w http.ResponseWriter, r *htt
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"changes": []interface{}{},
@@ -337,7 +340,7 @@ func (h *AISettingsHandler) HandleGetRecentChanges(w http.ResponseWriter, r *htt
})
}
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIPatrol)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
@@ -366,8 +369,9 @@ func (h *AISettingsHandler) HandleGetBaselines(w http.ResponseWriter, r *http.Re
return
}
+ aiService := h.GetAIService(r.Context())
// AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"baselines": []interface{}{},
"message": "AI is not enabled",
@@ -377,7 +381,7 @@ func (h *AISettingsHandler) HandleGetBaselines(w http.ResponseWriter, r *http.Re
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"baselines": []interface{}{},
@@ -422,7 +426,7 @@ func (h *AISettingsHandler) HandleGetBaselines(w http.ResponseWriter, r *http.Re
})
}
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIPatrol)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
@@ -450,15 +454,16 @@ func (h *AISettingsHandler) HandleGetRemediations(w http.ResponseWriter, r *http
return
}
+ aiService := h.GetAIService(r.Context())
// Check for Pulse Pro license (soft-lock)
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIAutoFix)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIAutoFix)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIAutoFix)
}
// AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"remediations": []interface{}{},
"message": "AI is not enabled",
@@ -470,7 +475,7 @@ func (h *AISettingsHandler) HandleGetRemediations(w http.ResponseWriter, r *http
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"remediations": []interface{}{},
@@ -612,8 +617,9 @@ func (h *AISettingsHandler) HandleGetAnomalies(w http.ResponseWriter, r *http.Re
return
}
+ aiService := h.GetAIService(r.Context())
// AI must be enabled to return intelligence data
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"anomalies": []interface{}{},
"message": "AI is not enabled",
@@ -623,7 +629,7 @@ func (h *AISettingsHandler) HandleGetAnomalies(w http.ResponseWriter, r *http.Re
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"anomalies": []interface{}{},
@@ -646,7 +652,7 @@ func (h *AISettingsHandler) HandleGetAnomalies(w http.ResponseWriter, r *http.Re
}
// Get current metrics from state provider
- stateProvider := h.aiService.GetStateProvider()
+ stateProvider := aiService.GetStateProvider()
if stateProvider == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"anomalies": []interface{}{},
@@ -853,8 +859,9 @@ func (h *AISettingsHandler) HandleGetLearningStatus(w http.ResponseWriter, r *ht
return
}
+ aiService := h.GetAIService(r.Context())
// AI must be enabled to return learning status
- if !h.aiService.IsEnabled() {
+ if aiService == nil || !aiService.IsEnabled() {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"resources_baselined": 0,
"total_metrics": 0,
@@ -866,7 +873,7 @@ func (h *AISettingsHandler) HandleGetLearningStatus(w http.ResponseWriter, r *ht
return
}
- patrol := h.aiService.GetPatrolService()
+ patrol := aiService.GetPatrolService()
if patrol == nil {
if err := utils.WriteJSONResponse(w, map[string]interface{}{
"resources_baselined": 0,
@@ -918,7 +925,7 @@ func (h *AISettingsHandler) HandleGetLearningStatus(w http.ResponseWriter, r *ht
message = "Baselines established and anomaly detection is active"
}
- locked := !h.aiService.HasLicenseFeature(license.FeatureAIPatrol)
+ locked := aiService == nil || !aiService.HasLicenseFeature(license.FeatureAIPatrol)
if locked {
w.Header().Set("X-License-Required", "true")
w.Header().Set("X-License-Feature", license.FeatureAIPatrol)
diff --git a/internal/api/alerts.go b/internal/api/alerts.go
index 2063ed6049..5432a854cc 100644
--- a/internal/api/alerts.go
+++ b/internal/api/alerts.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"net/http"
"net/url"
@@ -13,6 +14,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/mock"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/notifications"
"github.com/rcourtman/pulse-go-rewrite/internal/utils"
"github.com/rcourtman/pulse-go-rewrite/internal/websocket"
@@ -50,21 +52,49 @@ type AlertMonitor interface {
// AlertHandlers handles alert-related HTTP endpoints
type AlertHandlers struct {
- monitor AlertMonitor
- wsHub *websocket.Hub
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyMonitor AlertMonitor
+ wsHub *websocket.Hub
}
// NewAlertHandlers creates new alert handlers
-func NewAlertHandlers(monitor AlertMonitor, wsHub *websocket.Hub) *AlertHandlers {
+func NewAlertHandlers(mtm *monitoring.MultiTenantMonitor, monitor AlertMonitor, wsHub *websocket.Hub) *AlertHandlers {
+ // If mtm is provided, try to populate legacyMonitor from "default" org if not provided
+ if monitor == nil && mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ monitor = NewAlertMonitorWrapper(m)
+ }
+ }
return &AlertHandlers{
- monitor: monitor,
- wsHub: wsHub,
+ mtMonitor: mtm,
+ legacyMonitor: monitor,
+ wsHub: wsHub,
+ }
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor reference
+func (h *AlertHandlers) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = NewAlertMonitorWrapper(m)
+ }
}
}
// SetMonitor updates the monitor reference for alert handlers.
func (h *AlertHandlers) SetMonitor(m AlertMonitor) {
- h.monitor = m
+ h.legacyMonitor = m
+}
+
+func (h *AlertHandlers) getMonitor(ctx context.Context) AlertMonitor {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return NewAlertMonitorWrapper(m)
+ }
+ }
+ return h.legacyMonitor
}
// validateAlertID validates an alert ID for security.
@@ -100,7 +130,7 @@ func validateAlertID(alertID string) bool {
// GetAlertConfig returns the current alert configuration
func (h *AlertHandlers) GetAlertConfig(w http.ResponseWriter, r *http.Request) {
- config := h.monitor.GetAlertManager().GetConfig()
+ config := h.getMonitor(r.Context()).GetAlertManager().GetConfig()
if err := utils.WriteJSONResponse(w, config); err != nil {
log.Error().Err(err).Msg("Failed to write alert config response")
@@ -129,25 +159,25 @@ func (h *AlertHandlers) UpdateAlertConfig(w http.ResponseWriter, r *http.Request
Msg("Migrated deprecated GroupingWindow to Grouping.Window")
}
- h.monitor.GetAlertManager().UpdateConfig(config)
- updatedConfig := h.monitor.GetAlertManager().GetConfig()
+ h.getMonitor(r.Context()).GetAlertManager().UpdateConfig(config)
+ updatedConfig := h.getMonitor(r.Context()).GetAlertManager().GetConfig()
// Update notification manager with schedule settings
- h.monitor.GetNotificationManager().SetCooldown(updatedConfig.Schedule.Cooldown)
+ h.getMonitor(r.Context()).GetNotificationManager().SetCooldown(updatedConfig.Schedule.Cooldown)
groupWindow = updatedConfig.Schedule.Grouping.Window
if groupWindow == 0 && updatedConfig.Schedule.GroupingWindow != 0 {
groupWindow = updatedConfig.Schedule.GroupingWindow
}
- h.monitor.GetNotificationManager().SetGroupingWindow(groupWindow)
- h.monitor.GetNotificationManager().SetGroupingOptions(
+ h.getMonitor(r.Context()).GetNotificationManager().SetGroupingWindow(groupWindow)
+ h.getMonitor(r.Context()).GetNotificationManager().SetGroupingOptions(
updatedConfig.Schedule.Grouping.ByNode,
updatedConfig.Schedule.Grouping.ByGuest,
)
- h.monitor.GetNotificationManager().SetNotifyOnResolve(updatedConfig.Schedule.NotifyOnResolve)
+ h.getMonitor(r.Context()).GetNotificationManager().SetNotifyOnResolve(updatedConfig.Schedule.NotifyOnResolve)
// Save to persistent storage
- if err := h.monitor.GetConfigPersistence().SaveAlertConfig(updatedConfig); err != nil {
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveAlertConfig(updatedConfig); err != nil {
// Log error but don't fail the request
log.Error().Err(err).Msg("Failed to save alert configuration")
}
@@ -163,7 +193,7 @@ func (h *AlertHandlers) UpdateAlertConfig(w http.ResponseWriter, r *http.Request
// ActivateAlerts activates alert notifications
func (h *AlertHandlers) ActivateAlerts(w http.ResponseWriter, r *http.Request) {
// Get current config
- config := h.monitor.GetAlertManager().GetConfig()
+ config := h.getMonitor(r.Context()).GetAlertManager().GetConfig()
// Check if already active
if config.ActivationState == alerts.ActivationActive {
@@ -184,22 +214,22 @@ func (h *AlertHandlers) ActivateAlerts(w http.ResponseWriter, r *http.Request) {
config.ActivationTime = &now
// Update config
- h.monitor.GetAlertManager().UpdateConfig(config)
+ h.getMonitor(r.Context()).GetAlertManager().UpdateConfig(config)
// Save to persistent storage
- if err := h.monitor.GetConfigPersistence().SaveAlertConfig(config); err != nil {
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveAlertConfig(config); err != nil {
log.Error().Err(err).Msg("Failed to save alert configuration after activation")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
}
// Notify about existing critical alerts after activation
- activeAlerts := h.monitor.GetAlertManager().GetActiveAlerts()
+ activeAlerts := h.getMonitor(r.Context()).GetAlertManager().GetActiveAlerts()
criticalCount := 0
for _, alert := range activeAlerts {
if alert.Level == alerts.AlertLevelCritical && !alert.Acknowledged {
// Re-dispatch critical alerts to trigger notifications
- h.monitor.GetAlertManager().NotifyExistingAlert(alert.ID)
+ h.getMonitor(r.Context()).GetAlertManager().NotifyExistingAlert(alert.ID)
criticalCount++
}
}
@@ -224,7 +254,7 @@ func (h *AlertHandlers) ActivateAlerts(w http.ResponseWriter, r *http.Request) {
// GetActiveAlerts returns all active alerts
func (h *AlertHandlers) GetActiveAlerts(w http.ResponseWriter, r *http.Request) {
- alerts := h.monitor.GetAlertManager().GetActiveAlerts()
+ alerts := h.getMonitor(r.Context()).GetAlertManager().GetActiveAlerts()
if err := utils.WriteJSONResponse(w, alerts); err != nil {
log.Error().Err(err).Msg("Failed to write active alerts response")
@@ -370,12 +400,12 @@ func (h *AlertHandlers) GetAlertHistory(w http.ResponseWriter, r *http.Request)
return
}
- if h.monitor == nil {
+ if h.getMonitor(r.Context()) == nil {
http.Error(w, "monitor is not initialized", http.StatusServiceUnavailable)
return
}
- manager := h.monitor.GetAlertManager()
+ manager := h.getMonitor(r.Context()).GetAlertManager()
var history []alerts.Alert
if startTime != nil {
history = manager.GetAlertHistorySince(*startTime, fetchLimit)
@@ -403,7 +433,7 @@ func (h *AlertHandlers) GetAlertIncidentTimeline(w http.ResponseWriter, r *http.
return
}
- store := h.monitor.GetIncidentStore()
+ store := h.getMonitor(r.Context()).GetIncidentStore()
if store == nil {
http.Error(w, "Incident store unavailable", http.StatusServiceUnavailable)
return
@@ -472,7 +502,7 @@ func (h *AlertHandlers) SaveAlertIncidentNote(w http.ResponseWriter, r *http.Req
return
}
- store := h.monitor.GetIncidentStore()
+ store := h.getMonitor(r.Context()).GetIncidentStore()
if store == nil {
http.Error(w, "Incident store unavailable", http.StatusServiceUnavailable)
return
@@ -522,7 +552,7 @@ func (h *AlertHandlers) SaveAlertIncidentNote(w http.ResponseWriter, r *http.Req
// ClearAlertHistory clears all alert history
func (h *AlertHandlers) ClearAlertHistory(w http.ResponseWriter, r *http.Request) {
- if err := h.monitor.GetAlertManager().ClearAlertHistory(); err != nil {
+ if err := h.getMonitor(r.Context()).GetAlertManager().ClearAlertHistory(); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
@@ -570,7 +600,7 @@ func (h *AlertHandlers) UnacknowledgeAlert(w http.ResponseWriter, r *http.Reques
Str("path", r.URL.Path).
Msg("Attempting to unacknowledge alert")
- if err := h.monitor.GetAlertManager().UnacknowledgeAlert(alertID); err != nil {
+ if err := h.getMonitor(r.Context()).GetAlertManager().UnacknowledgeAlert(alertID); err != nil {
log.Error().
Err(err).
Str("alertID", alertID).
@@ -579,7 +609,7 @@ func (h *AlertHandlers) UnacknowledgeAlert(w http.ResponseWriter, r *http.Reques
return
}
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
log.Info().
Str("alertID", alertID).
@@ -594,7 +624,7 @@ func (h *AlertHandlers) UnacknowledgeAlert(w http.ResponseWriter, r *http.Reques
// Do this in a goroutine to avoid blocking the HTTP response
if h.wsHub != nil {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
log.Debug().Msg("Broadcasted state after alert unacknowledgment")
}()
@@ -648,7 +678,7 @@ func (h *AlertHandlers) AcknowledgeAlert(w http.ResponseWriter, r *http.Request)
Str("alertID", alertID).
Msg("About to call AcknowledgeAlert on manager")
- if err := h.monitor.GetAlertManager().AcknowledgeAlert(alertID, user); err != nil {
+ if err := h.getMonitor(r.Context()).GetAlertManager().AcknowledgeAlert(alertID, user); err != nil {
log.Error().
Err(err).
Str("alertID", alertID).
@@ -657,7 +687,7 @@ func (h *AlertHandlers) AcknowledgeAlert(w http.ResponseWriter, r *http.Request)
return
}
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
log.Info().
Str("alertID", alertID).
@@ -673,7 +703,7 @@ func (h *AlertHandlers) AcknowledgeAlert(w http.ResponseWriter, r *http.Request)
// Do this in a goroutine to avoid blocking the HTTP response
if h.wsHub != nil {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
log.Debug().Msg("Broadcasted state after alert acknowledgment")
}()
@@ -711,13 +741,13 @@ func (h *AlertHandlers) AcknowledgeAlertByBody(w http.ResponseWriter, r *http.Re
user := "admin"
- if err := h.monitor.GetAlertManager().AcknowledgeAlert(alertID, user); err != nil {
+ if err := h.getMonitor(r.Context()).GetAlertManager().AcknowledgeAlert(alertID, user); err != nil {
log.Error().Err(err).Str("alertID", alertID).Msg("Failed to acknowledge alert")
http.Error(w, err.Error(), http.StatusNotFound)
return
}
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
log.Info().Str("alertID", alertID).Str("user", user).Msg("Alert acknowledged successfully")
@@ -727,7 +757,7 @@ func (h *AlertHandlers) AcknowledgeAlertByBody(w http.ResponseWriter, r *http.Re
if h.wsHub != nil {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
}()
}
@@ -755,13 +785,13 @@ func (h *AlertHandlers) UnacknowledgeAlertByBody(w http.ResponseWriter, r *http.
return
}
- if err := h.monitor.GetAlertManager().UnacknowledgeAlert(alertID); err != nil {
+ if err := h.getMonitor(r.Context()).GetAlertManager().UnacknowledgeAlert(alertID); err != nil {
log.Error().Err(err).Str("alertID", alertID).Msg("Failed to unacknowledge alert")
http.Error(w, err.Error(), http.StatusNotFound)
return
}
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
log.Info().Str("alertID", alertID).Msg("Alert unacknowledged successfully")
@@ -771,7 +801,7 @@ func (h *AlertHandlers) UnacknowledgeAlertByBody(w http.ResponseWriter, r *http.
if h.wsHub != nil {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
}()
}
@@ -799,12 +829,12 @@ func (h *AlertHandlers) ClearAlertByBody(w http.ResponseWriter, r *http.Request)
return
}
- if !h.monitor.GetAlertManager().ClearAlert(alertID) {
+ if !h.getMonitor(r.Context()).GetAlertManager().ClearAlert(alertID) {
http.Error(w, "Alert not found", http.StatusNotFound)
return
}
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
log.Info().Str("alertID", alertID).Msg("Alert cleared successfully")
@@ -814,7 +844,7 @@ func (h *AlertHandlers) ClearAlertByBody(w http.ResponseWriter, r *http.Request)
if h.wsHub != nil {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
}()
}
@@ -854,11 +884,11 @@ func (h *AlertHandlers) ClearAlert(w http.ResponseWriter, r *http.Request) {
return
}
- if !h.monitor.GetAlertManager().ClearAlert(alertID) {
+ if !h.getMonitor(r.Context()).GetAlertManager().ClearAlert(alertID) {
http.Error(w, "Alert not found", http.StatusNotFound)
return
}
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
// Send response immediately
if err := utils.WriteJSONResponse(w, map[string]bool{"success": true}); err != nil {
@@ -869,7 +899,7 @@ func (h *AlertHandlers) ClearAlert(w http.ResponseWriter, r *http.Request) {
// Do this in a goroutine to avoid blocking the HTTP response
if h.wsHub != nil {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
log.Debug().Msg("Broadcasted state after alert clear")
}()
@@ -910,7 +940,7 @@ func (h *AlertHandlers) BulkAcknowledgeAlerts(w http.ResponseWriter, r *http.Req
"alertId": alertID,
"success": true,
}
- if err := h.monitor.GetAlertManager().AcknowledgeAlert(alertID, user); err != nil {
+ if err := h.getMonitor(r.Context()).GetAlertManager().AcknowledgeAlert(alertID, user); err != nil {
result["success"] = false
result["error"] = err.Error()
} else {
@@ -920,7 +950,7 @@ func (h *AlertHandlers) BulkAcknowledgeAlerts(w http.ResponseWriter, r *http.Req
}
if anySuccess {
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
}
// Send response immediately
@@ -934,7 +964,7 @@ func (h *AlertHandlers) BulkAcknowledgeAlerts(w http.ResponseWriter, r *http.Req
// Do this in a goroutine to avoid blocking the HTTP response
if h.wsHub != nil && anySuccess {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
log.Debug().Msg("Broadcasted state after bulk alert acknowledgment")
}()
@@ -969,7 +999,7 @@ func (h *AlertHandlers) BulkClearAlerts(w http.ResponseWriter, r *http.Request)
"alertId": alertID,
"success": true,
}
- if h.monitor.GetAlertManager().ClearAlert(alertID) {
+ if h.getMonitor(r.Context()).GetAlertManager().ClearAlert(alertID) {
anySuccess = true
} else {
result["success"] = false
@@ -979,7 +1009,7 @@ func (h *AlertHandlers) BulkClearAlerts(w http.ResponseWriter, r *http.Request)
}
if anySuccess {
- h.monitor.SyncAlertState()
+ h.getMonitor(r.Context()).SyncAlertState()
}
// Send response immediately
@@ -993,7 +1023,7 @@ func (h *AlertHandlers) BulkClearAlerts(w http.ResponseWriter, r *http.Request)
// Do this in a goroutine to avoid blocking the HTTP response
if h.wsHub != nil && anySuccess {
go func() {
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
h.wsHub.BroadcastState(state.ToFrontend())
log.Debug().Msg("Broadcasted state after bulk alert clear")
}()
diff --git a/internal/api/config_handlers.go b/internal/api/config_handlers.go
index 4df7d05b4c..b4c8c53459 100644
--- a/internal/api/config_handlers.go
+++ b/internal/api/config_handlers.go
@@ -84,13 +84,18 @@ type SetupCode struct {
Used bool
NodeType string // "pve" or "pbs"
Host string // The host URL for validation
+ OrgID string // Organization ID creating this code
}
// ConfigHandlers handles configuration-related API endpoints
type ConfigHandlers struct {
- config *config.Config
- persistence *config.ConfigPersistence
- monitor *monitoring.Monitor
+ mtPersistence *config.MultiTenantPersistence
+ mtMonitor *monitoring.MultiTenantMonitor
+ // Legacy fields - to be removed or used as fallback
+ legacyConfig *config.Config
+ legacyPersistence *config.ConfigPersistence
+ legacyMonitor *monitoring.Monitor
+
reloadFunc func() error
reloadSystemSettingsFunc func() // Function to reload cached system settings
wsHub *websocket.Hub
@@ -105,11 +110,33 @@ type ConfigHandlers struct {
}
// NewConfigHandlers creates a new ConfigHandlers instance
-func NewConfigHandlers(cfg *config.Config, monitor *monitoring.Monitor, reloadFunc func() error, wsHub *websocket.Hub, guestMetadataHandler *GuestMetadataHandler, reloadSystemSettingsFunc func()) *ConfigHandlers {
+func NewConfigHandlers(mtp *config.MultiTenantPersistence, mtm *monitoring.MultiTenantMonitor, reloadFunc func() error, wsHub *websocket.Hub, guestMetadataHandler *GuestMetadataHandler, reloadSystemSettingsFunc func()) *ConfigHandlers {
+ // Initialize with default (legacy) values if available, for backward compat during migration
+ // Ideally we fetch them from mtp/mtm for "default" org.
+ var defaultConfig *config.Config
+ var defaultMonitor *monitoring.Monitor
+ var defaultPersistence *config.ConfigPersistence
+
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ defaultMonitor = m
+ if m != nil {
+ defaultConfig = m.GetConfig()
+ }
+ }
+ }
+ if mtp != nil {
+ if p, err := mtp.GetPersistence("default"); err == nil {
+ defaultPersistence = p
+ }
+ }
+
h := &ConfigHandlers{
- config: cfg,
- persistence: config.NewConfigPersistence(cfg.DataPath),
- monitor: monitor,
+ mtPersistence: mtp,
+ mtMonitor: mtm,
+ legacyConfig: defaultConfig,
+ legacyMonitor: defaultMonitor,
+ legacyPersistence: defaultPersistence,
reloadFunc: reloadFunc,
reloadSystemSettingsFunc: reloadSystemSettingsFunc,
wsHub: wsHub,
@@ -126,9 +153,23 @@ func NewConfigHandlers(cfg *config.Config, monitor *monitoring.Monitor, reloadFu
return h
}
-// SetMonitor updates the monitor reference used by the config handlers.
+// SetMultiTenantMonitor updates the monitor reference used by the config handlers.
+func (h *ConfigHandlers) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = m
+ h.legacyConfig = m.GetConfig()
+ }
+ }
+}
+
+// SetMonitor updates the monitor reference used by the config handlers (legacy support).
func (h *ConfigHandlers) SetMonitor(m *monitoring.Monitor) {
- h.monitor = m
+ h.legacyMonitor = m
+ if m != nil {
+ h.legacyConfig = m.GetConfig()
+ }
}
// SetConfig updates the configuration reference used by the handlers.
@@ -136,7 +177,49 @@ func (h *ConfigHandlers) SetConfig(cfg *config.Config) {
if cfg == nil {
return
}
- h.config = cfg
+ h.legacyConfig = cfg
+}
+
+// getContextState helper to retrieve tenant-specific state
+func (h *ConfigHandlers) getContextState(ctx context.Context) (*config.Config, *config.ConfigPersistence, *monitoring.Monitor) {
+ orgID := "default"
+ if ctx != nil {
+ if id := GetOrgID(ctx); id != "" {
+ orgID = id
+ }
+ }
+
+ // Try to get from multi-tenant managers first
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ cfg := m.GetConfig()
+ var p *config.ConfigPersistence
+ if h.mtPersistence != nil {
+ p, _ = h.mtPersistence.GetPersistence(orgID)
+ }
+ return cfg, p, m
+ } else if err != nil {
+ log.Warn().Str("orgID", orgID).Err(err).Msg("Falling back to legacy config - failed to get tenant monitor")
+ }
+ }
+
+ // Fallback to legacy (should mostly happen for "default" or initialization)
+ return h.legacyConfig, h.legacyPersistence, h.legacyMonitor
+}
+
+func (h *ConfigHandlers) getConfig(ctx context.Context) *config.Config {
+ c, _, _ := h.getContextState(ctx)
+ return c
+}
+
+func (h *ConfigHandlers) getPersistence(ctx context.Context) *config.ConfigPersistence {
+ _, p, _ := h.getContextState(ctx)
+ return p
+}
+
+func (h *ConfigHandlers) getMonitor(ctx context.Context) *monitoring.Monitor {
+ _, _, m := h.getContextState(ctx)
+ return m
}
// cleanupExpiredCodes removes expired or used setup codes periodically
@@ -226,16 +309,16 @@ func (h *ConfigHandlers) isRecentlyAutoRegistered(nodeType, nodeName string) boo
return true
}
-func (h *ConfigHandlers) findInstanceNameByHost(nodeType, host string) string {
+func (h *ConfigHandlers) findInstanceNameByHost(ctx context.Context, nodeType, host string) string {
switch nodeType {
case "pve":
- for _, node := range h.config.PVEInstances {
+ for _, node := range h.getConfig(ctx).PVEInstances {
if node.Host == host {
return node.Name
}
}
case "pbs":
- for _, node := range h.config.PBSInstances {
+ for _, node := range h.getConfig(ctx).PBSInstances {
if node.Host == host {
return node.Name
}
@@ -290,7 +373,7 @@ func shouldSkipClusterAutoDetection(host, name string) bool {
strings.Contains(lowerName, "concurrent-")
}
-func (h *ConfigHandlers) maybeRefreshClusterInfo(instance *config.PVEInstance) {
+func (h *ConfigHandlers) maybeRefreshClusterInfo(ctx context.Context, instance *config.PVEInstance) {
if instance == nil {
return
}
@@ -348,8 +431,8 @@ func (h *ConfigHandlers) maybeRefreshClusterInfo(instance *config.PVEInstance) {
Int("endpoints", len(clusterEndpoints)).
Msg("Updated cluster metadata after validation retry")
- if h.persistence != nil {
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if h.getPersistence(ctx) != nil {
+ if err := h.getPersistence(ctx).SaveNodesConfig(h.getConfig(ctx).PVEInstances, h.getConfig(ctx).PBSInstances, h.getConfig(ctx).PMGInstances); err != nil {
log.Warn().
Err(err).
Str("instance", instance.Name).
@@ -951,14 +1034,14 @@ func defaultDetectPVECluster(clientConfig proxmox.ClientConfig, nodeName string,
}
// GetAllNodesForAPI returns all configured nodes for API responses
-func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {
+func (h *ConfigHandlers) GetAllNodesForAPI(ctx context.Context) []NodeResponse {
nodes := []NodeResponse{}
// Add PVE nodes
- for i := range h.config.PVEInstances {
+ for i := range h.getConfig(ctx).PVEInstances {
// Refresh cluster metadata if we previously failed to detect endpoints
- h.maybeRefreshClusterInfo(&h.config.PVEInstances[i])
- pve := h.config.PVEInstances[i]
+ h.maybeRefreshClusterInfo(ctx, &h.getConfig(ctx).PVEInstances[i])
+ pve := h.getConfig(ctx).PVEInstances[i]
node := NodeResponse{
ID: generateNodeID("pve", i),
Type: "pve",
@@ -978,7 +1061,7 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {
MonitorPhysicalDisks: pve.MonitorPhysicalDisks,
PhysicalDiskPollingMinutes: pve.PhysicalDiskPollingMinutes,
TemperatureMonitoringEnabled: pve.TemperatureMonitoringEnabled,
- Status: h.getNodeStatus("pve", pve.Name),
+ Status: h.getNodeStatus(ctx, "pve", pve.Name),
IsCluster: pve.IsCluster,
ClusterName: pve.ClusterName,
ClusterEndpoints: pve.ClusterEndpoints,
@@ -988,7 +1071,7 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {
}
// Add PBS nodes
- for i, pbs := range h.config.PBSInstances {
+ for i, pbs := range h.getConfig(ctx).PBSInstances {
node := NodeResponse{
ID: generateNodeID("pbs", i),
Type: "pbs",
@@ -1008,14 +1091,14 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {
MonitorPruneJobs: pbs.MonitorPruneJobs,
MonitorGarbageJobs: pbs.MonitorGarbageJobs,
ExcludeDatastores: pbs.ExcludeDatastores,
- Status: h.getNodeStatus("pbs", pbs.Name),
+ Status: h.getNodeStatus(ctx, "pbs", pbs.Name),
Source: pbs.Source,
}
nodes = append(nodes, node)
}
// Add PMG nodes
- for i, pmgInst := range h.config.PMGInstances {
+ for i, pmgInst := range h.getConfig(ctx).PMGInstances {
monitorMailStats := pmgInst.MonitorMailStats
if !pmgInst.MonitorMailStats && !pmgInst.MonitorQueues && !pmgInst.MonitorQuarantine && !pmgInst.MonitorDomainStats {
monitorMailStats = true
@@ -1038,7 +1121,7 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {
MonitorQueues: pmgInst.MonitorQueues,
MonitorQuarantine: pmgInst.MonitorQuarantine,
MonitorDomainStats: pmgInst.MonitorDomainStats,
- Status: h.getNodeStatus("pmg", pmgInst.Name),
+ Status: h.getNodeStatus(ctx, "pmg", pmgInst.Name),
}
nodes = append(nodes, node)
}
@@ -1054,7 +1137,7 @@ func (h *ConfigHandlers) HandleGetNodes(w http.ResponseWriter, r *http.Request)
mockNodes := []NodeResponse{}
// Get mock state to extract node information
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
// Get all cluster nodes and standalone nodes
var clusterNodes []models.Node
@@ -1177,7 +1260,7 @@ func (h *ConfigHandlers) HandleGetNodes(w http.ResponseWriter, r *http.Request)
return
}
- nodes := h.GetAllNodesForAPI()
+ nodes := h.GetAllNodesForAPI(r.Context())
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(nodes)
@@ -1349,7 +1432,7 @@ func resolveHostnameToIP(hostURL string) string {
// disambiguateNodeName ensures a node name is unique by appending the host IP if needed.
// This handles cases where multiple Proxmox hosts have the same hostname (e.g., "px1" on different networks).
// Returns the original name if unique, or "name (ip)" if duplicates exist.
-func (h *ConfigHandlers) disambiguateNodeName(name, host, nodeType string) string {
+func (h *ConfigHandlers) disambiguateNodeName(ctx context.Context, name, host, nodeType string) string {
if name == "" {
return name
}
@@ -1357,14 +1440,14 @@ func (h *ConfigHandlers) disambiguateNodeName(name, host, nodeType string) strin
// Check if any existing node has the same name
hasDuplicate := false
if nodeType == "pve" {
- for _, node := range h.config.PVEInstances {
+ for _, node := range h.getConfig(ctx).PVEInstances {
if strings.EqualFold(node.Name, name) && node.Host != host {
hasDuplicate = true
break
}
}
} else if nodeType == "pbs" {
- for _, node := range h.config.PBSInstances {
+ for _, node := range h.getConfig(ctx).PBSInstances {
if strings.EqualFold(node.Name, name) && node.Host != host {
hasDuplicate = true
break
@@ -1489,21 +1572,21 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
// We disambiguate names later, but Host URLs must be unique.
switch req.Type {
case "pve":
- for _, node := range h.config.PVEInstances {
+ for _, node := range h.getConfig(r.Context()).PVEInstances {
if node.Host == normalizedHost {
http.Error(w, "A node with this host URL already exists", http.StatusConflict)
return
}
}
case "pbs":
- for _, node := range h.config.PBSInstances {
+ for _, node := range h.getConfig(r.Context()).PBSInstances {
if node.Host == normalizedHost {
http.Error(w, "A node with this host URL already exists", http.StatusConflict)
return
}
}
case "pmg":
- for _, node := range h.config.PMGInstances {
+ for _, node := range h.getConfig(r.Context()).PMGInstances {
if node.Host == normalizedHost {
http.Error(w, "A node with this host URL already exists", http.StatusConflict)
return
@@ -1545,8 +1628,8 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
// the node as an endpoint to the existing cluster instead of creating a new instance.
// This prevents duplicate VMs/containers when users install agents on multiple cluster nodes.
if isCluster && clusterName != "" {
- for i := range h.config.PVEInstances {
- existingInstance := &h.config.PVEInstances[i]
+ for i := range h.getConfig(r.Context()).PVEInstances {
+ existingInstance := &h.getConfig(r.Context()).PVEInstances[i]
if existingInstance.IsCluster && existingInstance.ClusterName == clusterName {
// Found existing cluster with same name - merge endpoints!
log.Info().
@@ -1571,8 +1654,8 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
}
// Save the updated configuration
- if h.persistence != nil {
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if h.getPersistence(r.Context()) != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Warn().Err(err).Msg("Failed to persist cluster endpoint merge")
}
}
@@ -1629,7 +1712,7 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
}
// Disambiguate name if duplicate hostnames exist (Issue #891)
- displayName := h.disambiguateNodeName(req.Name, host, "pve")
+ displayName := h.disambiguateNodeName(r.Context(), req.Name, host, "pve")
pve := config.PVEInstance{
Name: displayName,
@@ -1656,7 +1739,7 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
pve.PhysicalDiskPollingMinutes = *req.PhysicalDiskPollingMinutes
}
- h.config.PVEInstances = append(h.config.PVEInstances, pve)
+ h.getConfig(r.Context()).PVEInstances = append(h.getConfig(r.Context()).PVEInstances, pve)
if isCluster {
log.Info().
@@ -1764,7 +1847,7 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
}
// Disambiguate name if duplicate hostnames exist (Issue #891)
- pbsDisplayName := h.disambiguateNodeName(req.Name, host, "pbs")
+ pbsDisplayName := h.disambiguateNodeName(r.Context(), req.Name, host, "pbs")
pbs := config.PBSInstance{
Name: pbsDisplayName,
@@ -1784,7 +1867,7 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
MonitorGarbageJobs: monitorGarbageJobs,
TemperatureMonitoringEnabled: req.TemperatureMonitoringEnabled,
}
- h.config.PBSInstances = append(h.config.PBSInstances, pbs)
+ h.getConfig(r.Context()).PBSInstances = append(h.getConfig(r.Context()).PBSInstances, pbs)
} else if req.Type == "pmg" {
host := normalizedHost
@@ -1840,7 +1923,7 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
// Disambiguate name if duplicate hostnames exist (Issue #891)
// Note: PMG uses similar logic to PBS - we check against PMG instances
pmgDisplayName := req.Name
- for _, node := range h.config.PMGInstances {
+ for _, node := range h.getConfig(r.Context()).PMGInstances {
if strings.EqualFold(node.Name, req.Name) && node.Host != host {
parsed, err := url.Parse(host)
if err == nil && parsed.Host != "" {
@@ -1866,11 +1949,11 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
MonitorDomainStats: monitorDomainStats,
TemperatureMonitoringEnabled: req.TemperatureMonitoringEnabled,
}
- h.config.PMGInstances = append(h.config.PMGInstances, pmgInstance)
+ h.getConfig(r.Context()).PMGInstances = append(h.getConfig(r.Context()).PMGInstances, pmgInstance)
}
// Save configuration to disk using our persistence instance
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Error().Err(err).Msg("Failed to save nodes configuration")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
@@ -2232,8 +2315,8 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
}
// Update the node
- if nodeType == "pve" && index < len(h.config.PVEInstances) {
- pve := &h.config.PVEInstances[index]
+ if nodeType == "pve" && index < len(h.getConfig(r.Context()).PVEInstances) {
+ pve := &h.getConfig(r.Context()).PVEInstances[index]
// Only update name if provided
if req.Name != "" {
@@ -2310,8 +2393,8 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
if req.TemperatureMonitoringEnabled != nil {
pve.TemperatureMonitoringEnabled = req.TemperatureMonitoringEnabled
}
- } else if nodeType == "pbs" && index < len(h.config.PBSInstances) {
- pbs := &h.config.PBSInstances[index]
+ } else if nodeType == "pbs" && index < len(h.getConfig(r.Context()).PBSInstances) {
+ pbs := &h.getConfig(r.Context()).PBSInstances[index]
pbs.Name = req.Name
host, err := normalizeNodeHost(req.Host, nodeType)
@@ -2395,8 +2478,8 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
if req.ExcludeDatastores != nil {
pbs.ExcludeDatastores = req.ExcludeDatastores
}
- } else if nodeType == "pmg" && index < len(h.config.PMGInstances) {
- pmgInst := &h.config.PMGInstances[index]
+ } else if nodeType == "pmg" && index < len(h.getConfig(r.Context()).PMGInstances) {
+ pmgInst := &h.getConfig(r.Context()).PMGInstances[index]
pmgInst.Name = req.Name
if req.Host != "" {
@@ -2476,7 +2559,7 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
}
// Save configuration to disk using our persistence instance
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Error().Err(err).Msg("Failed to save nodes configuration")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
@@ -2486,15 +2569,15 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
// This fixes issue #440 where PBS alert thresholds were being reset
// Alert overrides are stored separately from node configuration
// and must be explicitly preserved during node updates
- if h.monitor != nil {
+ if h.getMonitor(r.Context()) != nil {
// Load current alert configuration to preserve overrides
- alertConfig, err := h.persistence.LoadAlertConfig()
+ alertConfig, err := h.getPersistence(r.Context()).LoadAlertConfig()
if err == nil && alertConfig != nil {
// For PBS nodes, we need to handle ID mapping
// PBS monitoring uses "pbs-<name>" but config uses "pbs-<index>"
// We need to preserve overrides by the monitoring ID
- if nodeType == "pbs" && index < len(h.config.PBSInstances) {
- pbsName := h.config.PBSInstances[index].Name
+ if nodeType == "pbs" && index < len(h.getConfig(r.Context()).PBSInstances) {
+ pbsName := h.getConfig(r.Context()).PBSInstances[index].Name
monitoringID := "pbs-" + pbsName
// Check if there are overrides for this PBS node
@@ -2510,7 +2593,7 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
}
// Apply the alert configuration to preserve all overrides
- h.monitor.GetAlertManager().UpdateConfig(*alertConfig)
+ h.getMonitor(r.Context()).GetAlertManager().UpdateConfig(*alertConfig)
log.Debug().
Str("nodeID", nodeID).
Str("nodeType", nodeType).
@@ -2528,16 +2611,16 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
}
// Trigger discovery refresh after adding node
- if h.monitor != nil && h.monitor.GetDiscoveryService() != nil {
+ if h.getMonitor(r.Context()) != nil && h.getMonitor(r.Context()).GetDiscoveryService() != nil {
log.Info().Msg("Triggering discovery refresh after adding node")
- h.monitor.GetDiscoveryService().ForceRefresh()
+ h.getMonitor(r.Context()).GetDiscoveryService().ForceRefresh()
// Broadcast discovery update via WebSocket
if h.wsHub != nil {
// Wait a moment for discovery to complete
go func() {
time.Sleep(2 * time.Second)
- result, _ := h.monitor.GetDiscoveryService().GetCachedResult()
+ result, _ := h.getMonitor(r.Context()).GetDiscoveryService().GetCachedResult()
if result != nil {
h.wsHub.BroadcastMessage(websocket.Message{
Type: "discovery_update",
@@ -2592,41 +2675,41 @@ func (h *ConfigHandlers) HandleDeleteNode(w http.ResponseWriter, r *http.Request
Str("nodeID", nodeID).
Str("nodeType", nodeType).
Int("index", index).
- Int("pveCount", len(h.config.PVEInstances)).
- Int("pbsCount", len(h.config.PBSInstances)).
- Int("pmgCount", len(h.config.PMGInstances)).
+ Int("pveCount", len(h.getConfig(r.Context()).PVEInstances)).
+ Int("pbsCount", len(h.getConfig(r.Context()).PBSInstances)).
+ Int("pmgCount", len(h.getConfig(r.Context()).PMGInstances)).
Msg("Attempting to delete node")
var deletedNodeHost string
// Delete the node
- if nodeType == "pve" && index < len(h.config.PVEInstances) {
- deletedNodeHost = h.config.PVEInstances[index].Host
+ if nodeType == "pve" && index < len(h.getConfig(r.Context()).PVEInstances) {
+ deletedNodeHost = h.getConfig(r.Context()).PVEInstances[index].Host
log.Info().Str("nodeID", nodeID).Int("index", index).Msg("Deleting PVE node")
- h.config.PVEInstances = append(h.config.PVEInstances[:index], h.config.PVEInstances[index+1:]...)
- } else if nodeType == "pbs" && index < len(h.config.PBSInstances) {
- deletedNodeHost = h.config.PBSInstances[index].Host
+ h.getConfig(r.Context()).PVEInstances = append(h.getConfig(r.Context()).PVEInstances[:index], h.getConfig(r.Context()).PVEInstances[index+1:]...)
+ } else if nodeType == "pbs" && index < len(h.getConfig(r.Context()).PBSInstances) {
+ deletedNodeHost = h.getConfig(r.Context()).PBSInstances[index].Host
log.Info().Str("nodeID", nodeID).Int("index", index).Msg("Deleting PBS node")
- h.config.PBSInstances = append(h.config.PBSInstances[:index], h.config.PBSInstances[index+1:]...)
- } else if nodeType == "pmg" && index < len(h.config.PMGInstances) {
- deletedNodeHost = h.config.PMGInstances[index].Host
+ h.getConfig(r.Context()).PBSInstances = append(h.getConfig(r.Context()).PBSInstances[:index], h.getConfig(r.Context()).PBSInstances[index+1:]...)
+ } else if nodeType == "pmg" && index < len(h.getConfig(r.Context()).PMGInstances) {
+ deletedNodeHost = h.getConfig(r.Context()).PMGInstances[index].Host
log.Info().Str("nodeID", nodeID).Int("index", index).Msg("Deleting PMG node")
- h.config.PMGInstances = append(h.config.PMGInstances[:index], h.config.PMGInstances[index+1:]...)
+ h.getConfig(r.Context()).PMGInstances = append(h.getConfig(r.Context()).PMGInstances[:index], h.getConfig(r.Context()).PMGInstances[index+1:]...)
} else {
log.Warn().
Str("nodeID", nodeID).
Str("nodeType", nodeType).
Int("index", index).
- Int("pveCount", len(h.config.PVEInstances)).
- Int("pbsCount", len(h.config.PBSInstances)).
- Int("pmgCount", len(h.config.PMGInstances)).
+ Int("pveCount", len(h.getConfig(r.Context()).PVEInstances)).
+ Int("pbsCount", len(h.getConfig(r.Context()).PBSInstances)).
+ Int("pmgCount", len(h.getConfig(r.Context()).PMGInstances)).
Msg("Node not found for deletion")
http.Error(w, "Node not found", http.StatusNotFound)
return
}
// Save configuration to disk using our persistence instance
- if err := h.persistence.SaveNodesConfigAllowEmpty(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfigAllowEmpty(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Error().Err(err).Msg("Failed to save nodes configuration")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
@@ -2666,8 +2749,8 @@ func (h *ConfigHandlers) HandleDeleteNode(w http.ResponseWriter, r *http.Request
time.Sleep(500 * time.Millisecond)
// Trigger full discovery refresh
- if h.monitor != nil && h.monitor.GetDiscoveryService() != nil {
- h.monitor.GetDiscoveryService().ForceRefresh()
+ if h.getMonitor(r.Context()) != nil && h.getMonitor(r.Context()).GetDiscoveryService() != nil {
+ h.getMonitor(r.Context()).GetDiscoveryService().ForceRefresh()
log.Info().Msg("Triggered background discovery refresh after node deletion")
}
}()
@@ -2719,12 +2802,12 @@ func (h *ConfigHandlers) HandleRefreshClusterNodes(w http.ResponseWriter, r *htt
return
}
- if index >= len(h.config.PVEInstances) {
+ if index >= len(h.getConfig(r.Context()).PVEInstances) {
http.Error(w, "Node not found", http.StatusNotFound)
return
}
- pve := &h.config.PVEInstances[index]
+ pve := &h.getConfig(r.Context()).PVEInstances[index]
// Create client config for cluster detection
clientConfig := config.CreateProxmoxConfig(pve)
@@ -2753,7 +2836,7 @@ func (h *ConfigHandlers) HandleRefreshClusterNodes(w http.ResponseWriter, r *htt
pve.ClusterEndpoints = clusterEndpoints
// Save configuration
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Error().Err(err).Msg("Failed to save nodes configuration after cluster refresh")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
@@ -2977,8 +3060,8 @@ func (h *ConfigHandlers) HandleTestNode(w http.ResponseWriter, r *http.Request)
// Find the node to test
var testResult map[string]interface{}
- if nodeType == "pve" && index < len(h.config.PVEInstances) {
- pve := h.config.PVEInstances[index]
+ if nodeType == "pve" && index < len(h.getConfig(r.Context()).PVEInstances) {
+ pve := h.getConfig(r.Context()).PVEInstances[index]
// Create a temporary client to test connection
authUser := pve.User
@@ -3020,8 +3103,8 @@ func (h *ConfigHandlers) HandleTestNode(w http.ResponseWriter, r *http.Request)
}
}
}
- } else if nodeType == "pbs" && index < len(h.config.PBSInstances) {
- pbsInstance := h.config.PBSInstances[index]
+ } else if nodeType == "pbs" && index < len(h.getConfig(r.Context()).PBSInstances) {
+ pbsInstance := h.getConfig(r.Context()).PBSInstances[index]
// Create a temporary client to test connection
clientConfig := pbs.ClientConfig{
@@ -3059,8 +3142,8 @@ func (h *ConfigHandlers) HandleTestNode(w http.ResponseWriter, r *http.Request)
}
}
}
- } else if nodeType == "pmg" && index < len(h.config.PMGInstances) {
- pmgInstance := h.config.PMGInstances[index]
+ } else if nodeType == "pmg" && index < len(h.getConfig(r.Context()).PMGInstances) {
+ pmgInstance := h.getConfig(r.Context()).PMGInstances[index]
clientConfig := config.CreatePMGConfig(&pmgInstance)
if pmgInstance.Password != "" && pmgInstance.TokenName == "" && pmgInstance.TokenValue == "" {
@@ -3132,8 +3215,8 @@ func (h *ConfigHandlers) HandleTestNode(w http.ResponseWriter, r *http.Request)
}
// getNodeStatus returns the connection status for a node
-func (h *ConfigHandlers) getNodeStatus(nodeType, nodeName string) string {
- if h.monitor == nil {
+func (h *ConfigHandlers) getNodeStatus(ctx context.Context, nodeType, nodeName string) string {
+ if h.getMonitor(ctx) == nil {
if h.isRecentlyAutoRegistered(nodeType, nodeName) {
return "connected"
}
@@ -3141,7 +3224,7 @@ func (h *ConfigHandlers) getNodeStatus(nodeType, nodeName string) string {
}
// Get connection statuses from monitor
- connectionStatus := h.monitor.GetConnectionStatuses()
+ connectionStatus := h.getMonitor(ctx).GetConnectionStatuses()
key := fmt.Sprintf("%s-%s", nodeType, nodeName)
if connected, ok := connectionStatus[key]; ok {
@@ -3165,7 +3248,7 @@ func (h *ConfigHandlers) getNodeStatus(nodeType, nodeName string) string {
// HandleGetSystemSettings returns current system settings
func (h *ConfigHandlers) HandleGetSystemSettings(w http.ResponseWriter, r *http.Request) {
// Load settings from persistence to get all fields including theme
- persistedSettings, err := h.persistence.LoadSystemSettings()
+ persistedSettings, err := h.getPersistence(r.Context()).LoadSystemSettings()
if err != nil {
log.Warn().Err(err).Msg("Failed to load persisted system settings")
persistedSettings = config.DefaultSystemSettings()
@@ -3176,22 +3259,22 @@ func (h *ConfigHandlers) HandleGetSystemSettings(w http.ResponseWriter, r *http.
// Get current values from running config
settings := *persistedSettings
- settings.PVEPollingInterval = int(h.config.PVEPollingInterval.Seconds())
- settings.PBSPollingInterval = int(h.config.PBSPollingInterval.Seconds())
- settings.BackupPollingInterval = int(h.config.BackupPollingInterval.Seconds())
- settings.BackendPort = h.config.BackendPort
- settings.FrontendPort = h.config.FrontendPort
- settings.AllowedOrigins = h.config.AllowedOrigins
- settings.ConnectionTimeout = int(h.config.ConnectionTimeout.Seconds())
- settings.UpdateChannel = h.config.UpdateChannel
- settings.AutoUpdateEnabled = h.config.AutoUpdateEnabled
- settings.AutoUpdateCheckInterval = int(h.config.AutoUpdateCheckInterval.Hours())
- settings.AutoUpdateTime = h.config.AutoUpdateTime
- settings.LogLevel = h.config.LogLevel
- settings.DiscoveryEnabled = h.config.DiscoveryEnabled
- settings.DiscoverySubnet = h.config.DiscoverySubnet
- settings.DiscoveryConfig = config.CloneDiscoveryConfig(h.config.Discovery)
- backupEnabled := h.config.EnableBackupPolling
+ settings.PVEPollingInterval = int(h.getConfig(r.Context()).PVEPollingInterval.Seconds())
+ settings.PBSPollingInterval = int(h.getConfig(r.Context()).PBSPollingInterval.Seconds())
+ settings.BackupPollingInterval = int(h.getConfig(r.Context()).BackupPollingInterval.Seconds())
+ settings.BackendPort = h.getConfig(r.Context()).BackendPort
+ settings.FrontendPort = h.getConfig(r.Context()).FrontendPort
+ settings.AllowedOrigins = h.getConfig(r.Context()).AllowedOrigins
+ settings.ConnectionTimeout = int(h.getConfig(r.Context()).ConnectionTimeout.Seconds())
+ settings.UpdateChannel = h.getConfig(r.Context()).UpdateChannel
+ settings.AutoUpdateEnabled = h.getConfig(r.Context()).AutoUpdateEnabled
+ settings.AutoUpdateCheckInterval = int(h.getConfig(r.Context()).AutoUpdateCheckInterval.Hours())
+ settings.AutoUpdateTime = h.getConfig(r.Context()).AutoUpdateTime
+ settings.LogLevel = h.getConfig(r.Context()).LogLevel
+ settings.DiscoveryEnabled = h.getConfig(r.Context()).DiscoveryEnabled
+ settings.DiscoverySubnet = h.getConfig(r.Context()).DiscoverySubnet
+ settings.DiscoveryConfig = config.CloneDiscoveryConfig(h.getConfig(r.Context()).Discovery)
+ backupEnabled := h.getConfig(r.Context()).EnableBackupPolling
settings.BackupPollingEnabled = &backupEnabled
// Create response structure that includes environment overrides
@@ -3245,7 +3328,7 @@ func (h *ConfigHandlers) HandleVerifyTemperatureSSH(w http.ResponseWriter, r *ht
homeDir = "/home/pulse"
}
sshKeyPath := filepath.Join(homeDir, ".ssh/id_ed25519_sensors")
- tempCollector := monitoring.NewTemperatureCollectorWithPort("root", sshKeyPath, h.config.SSHPort)
+ tempCollector := monitoring.NewTemperatureCollectorWithPort("root", sshKeyPath, h.getConfig(r.Context()).SSHPort)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -3333,7 +3416,7 @@ func (h *ConfigHandlers) HandleExportConfig(w http.ResponseWriter, r *http.Reque
}
// Export configuration
- exportedData, err := h.persistence.ExportConfig(req.Passphrase)
+ exportedData, err := h.getPersistence(r.Context()).ExportConfig(req.Passphrase)
if err != nil {
log.Error().Err(err).Msg("Failed to export configuration")
http.Error(w, "Failed to export configuration", http.StatusInternalServerError)
@@ -3374,7 +3457,7 @@ func (h *ConfigHandlers) HandleImportConfig(w http.ResponseWriter, r *http.Reque
}
// Import configuration
- if err := h.persistence.ImportConfig(req.Data, req.Passphrase); err != nil {
+ if err := h.getPersistence(r.Context()).ImportConfig(req.Data, req.Passphrase); err != nil {
log.Error().Err(err).Msg("Failed to import configuration")
http.Error(w, "Failed to import configuration: "+err.Error(), http.StatusBadRequest)
return
@@ -3389,7 +3472,7 @@ func (h *ConfigHandlers) HandleImportConfig(w http.ResponseWriter, r *http.Reque
}
// Update the config reference
- *h.config = *newConfig
+ *h.getConfig(r.Context()) = *newConfig
// Reload monitor with new configuration
if h.reloadFunc != nil {
@@ -3402,19 +3485,19 @@ func (h *ConfigHandlers) HandleImportConfig(w http.ResponseWriter, r *http.Reque
// Also reload alert and notification configs explicitly
// (the monitor reload only reloads nodes unless it's a full reload)
- if h.monitor != nil {
+ if h.getMonitor(r.Context()) != nil {
// Reload alert configuration
- if alertConfig, err := h.persistence.LoadAlertConfig(); err == nil {
- h.monitor.GetAlertManager().UpdateConfig(*alertConfig)
+ if alertConfig, err := h.getPersistence(r.Context()).LoadAlertConfig(); err == nil {
+ h.getMonitor(r.Context()).GetAlertManager().UpdateConfig(*alertConfig)
log.Info().Msg("Reloaded alert configuration after import")
} else {
log.Warn().Err(err).Msg("Failed to reload alert configuration after import")
}
// Reload webhook configuration
- if webhooks, err := h.persistence.LoadWebhooks(); err == nil {
+ if webhooks, err := h.getPersistence(r.Context()).LoadWebhooks(); err == nil {
// Clear existing webhooks and add new ones
- notificationMgr := h.monitor.GetNotificationManager()
+ notificationMgr := h.getMonitor(r.Context()).GetNotificationManager()
// Get current webhooks to clear them
for _, webhook := range notificationMgr.GetWebhooks() {
if err := notificationMgr.DeleteWebhook(webhook.ID); err != nil {
@@ -3431,8 +3514,8 @@ func (h *ConfigHandlers) HandleImportConfig(w http.ResponseWriter, r *http.Reque
}
// Reload email configuration
- if emailConfig, err := h.persistence.LoadEmailConfig(); err == nil {
- h.monitor.GetNotificationManager().SetEmailConfig(*emailConfig)
+ if emailConfig, err := h.getPersistence(r.Context()).LoadEmailConfig(); err == nil {
+ h.getMonitor(r.Context()).GetNotificationManager().SetEmailConfig(*emailConfig)
log.Info().Msg("Reloaded email configuration after import")
} else {
log.Warn().Err(err).Msg("Failed to reload email configuration after import")
@@ -3463,7 +3546,7 @@ func (h *ConfigHandlers) HandleDiscoverServers(w http.ResponseWriter, r *http.Re
switch r.Method {
case http.MethodGet:
// Return cached results from background discovery service
- if discoveryService := h.monitor.GetDiscoveryService(); discoveryService != nil {
+ if discoveryService := h.getMonitor(r.Context()).GetDiscoveryService(); discoveryService != nil {
result, updated := discoveryService.GetCachedResult()
var updatedUnix int64
@@ -3513,7 +3596,7 @@ func (h *ConfigHandlers) HandleDiscoverServers(w http.ResponseWriter, r *http.Re
}
if req.UseCache {
- if discoveryService := h.monitor.GetDiscoveryService(); discoveryService != nil {
+ if discoveryService := h.getMonitor(r.Context()).GetDiscoveryService(); discoveryService != nil {
result, updated := discoveryService.GetCachedResult()
var updatedUnix int64
@@ -3545,7 +3628,7 @@ func (h *ConfigHandlers) HandleDiscoverServers(w http.ResponseWriter, r *http.Re
log.Info().Str("subnet", subnet).Msg("Starting manual discovery scan")
- scanner, buildErr := discoveryinternal.BuildScanner(h.config.Discovery)
+ scanner, buildErr := discoveryinternal.BuildScanner(h.getConfig(r.Context()).Discovery)
if buildErr != nil {
log.Warn().Err(buildErr).Msg("Falling back to default scanner for manual discovery")
scanner = pkgdiscovery.NewScanner()
@@ -3659,7 +3742,7 @@ func (h *ConfigHandlers) HandleSetupScript(w http.ResponseWriter, r *http.Reques
log.Info().
Str("type", serverType).
Str("host", serverHost).
- Bool("has_auth", h.config.AuthUser != "" || h.config.AuthPass != "" || h.config.HasAPITokens()).
+ Bool("has_auth", h.getConfig(r.Context()).AuthUser != "" || h.getConfig(r.Context()).AuthPass != "" || h.getConfig(r.Context()).HasAPITokens()).
Msg("HandleSetupScript called")
// The setup script is now public - authentication happens via setup code
@@ -4697,6 +4780,7 @@ func (h *ConfigHandlers) HandleSetupScriptURL(w http.ResponseWriter, r *http.Req
Used: false,
NodeType: req.Type,
Host: req.Host,
+ OrgID: GetOrgID(r.Context()),
}
h.codeMutex.Unlock()
@@ -4710,9 +4794,9 @@ func (h *ConfigHandlers) HandleSetupScriptURL(w http.ResponseWriter, r *http.Req
host := r.Host
if parsedHost, parsedPort, err := net.SplitHostPort(host); err == nil {
- if (parsedHost == "127.0.0.1" || parsedHost == "localhost") && parsedPort == strconv.Itoa(h.config.FrontendPort) {
+ if (parsedHost == "127.0.0.1" || parsedHost == "localhost") && parsedPort == strconv.Itoa(h.getConfig(r.Context()).FrontendPort) {
// Prefer a user-configured public URL when we're running on loopback.
- if publicURL := strings.TrimSpace(h.config.PublicURL); publicURL != "" {
+ if publicURL := strings.TrimSpace(h.getConfig(r.Context()).PublicURL); publicURL != "" {
if parsedURL, err := url.Parse(publicURL); err == nil && parsedURL.Host != "" {
host = parsedURL.Host
}
@@ -4844,8 +4928,8 @@ func (h *ConfigHandlers) HandleUpdateMockMode(w http.ResponseWriter, r *http.Req
mock.SetMockConfig(currentCfg)
if req.Enabled != nil {
- if h.monitor != nil {
- h.monitor.SetMockMode(*req.Enabled)
+ if h.getMonitor(r.Context()) != nil {
+ h.getMonitor(r.Context()).SetMockMode(*req.Enabled)
} else {
mock.SetEnabled(*req.Enabled)
}
@@ -4914,14 +4998,14 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
log.Debug().
Bool("hasAuthToken", strings.TrimSpace(req.AuthToken) != "").
Bool("hasSetupCode", strings.TrimSpace(authCode) != "").
- Bool("hasConfigToken", h.config.HasAPITokens()).
+ Bool("hasConfigToken", h.getConfig(r.Context()).HasAPITokens()).
Msg("Checking authentication for auto-register")
// First check for setup code/auth token in the request
if authCode != "" {
matchedAPIToken := false
- if h.config.HasAPITokens() {
- if _, ok := h.config.ValidateAPIToken(authCode); ok {
+ if h.getConfig(r.Context()).HasAPITokens() {
+ if _, ok := h.getConfig(r.Context()).ValidateAPIToken(authCode); ok {
authenticated = true
matchedAPIToken = true
log.Info().
@@ -4950,6 +5034,12 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
// what's entered in the UI and what's provided in the setup script URL
if setupCode.NodeType == req.Type {
setupCode.Used = true // Mark as used immediately
+
+ // Inject OrgID from setup code into context for subsequent processing
+ if setupCode.OrgID != "" {
+ ctx := context.WithValue(r.Context(), OrgIDContextKey, setupCode.OrgID)
+ r = r.WithContext(ctx)
+ }
// Allow a short grace period for follow-up actions without keeping tokens alive too long
graceExpiry := time.Now().Add(1 * time.Minute)
if setupCode.ExpiresAt.Before(graceExpiry) {
@@ -4980,9 +5070,9 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// If not authenticated via setup code, check API token if configured
- if !authenticated && h.config.HasAPITokens() {
+ if !authenticated && h.getConfig(r.Context()).HasAPITokens() {
apiToken := r.Header.Get("X-API-Token")
- if _, ok := h.config.ValidateAPIToken(apiToken); ok {
+ if _, ok := h.getConfig(r.Context()).ValidateAPIToken(apiToken); ok {
authenticated = true
log.Info().Msg("Auto-register authenticated via API token")
}
@@ -5100,7 +5190,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
newHostIP := extractHostIP(host)
if req.Type == "pve" {
- for i, node := range h.config.PVEInstances {
+ for i, node := range h.getConfig(r.Context()).PVEInstances {
if node.Host == host {
existingIndex = i
break
@@ -5141,7 +5231,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
}
} else {
- for i, node := range h.config.PBSInstances {
+ for i, node := range h.getConfig(r.Context()).PBSInstances {
if node.Host == host {
existingIndex = i
break
@@ -5182,7 +5272,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
if existingIndex >= 0 {
// Update existing node
if req.Type == "pve" {
- instance := &h.config.PVEInstances[existingIndex]
+ instance := &h.getConfig(r.Context()).PVEInstances[existingIndex]
// Update host in case IP changed (DHCP scenario)
// But preserve user's configured hostname when matched by IP resolution (Issue #940)
if !preserveHost {
@@ -5220,7 +5310,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// Keep other settings as they were
} else {
- instance := &h.config.PBSInstances[existingIndex]
+ instance := &h.getConfig(r.Context()).PBSInstances[existingIndex]
// Update host in case IP changed (DHCP scenario)
// But preserve user's configured hostname when matched by IP resolution (Issue #940)
if !preserveHost {
@@ -5263,8 +5353,8 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
// CLUSTER DEDUPLICATION: Check if we already have this cluster configured
// If so, merge this node as an endpoint instead of creating a duplicate instance
if isCluster && clusterName != "" {
- for i := range h.config.PVEInstances {
- existingInstance := &h.config.PVEInstances[i]
+ for i := range h.getConfig(r.Context()).PVEInstances {
+ existingInstance := &h.getConfig(r.Context()).PVEInstances[i]
if existingInstance.IsCluster && existingInstance.ClusterName == clusterName {
// Found existing cluster with same name - merge endpoints!
log.Info().
@@ -5289,8 +5379,8 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// Save and reload
- if h.persistence != nil {
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if h.getPersistence(r.Context()) != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Warn().Err(err).Msg("Failed to persist cluster endpoint merge during auto-registration")
}
}
@@ -5333,7 +5423,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// Disambiguate node name if duplicate hostnames exist
- displayName := h.disambiguateNodeName(nodeConfig.Name, nodeConfig.Host, "pve")
+ displayName := h.disambiguateNodeName(r.Context(), nodeConfig.Name, nodeConfig.Host, "pve")
newInstance := config.PVEInstance{
Name: displayName,
@@ -5350,7 +5440,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
ClusterEndpoints: clusterEndpoints,
Source: req.Source, // Track how this node was registered
}
- h.config.PVEInstances = append(h.config.PVEInstances, newInstance)
+ h.getConfig(r.Context()).PVEInstances = append(h.getConfig(r.Context()).PVEInstances, newInstance)
if isCluster {
log.Info().
@@ -5385,7 +5475,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// Disambiguate node name if duplicate hostnames exist
- pbsDisplayName := h.disambiguateNodeName(nodeConfig.Name, nodeConfig.Host, "pbs")
+ pbsDisplayName := h.disambiguateNodeName(r.Context(), nodeConfig.Name, nodeConfig.Host, "pbs")
newInstance := config.PBSInstance{
Name: pbsDisplayName,
@@ -5401,14 +5491,14 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
MonitorGarbageJobs: monitorGarbageJobs,
Source: req.Source, // Track how this node was registered
}
- h.config.PBSInstances = append(h.config.PBSInstances, newInstance)
+ h.getConfig(r.Context()).PBSInstances = append(h.getConfig(r.Context()).PBSInstances, newInstance)
}
log.Info().Str("host", req.Host).Str("type", req.Type).Msg("Added new node via auto-registration")
}
// Log what we're about to save
- if req.Type == "pve" && len(h.config.PVEInstances) > 0 {
- lastNode := h.config.PVEInstances[len(h.config.PVEInstances)-1]
+ if req.Type == "pve" && len(h.getConfig(r.Context()).PVEInstances) > 0 {
+ lastNode := h.getConfig(r.Context()).PVEInstances[len(h.getConfig(r.Context()).PVEInstances)-1]
log.Info().
Str("name", lastNode.Name).
Str("host", lastNode.Host).
@@ -5418,7 +5508,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// Save configuration
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Error().Err(err).Msg("Failed to save auto-registered node")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
@@ -5426,7 +5516,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
log.Info().Msg("Configuration saved successfully")
- actualName := h.findInstanceNameByHost(req.Type, host)
+ actualName := h.findInstanceNameByHost(r.Context(), req.Type, host)
if actualName == "" {
actualName = strings.TrimSpace(req.ServerName)
}
@@ -5452,9 +5542,9 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// Trigger a discovery refresh to remove the node from discovered list
- if h.monitor != nil && h.monitor.GetDiscoveryService() != nil {
+ if h.getMonitor(r.Context()) != nil && h.getMonitor(r.Context()).GetDiscoveryService() != nil {
log.Info().Msg("Triggering discovery refresh after auto-registration")
- h.monitor.GetDiscoveryService().ForceRefresh()
+ h.getMonitor(r.Context()).GetDiscoveryService().ForceRefresh()
}
// Broadcast auto-registration success via WebSocket
@@ -5477,8 +5567,8 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
})
// Also broadcast a discovery update to refresh the UI
- if h.monitor != nil && h.monitor.GetDiscoveryService() != nil {
- result, _ := h.monitor.GetDiscoveryService().GetCachedResult()
+ if h.getMonitor(r.Context()) != nil && h.getMonitor(r.Context()).GetDiscoveryService() != nil {
+ result, _ := h.getMonitor(r.Context()).GetDiscoveryService().GetCachedResult()
if result != nil {
h.wsHub.BroadcastMessage(websocket.Message{
Type: "discovery_update",
@@ -5512,7 +5602,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// handleSecureAutoRegister handles the new secure registration flow where Pulse generates the token
-func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, _ *http.Request, req *AutoRegisterRequest, clientIP string) {
+func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, r *http.Request, req *AutoRegisterRequest, clientIP string) {
log.Info().
Str("type", req.Type).
Str("host", req.Host).
@@ -5629,7 +5719,7 @@ func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, _ *http
MonitorStorage: true,
MonitorBackups: true,
}
- h.config.PVEInstances = append(h.config.PVEInstances, pveNode)
+ h.getConfig(r.Context()).PVEInstances = append(h.getConfig(r.Context()).PVEInstances, pveNode)
} else if req.Type == "pbs" {
pbsNode := config.PBSInstance{
Name: serverName,
@@ -5644,17 +5734,17 @@ func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, _ *http
MonitorVerifyJobs: true,
MonitorPruneJobs: true,
}
- h.config.PBSInstances = append(h.config.PBSInstances, pbsNode)
+ h.getConfig(r.Context()).PBSInstances = append(h.getConfig(r.Context()).PBSInstances, pbsNode)
}
// Save configuration
- if err := h.persistence.SaveNodesConfig(h.config.PVEInstances, h.config.PBSInstances, h.config.PMGInstances); err != nil {
+ if err := h.getPersistence(r.Context()).SaveNodesConfig(h.getConfig(r.Context()).PVEInstances, h.getConfig(r.Context()).PBSInstances, h.getConfig(r.Context()).PMGInstances); err != nil {
log.Error().Err(err).Msg("Failed to save auto-registered node")
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
return
}
- actualName := h.findInstanceNameByHost(req.Type, host)
+ actualName := h.findInstanceNameByHost(r.Context(), req.Type, host)
if actualName == "" {
actualName = serverName
}
@@ -5849,13 +5939,13 @@ func (h *ConfigHandlers) HandleAgentInstallCommand(w http.ResponseWriter, r *htt
// Persist the token
config.Mu.Lock()
- h.config.APITokens = append(h.config.APITokens, *record)
- h.config.SortAPITokens()
+ h.getConfig(r.Context()).APITokens = append(h.getConfig(r.Context()).APITokens, *record)
+ h.getConfig(r.Context()).SortAPITokens()
- if h.persistence != nil {
- if err := h.persistence.SaveAPITokens(h.config.APITokens); err != nil {
+ if h.getPersistence(r.Context()) != nil {
+ if err := h.getPersistence(r.Context()).SaveAPITokens(h.getConfig(r.Context()).APITokens); err != nil {
// Rollback the in-memory addition
- h.config.APITokens = h.config.APITokens[:len(h.config.APITokens)-1]
+ h.getConfig(r.Context()).APITokens = h.getConfig(r.Context()).APITokens[:len(h.getConfig(r.Context()).APITokens)-1]
config.Mu.Unlock()
log.Error().Err(err).Msg("Failed to persist API tokens after creation")
http.Error(w, "Failed to save token to disk: "+err.Error(), http.StatusInternalServerError)
@@ -5867,9 +5957,9 @@ func (h *ConfigHandlers) HandleAgentInstallCommand(w http.ResponseWriter, r *htt
// Derive Pulse URL from the request
host := r.Host
if parsedHost, parsedPort, err := net.SplitHostPort(host); err == nil {
- if (parsedHost == "127.0.0.1" || parsedHost == "localhost") && parsedPort == strconv.Itoa(h.config.FrontendPort) {
+ if (parsedHost == "127.0.0.1" || parsedHost == "localhost") && parsedPort == strconv.Itoa(h.getConfig(r.Context()).FrontendPort) {
// Prefer a user-configured public URL when we're running on loopback
- if publicURL := strings.TrimSpace(h.config.PublicURL); publicURL != "" {
+ if publicURL := strings.TrimSpace(h.getConfig(r.Context()).PublicURL); publicURL != "" {
if parsedURL, err := url.Parse(publicURL); err == nil && parsedURL.Host != "" {
host = parsedURL.Host
}
diff --git a/internal/api/diagnostics.go b/internal/api/diagnostics.go
index ce0f482045..3bab92a018 100644
--- a/internal/api/diagnostics.go
+++ b/internal/api/diagnostics.go
@@ -1516,13 +1516,14 @@ func buildAIChatDiagnostic(cfg *config.Config, aiHandler *AIHandler) *AIChatDiag
// Calculate enabled state based on AI config
// NOTE: aiHandler might be nil during early startup
if aiHandler != nil {
- aiCfg := aiHandler.GetAIConfig()
+ ctx := context.Background()
+ aiCfg := aiHandler.GetAIConfig(ctx)
if aiCfg != nil {
diag.Enabled = aiCfg.Enabled
diag.Model = aiCfg.GetChatModel()
}
- svc := aiHandler.GetService()
+ svc := aiHandler.GetService(ctx)
if svc != nil {
diag.Running = svc.IsRunning()
diag.Healthy = svc.IsRunning() // Consolidate for now
diff --git a/internal/api/docker_agents.go b/internal/api/docker_agents.go
index 344e5a69c7..e8c451fb03 100644
--- a/internal/api/docker_agents.go
+++ b/internal/api/docker_agents.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"errors"
"net/http"
@@ -17,9 +18,10 @@ import (
// DockerAgentHandlers manages ingest from the external Docker agent.
type DockerAgentHandlers struct {
- monitor *monitoring.Monitor
- wsHub *websocket.Hub
- config *config.Config
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyMonitor *monitoring.Monitor
+ wsHub *websocket.Hub
+ config *config.Config
}
type dockerCommandAckRequest struct {
@@ -56,13 +58,40 @@ func normalizeCommandStatus(status string) (string, error) {
}
// NewDockerAgentHandlers constructs a new Docker agent handler group.
-func NewDockerAgentHandlers(m *monitoring.Monitor, hub *websocket.Hub, cfg *config.Config) *DockerAgentHandlers {
- return &DockerAgentHandlers{monitor: m, wsHub: hub, config: cfg}
+func NewDockerAgentHandlers(mtm *monitoring.MultiTenantMonitor, m *monitoring.Monitor, hub *websocket.Hub, cfg *config.Config) *DockerAgentHandlers {
+ // If mtm is provided, try to populate legacyMonitor from "default" org if not provided
+ if m == nil && mtm != nil {
+ if mon, err := mtm.GetMonitor("default"); err == nil {
+ m = mon
+ }
+ }
+ return &DockerAgentHandlers{mtMonitor: mtm, legacyMonitor: m, wsHub: hub, config: cfg}
}
// SetMonitor updates the monitor reference for docker agent handlers.
func (h *DockerAgentHandlers) SetMonitor(m *monitoring.Monitor) {
- h.monitor = m
+ h.legacyMonitor = m
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor reference
+func (h *DockerAgentHandlers) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = m
+ }
+ }
+}
+
+// getMonitor helper
+func (h *DockerAgentHandlers) getMonitor(ctx context.Context) *monitoring.Monitor {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return m
+ }
+ }
+ return h.legacyMonitor
}
// HandleReport accepts heartbeat payloads from the Docker agent.
@@ -89,7 +118,7 @@ func (h *DockerAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Reques
tokenRecord := getAPITokenRecordFromRequest(r)
- host, err := h.monitor.ApplyDockerReport(report, tokenRecord)
+ host, err := h.getMonitor(r.Context()).ApplyDockerReport(report, tokenRecord)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "invalid_report", err.Error(), nil)
return
@@ -101,7 +130,7 @@ func (h *DockerAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Reques
Msg("Docker agent report processed")
// Broadcast the updated state for near-real-time UI updates
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
response := map[string]any{
"success": true,
@@ -110,7 +139,7 @@ func (h *DockerAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Reques
"lastSeen": host.LastSeen,
}
- if payload, cmd := h.monitor.FetchDockerCommandForHost(host.ID); cmd != nil {
+ if payload, cmd := h.getMonitor(r.Context()).FetchDockerCommandForHost(host.ID); cmd != nil {
commandResponse := map[string]any{
"id": cmd.ID,
"type": cmd.Type,
@@ -202,25 +231,25 @@ func (h *DockerAgentHandlers) HandleCommandAck(w http.ResponseWriter, r *http.Re
return
}
- commandStatus, hostID, shouldRemove, err := h.monitor.AcknowledgeDockerHostCommand(commandID, req.HostID, status, req.Message)
+ commandStatus, hostID, shouldRemove, err := h.getMonitor(r.Context()).AcknowledgeDockerHostCommand(commandID, req.HostID, status, req.Message)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "docker_command_ack_failed", err.Error(), nil)
return
}
if shouldRemove {
- if _, removeErr := h.monitor.RemoveDockerHost(hostID); removeErr != nil {
+ if _, removeErr := h.getMonitor(r.Context()).RemoveDockerHost(hostID); removeErr != nil {
log.Error().Err(removeErr).Str("dockerHostID", hostID).Str("commandID", commandID).Msg("Failed to remove docker host after command completion")
} else {
// Clear the removal block since the agent has confirmed it stopped successfully.
// This allows immediate re-enrollment without waiting for the 24-hour TTL.
- if reenrollErr := h.monitor.AllowDockerHostReenroll(hostID); reenrollErr != nil {
+ if reenrollErr := h.getMonitor(r.Context()).AllowDockerHostReenroll(hostID); reenrollErr != nil {
log.Warn().Err(reenrollErr).Str("dockerHostID", hostID).Msg("Failed to clear removal block after successful stop")
}
}
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -252,20 +281,20 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
forceParam := strings.ToLower(r.URL.Query().Get("force"))
force := forceParam == "true" || strings.ToLower(r.URL.Query().Get("mode")) == "force"
- priorHost, hostExists := h.monitor.GetDockerHost(hostID)
+ priorHost, hostExists := h.getMonitor(r.Context()).GetDockerHost(hostID)
if shouldHide {
if !hostExists {
writeErrorResponse(w, http.StatusNotFound, "docker_host_not_found", "Docker host not found", nil)
return
}
- host, err := h.monitor.HideDockerHost(hostID)
+ host, err := h.getMonitor(r.Context()).HideDockerHost(hostID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "docker_host_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -294,13 +323,13 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
}
if !force && strings.EqualFold(priorHost.Status, "online") {
- command, err := h.monitor.QueueDockerHostStop(hostID)
+ command, err := h.getMonitor(r.Context()).QueueDockerHostStop(hostID)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "docker_command_failed", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -313,13 +342,13 @@ func (h *DockerAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Re
return
}
- host, err := h.monitor.RemoveDockerHost(hostID)
+ host, err := h.getMonitor(r.Context()).RemoveDockerHost(hostID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "docker_host_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -345,13 +374,13 @@ func (h *DockerAgentHandlers) HandleAllowReenroll(w http.ResponseWriter, r *http
return
}
- if err := h.monitor.AllowDockerHostReenroll(hostID); err != nil {
+ if err := h.getMonitor(r.Context()).AllowDockerHostReenroll(hostID); err != nil {
writeErrorResponse(w, http.StatusBadRequest, "docker_host_reenroll_failed", err.Error(), nil)
return
}
// Broadcast updated state to ensure the frontend reflects the change
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -376,13 +405,13 @@ func (h *DockerAgentHandlers) HandleUnhideHost(w http.ResponseWriter, r *http.Re
return
}
- host, err := h.monitor.UnhideDockerHost(hostID)
+ host, err := h.getMonitor(r.Context()).UnhideDockerHost(hostID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "docker_host_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -408,13 +437,13 @@ func (h *DockerAgentHandlers) HandleMarkPendingUninstall(w http.ResponseWriter,
return
}
- host, err := h.monitor.MarkDockerHostPendingUninstall(hostID)
+ host, err := h.getMonitor(r.Context()).MarkDockerHostPendingUninstall(hostID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "docker_host_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -454,13 +483,13 @@ func (h *DockerAgentHandlers) HandleSetCustomDisplayName(w http.ResponseWriter,
customName := strings.TrimSpace(req.DisplayName)
- host, err := h.monitor.SetDockerHostCustomDisplayName(hostID, customName)
+ host, err := h.getMonitor(r.Context()).SetDockerHostCustomDisplayName(hostID, customName)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "docker_host_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -510,13 +539,13 @@ func (h *DockerAgentHandlers) HandleContainerUpdate(w http.ResponseWriter, r *ht
}
// Queue the update command
- commandStatus, err := h.monitor.QueueDockerContainerUpdateCommand(req.HostID, req.ContainerID, req.ContainerName)
+ commandStatus, err := h.getMonitor(r.Context()).QueueDockerContainerUpdateCommand(req.HostID, req.ContainerID, req.ContainerName)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "update_command_failed", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -550,13 +579,13 @@ func (h *DockerAgentHandlers) HandleCheckUpdates(w http.ResponseWriter, r *http.
}
// Queue the check updates command
- commandStatus, err := h.monitor.QueueDockerCheckUpdatesCommand(hostID)
+ commandStatus, err := h.getMonitor(r.Context()).QueueDockerCheckUpdatesCommand(hostID)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "check_updates_command_failed", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
diff --git a/internal/api/docker_metadata.go b/internal/api/docker_metadata.go
index 987cd1330c..12eacd4467 100644
--- a/internal/api/docker_metadata.go
+++ b/internal/api/docker_metadata.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"net/http"
"net/url"
@@ -12,19 +13,30 @@ import (
// DockerMetadataHandler handles Docker resource metadata operations
type DockerMetadataHandler struct {
- store *config.DockerMetadataStore
+ mtPersistence *config.MultiTenantPersistence
}
// NewDockerMetadataHandler creates a new Docker metadata handler
-func NewDockerMetadataHandler(dataPath string) *DockerMetadataHandler {
+func NewDockerMetadataHandler(mtPersistence *config.MultiTenantPersistence) *DockerMetadataHandler {
return &DockerMetadataHandler{
- store: config.NewDockerMetadataStore(dataPath, nil),
+ mtPersistence: mtPersistence,
}
}
-// Store returns the underlying metadata store
+func (h *DockerMetadataHandler) getStore(ctx context.Context) *config.DockerMetadataStore {
+ orgID := "default"
+ if ctx != nil {
+ if id := GetOrgID(ctx); id != "" {
+ orgID = id
+ }
+ }
+ p, _ := h.mtPersistence.GetPersistence(orgID)
+ return p.GetDockerMetadataStore()
+}
+
+// Store returns the underlying metadata store for default tenant
func (h *DockerMetadataHandler) Store() *config.DockerMetadataStore {
- return h.store
+ return h.getStore(context.Background())
}
// HandleGetMetadata retrieves metadata for a specific Docker resource or all resources
@@ -40,7 +52,8 @@ func (h *DockerMetadataHandler) HandleGetMetadata(w http.ResponseWriter, r *http
if path == "/api/docker/metadata" || path == "/api/docker/metadata/" {
// Get all metadata
w.Header().Set("Content-Type", "application/json")
- allMeta := h.store.GetAll()
+ store := h.getStore(r.Context())
+ allMeta := store.GetAll()
if allMeta == nil {
// Return empty object instead of null
json.NewEncoder(w).Encode(make(map[string]*config.DockerMetadata))
@@ -57,7 +70,8 @@ func (h *DockerMetadataHandler) HandleGetMetadata(w http.ResponseWriter, r *http
if resourceID != "" {
// Get specific Docker resource metadata
- meta := h.store.Get(resourceID)
+ store := h.getStore(r.Context())
+ meta := store.Get(resourceID)
if meta == nil {
// Return empty metadata instead of 404
json.NewEncoder(w).Encode(&config.DockerMetadata{ID: resourceID})
@@ -120,7 +134,8 @@ func (h *DockerMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *h
}
}
- if err := h.store.Set(resourceID, &meta); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.Set(resourceID, &meta); err != nil {
log.Error().Err(err).Str("resourceID", resourceID).Msg("Failed to save Docker metadata")
// Provide more specific error message
errMsg := "Failed to save metadata"
@@ -152,7 +167,8 @@ func (h *DockerMetadataHandler) HandleDeleteMetadata(w http.ResponseWriter, r *h
return
}
- if err := h.store.Delete(resourceID); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.Delete(resourceID); err != nil {
log.Error().Err(err).Str("resourceID", resourceID).Msg("Failed to delete Docker metadata")
http.Error(w, "Failed to delete metadata", http.StatusInternalServerError)
return
@@ -176,7 +192,8 @@ func (h *DockerMetadataHandler) HandleGetHostMetadata(w http.ResponseWriter, r *
if path == "/api/docker/hosts/metadata" || path == "/api/docker/hosts/metadata/" {
// Get all host metadata
w.Header().Set("Content-Type", "application/json")
- allMeta := h.store.GetAllHostMetadata()
+ store := h.getStore(r.Context())
+ allMeta := store.GetAllHostMetadata()
if allMeta == nil {
// Return empty object instead of null
json.NewEncoder(w).Encode(make(map[string]*config.DockerHostMetadata))
@@ -193,7 +210,8 @@ func (h *DockerMetadataHandler) HandleGetHostMetadata(w http.ResponseWriter, r *
if hostID != "" {
// Get specific Docker host metadata
- meta := h.store.GetHostMetadata(hostID)
+ store := h.getStore(r.Context())
+ meta := store.GetHostMetadata(hostID)
if meta == nil {
// Return empty metadata instead of 404
json.NewEncoder(w).Encode(&config.DockerHostMetadata{})
@@ -257,7 +275,8 @@ func (h *DockerMetadataHandler) HandleUpdateHostMetadata(w http.ResponseWriter,
}
// Get existing metadata to merge with new data
- existing := h.store.GetHostMetadata(hostID)
+ store := h.getStore(r.Context())
+ existing := store.GetHostMetadata(hostID)
if existing != nil {
// Merge: only update fields that are provided
if meta.CustomDisplayName != "" || existing.CustomDisplayName != "" {
@@ -271,7 +290,7 @@ func (h *DockerMetadataHandler) HandleUpdateHostMetadata(w http.ResponseWriter,
}
}
- if err := h.store.SetHostMetadata(hostID, &meta); err != nil {
+ if err := store.SetHostMetadata(hostID, &meta); err != nil {
log.Error().Err(err).Str("hostID", hostID).Msg("Failed to save Docker host metadata")
// Provide more specific error message
errMsg := "Failed to save metadata"
@@ -300,10 +319,9 @@ func (h *DockerMetadataHandler) HandleDeleteHostMetadata(w http.ResponseWriter,
hostID := strings.TrimPrefix(r.URL.Path, "/api/docker/hosts/metadata/")
if hostID == "" || hostID == "metadata" {
http.Error(w, "Host ID required", http.StatusBadRequest)
- return
}
-
- if err := h.store.SetHostMetadata(hostID, nil); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.SetHostMetadata(hostID, nil); err != nil {
log.Error().Err(err).Str("hostID", hostID).Msg("Failed to delete Docker host metadata")
http.Error(w, "Failed to delete metadata", http.StatusInternalServerError)
return
diff --git a/internal/api/guest_metadata.go b/internal/api/guest_metadata.go
index d7d67e99f9..f955fa7ec2 100644
--- a/internal/api/guest_metadata.go
+++ b/internal/api/guest_metadata.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"net/http"
"net/url"
@@ -12,24 +13,42 @@ import (
// GuestMetadataHandler handles guest metadata operations
type GuestMetadataHandler struct {
- store *config.GuestMetadataStore
+ mtPersistence *config.MultiTenantPersistence
}
// NewGuestMetadataHandler creates a new guest metadata handler
-func NewGuestMetadataHandler(dataPath string) *GuestMetadataHandler {
+func NewGuestMetadataHandler(mtPersistence *config.MultiTenantPersistence) *GuestMetadataHandler {
return &GuestMetadataHandler{
- store: config.NewGuestMetadataStore(dataPath, nil),
+ mtPersistence: mtPersistence,
}
}
+func (h *GuestMetadataHandler) getStore(ctx context.Context) *config.GuestMetadataStore {
+ // Default to "default" org if none specified (though middleware should always set it)
+ orgID := "default"
+ if ctx != nil {
+ if id := GetOrgID(ctx); id != "" {
+ orgID = id
+ }
+ }
+ p, _ := h.mtPersistence.GetPersistence(orgID)
+ return p.GetGuestMetadataStore()
+}
+
// Reload reloads the guest metadata from disk
func (h *GuestMetadataHandler) Reload() error {
- return h.store.Load()
+ // For multi-tenant, we might need to reload all loaded stores?
+ // Or we just rely on lazy loading.
+ // Since stores are cached in ConfigPersistence, we currently don't have an easy way to iterate all.
+ // But stores load on init. Reload() method on store might be needed if modified on disk externally.
+ // For now, this is a no-op or TODO for multi-tenant deep reload.
+ // Actually, we can get "default" store and reload it for legacy compat.
+ return h.getStore(context.Background()).Load()
}
-// Store returns the underlying metadata store
+// Store returns the underlying metadata store for the default tenant (Legacy support)
func (h *GuestMetadataHandler) Store() *config.GuestMetadataStore {
- return h.store
+ return h.getStore(context.Background())
}
// HandleGetMetadata retrieves metadata for a specific guest or all guests
@@ -45,7 +64,8 @@ func (h *GuestMetadataHandler) HandleGetMetadata(w http.ResponseWriter, r *http.
if path == "/api/guests/metadata" || path == "/api/guests/metadata/" {
// Get all metadata
w.Header().Set("Content-Type", "application/json")
- allMeta := h.store.GetAll()
+ store := h.getStore(r.Context())
+ allMeta := store.GetAll()
if allMeta == nil {
// Return empty object instead of null
json.NewEncoder(w).Encode(make(map[string]*config.GuestMetadata))
@@ -62,7 +82,8 @@ func (h *GuestMetadataHandler) HandleGetMetadata(w http.ResponseWriter, r *http.
if guestID != "" {
// Get specific guest metadata
- meta := h.store.Get(guestID)
+ store := h.getStore(r.Context())
+ meta := store.Get(guestID)
if meta == nil {
// Return empty metadata instead of 404
json.NewEncoder(w).Encode(&config.GuestMetadata{ID: guestID})
@@ -125,7 +146,8 @@ func (h *GuestMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *ht
}
}
- if err := h.store.Set(guestID, &meta); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.Set(guestID, &meta); err != nil {
log.Error().Err(err).Str("guestID", guestID).Msg("Failed to save guest metadata")
// Provide more specific error message
errMsg := "Failed to save metadata"
@@ -157,7 +179,8 @@ func (h *GuestMetadataHandler) HandleDeleteMetadata(w http.ResponseWriter, r *ht
return
}
- if err := h.store.Delete(guestID); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.Delete(guestID); err != nil {
log.Error().Err(err).Str("guestID", guestID).Msg("Failed to delete guest metadata")
http.Error(w, "Failed to delete metadata", http.StatusInternalServerError)
return
diff --git a/internal/api/host_agents.go b/internal/api/host_agents.go
index ec26b4b287..c9d1836c6f 100644
--- a/internal/api/host_agents.go
+++ b/internal/api/host_agents.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"crypto/ed25519"
"encoding/json"
"fmt"
@@ -30,18 +31,46 @@ var configSigningState struct {
// HostAgentHandlers manages ingest from the pulse-host-agent.
type HostAgentHandlers struct {
- monitor *monitoring.Monitor
- wsHub *websocket.Hub
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyMonitor *monitoring.Monitor
+ wsHub *websocket.Hub
}
// NewHostAgentHandlers constructs a new handler set for host agents.
-func NewHostAgentHandlers(m *monitoring.Monitor, hub *websocket.Hub) *HostAgentHandlers {
- return &HostAgentHandlers{monitor: m, wsHub: hub}
+func NewHostAgentHandlers(mtm *monitoring.MultiTenantMonitor, m *monitoring.Monitor, hub *websocket.Hub) *HostAgentHandlers {
+ // If mtm is provided, try to populate legacyMonitor from "default" org if not provided
+ if m == nil && mtm != nil {
+ if mon, err := mtm.GetMonitor("default"); err == nil {
+ m = mon
+ }
+ }
+ return &HostAgentHandlers{mtMonitor: mtm, legacyMonitor: m, wsHub: hub}
}
// SetMonitor updates the monitor reference for host agent handlers.
func (h *HostAgentHandlers) SetMonitor(m *monitoring.Monitor) {
- h.monitor = m
+ h.legacyMonitor = m
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor reference
+func (h *HostAgentHandlers) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = m
+ }
+ }
+}
+
+// getMonitor helper
+func (h *HostAgentHandlers) getMonitor(ctx context.Context) *monitoring.Monitor {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return m
+ }
+ }
+ return h.legacyMonitor
}
// HandleReport ingests host agent reports.
@@ -67,7 +96,7 @@ func (h *HostAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Request)
tokenRecord := getAPITokenRecordFromRequest(r)
- host, err := h.monitor.ApplyHostReport(report, tokenRecord)
+ host, err := h.getMonitor(r.Context()).ApplyHostReport(report, tokenRecord)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "invalid_report", err.Error(), nil)
return
@@ -79,10 +108,10 @@ func (h *HostAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Request)
Str("platform", host.Platform).
Msg("Host agent report processed")
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
// Include any server-side config overrides in the response
- serverConfig := h.monitor.GetHostAgentConfig(host.ID)
+ serverConfig := h.getMonitor(r.Context()).GetHostAgentConfig(host.ID)
resp := map[string]any{
"success": true,
@@ -120,7 +149,7 @@ func (h *HostAgentHandlers) HandleLookup(w http.ResponseWriter, r *http.Request)
return
}
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
var (
host models.Host
@@ -218,13 +247,13 @@ func (h *HostAgentHandlers) HandleDeleteHost(w http.ResponseWriter, r *http.Requ
}
// Remove the host from state
- host, err := h.monitor.RemoveHostAgent(hostID)
+ host, err := h.getMonitor(r.Context()).RemoveHostAgent(hostID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "host_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -268,8 +297,8 @@ func (h *HostAgentHandlers) canReadConfig(record *config.APITokenRecord) bool {
record.HasScope(config.ScopeSettingsWrite)
}
-func (h *HostAgentHandlers) resolveConfigHost(hostID string, record *config.APITokenRecord) (models.Host, bool) {
- state := h.monitor.GetState()
+func (h *HostAgentHandlers) resolveConfigHost(ctx context.Context, hostID string, record *config.APITokenRecord) (models.Host, bool) {
+ state := h.getMonitor(ctx).GetState()
if record == nil || record.HasScope(config.ScopeHostManage) || record.HasScope(config.ScopeSettingsWrite) {
for _, candidate := range state.Hosts {
@@ -363,7 +392,7 @@ func (h *HostAgentHandlers) handleGetConfig(w http.ResponseWriter, r *http.Reque
return
}
- host, ok := h.resolveConfigHost(hostID, record)
+ host, ok := h.resolveConfigHost(r.Context(), hostID, record)
if !ok {
writeErrorResponse(w, http.StatusNotFound, "host_not_found", "Host has not registered with Pulse yet", nil)
LogAuditEvent("host_agent_config_fetch", auth.GetUser(r.Context()), GetClientIP(r), r.URL.Path, false,
@@ -373,7 +402,7 @@ func (h *HostAgentHandlers) handleGetConfig(w http.ResponseWriter, r *http.Reque
hostID = host.ID
- config := h.monitor.GetHostAgentConfig(hostID)
+ config := h.getMonitor(r.Context()).GetHostAgentConfig(hostID)
signedConfig, err := h.signHostConfig(hostID, config)
if err != nil {
log.Error().Err(err).Msg("Failed to sign host config payload")
@@ -417,7 +446,7 @@ func (h *HostAgentHandlers) ensureHostTokenMatch(w http.ResponseWriter, r *http.
return true
}
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
for _, host := range state.Hosts {
if host.ID != hostID {
continue
@@ -446,12 +475,12 @@ func (h *HostAgentHandlers) handlePatchConfig(w http.ResponseWriter, r *http.Req
return
}
- if err := h.monitor.UpdateHostAgentConfig(hostID, req.CommandsEnabled); err != nil {
+ if err := h.getMonitor(r.Context()).UpdateHostAgentConfig(hostID, req.CommandsEnabled); err != nil {
writeErrorResponse(w, http.StatusInternalServerError, "update_failed", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
log.Info().
Str("hostId", hostID).
@@ -499,13 +528,13 @@ func (h *HostAgentHandlers) HandleUninstall(w http.ResponseWriter, r *http.Reque
log.Info().Str("hostId", hostID).Msg("Received unregistration request from agent uninstaller")
// Remove the host from state
- _, err := h.monitor.RemoveHostAgent(hostID)
+ _, err := h.getMonitor(r.Context()).RemoveHostAgent(hostID)
if err != nil {
// If host not found, we still return success because the goal is reached
log.Warn().Err(err).Str("hostId", hostID).Msg("Host not found during unregistration request")
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -548,12 +577,12 @@ func (h *HostAgentHandlers) HandleLink(w http.ResponseWriter, r *http.Request) {
return
}
- if err := h.monitor.LinkHostAgent(hostID, nodeID); err != nil {
+ if err := h.getMonitor(r.Context()).LinkHostAgent(hostID, nodeID); err != nil {
writeErrorResponse(w, http.StatusBadRequest, "link_failed", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -590,12 +619,12 @@ func (h *HostAgentHandlers) HandleUnlink(w http.ResponseWriter, r *http.Request)
return
}
- if err := h.monitor.UnlinkHostAgent(hostID); err != nil {
+ if err := h.getMonitor(r.Context()).UnlinkHostAgent(hostID); err != nil {
writeErrorResponse(w, http.StatusNotFound, "unlink_failed", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
diff --git a/internal/api/host_metadata.go b/internal/api/host_metadata.go
index 9e6fa41677..ce2f7a8515 100644
--- a/internal/api/host_metadata.go
+++ b/internal/api/host_metadata.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"net/http"
"net/url"
@@ -12,19 +13,30 @@ import (
// HostMetadataHandler handles host metadata operations
type HostMetadataHandler struct {
- store *config.HostMetadataStore
+ mtPersistence *config.MultiTenantPersistence
}
// NewHostMetadataHandler creates a new host metadata handler
-func NewHostMetadataHandler(dataPath string) *HostMetadataHandler {
+func NewHostMetadataHandler(mtPersistence *config.MultiTenantPersistence) *HostMetadataHandler {
return &HostMetadataHandler{
- store: config.NewHostMetadataStore(dataPath, nil),
+ mtPersistence: mtPersistence,
}
}
-// Store returns the underlying metadata store
+func (h *HostMetadataHandler) getStore(ctx context.Context) *config.HostMetadataStore {
+ orgID := "default"
+ if ctx != nil {
+ if id := GetOrgID(ctx); id != "" {
+ orgID = id
+ }
+ }
+ p, _ := h.mtPersistence.GetPersistence(orgID)
+ return p.GetHostMetadataStore()
+}
+
+// Store returns the underlying metadata store for default tenant
func (h *HostMetadataHandler) Store() *config.HostMetadataStore {
- return h.store
+ return h.getStore(context.Background())
}
// HandleGetMetadata retrieves metadata for a specific host or all hosts
@@ -40,7 +52,8 @@ func (h *HostMetadataHandler) HandleGetMetadata(w http.ResponseWriter, r *http.R
if path == "/api/hosts/metadata" || path == "/api/hosts/metadata/" {
// Get all metadata
w.Header().Set("Content-Type", "application/json")
- allMeta := h.store.GetAll()
+ store := h.getStore(r.Context())
+ allMeta := store.GetAll()
if allMeta == nil {
// Return empty object instead of null
json.NewEncoder(w).Encode(make(map[string]*config.HostMetadata))
@@ -57,7 +70,8 @@ func (h *HostMetadataHandler) HandleGetMetadata(w http.ResponseWriter, r *http.R
if hostID != "" {
// Get specific host metadata
- meta := h.store.Get(hostID)
+ store := h.getStore(r.Context())
+ meta := store.Get(hostID)
if meta == nil {
// Return empty metadata instead of 404
json.NewEncoder(w).Encode(&config.HostMetadata{ID: hostID})
@@ -119,8 +133,8 @@ func (h *HostMetadataHandler) HandleUpdateMetadata(w http.ResponseWriter, r *htt
return
}
}
-
- if err := h.store.Set(hostID, &meta); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.Set(hostID, &meta); err != nil {
log.Error().Err(err).Str("hostID", hostID).Msg("Failed to save host metadata")
// Provide more specific error message
errMsg := "Failed to save metadata"
@@ -151,8 +165,8 @@ func (h *HostMetadataHandler) HandleDeleteMetadata(w http.ResponseWriter, r *htt
http.Error(w, "Host ID required", http.StatusBadRequest)
return
}
-
- if err := h.store.Delete(hostID); err != nil {
+ store := h.getStore(r.Context())
+ if err := store.Delete(hostID); err != nil {
log.Error().Err(err).Str("hostID", hostID).Msg("Failed to delete host metadata")
http.Error(w, "Failed to delete metadata", http.StatusInternalServerError)
return
diff --git a/internal/api/kubernetes_agents.go b/internal/api/kubernetes_agents.go
index 44ab243e11..6f9c869e1e 100644
--- a/internal/api/kubernetes_agents.go
+++ b/internal/api/kubernetes_agents.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"net/http"
"strings"
@@ -15,18 +16,46 @@ import (
// KubernetesAgentHandlers manages ingest from the Kubernetes agent.
type KubernetesAgentHandlers struct {
- monitor *monitoring.Monitor
- wsHub *websocket.Hub
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyMonitor *monitoring.Monitor
+ wsHub *websocket.Hub
}
// NewKubernetesAgentHandlers constructs a new Kubernetes agent handler group.
-func NewKubernetesAgentHandlers(m *monitoring.Monitor, hub *websocket.Hub) *KubernetesAgentHandlers {
- return &KubernetesAgentHandlers{monitor: m, wsHub: hub}
+func NewKubernetesAgentHandlers(mtm *monitoring.MultiTenantMonitor, m *monitoring.Monitor, hub *websocket.Hub) *KubernetesAgentHandlers {
+ // If mtm is provided, try to populate legacyMonitor from "default" org if not provided
+ if m == nil && mtm != nil {
+ if mon, err := mtm.GetMonitor("default"); err == nil {
+ m = mon
+ }
+ }
+ return &KubernetesAgentHandlers{mtMonitor: mtm, legacyMonitor: m, wsHub: hub}
}
// SetMonitor updates the monitor reference for kubernetes agent handlers.
func (h *KubernetesAgentHandlers) SetMonitor(m *monitoring.Monitor) {
- h.monitor = m
+ h.legacyMonitor = m
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor reference
+func (h *KubernetesAgentHandlers) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = m
+ }
+ }
+}
+
+// getMonitor helper
+func (h *KubernetesAgentHandlers) getMonitor(ctx context.Context) *monitoring.Monitor {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return m
+ }
+ }
+ return h.legacyMonitor
}
// HandleReport accepts heartbeat payloads from the Kubernetes agent.
@@ -52,7 +81,7 @@ func (h *KubernetesAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Re
tokenRecord := getAPITokenRecordFromRequest(r)
- cluster, err := h.monitor.ApplyKubernetesReport(report, tokenRecord)
+ cluster, err := h.getMonitor(r.Context()).ApplyKubernetesReport(report, tokenRecord)
if err != nil {
writeErrorResponse(w, http.StatusBadRequest, "invalid_report", err.Error(), nil)
return
@@ -66,7 +95,7 @@ func (h *KubernetesAgentHandlers) HandleReport(w http.ResponseWriter, r *http.Re
Int("deployments", len(cluster.Deployments)).
Msg("Kubernetes agent report processed")
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -130,13 +159,13 @@ func (h *KubernetesAgentHandlers) HandleDeleteCluster(w http.ResponseWriter, r *
return
}
- cluster, err := h.monitor.RemoveKubernetesCluster(clusterID)
+ cluster, err := h.getMonitor(r.Context()).RemoveKubernetesCluster(clusterID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "kubernetes_cluster_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -162,7 +191,7 @@ func (h *KubernetesAgentHandlers) HandleAllowReenroll(w http.ResponseWriter, r *
return
}
- if err := h.monitor.AllowKubernetesClusterReenroll(clusterID); err != nil {
+ if err := h.getMonitor(r.Context()).AllowKubernetesClusterReenroll(clusterID); err != nil {
writeErrorResponse(w, http.StatusBadRequest, "kubernetes_cluster_reenroll_failed", err.Error(), nil)
return
}
@@ -190,13 +219,13 @@ func (h *KubernetesAgentHandlers) HandleUnhideCluster(w http.ResponseWriter, r *
return
}
- cluster, err := h.monitor.UnhideKubernetesCluster(clusterID)
+ cluster, err := h.getMonitor(r.Context()).UnhideKubernetesCluster(clusterID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "kubernetes_cluster_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -222,13 +251,13 @@ func (h *KubernetesAgentHandlers) HandleMarkPendingUninstall(w http.ResponseWrit
return
}
- cluster, err := h.monitor.MarkKubernetesClusterPendingUninstall(clusterID)
+ cluster, err := h.getMonitor(r.Context()).MarkKubernetesClusterPendingUninstall(clusterID)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "kubernetes_cluster_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
@@ -268,13 +297,13 @@ func (h *KubernetesAgentHandlers) HandleSetCustomDisplayName(w http.ResponseWrit
customName := strings.TrimSpace(req.DisplayName)
- cluster, err := h.monitor.SetKubernetesClusterCustomDisplayName(clusterID, customName)
+ cluster, err := h.getMonitor(r.Context()).SetKubernetesClusterCustomDisplayName(clusterID, customName)
if err != nil {
writeErrorResponse(w, http.StatusNotFound, "kubernetes_cluster_not_found", err.Error(), nil)
return
}
- go h.wsHub.BroadcastState(h.monitor.GetState().ToFrontend())
+ go h.wsHub.BroadcastState(h.getMonitor(r.Context()).GetState().ToFrontend())
if err := utils.WriteJSONResponse(w, map[string]any{
"success": true,
diff --git a/internal/api/middleware_tenant.go b/internal/api/middleware_tenant.go
new file mode 100644
index 0000000000..c08af90fce
--- /dev/null
+++ b/internal/api/middleware_tenant.go
@@ -0,0 +1,86 @@
+package api
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
+)
+
+type OrganizationContextKey string
+
+const (
+ OrgIDContextKey OrganizationContextKey = "org_id"
+ OrgContextKey OrganizationContextKey = "org_object"
+)
+
+// TenantMiddleware extracts the organization ID from the request and
+// sets up the context for multi-tenant isolation.
+type TenantMiddleware struct {
+ persistence *config.MultiTenantPersistence
+}
+
+func NewTenantMiddleware(p *config.MultiTenantPersistence) *TenantMiddleware {
+ return &TenantMiddleware{persistence: p}
+}
+
+func (m *TenantMiddleware) Middleware(next http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ // 1. Extract Org ID
+ // Priority:
+ // 1. Header: X-Pulse-Org-ID (for API clients/agents)
+ // 2. Cookie: pulse_org_id (for browser session)
+ // 3. Fallback: "default" (for backward compatibility)
+
+ orgID := r.Header.Get("X-Pulse-Org-ID")
+ if orgID == "" {
+ // Check cookie
+ if cookie, err := r.Cookie("pulse_org_id"); err == nil {
+ orgID = cookie.Value
+ }
+ }
+
+ // Fallback to default
+ if orgID == "" {
+ orgID = "default"
+ }
+
+ // 2. Validate/Load Organization
+ // In a real implementation, we would check if the user has access to this org.
+ // For Phase 1 (Persistence), we just ensure the org is valid in the persistence layer.
+
+ // Ensure the organization persistence is initialized
+ // This creates the directory if it doesn't exist for valid IDs
+ _, err := m.persistence.GetPersistence(orgID)
+ if err != nil {
+ http.Error(w, "Invalid Organization ID", http.StatusBadRequest)
+ return
+ }
+
+ // 3. Inject into Context
+ ctx := context.WithValue(r.Context(), OrgIDContextKey, orgID)
+
+ // Also store a mock organization object for now
+ org := &models.Organization{ID: orgID, DisplayName: orgID}
+ ctx = context.WithValue(ctx, OrgContextKey, org)
+
+ next.ServeHTTP(w, r.WithContext(ctx))
+ })
+}
+
+// Helper to get OrgID from context
+func GetOrgID(ctx context.Context) string {
+ if id, ok := ctx.Value(OrgIDContextKey).(string); ok {
+ return id
+ }
+ return "default"
+}
+
+// Helper to get Organization from context
+func GetOrganization(ctx context.Context) *models.Organization {
+ if org, ok := ctx.Value(OrgContextKey).(*models.Organization); ok {
+ return org
+ }
+ return &models.Organization{ID: "default", DisplayName: "Default Organization"}
+}
diff --git a/internal/api/middleware_tenant_test.go b/internal/api/middleware_tenant_test.go
new file mode 100644
index 0000000000..bc6367af3b
--- /dev/null
+++ b/internal/api/middleware_tenant_test.go
@@ -0,0 +1,80 @@
+package api
+
+import (
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestTenantMiddleware(t *testing.T) {
+ // Setup temporary directory for testing
+ tmpDir, err := os.MkdirTemp("", "pulse-tenant-test-*")
+ require.NoError(t, err)
+ defer os.RemoveAll(tmpDir)
+
+ // Create MultiTenantPersistence
+ mtp := config.NewMultiTenantPersistence(tmpDir)
+
+ // Create middleware
+ middleware := NewTenantMiddleware(mtp)
+
+ // Test handler that checks the context
+ testHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ orgID := GetOrgID(r.Context())
+ if orgID == "" {
+ w.WriteHeader(http.StatusInternalServerError)
+ w.Write([]byte("OrgID missing"))
+ return
+ }
+ w.WriteHeader(http.StatusOK)
+ w.Write([]byte("OrgID: " + orgID))
+ })
+
+ // Wrap handler
+ handler := middleware.Middleware(testHandler)
+
+ t.Run("Default Org (No Header)", func(t *testing.T) {
+ req := httptest.NewRequest("GET", "/", nil)
+ rec := httptest.NewRecorder()
+
+ handler.ServeHTTP(rec, req)
+
+ assert.Equal(t, http.StatusOK, rec.Code)
+ assert.Equal(t, "OrgID: default", rec.Body.String())
+
+ // Verify default directory was created
+ _, err := os.Stat(filepath.Join(tmpDir, "orgs", "default"))
+ assert.NoError(t, err)
+ })
+
+ t.Run("Custom Org (Header)", func(t *testing.T) {
+ req := httptest.NewRequest("GET", "/", nil)
+ req.Header.Set("X-Pulse-Org-ID", "customer-a")
+ rec := httptest.NewRecorder()
+
+ handler.ServeHTTP(rec, req)
+
+ assert.Equal(t, http.StatusOK, rec.Code)
+ assert.Equal(t, "OrgID: customer-a", rec.Body.String())
+
+ // Verify custom directory was created
+ _, err := os.Stat(filepath.Join(tmpDir, "orgs", "customer-a"))
+ assert.NoError(t, err)
+ })
+
+ t.Run("Invalid Org ID (Directory Traversal Attempt)", func(t *testing.T) {
+ req := httptest.NewRequest("GET", "/", nil)
+ req.Header.Set("X-Pulse-Org-ID", "../../../etc/passwd")
+ rec := httptest.NewRecorder()
+
+ handler.ServeHTTP(rec, req)
+
+ assert.Equal(t, http.StatusBadRequest, rec.Code)
+ })
+}
diff --git a/internal/api/notifications.go b/internal/api/notifications.go
index 31ae561dd5..23cc3faf75 100644
--- a/internal/api/notifications.go
+++ b/internal/api/notifications.go
@@ -1,6 +1,7 @@
package api
import (
+ "context"
"encoding/json"
"fmt"
"io"
@@ -9,6 +10,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/notifications"
"github.com/rcourtman/pulse-go-rewrite/internal/utils"
"github.com/rs/zerolog/log"
@@ -51,24 +53,52 @@ type NotificationMonitor interface {
// NotificationHandlers handles notification-related HTTP endpoints
type NotificationHandlers struct {
- monitor NotificationMonitor
+ mtMonitor *monitoring.MultiTenantMonitor
+ legacyMonitor NotificationMonitor
}
// NewNotificationHandlers creates new notification handlers
-func NewNotificationHandlers(monitor NotificationMonitor) *NotificationHandlers {
+func NewNotificationHandlers(mtm *monitoring.MultiTenantMonitor, monitor NotificationMonitor) *NotificationHandlers {
+ // If mtm is provided, try to populate legacyMonitor from "default" org if not provided
+ if monitor == nil && mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ monitor = NewNotificationMonitorWrapper(m)
+ }
+ }
return &NotificationHandlers{
- monitor: monitor,
+ mtMonitor: mtm,
+ legacyMonitor: monitor,
}
}
// SetMonitor updates the monitor reference for notification handlers.
func (h *NotificationHandlers) SetMonitor(m NotificationMonitor) {
- h.monitor = m
+ h.legacyMonitor = m
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor reference
+func (h *NotificationHandlers) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = NewNotificationMonitorWrapper(m)
+ }
+ }
+}
+
+func (h *NotificationHandlers) getMonitor(ctx context.Context) NotificationMonitor {
+ orgID := GetOrgID(ctx)
+ if h.mtMonitor != nil {
+ if m, err := h.mtMonitor.GetMonitor(orgID); err == nil && m != nil {
+ return NewNotificationMonitorWrapper(m)
+ }
+ }
+ return h.legacyMonitor
}
// GetEmailConfig returns the current email configuration
func (h *NotificationHandlers) GetEmailConfig(w http.ResponseWriter, r *http.Request) {
- config := h.monitor.GetNotificationManager().GetEmailConfig()
+ config := h.getMonitor(r.Context()).GetNotificationManager().GetEmailConfig()
// For security, don't return the password
config.Password = ""
@@ -102,7 +132,7 @@ func (h *NotificationHandlers) UpdateEmailConfig(w http.ResponseWriter, r *http.
// If password is empty, preserve the existing password
if config.Password == "" {
- existingConfig := h.monitor.GetNotificationManager().GetEmailConfig()
+ existingConfig := h.getMonitor(r.Context()).GetNotificationManager().GetEmailConfig()
config.Password = existingConfig.Password
}
@@ -114,10 +144,10 @@ func (h *NotificationHandlers) UpdateEmailConfig(w http.ResponseWriter, r *http.
Bool("hasPassword", config.Password != "").
Msg("Parsed email config")
- h.monitor.GetNotificationManager().SetEmailConfig(config)
+ h.getMonitor(r.Context()).GetNotificationManager().SetEmailConfig(config)
// Save to persistent storage
- if err := h.monitor.GetConfigPersistence().SaveEmailConfig(config); err != nil {
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveEmailConfig(config); err != nil {
// Log error but don't fail the request
log.Error().Err(err).Msg("Failed to save email configuration")
}
@@ -128,7 +158,7 @@ func (h *NotificationHandlers) UpdateEmailConfig(w http.ResponseWriter, r *http.
// GetAppriseConfig returns the current Apprise configuration.
func (h *NotificationHandlers) GetAppriseConfig(w http.ResponseWriter, r *http.Request) {
- config := h.monitor.GetNotificationManager().GetAppriseConfig()
+ config := h.getMonitor(r.Context()).GetNotificationManager().GetAppriseConfig()
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(config); err != nil {
@@ -166,13 +196,13 @@ func (h *NotificationHandlers) UpdateAppriseConfig(w http.ResponseWriter, r *htt
Int("timeoutSeconds", config.TimeoutSeconds).
Msg("Parsed Apprise configuration update")
- h.monitor.GetNotificationManager().SetAppriseConfig(config)
+ h.getMonitor(r.Context()).GetNotificationManager().SetAppriseConfig(config)
- if err := h.monitor.GetConfigPersistence().SaveAppriseConfig(config); err != nil {
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveAppriseConfig(config); err != nil {
log.Error().Err(err).Msg("Failed to save Apprise configuration")
}
- normalized := h.monitor.GetNotificationManager().GetAppriseConfig()
+ normalized := h.getMonitor(r.Context()).GetNotificationManager().GetAppriseConfig()
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(normalized); err != nil {
@@ -182,7 +212,7 @@ func (h *NotificationHandlers) UpdateAppriseConfig(w http.ResponseWriter, r *htt
// GetWebhooks returns all webhook configurations with secrets masked
func (h *NotificationHandlers) GetWebhooks(w http.ResponseWriter, r *http.Request) {
- webhooks := h.monitor.GetNotificationManager().GetWebhooks()
+ webhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
// Mask sensitive fields in headers and customFields
maskedWebhooks := make([]map[string]interface{}, len(webhooks))
@@ -245,7 +275,7 @@ func (h *NotificationHandlers) CreateWebhook(w http.ResponseWriter, r *http.Requ
}
// Validate webhook URL
- if err := h.monitor.GetNotificationManager().ValidateWebhookURL(webhook.URL); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().ValidateWebhookURL(webhook.URL); err != nil {
http.Error(w, fmt.Sprintf("Invalid webhook URL: %v", err), http.StatusBadRequest)
return
}
@@ -255,11 +285,11 @@ func (h *NotificationHandlers) CreateWebhook(w http.ResponseWriter, r *http.Requ
webhook.ID = utils.GenerateID("webhook")
}
- h.monitor.GetNotificationManager().AddWebhook(webhook)
+ h.getMonitor(r.Context()).GetNotificationManager().AddWebhook(webhook)
// Save webhooks to persistent storage with all fields
- webhooks := h.monitor.GetNotificationManager().GetWebhooks()
- if err := h.monitor.GetConfigPersistence().SaveWebhooks(webhooks); err != nil {
+ webhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveWebhooks(webhooks); err != nil {
log.Error().Err(err).Msg("Failed to save webhooks")
}
@@ -306,7 +336,7 @@ func (h *NotificationHandlers) UpdateWebhook(w http.ResponseWriter, r *http.Requ
// Preserve original headers/customFields if the incoming values are redacted
// This happens when the frontend sends back masked values from GetWebhooks
- existingWebhooks := h.monitor.GetNotificationManager().GetWebhooks()
+ existingWebhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
for _, existing := range existingWebhooks {
if existing.ID == webhookID {
// Preserve headers if incoming contains redacted values
@@ -340,20 +370,20 @@ func (h *NotificationHandlers) UpdateWebhook(w http.ResponseWriter, r *http.Requ
}
// Validate webhook URL
- if err := h.monitor.GetNotificationManager().ValidateWebhookURL(webhook.URL); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().ValidateWebhookURL(webhook.URL); err != nil {
http.Error(w, fmt.Sprintf("Invalid webhook URL: %v", err), http.StatusBadRequest)
return
}
webhook.ID = webhookID
- if err := h.monitor.GetNotificationManager().UpdateWebhook(webhookID, webhook); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().UpdateWebhook(webhookID, webhook); err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
// Save webhooks to persistent storage
- webhooks := h.monitor.GetNotificationManager().GetWebhooks()
- if err := h.monitor.GetConfigPersistence().SaveWebhooks(webhooks); err != nil {
+ webhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveWebhooks(webhooks); err != nil {
log.Error().Err(err).Msg("Failed to save webhooks")
}
@@ -382,14 +412,14 @@ func (h *NotificationHandlers) DeleteWebhook(w http.ResponseWriter, r *http.Requ
return
}
- if err := h.monitor.GetNotificationManager().DeleteWebhook(webhookID); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().DeleteWebhook(webhookID); err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
// Save webhooks to persistent storage
- webhooks := h.monitor.GetNotificationManager().GetWebhooks()
- if err := h.monitor.GetConfigPersistence().SaveWebhooks(webhooks); err != nil {
+ webhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
+ if err := h.getMonitor(r.Context()).GetConfigPersistence().SaveWebhooks(webhooks); err != nil {
log.Error().Err(err).Msg("Failed to save webhooks")
}
@@ -429,7 +459,7 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
}
// Get actual node info from monitor state
- state := h.monitor.GetState()
+ state := h.getMonitor(r.Context()).GetState()
var nodeInfo *notifications.TestNodeInfo
// Use first available node and instance
@@ -450,7 +480,7 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
Msg("Testing specific webhook")
// Get the webhook by ID and test it
- webhooks := h.monitor.GetNotificationManager().GetWebhooks()
+ webhooks := h.getMonitor(r.Context()).GetNotificationManager().GetWebhooks()
var foundWebhook *notifications.WebhookConfig
for _, wh := range webhooks {
if wh.ID == req.WebhookID {
@@ -465,7 +495,7 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
}
// Send test webhook
- if err := h.monitor.GetNotificationManager().SendTestWebhook(*foundWebhook); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().SendTestWebhook(*foundWebhook); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
@@ -478,7 +508,7 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
// If password is empty, use the saved password
if emailConfig.Password == "" {
- savedConfig := h.monitor.GetNotificationManager().GetEmailConfig()
+ savedConfig := h.getMonitor(r.Context()).GetNotificationManager().GetEmailConfig()
emailConfig.Password = savedConfig.Password
}
@@ -491,7 +521,7 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
Bool("hasPassword", emailConfig.Password != "").
Msg("Testing email with provided config")
- if err := h.monitor.GetNotificationManager().SendTestNotificationWithConfig(req.Method, &emailConfig, nodeInfo); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().SendTestNotificationWithConfig(req.Method, &emailConfig, nodeInfo); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
@@ -502,13 +532,13 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
return
}
- if err := h.monitor.GetNotificationManager().SendTestAppriseWithConfig(appriseConfig); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().SendTestAppriseWithConfig(appriseConfig); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
} else {
// Use saved config
- if err := h.monitor.GetNotificationManager().SendTestNotification(req.Method); err != nil {
+ if err := h.getMonitor(r.Context()).GetNotificationManager().SendTestNotification(req.Method); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
@@ -528,7 +558,7 @@ func (h *NotificationHandlers) GetWebhookTemplates(w http.ResponseWriter, r *htt
// GetWebhookHistory returns recent webhook delivery history with URLs redacted
func (h *NotificationHandlers) GetWebhookHistory(w http.ResponseWriter, r *http.Request) {
- history := h.monitor.GetNotificationManager().GetWebhookHistory()
+ history := h.getMonitor(r.Context()).GetNotificationManager().GetWebhookHistory()
// Redact secrets from URLs in history
for i := range history {
@@ -705,7 +735,7 @@ func (h *NotificationHandlers) TestWebhook(w http.ResponseWriter, r *http.Reques
}
// Test the webhook
- status, response, err := h.monitor.GetNotificationManager().TestEnhancedWebhook(webhook)
+ status, response, err := h.getMonitor(r.Context()).GetNotificationManager().TestEnhancedWebhook(webhook)
result := map[string]interface{}{
"status": status,
@@ -732,7 +762,7 @@ func (h *NotificationHandlers) TestWebhook(w http.ResponseWriter, r *http.Reques
func (h *NotificationHandlers) GetNotificationHealth(w http.ResponseWriter, r *http.Request) {
// Get queue stats
queueStats := make(map[string]interface{})
- stats, err := h.monitor.GetNotificationManager().GetQueueStats()
+ stats, err := h.getMonitor(r.Context()).GetNotificationManager().GetQueueStats()
if err != nil {
log.Warn().Err(err).Msg("Failed to get queue stats for health check")
queueStats["error"] = err.Error()
@@ -749,7 +779,7 @@ func (h *NotificationHandlers) GetNotificationHealth(w http.ResponseWriter, r *h
}
// Get config status
- nm := h.monitor.GetNotificationManager()
+ nm := h.getMonitor(r.Context()).GetNotificationManager()
emailCfg := nm.GetEmailConfig()
webhooks := nm.GetWebhooks()
@@ -764,7 +794,7 @@ func (h *NotificationHandlers) GetNotificationHealth(w http.ResponseWriter, r *h
"enabled": countEnabledWebhooks(webhooks),
},
"encryption": map[string]interface{}{
- "enabled": h.monitor.GetConfigPersistence().IsEncryptionEnabled(),
+ "enabled": h.getMonitor(r.Context()).GetConfigPersistence().IsEncryptionEnabled(),
},
"overall_healthy": queueStats["healthy"] == true,
}
diff --git a/internal/api/profile_suggestions.go b/internal/api/profile_suggestions.go
index 809b0db210..e30eceb01e 100644
--- a/internal/api/profile_suggestions.go
+++ b/internal/api/profile_suggestions.go
@@ -49,7 +49,7 @@ func (h *ProfileSuggestionHandler) HandleSuggestProfile(w http.ResponseWriter, r
}
// Check if AI is running
- if h.aiHandler == nil || !h.aiHandler.IsRunning() {
+ if h.aiHandler == nil || !h.aiHandler.IsRunning(r.Context()) {
http.Error(w, "AI service is not available", http.StatusServiceUnavailable)
return
}
@@ -115,7 +115,7 @@ Only include settings that are relevant to the user's request. Do not include se
ctx, cancel := context.WithTimeout(r.Context(), 120*time.Second)
defer cancel()
- response, err := h.aiHandler.GetService().Execute(ctx, chat.ExecuteRequest{
+ response, err := h.aiHandler.GetService(ctx).Execute(ctx, chat.ExecuteRequest{
Prompt: fullPrompt,
})
if err != nil {
diff --git a/internal/api/router.go b/internal/api/router.go
index d3d7ca5732..0bd49bf5cb 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -46,7 +46,8 @@ import (
type Router struct {
mux *http.ServeMux
config *config.Config
- monitor *monitoring.Monitor
+ monitor *monitoring.Monitor // Legacy/Default support
+ mtMonitor *monitoring.MultiTenantMonitor // Multi-tenant manager
alertHandlers *AlertHandlers
configHandlers *ConfigHandlers
notificationHandlers *NotificationHandlers
@@ -69,6 +70,7 @@ type Router struct {
exportLimiter *RateLimiter
downloadLimiter *RateLimiter
persistence *config.ConfigPersistence
+ multiTenant *config.MultiTenantPersistence
oidcMu sync.Mutex
oidcService *OIDCService
samlManager *SAMLServiceManager
@@ -117,7 +119,7 @@ func isDirectLoopbackRequest(req *http.Request) bool {
}
// NewRouter creates a new router instance
-func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, wsHub *websocket.Hub, reloadFunc func() error, serverVersion string) *Router {
+func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, mtMonitor *monitoring.MultiTenantMonitor, wsHub *websocket.Hub, reloadFunc func() error, serverVersion string) *Router {
// Initialize persistent session and CSRF stores
InitSessionStore(cfg.DataPath)
InitCSRFStore(cfg.DataPath)
@@ -139,6 +141,7 @@ func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, wsHub *websocket
mux: http.NewServeMux(),
config: cfg,
monitor: monitor,
+ mtMonitor: mtMonitor,
wsHub: wsHub,
reloadFunc: reloadFunc,
updateManager: updateManager,
@@ -146,6 +149,7 @@ func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, wsHub *websocket
exportLimiter: NewRateLimiter(5, 1*time.Minute), // 5 attempts per minute
downloadLimiter: NewRateLimiter(60, 1*time.Minute), // downloads/installers per minute per IP
persistence: config.NewConfigPersistence(cfg.DataPath),
+ multiTenant: config.NewMultiTenantPersistence(cfg.DataPath),
authorizer: auth.GetAuthorizer(),
serverVersion: strings.TrimSpace(serverVersion),
projectRoot: projectRoot,
@@ -189,6 +193,7 @@ func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, wsHub *websocket
handler := SecurityHeadersWithConfig(r, allowEmbedding, allowedOrigins)
handler = ErrorHandler(handler)
handler = DemoModeMiddleware(cfg, handler)
+ handler = NewTenantMiddleware(r.multiTenant).Middleware(handler)
handler = UniversalRateLimitMiddleware(handler)
r.wrapped = handler
return r
@@ -197,17 +202,20 @@ func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, wsHub *websocket
// setupRoutes configures all routes
func (r *Router) setupRoutes() {
// Create handlers
- r.alertHandlers = NewAlertHandlers(NewAlertMonitorWrapper(r.monitor), r.wsHub)
- r.notificationHandlers = NewNotificationHandlers(NewNotificationMonitorWrapper(r.monitor))
+ r.alertHandlers = NewAlertHandlers(r.mtMonitor, NewAlertMonitorWrapper(r.monitor), r.wsHub)
+ r.notificationHandlers = NewNotificationHandlers(r.mtMonitor, NewNotificationMonitorWrapper(r.monitor))
r.notificationQueueHandlers = NewNotificationQueueHandlers(r.monitor)
- guestMetadataHandler := NewGuestMetadataHandler(r.config.DataPath)
- dockerMetadataHandler := NewDockerMetadataHandler(r.config.DataPath)
- hostMetadataHandler := NewHostMetadataHandler(r.config.DataPath)
- r.configHandlers = NewConfigHandlers(r.config, r.monitor, r.reloadFunc, r.wsHub, guestMetadataHandler, r.reloadSystemSettings)
+ guestMetadataHandler := NewGuestMetadataHandler(r.multiTenant)
+ dockerMetadataHandler := NewDockerMetadataHandler(r.multiTenant)
+ hostMetadataHandler := NewHostMetadataHandler(r.multiTenant)
+ r.configHandlers = NewConfigHandlers(r.multiTenant, r.mtMonitor, r.reloadFunc, r.wsHub, guestMetadataHandler, r.reloadSystemSettings)
+ if r.monitor != nil {
+ r.configHandlers.SetMonitor(r.monitor)
+ }
updateHandlers := NewUpdateHandlers(r.updateManager, r.updateHistory)
- r.dockerAgentHandlers = NewDockerAgentHandlers(r.monitor, r.wsHub, r.config)
- r.kubernetesAgentHandlers = NewKubernetesAgentHandlers(r.monitor, r.wsHub)
- r.hostAgentHandlers = NewHostAgentHandlers(r.monitor, r.wsHub)
+ r.dockerAgentHandlers = NewDockerAgentHandlers(r.mtMonitor, r.monitor, r.wsHub, r.config)
+ r.kubernetesAgentHandlers = NewKubernetesAgentHandlers(r.mtMonitor, r.monitor, r.wsHub)
+ r.hostAgentHandlers = NewHostAgentHandlers(r.mtMonitor, r.monitor, r.wsHub)
r.resourceHandlers = NewResourceHandlers()
r.configProfileHandler = NewConfigProfileHandler(r.persistence)
r.licenseHandlers = NewLicenseHandlers(r.config.DataPath)
@@ -413,9 +421,9 @@ func (r *Router) setupRoutes() {
r.mux.HandleFunc("/api/config/nodes", func(w http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodGet:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsRead, r.configHandlers.HandleGetNodes))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, r.configHandlers.HandleGetNodes))(w, req)
case http.MethodPost:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleAddNode))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleAddNode))(w, req)
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
@@ -425,7 +433,7 @@ func (r *Router) setupRoutes() {
// Test node configuration endpoint (for new nodes)
r.mux.HandleFunc("/api/config/nodes/test-config", func(w http.ResponseWriter, req *http.Request) {
if req.Method == http.MethodPost {
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleTestNodeConfig))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleTestNodeConfig))(w, req)
} else {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
@@ -434,7 +442,7 @@ func (r *Router) setupRoutes() {
// Test connection endpoint
r.mux.HandleFunc("/api/config/nodes/test-connection", func(w http.ResponseWriter, req *http.Request) {
if req.Method == http.MethodPost {
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleTestConnection))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleTestConnection))(w, req)
} else {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
@@ -442,15 +450,15 @@ func (r *Router) setupRoutes() {
r.mux.HandleFunc("/api/config/nodes/", func(w http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodPut:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleUpdateNode))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleUpdateNode))(w, req)
case http.MethodDelete:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleDeleteNode))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleDeleteNode))(w, req)
case http.MethodPost:
// Handle test endpoint and refresh-cluster endpoint
if strings.HasSuffix(req.URL.Path, "/test") {
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleTestNode))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleTestNode))(w, req)
} else if strings.HasSuffix(req.URL.Path, "/refresh-cluster") {
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleRefreshClusterNodes))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleRefreshClusterNodes))(w, req)
} else {
http.Error(w, "Not found", http.StatusNotFound)
}
@@ -469,7 +477,7 @@ func (r *Router) setupRoutes() {
r.mux.HandleFunc("/api/config/system", func(w http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodGet:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsRead, r.configHandlers.HandleGetSystemSettings))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, r.configHandlers.HandleGetSystemSettings))(w, req)
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
@@ -479,9 +487,9 @@ func (r *Router) setupRoutes() {
r.mux.HandleFunc("/api/system/mock-mode", func(w http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodGet:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsRead, r.configHandlers.HandleGetMockMode))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, r.configHandlers.HandleGetMockMode))(w, req)
case http.MethodPost, http.MethodPut:
- RequireAdmin(r.configHandlers.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleUpdateMockMode))(w, req)
+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.configHandlers.HandleUpdateMockMode))(w, req)
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
@@ -1181,7 +1189,7 @@ func (r *Router) setupRoutes() {
}))
// System settings and API token management
- r.systemSettingsHandler = NewSystemSettingsHandler(r.config, r.persistence, r.wsHub, r.monitor, r.reloadSystemSettings, r.reloadFunc)
+ r.systemSettingsHandler = NewSystemSettingsHandler(r.config, r.persistence, r.wsHub, r.mtMonitor, r.monitor, r.reloadSystemSettings, r.reloadFunc)
r.mux.HandleFunc("/api/system/settings", RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, r.systemSettingsHandler.HandleGetSystemSettings)))
r.mux.HandleFunc("/api/system/settings/update", RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.systemSettingsHandler.HandleUpdateSystemSettings)))
r.mux.HandleFunc("/api/system/ssh-config", r.handleSSHConfig)
@@ -1206,7 +1214,7 @@ func (r *Router) setupRoutes() {
})
// AI settings endpoints
- r.aiSettingsHandler = NewAISettingsHandler(r.config, r.persistence, r.agentExecServer)
+ r.aiSettingsHandler = NewAISettingsHandler(r.multiTenant, r.mtMonitor, r.agentExecServer)
// Inject state provider so AI has access to full infrastructure context (VMs, containers, IPs)
if r.monitor != nil {
r.aiSettingsHandler.SetStateProvider(r.monitor)
@@ -1232,7 +1240,7 @@ func (r *Router) setupRoutes() {
r.aiSettingsHandler.SetMetadataProvider(metadataProvider)
// AI chat handler
- r.aiHandler = NewAIHandler(r.config, r.persistence, r.agentExecServer)
+ r.aiHandler = NewAIHandler(r.multiTenant, r.mtMonitor, r.agentExecServer)
// Wire license checker for Pro feature gating (AI Patrol, Alert Analysis, Auto-Fix)
r.aiSettingsHandler.SetLicenseChecker(r.licenseHandlers.Service())
// Wire model change callback to restart AI chat service when model is changed
@@ -1242,8 +1250,9 @@ func (r *Router) setupRoutes() {
// Wire control settings change callback to update MCP tool visibility
r.aiSettingsHandler.SetOnControlSettingsChange(func() {
if r.aiHandler != nil {
- if svc := r.aiHandler.GetService(); svc != nil {
- cfg := r.aiHandler.GetAIConfig()
+ ctx := context.Background()
+ if svc := r.aiHandler.GetService(ctx); svc != nil {
+ cfg := r.aiHandler.GetAIConfig(ctx)
if cfg != nil {
svc.UpdateControlSettings(cfg)
log.Info().Str("control_level", cfg.GetControlLevel()).Msg("Updated AI control settings")
@@ -1777,7 +1786,7 @@ func (r *Router) StartPatrol(ctx context.Context) {
// Only initialize baseline learning if AI is enabled
// This prevents anomaly data from being collected and displayed when AI is disabled
- if r.aiSettingsHandler.IsAIEnabled() {
+ if r.aiSettingsHandler.IsAIEnabled(context.Background()) {
// Initialize baseline store for anomaly detection
// Uses config dir for persistence
baselineCfg := ai.DefaultBaselineConfig()
@@ -1819,7 +1828,7 @@ func (r *Router) StartPatrol(ctx context.Context) {
// Only initialize pattern and correlation detectors if AI is enabled
// This prevents these subsystems from collecting data and displaying findings when AI is disabled
- if r.aiSettingsHandler.IsAIEnabled() {
+ if r.aiSettingsHandler.IsAIEnabled(context.Background()) {
// Initialize pattern detector for failure prediction
patternDetector := ai.NewPatternDetector(ai.PatternDetectorConfig{
MaxEvents: 5000,
@@ -1912,9 +1921,9 @@ func (r *Router) StartAIChat(ctx context.Context) {
r.wireAIChatProviders()
// Wire up AI patrol if AI is running
- aiCfg := r.aiHandler.GetAIConfig()
- if aiCfg != nil && r.aiHandler.IsRunning() {
- service := r.aiHandler.GetService()
+ aiCfg := r.aiHandler.GetAIConfig(context.Background())
+ if aiCfg != nil && r.aiHandler.IsRunning(context.Background()) {
+ service := r.aiHandler.GetService(context.Background())
if service != nil {
// Create patrol service - need concrete type for patrol
chatService, ok := service.(*chat.Service)
@@ -1925,7 +1934,7 @@ func (r *Router) StartAIChat(ctx context.Context) {
// Wire to existing patrol service
if r.aiSettingsHandler != nil {
- if patrolSvc := r.aiSettingsHandler.GetAIService().GetPatrolService(); patrolSvc != nil {
+ if patrolSvc := r.aiSettingsHandler.GetAIService(context.Background()).GetPatrolService(); patrolSvc != nil {
patrolSvc.SetChatPatrol(aiPatrol, true)
log.Info().Msg("AI patrol integration enabled")
}
@@ -1936,11 +1945,11 @@ func (r *Router) StartAIChat(ctx context.Context) {
// wireAIChatProviders wires up all MCP tool providers for AI chat
func (r *Router) wireAIChatProviders() {
- if r.aiHandler == nil || !r.aiHandler.IsRunning() {
+ if r.aiHandler == nil || !r.aiHandler.IsRunning(context.Background()) {
return
}
- service := r.aiHandler.GetService()
+ service := r.aiHandler.GetService(context.Background())
if service == nil {
return
}
@@ -1958,7 +1967,7 @@ func (r *Router) wireAIChatProviders() {
// Wire findings provider from patrol service
if r.aiSettingsHandler != nil {
- if patrolSvc := r.aiSettingsHandler.GetAIService().GetPatrolService(); patrolSvc != nil {
+ if patrolSvc := r.aiSettingsHandler.GetAIService(context.Background()).GetPatrolService(); patrolSvc != nil {
if findingsStore := patrolSvc.GetFindings(); findingsStore != nil {
findingsAdapter := ai.NewFindingsMCPAdapter(findingsStore)
if findingsAdapter != nil {
@@ -2027,7 +2036,7 @@ func (r *Router) wireAIChatProviders() {
// Wire baseline provider
if r.aiSettingsHandler != nil {
- if patrolSvc := r.aiSettingsHandler.GetAIService().GetPatrolService(); patrolSvc != nil {
+ if patrolSvc := r.aiSettingsHandler.GetAIService(context.Background()).GetPatrolService(); patrolSvc != nil {
if baselineStore := patrolSvc.GetBaselineStore(); baselineStore != nil {
baselineAdapter := tools.NewBaselineMCPAdapter(&baselineSourceWrapper{store: baselineStore})
if baselineAdapter != nil {
@@ -2040,7 +2049,7 @@ func (r *Router) wireAIChatProviders() {
// Wire pattern provider
if r.aiSettingsHandler != nil {
- if patrolSvc := r.aiSettingsHandler.GetAIService().GetPatrolService(); patrolSvc != nil {
+ if patrolSvc := r.aiSettingsHandler.GetAIService(context.Background()).GetPatrolService(); patrolSvc != nil {
if patternDetector := patrolSvc.GetPatternDetector(); patternDetector != nil {
patternAdapter := tools.NewPatternMCPAdapter(
&patternSourceWrapper{detector: patternDetector},
@@ -2056,7 +2065,7 @@ func (r *Router) wireAIChatProviders() {
// Wire findings manager
if r.aiSettingsHandler != nil {
- if patrolSvc := r.aiSettingsHandler.GetAIService().GetPatrolService(); patrolSvc != nil {
+ if patrolSvc := r.aiSettingsHandler.GetAIService(context.Background()).GetPatrolService(); patrolSvc != nil {
findingsManagerAdapter := tools.NewFindingsManagerMCPAdapter(patrolSvc)
if findingsManagerAdapter != nil {
service.SetFindingsManager(findingsManagerAdapter)
@@ -2067,7 +2076,7 @@ func (r *Router) wireAIChatProviders() {
// Wire metadata updater
if r.aiSettingsHandler != nil {
- metadataAdapter := tools.NewMetadataUpdaterMCPAdapter(r.aiSettingsHandler.GetAIService())
+ metadataAdapter := tools.NewMetadataUpdaterMCPAdapter(r.aiSettingsHandler.GetAIService(context.Background()))
if metadataAdapter != nil {
service.SetMetadataUpdater(metadataAdapter)
log.Debug().Msg("AI chat: Metadata updater wired")
@@ -2360,7 +2369,7 @@ func (r *Router) learnBaselines(store *ai.BaselineStore, metricsHistory *monitor
// This enables AI to analyze specific resources when alerts fire, providing token-efficient real-time insights
func (r *Router) GetAlertTriggeredAnalyzer() *ai.AlertTriggeredAnalyzer {
if r.aiSettingsHandler != nil {
- return r.aiSettingsHandler.GetAlertTriggeredAnalyzer()
+ return r.aiSettingsHandler.GetAlertTriggeredAnalyzer(context.Background())
}
return nil
}
@@ -3839,6 +3848,8 @@ func (r *Router) handleCharts(w http.ResponseWriter, req *http.Request) {
duration = time.Hour
case "4h":
duration = 4 * time.Hour
+ case "8h":
+ duration = 8 * time.Hour
case "12h":
duration = 12 * time.Hour
case "24h":
diff --git a/internal/api/router_helpers.go b/internal/api/router_helpers.go
new file mode 100644
index 0000000000..5ba70194be
--- /dev/null
+++ b/internal/api/router_helpers.go
@@ -0,0 +1,52 @@
+package api
+
+import (
+ "net/http"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
+)
+
+// getMonitor returns the tenant-specific monitor instance for the request.
+// It uses the OrgID from the context (injected by TenantMiddleware).
+// If no tenant monitor is found, or if not in multi-tenant mode, it returns the default monitor.
+func (r *Router) getMonitor(req *http.Request) (*monitoring.Monitor, error) {
+ if r.mtMonitor == nil {
+ return r.monitor, nil
+ }
+
+ orgID := GetOrgID(req.Context())
+ if orgID == "" {
+ return r.monitor, nil
+ }
+
+ return r.mtMonitor.GetMonitor(orgID)
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor manager.
+// Used during reload.
+func (r *Router) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ r.mtMonitor = mtm
+ if r.alertHandlers != nil {
+ r.alertHandlers.SetMultiTenantMonitor(mtm)
+ }
+ if r.notificationHandlers != nil {
+ r.notificationHandlers.SetMultiTenantMonitor(mtm)
+ }
+ if r.dockerAgentHandlers != nil {
+ r.dockerAgentHandlers.SetMultiTenantMonitor(mtm)
+ }
+ if r.hostAgentHandlers != nil {
+ r.hostAgentHandlers.SetMultiTenantMonitor(mtm)
+ }
+ if r.kubernetesAgentHandlers != nil {
+ r.kubernetesAgentHandlers.SetMultiTenantMonitor(mtm)
+ }
+ if r.systemSettingsHandler != nil {
+ r.systemSettingsHandler.SetMultiTenantMonitor(mtm)
+ }
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ r.monitor = m
+ }
+ }
+}
diff --git a/internal/api/system_settings.go b/internal/api/system_settings.go
index 8bbb6d56f2..e4aadc6d5a 100644
--- a/internal/api/system_settings.go
+++ b/internal/api/system_settings.go
@@ -16,12 +16,23 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/discovery"
+ "github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/notifications"
"github.com/rcourtman/pulse-go-rewrite/internal/utils"
"github.com/rcourtman/pulse-go-rewrite/internal/websocket"
"github.com/rs/zerolog/log"
)
+// SystemSettingsMonitor defines the monitor interface needed by system settings
+type SystemSettingsMonitor interface {
+ GetDiscoveryService() *discovery.Service
+ StartDiscoveryService(ctx context.Context, wsHub *websocket.Hub, subnet string)
+ StopDiscoveryService()
+ EnableTemperatureMonitoring()
+ DisableTemperatureMonitoring()
+ GetNotificationManager() *notifications.NotificationManager
+}
+
// SystemSettingsHandler handles system settings
type SystemSettingsHandler struct {
config *config.Config
@@ -29,45 +40,63 @@ type SystemSettingsHandler struct {
wsHub *websocket.Hub
reloadSystemSettingsFunc func() // Function to reload cached system settings
reloadMonitorFunc func() error
- monitor interface {
- GetDiscoveryService() *discovery.Service
- StartDiscoveryService(ctx context.Context, wsHub *websocket.Hub, subnet string)
- StopDiscoveryService()
- EnableTemperatureMonitoring()
- DisableTemperatureMonitoring()
- GetNotificationManager() *notifications.NotificationManager
+ mtMonitor interface {
+ GetMonitor(string) (*monitoring.Monitor, error)
}
+ legacyMonitor SystemSettingsMonitor
}
// NewSystemSettingsHandler creates a new system settings handler
-func NewSystemSettingsHandler(cfg *config.Config, persistence *config.ConfigPersistence, wsHub *websocket.Hub, monitor interface {
- GetDiscoveryService() *discovery.Service
- StartDiscoveryService(ctx context.Context, wsHub *websocket.Hub, subnet string)
- StopDiscoveryService()
- EnableTemperatureMonitoring()
- DisableTemperatureMonitoring()
- GetNotificationManager() *notifications.NotificationManager
-}, reloadSystemSettingsFunc func(), reloadMonitorFunc func() error) *SystemSettingsHandler {
+func NewSystemSettingsHandler(cfg *config.Config, persistence *config.ConfigPersistence, wsHub *websocket.Hub, mtm *monitoring.MultiTenantMonitor, monitor SystemSettingsMonitor, reloadSystemSettingsFunc func(), reloadMonitorFunc func() error) *SystemSettingsHandler {
+ // If mtm is provided, try to populate legacyMonitor from "default" org if not provided
+ if monitor == nil && mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ monitor = m
+ }
+ }
return &SystemSettingsHandler{
config: cfg,
persistence: persistence,
wsHub: wsHub,
- monitor: monitor,
+ mtMonitor: mtm,
+ legacyMonitor: monitor,
reloadSystemSettingsFunc: reloadSystemSettingsFunc,
reloadMonitorFunc: reloadMonitorFunc,
}
}
// SetMonitor updates the monitor reference used by the handler at runtime.
-func (h *SystemSettingsHandler) SetMonitor(m interface {
- GetDiscoveryService() *discovery.Service
- StartDiscoveryService(ctx context.Context, wsHub *websocket.Hub, subnet string)
- StopDiscoveryService()
- EnableTemperatureMonitoring()
- DisableTemperatureMonitoring()
- GetNotificationManager() *notifications.NotificationManager
-}) {
- h.monitor = m
+func (h *SystemSettingsHandler) SetMonitor(m SystemSettingsMonitor) {
+ h.legacyMonitor = m
+}
+
+// SetMultiTenantMonitor updates the multi-tenant monitor reference
+func (h *SystemSettingsHandler) SetMultiTenantMonitor(mtm *monitoring.MultiTenantMonitor) {
+ h.mtMonitor = mtm
+ if mtm != nil {
+ if m, err := mtm.GetMonitor("default"); err == nil {
+ h.legacyMonitor = m
+ }
+ }
+}
+
+func (h *SystemSettingsHandler) getMonitor(ctx context.Context) SystemSettingsMonitor {
+ // Note: SystemSettingsMonitor interface methods (GetDiscoveryService etc.)
+ // must be implemented by *monitoring.Monitor directly.
+ // Since decoupling *monitoring.Monitor from specific interfaces involves casting or wrappers,
+ // we assume here that *monitoring.Monitor satisfies SystemSettingsMonitor.
+
+ if h.mtMonitor != nil {
+ // Use GetOrgID helper from current package or context
+ // Assuming we can access GetOrgID from api package context helpers
+ orgID := GetOrgID(ctx)
+ if mtm, ok := h.mtMonitor.(*monitoring.MultiTenantMonitor); ok {
+ if m, err := mtm.GetMonitor(orgID); err == nil && m != nil {
+ return m
+ }
+ }
+ }
+ return h.legacyMonitor
}
// SetConfig updates the configuration reference used by the handler.
@@ -680,44 +709,44 @@ func (h *SystemSettingsHandler) HandleUpdateSystemSettings(w http.ResponseWriter
}
// Start or stop discovery service based on setting change
- if h.monitor != nil {
+ if h.getMonitor(r.Context()) != nil {
if settings.DiscoveryEnabled && !prevDiscoveryEnabled {
// Discovery was just enabled, start the service
subnet := h.config.DiscoverySubnet
if subnet == "" {
subnet = "auto"
}
- h.monitor.StartDiscoveryService(context.Background(), h.wsHub, subnet)
+ h.getMonitor(r.Context()).StartDiscoveryService(context.Background(), h.wsHub, subnet)
log.Info().Msg("Discovery service started via settings update")
} else if !settings.DiscoveryEnabled && prevDiscoveryEnabled {
// Discovery was just disabled, stop the service
- h.monitor.StopDiscoveryService()
+ h.getMonitor(r.Context()).StopDiscoveryService()
log.Info().Msg("Discovery service stopped via settings update")
} else if settings.DiscoveryEnabled && settings.DiscoverySubnet != "" {
// Subnet changed while discovery is enabled, update it
- if svc := h.monitor.GetDiscoveryService(); svc != nil {
+ if svc := h.getMonitor(r.Context()).GetDiscoveryService(); svc != nil {
svc.SetSubnet(settings.DiscoverySubnet)
}
}
if discoveryConfigUpdated && settings.DiscoveryEnabled {
- if svc := h.monitor.GetDiscoveryService(); svc != nil {
+ if svc := h.getMonitor(r.Context()).GetDiscoveryService(); svc != nil {
log.Info().Msg("Discovery configuration changed; triggering refresh")
svc.ForceRefresh()
}
}
}
- if tempToggleRequested && h.monitor != nil {
+ if tempToggleRequested && h.getMonitor(r.Context()) != nil {
if settings.TemperatureMonitoringEnabled && !prevTempEnabled {
- h.monitor.EnableTemperatureMonitoring()
+ h.getMonitor(r.Context()).EnableTemperatureMonitoring()
} else if !settings.TemperatureMonitoringEnabled && prevTempEnabled {
- h.monitor.DisableTemperatureMonitoring()
+ h.getMonitor(r.Context()).DisableTemperatureMonitoring()
}
}
// Update webhook allowed private CIDRs if changed
- if _, ok := rawRequest["webhookAllowedPrivateCIDRs"]; ok && h.monitor != nil {
- if nm := h.monitor.GetNotificationManager(); nm != nil {
+ if _, ok := rawRequest["webhookAllowedPrivateCIDRs"]; ok && h.getMonitor(r.Context()) != nil {
+ if nm := h.getMonitor(r.Context()).GetNotificationManager(); nm != nil {
if err := nm.UpdateAllowedPrivateCIDRs(settings.WebhookAllowedPrivateCIDRs); err != nil {
log.Error().Err(err).Msg("Failed to update webhook allowed private CIDRs")
http.Error(w, fmt.Sprintf("Invalid webhook allowed private CIDRs: %v", err), http.StatusBadRequest)
@@ -729,8 +758,8 @@ func (h *SystemSettingsHandler) HandleUpdateSystemSettings(w http.ResponseWriter
// Update public URL for notifications if changed
if _, ok := rawRequest["publicURL"]; ok {
h.config.PublicURL = settings.PublicURL
- if h.monitor != nil {
- if nm := h.monitor.GetNotificationManager(); nm != nil {
+ if h.getMonitor(r.Context()) != nil {
+ if nm := h.getMonitor(r.Context()).GetNotificationManager(); nm != nil {
nm.SetPublicURL(settings.PublicURL)
log.Info().Str("publicURL", settings.PublicURL).Msg("Updated notification public URL from settings")
}
diff --git a/internal/config/multi_tenant.go b/internal/config/multi_tenant.go
new file mode 100644
index 0000000000..ed14922b2f
--- /dev/null
+++ b/internal/config/multi_tenant.go
@@ -0,0 +1,86 @@
+package config
+
+import (
+ "fmt"
+ "path/filepath"
+ "sync"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rs/zerolog/log"
+)
+
+// MultiTenantPersistence manages a collection of TenantPersistence instances,
+// one for each organization.
+type MultiTenantPersistence struct {
+ baseDataDir string
+ mu sync.RWMutex
+ tenants map[string]*ConfigPersistence
+}
+
+// NewMultiTenantPersistence creates a new multi-tenant persistence manager.
+func NewMultiTenantPersistence(baseDataDir string) *MultiTenantPersistence {
+ return &MultiTenantPersistence{
+ baseDataDir: baseDataDir,
+ tenants: make(map[string]*ConfigPersistence),
+ }
+}
+
+// GetPersistence returns the persistence instance for a specific organization.
+// It initializes the persistence if it hasn't been loaded yet.
+func (mtp *MultiTenantPersistence) GetPersistence(orgID string) (*ConfigPersistence, error) {
+ mtp.mu.RLock()
+ persistence, exists := mtp.tenants[orgID]
+ mtp.mu.RUnlock()
+
+ if exists {
+ return persistence, nil
+ }
+
+ mtp.mu.Lock()
+ defer mtp.mu.Unlock()
+
+ // Double-check locking pattern
+ if persistence, exists = mtp.tenants[orgID]; exists {
+ return persistence, nil
+ }
+
+ // Validate OrgID (prevent directory traversal)
+ if filepath.Base(orgID) != orgID || orgID == "" || orgID == "." || orgID == ".." {
+ return nil, fmt.Errorf("invalid organization ID: %s", orgID)
+ }
+
+ // Determine org data directory
+ // Global/Default org uses the root data dir (legacy compatibility)
+ // New orgs use /data/orgs/<org-id>
+ var orgDir string
+ if orgID == "default" {
+ orgDir = filepath.Join(mtp.baseDataDir, "orgs", "default")
+ } else {
+ orgDir = filepath.Join(mtp.baseDataDir, "orgs", orgID)
+ }
+
+ log.Info().Str("org_id", orgID).Str("dir", orgDir).Msg("Initializing tenant persistence")
+
+ cp, err := newConfigPersistence(orgDir)
+ if err != nil {
+ return nil, fmt.Errorf("failed to initialize persistence for org %s: %w", orgID, err)
+ }
+
+ // Ensure the directory exists
+ if err := cp.EnsureConfigDir(); err != nil {
+ return nil, err
+ }
+
+ mtp.tenants[orgID] = cp
+ return cp, nil
+}
+
+// LoadOrganizationMetadata loads basic metadata for an organization.
+// This is separate from the tenant's internal config.
+func (mtp *MultiTenantPersistence) LoadOrganization(orgID string) (*models.Organization, error) {
+ // TODO: implementing organization metadata storage in system.json later
+ return &models.Organization{
+ ID: orgID,
+ DisplayName: orgID, // Placeholder
+ }, nil
+}
diff --git a/internal/config/persistence.go b/internal/config/persistence.go
index c338678607..75c5ed9498 100644
--- a/internal/config/persistence.go
+++ b/internal/config/persistence.go
@@ -44,6 +44,12 @@ type ConfigPersistence struct {
aiChatSessionsFile string
crypto *crypto.CryptoManager
fs FileSystem
+
+ // Lazy loaded metadata stores
+ guestMetadataStore *GuestMetadataStore
+ dockerMetadataStore *DockerMetadataStore
+ hostMetadataStore *HostMetadataStore
+ metadataMu sync.Mutex
}
// FileSystem interface for mocking file operations
@@ -138,6 +144,11 @@ func (c *ConfigPersistence) DataDir() string {
return c.configDir
}
+// GetConfigDir returns the configuration directory path (alias for DataDir to match interface expectations)
+func (c *ConfigPersistence) GetConfigDir() string {
+ return c.configDir
+}
+
// EnsureConfigDir ensures the configuration directory exists
func (c *ConfigPersistence) EnsureConfigDir() error {
return c.fs.MkdirAll(c.configDir, 0700)
diff --git a/internal/config/persistence_metadata_accessors.go b/internal/config/persistence_metadata_accessors.go
new file mode 100644
index 0000000000..fadbc6e23c
--- /dev/null
+++ b/internal/config/persistence_metadata_accessors.go
@@ -0,0 +1,34 @@
+package config
+
+// GetGuestMetadataStore returns the guest metadata store, creating it if necessary
+func (c *ConfigPersistence) GetGuestMetadataStore() *GuestMetadataStore {
+ c.metadataMu.Lock()
+ defer c.metadataMu.Unlock()
+
+ if c.guestMetadataStore == nil {
+ c.guestMetadataStore = NewGuestMetadataStore(c.configDir, c.fs)
+ }
+ return c.guestMetadataStore
+}
+
+// GetDockerMetadataStore returns the docker metadata store, creating it if necessary
+func (c *ConfigPersistence) GetDockerMetadataStore() *DockerMetadataStore {
+ c.metadataMu.Lock()
+ defer c.metadataMu.Unlock()
+
+ if c.dockerMetadataStore == nil {
+ c.dockerMetadataStore = NewDockerMetadataStore(c.configDir, c.fs)
+ }
+ return c.dockerMetadataStore
+}
+
+// GetHostMetadataStore returns the host metadata store, creating it if necessary
+func (c *ConfigPersistence) GetHostMetadataStore() *HostMetadataStore {
+ c.metadataMu.Lock()
+ defer c.metadataMu.Unlock()
+
+ if c.hostMetadataStore == nil {
+ c.hostMetadataStore = NewHostMetadataStore(c.configDir, c.fs)
+ }
+ return c.hostMetadataStore
+}
diff --git a/internal/models/organization.go b/internal/models/organization.go
new file mode 100644
index 0000000000..292a82134e
--- /dev/null
+++ b/internal/models/organization.go
@@ -0,0 +1,20 @@
+package models
+
+import "time"
+
+// Organization represents a distinct tenant in the system.
+type Organization struct {
+ // ID is the unique identifier for the organization (e.g., "customer-a").
+ // It is used as the directory name for data isolation.
+ ID string `json:"id"`
+
+ // DisplayName is the human-readable name of the organization.
+ DisplayName string `json:"displayName"`
+
+ // CreatedAt is when the organization was registered.
+ CreatedAt time.Time `json:"createdAt"`
+
+ // EncryptionKeyID refers to the specific encryption key used for this org's data
+ // (Future proofing for per-tenant encryption keys)
+ EncryptionKeyID string `json:"encryptionKeyId,omitempty"`
+}
diff --git a/internal/monitoring/monitor_accessors.go b/internal/monitoring/monitor_accessors.go
new file mode 100644
index 0000000000..96419a9bb0
--- /dev/null
+++ b/internal/monitoring/monitor_accessors.go
@@ -0,0 +1,10 @@
+package monitoring
+
+import "github.com/rcourtman/pulse-go-rewrite/internal/config"
+
+// GetConfig returns the current configuration used by the monitor
+func (m *Monitor) GetConfig() *config.Config {
+ m.mu.RLock()
+ defer m.mu.RUnlock()
+ return m.config
+}
diff --git a/internal/monitoring/multi_tenant_monitor.go b/internal/monitoring/multi_tenant_monitor.go
new file mode 100644
index 0000000000..b762c95464
--- /dev/null
+++ b/internal/monitoring/multi_tenant_monitor.go
@@ -0,0 +1,115 @@
+package monitoring
+
+import (
+ "context"
+ "fmt"
+ "sync"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+ "github.com/rcourtman/pulse-go-rewrite/internal/websocket"
+ "github.com/rs/zerolog/log"
+)
+
+// MultiTenantMonitor manages a dedicated Monitor instance for each organization.
+type MultiTenantMonitor struct {
+ mu sync.RWMutex
+ monitors map[string]*Monitor
+ persistence *config.MultiTenantPersistence
+ baseConfig *config.Config
+ wsHub *websocket.Hub
+ globalCtx context.Context
+ globalCancel context.CancelFunc
+}
+
+// NewMultiTenantMonitor creates a new multi-tenant monitor manager.
+func NewMultiTenantMonitor(baseCfg *config.Config, persistence *config.MultiTenantPersistence, wsHub *websocket.Hub) *MultiTenantMonitor {
+ ctx, cancel := context.WithCancel(context.Background())
+ return &MultiTenantMonitor{
+ monitors: make(map[string]*Monitor),
+ persistence: persistence,
+ baseConfig: baseCfg, // Used as a template or for global settings
+ wsHub: wsHub,
+ globalCtx: ctx,
+ globalCancel: cancel,
+ }
+}
+
+// GetMonitor returns the monitor instance for a specific organization.
+// It lazily initializes the monitor if it doesn't exist.
+func (mtm *MultiTenantMonitor) GetMonitor(orgID string) (*Monitor, error) {
+ mtm.mu.RLock()
+ monitor, exists := mtm.monitors[orgID]
+ mtm.mu.RUnlock()
+
+ if exists {
+ return monitor, nil
+ }
+
+ mtm.mu.Lock()
+ defer mtm.mu.Unlock()
+
+ // Double-check locking pattern
+ if monitor, exists = mtm.monitors[orgID]; exists {
+ return monitor, nil
+ }
+
+ // Initialize new monitor for this tenant
+ log.Info().Str("org_id", orgID).Msg("Initializing tenant monitor")
+
+ // 1. Load Tenant Config
+ // We need a specific config for this tenant.
+ // For now, we clone the base config (assuming shared defaults)
+ // In the future, we'll load overrides from persistence.GetPersistence(orgID)
+ tenantConfig := *mtm.baseConfig // Shallow copy
+
+ // Ensure the DataPath is correct for this tenant to isolate storage (sqlite, etc)
+ tenantPersistence, err := mtm.persistence.GetPersistence(orgID)
+ if err != nil {
+ return nil, fmt.Errorf("failed to get persistence for org %s: %w", orgID, err)
+ }
+ tenantConfig.DataPath = tenantPersistence.GetConfigDir()
+
+ // 2. Create Monitor
+ // Usage of internal New constructor
+ monitor, err = New(&tenantConfig)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create monitor for org %s: %w", orgID, err)
+ }
+
+ // 3. Start Monitor
+ // We pass the global context, but maybe we should give it a derived one?
+ // Using globalCtx ensures all monitors stop when MultiTenantMonitor stops.
+ // NOTE: Monitor.Start is async
+ go monitor.Start(mtm.globalCtx, mtm.wsHub)
+
+ mtm.monitors[orgID] = monitor
+ return monitor, nil
+}
+
+// Stop stops all tenant monitors.
+func (mtm *MultiTenantMonitor) Stop() {
+ mtm.mu.Lock()
+ defer mtm.mu.Unlock()
+
+ log.Info().Msg("Stopping MultiTenantMonitor and all tenant instances")
+ mtm.globalCancel()
+
+ for _, monitor := range mtm.monitors {
+ monitor.Stop()
+ }
+ // Clear map
+ mtm.monitors = make(map[string]*Monitor)
+}
+
+// RemoveTenant stops and removes a specific tenant's monitor.
+// Useful for offboarding or manual reloading.
+func (mtm *MultiTenantMonitor) RemoveTenant(orgID string) {
+ mtm.mu.Lock()
+ defer mtm.mu.Unlock()
+
+ if monitor, exists := mtm.monitors[orgID]; exists {
+ log.Info().Str("org_id", orgID).Msg("Stopping and removing tenant monitor")
+ monitor.Stop()
+ delete(mtm.monitors, orgID)
+ }
+}
diff --git a/internal/monitoring/reload.go b/internal/monitoring/reload.go
index 59815c4489..c0e6268d4a 100644
--- a/internal/monitoring/reload.go
+++ b/internal/monitoring/reload.go
@@ -12,28 +12,28 @@ import (
// ReloadableMonitor wraps a Monitor with reload capability
type ReloadableMonitor struct {
- mu sync.RWMutex
- monitor *Monitor
- config *config.Config
- wsHub *websocket.Hub
- ctx context.Context
- cancel context.CancelFunc
- parentCtx context.Context
- reloadChan chan chan error
+ mu sync.RWMutex
+ mtMonitor *MultiTenantMonitor
+ persistence *config.MultiTenantPersistence
+ config *config.Config
+ wsHub *websocket.Hub
+ ctx context.Context
+ cancel context.CancelFunc
+ parentCtx context.Context
+ reloadChan chan chan error
}
// NewReloadableMonitor creates a new reloadable monitor
-func NewReloadableMonitor(cfg *config.Config, wsHub *websocket.Hub) (*ReloadableMonitor, error) {
- monitor, err := New(cfg)
- if err != nil {
- return nil, err
- }
+func NewReloadableMonitor(cfg *config.Config, persistence *config.MultiTenantPersistence, wsHub *websocket.Hub) (*ReloadableMonitor, error) {
+ mtMonitor := NewMultiTenantMonitor(cfg, persistence, wsHub)
+ // No error check needed for NewMultiTenantMonitor as it doesn't return error
rm := &ReloadableMonitor{
- monitor: monitor,
- config: cfg,
- wsHub: wsHub,
- reloadChan: make(chan chan error, 1),
+ mtMonitor: mtMonitor,
+ config: cfg,
+ persistence: persistence,
+ wsHub: wsHub,
+ reloadChan: make(chan chan error, 1),
}
return rm, nil
@@ -46,8 +46,10 @@ func (rm *ReloadableMonitor) Start(ctx context.Context) {
rm.ctx, rm.cancel = context.WithCancel(ctx)
rm.mu.Unlock()
- // Start the monitor
- go rm.monitor.Start(rm.ctx, rm.wsHub)
+ // Start the multi-tenant monitor manager
+ // Note: It doesn't start individual monitors until requested via GetMonitor()
+ // But we might want to start "default" monitor if it exists?
+ // For now, lazy loading handles it.
// Watch for reload signals
go rm.watchReload(ctx)
@@ -101,31 +103,37 @@ func (rm *ReloadableMonitor) doReload() error {
// Wait a moment for cleanup
time.Sleep(1 * time.Second)
- // Create new monitor
- newMonitor, err := New(cfg)
- if err != nil {
- // Restart old monitor if new one fails
- rm.ctx, rm.cancel = context.WithCancel(rm.parentCtx)
- go rm.monitor.Start(rm.ctx, rm.wsHub)
- return err
- }
+ // Create new multi-tenant monitor
+ // Note: We lose existing instances state here, which is expected on full reload.
+ newMTMonitor := NewMultiTenantMonitor(cfg, rm.persistence, rm.wsHub)
// Replace monitor
- rm.monitor = newMonitor
+ rm.mtMonitor = newMTMonitor
rm.config = cfg
- // Start new monitor
+ // Start new monitor context (individual monitors are lazy loaded/started)
rm.ctx, rm.cancel = context.WithCancel(rm.parentCtx)
- go rm.monitor.Start(rm.ctx, rm.wsHub)
return nil
}
-// GetMonitor returns the current monitor instance
+// GetMultiTenantMonitor returns the current multi-tenant monitor instance
+func (rm *ReloadableMonitor) GetMultiTenantMonitor() *MultiTenantMonitor {
+ rm.mu.RLock()
+ defer rm.mu.RUnlock()
+ return rm.mtMonitor
+}
+
+// GetMonitor returns the default monitor instance (compatibility shim)
+// It ensures the "default" tenant is initialized.
func (rm *ReloadableMonitor) GetMonitor() *Monitor {
rm.mu.RLock()
defer rm.mu.RUnlock()
- return rm.monitor
+ if rm.mtMonitor == nil {
+ return nil
+ }
+ m, _ := rm.mtMonitor.GetMonitor("default")
+ return m
}
// GetConfig returns the current configuration used by the monitor.
@@ -140,7 +148,13 @@ func (rm *ReloadableMonitor) GetConfig() *config.Config {
// GetState returns the current state
func (rm *ReloadableMonitor) GetState() interface{} {
- return rm.GetMonitor().GetState()
+ // For backward compatibility / frontend simplicity, return default org state
+ // TODO: Make WebSocket state getter tenant-aware
+ monitor, err := rm.GetMultiTenantMonitor().GetMonitor("default")
+ if err != nil {
+ return nil
+ }
+ return monitor.GetState()
}
// Stop stops the monitor
@@ -152,7 +166,7 @@ func (rm *ReloadableMonitor) Stop() {
rm.cancel()
}
- if rm.monitor != nil {
- rm.monitor.Stop()
+ if rm.mtMonitor != nil {
+ rm.mtMonitor.Stop()
}
}
diff --git a/mock.env b/mock.env
new file mode 100644
index 0000000000..230e7bd35b
--- /dev/null
+++ b/mock.env
@@ -0,0 +1,9 @@
+# Mock Mode Configuration
+PULSE_MOCK_MODE=true
+PULSE_MOCK_NODES=7
+PULSE_MOCK_VMS_PER_NODE=5
+PULSE_MOCK_LXCS_PER_NODE=8
+PULSE_MOCK_DOCKER_HOSTS=3
+PULSE_MOCK_DOCKER_CONTAINERS=12
+PULSE_MOCK_RANDOM_METRICS=true
+PULSE_MOCK_STOPPED_PERCENT=20
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 08466729d9..525246fa83 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -132,7 +132,8 @@ func Run(ctx context.Context, version string) error {
go wsHub.Run()
// Initialize reloadable monitoring system
- reloadableMonitor, err := monitoring.NewReloadableMonitor(cfg, wsHub)
+ mtPersistence := config.NewMultiTenantPersistence(cfg.DataPath)
+ reloadableMonitor, err := monitoring.NewReloadableMonitor(cfg, mtPersistence, wsHub)
if err != nil {
return fmt.Errorf("failed to initialize monitoring system: %w", err)
}
@@ -181,13 +182,14 @@ func Run(ctx context.Context, version string) error {
}
if router != nil {
router.SetMonitor(reloadableMonitor.GetMonitor())
+ router.SetMultiTenantMonitor(reloadableMonitor.GetMultiTenantMonitor())
if cfg := reloadableMonitor.GetConfig(); cfg != nil {
router.SetConfig(cfg)
}
}
return nil
}
- router = api.NewRouter(cfg, reloadableMonitor.GetMonitor(), wsHub, reloadFunc, version)
+ router = api.NewRouter(cfg, reloadableMonitor.GetMonitor(), reloadableMonitor.GetMultiTenantMonitor(), wsHub, reloadFunc, version)
// Inject resource store into monitor for WebSocket broadcasts
router.SetMonitor(reloadableMonitor.GetMonitor())
@@ -221,6 +223,7 @@ func Run(ctx context.Context, version string) error {
log.Error().Err(err).Msg("Failed to reload monitor after mock.env change")
} else if router != nil {
router.SetMonitor(reloadableMonitor.GetMonitor())
+ router.SetMultiTenantMonitor(reloadableMonitor.GetMultiTenantMonitor())
if cfg := reloadableMonitor.GetConfig(); cfg != nil {
router.SetConfig(cfg)
}