feat(TASK-12): periodic telemetry reporter — 15min interval, collector POST
Background task spawned on server startup: every 15 minutes, checks opt-in status, builds anonymous health report (node ID hash, version, uptime, CPU/RAM/disk %, container states, recent alerts), saves to disk, and POSTs to TELEMETRY_COLLECTOR_URL env var if configured. Non-fatal on failure. Fixed FiredAlert field references (kind not rule_type, timestamp not fired_at) in both monitoring and analytics modules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
b28b0f335f
commit
bce70b13f2
@@ -103,6 +103,7 @@ impl Server {
|
||||
|
||||
// Create metrics store and spawn background collector
|
||||
let metrics_store = Arc::new(MetricsStore::with_data_dir(config.data_dir.clone()));
|
||||
let metrics_for_telemetry = metrics_store.clone();
|
||||
crate::monitoring::spawn_metrics_collector(metrics_store.clone(), Some(state_manager.clone()), Some(config.data_dir.clone()));
|
||||
|
||||
let api_handler = Arc::new(
|
||||
@@ -292,6 +293,13 @@ impl Server {
|
||||
// Respects webhook config: skips when disabled or ContainerCrash not subscribed
|
||||
crate::health_monitor::spawn_health_monitor(state_manager.clone(), config.data_dir.clone());
|
||||
|
||||
// Periodic telemetry reporter (every 15 min when opted in)
|
||||
crate::monitoring::spawn_telemetry_reporter(
|
||||
metrics_for_telemetry,
|
||||
Some(state_manager.clone()),
|
||||
config.data_dir.clone(),
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
_config: config,
|
||||
_identity: identity,
|
||||
|
||||
Reference in New Issue
Block a user