Pulse/internal/monitoring
rcourtman 5f000b7974 feat: Complete Unified Resource Architecture (Phases 1-3)
This commit implements the Unified Resource Architecture for AI-first
infrastructure management. Key features:

Phase 1 - Backend Unification:
- New unified Resource type with 9 resource types, 7 platforms, 7 statuses
- Resource store with identity-based deduplication (hostname, machineID, IP)
- 8 converter functions (FromNode, FromVM, FromContainer, etc.)
- REST API endpoints: /api/resources, /api/resources/stats, /api/resources/{id}
- 28 comprehensive unit tests

Phase 2 - AI Context Enhancement:
- Unified context builder for AI system prompts
- Cross-platform query methods: GetTopByCPU, GetTopByMemory, GetTopByDisk
- Resource correlation: GetRelated (parent, children, siblings, cluster)
- Infrastructure summary: GetResourceSummary with health status counts
- AI context now includes top consumers and infrastructure overview

Phase 3 - Agent Preference & Hybrid Mode:
- Polling optimization methods in resource store
- ResourceStoreInterface added to Monitor
- SetResourceStore() and shouldSkipNodeMetrics() helper methods
- Store automatically wired into Monitor via Router.SetMonitor()
- Foundation ready for reduced API polling when agents are active

Files added:
- internal/resources/resource.go - Core Resource type
- internal/resources/store.go - Store with deduplication
- internal/resources/converters.go - Type converters
- internal/resources/platform_data.go - Platform-specific data
- internal/resources/store_test.go - 28 tests
- internal/resources/converters_test.go - Converter tests
- internal/api/resource_handlers.go - REST API handlers
- internal/ai/resource_context.go - AI context builder
- .gemini/docs/unified-resource-architecture.md - Architecture docs

