Telemetry and Persistence
How AutoDoctor builds telemetry, writes SQLite rows, stores metadata, and keeps API/dashboard reads consistent with current run context.
Categories:
Who This Is For
- Developers troubleshooting missing dashboard data.
- Operators validating write/read consistency.
Telemetry Collection Flow
Invoke-AutoDoctorTelemetryCollectionbuilds telemetry object.- JSON file is written as UTF-8 without BOM.
Write-AutoDoctorTelemetryinserts module and system snapshot rows into SQLite.
Key telemetry object sections:
RunID,GeneratedAt,Hostname,AutoDoctorVersionExecutionStatsSystemModules
DB Write Flow
Diagnostics
Write-AutoDoctorDiagnostics inserts per-module status and summary into diagnostics.
Remediation
Write-AutoDoctorRemediation inserts remediation module status into remediation.
Telemetry
Write-AutoDoctorTelemetry writes:
- module-level status and keys into
telemetry_modules - derived system snapshot into
system_info
Alerts
Write-AutoDoctorAlerts maps root-cause detected issues into alerts with severity.
Metadata File for Dashboard
latest_run.json is written at:
server/latest_run.json
Fields:
run_idhost_namegenerated_time
The API endpoint /api/dashboard/meta reads this file and provides fallbacks if missing/corrupt.
Concurrency Notes
API DB connections set:
PRAGMA journal_mode=WALPRAGMA busy_timeout=5000
This supports concurrent writer/reader behavior between agent and API.
Validation Queries
SELECT COUNT(*) FROM diagnostics;
SELECT COUNT(*) FROM alerts;
SELECT COUNT(*) FROM telemetry_modules;
SELECT * FROM system_info ORDER BY timestamp DESC LIMIT 5;
Next Steps
- Review API Reference
- Use Troubleshooting Playbook when writes appear but dashboard is stale