All tests pass.
2025-12-07 13:49:00 +00:00
..
backoff.go feat: implement error handling with circuit breakers and backoff (Phase 2 Task 7) 2025-10-20 15:13:37 +00:00
backoff_test.go style: fix gofmt formatting inconsistencies 2025-11-26 23:44:36 +00:00
backup_guard_test.go Guard PBS backups from failed polls 2025-11-05 19:26:20 +00:00
ceph.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
ceph_test.go test: Add tests for monitoring and notifications functions 2025-12-01 17:33:36 +00:00
circuit_breaker.go style: fix gofmt formatting inconsistencies 2025-11-26 23:44:36 +00:00
circuit_breaker_test.go test: Add tests for allow, ensureContainerRootDiskEntry; remove dead code 2025-12-01 20:15:32 +00:00
container_disk_usage.go Skip inactive storages during content scans 2025-11-18 09:46:48 +00:00
container_disk_usage_test.go test: Add tests for monitoring and notifications functions 2025-12-01 17:33:36 +00:00
container_parsing.go feat: Add OS type display for LXC containers 2025-12-05 12:43:32 +00:00
container_parsing_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
diagnostic_snapshots.go Refine Proxmox node memory fallback (#582) 2025-10-22 15:36:26 +00:00
diagnostic_snapshots_test.go test: Add tests for handleProxyHostFailure, recordNodeSnapshot, evaluateHostAgents 2025-12-01 19:40:32 +00:00
docker_commands.go feat: add docker agent command handling 2025-10-15 19:27:19 +00:00
docker_commands_test.go test: Add tests for GetGuestMetrics, mergeSnapshot, getDockerCommandPayload 2025-12-01 19:58:43 +00:00
docker_host_identity.go refactor: Extract Docker host identifier functions to separate file 2025-12-01 10:03:47 +00:00
docker_host_identity_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
error_classification_test.go Add unit tests for error classification functions in monitoring 2025-12-01 01:37:28 +00:00
fake_executor_integration.go test: add comprehensive integration test harness for adaptive polling (Phase 2 Task 9c) 2025-10-20 15:13:38 +00:00
fs_filters.go Filter read-only filesystems from host agent disk metrics (related to #690) 2025-11-12 09:47:02 +00:00
fs_filters_test.go Ignore read-only guest filesystems in disk aggregation 2025-10-14 16:13:53 +00:00
guest_metadata.go refactor: Extract guest metadata functions to separate file 2025-12-01 10:53:41 +00:00
guest_metadata_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
harness_integration.go Surface LXC interface IPs via PVE interfaces API (#596) 2025-10-23 08:07:32 +00:00
helpers_test.go test: Add tests for sanitizeGuestAddressStrings, parseContainerConfigNetworks, mergeNVMeTempsIntoDisks 2025-12-01 20:34:48 +00:00
host_agent_temps.go feat: AI features, agent improvements, and host monitoring enhancements 2025-12-05 10:37:02 +00:00
integration_integration_test.go style: fix gofmt formatting inconsistencies 2025-11-26 23:44:36 +00:00
main_test.go Harden setup token flow and enforce encrypted persistence 2025-10-25 16:00:37 +00:00
merge_temps_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
metrics.go style: fix staticcheck style warnings 2025-11-27 09:19:33 +00:00
metrics_helpers_test.go test: Add tests for monitor helper and metrics functions 2025-12-01 21:18:33 +00:00
metrics_history.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
metrics_history_concurrency_test.go chore: fix staticcheck SA warnings 2025-11-27 09:16:53 +00:00
metrics_history_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
metrics_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
monitor.go feat: Complete Unified Resource Architecture (Phases 1-3) 2025-12-07 13:49:00 +00:00
monitor_backup_poll_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
monitor_container_test.go feat: surface LXC mountpoints in UI (related to #715) 2025-11-18 22:57:20 +00:00
monitor_docker_test.go test: Add ApplyDockerReport error path tests 2025-12-02 02:00:06 +00:00
monitor_health_test.go feat: enhance scheduler health API with rich instance metadata 2025-10-20 15:13:38 +00:00
monitor_host_agents_test.go test: Add ApplyHostReport error path tests 2025-12-02 02:03:03 +00:00
monitor_memory_test.go Fix monitoring test panic and goroutine leaks 2025-11-11 23:52:24 +00:00
monitor_pmg_test.go Fix PMG API parameter issues causing 400 errors 2025-11-05 19:28:37 +00:00
monitor_polling.go AI Problem Solver implementation and various fixes 2025-12-06 23:46:08 +00:00
monitor_polling_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
monitor_proxy_test.go Improve temperature proxy detection 2025-11-18 14:25:09 +00:00
monitor_snapshots_test.go Skip inactive storages during content scans 2025-11-18 09:46:48 +00:00
monitor_storage_test.go Fix inflated RAM usage reporting for LXC containers 2025-11-06 00:16:18 +00:00
monitor_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
monitor_timeout_test.go test: Add tests for normalizeEndpointHost, taskExecutionTimeout, decrementPending 2025-12-01 18:42:57 +00:00
pbs_convert_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
poller.go chore: remove dead code and unused files 2025-11-27 00:05:04 +00:00
ratetracker.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
ratetracker_concurrency_test.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
ratetracker_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
reload.go feat: make PVE polling interval configurable (related to #467) 2025-11-18 21:30:04 +00:00
scheduler.go refactor: Remove unreachable dead code branches 2025-12-02 14:48:57 +00:00
scheduler_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00
staleness_tracker.go refactor: Remove unreachable dead code branches 2025-12-02 14:41:53 +00:00
staleness_tracker_test.go test: Add tests for parseContainerMountMetadata, convertContainerDiskInfo, StalenessScore 2025-12-01 20:44:00 +00:00
storage_backup_preserve_test.go test: Add tests for convertDockerSwarmInfo, namespacePathsForDatastore, preserveFailedStorageBackups 2025-12-01 19:04:23 +00:00
storage_filters.go Improve installer temperature proxy and backup polling 2025-11-18 18:42:33 +00:00
storage_filters_test.go Improve installer temperature proxy and backup polling 2025-11-18 18:42:33 +00:00
task_queue.go perf: reduce polling allocations and guest metadata load 2025-10-25 13:12:47 +00:00
task_queue_test.go test: Add WaitNext and key() tests for TaskQueue 2025-12-02 12:02:13 +00:00
temperature.go perf: Use strconv.Itoa instead of fmt.Sprintf for int conversion 2025-12-02 15:21:41 +00:00
temperature_test.go style: Apply gofmt to 37 files 2025-12-02 17:21:48 +00:00