Build Log: Shipping a Lean Python Telemetry Agent (CPU, Memory, Disk)
Build Log (April 8, 2026) Today I implemented the first production-ready telemetry collectors for heka-insights-agent and wired them into the main polling loop. What I built Added an optimized CPUCollector in src/collectors/cpu.py Added a MemoryCollector in src/collectors/memory.py Added a DiskCollector in src/collectors/disk.py Wired all collectors into src/main.py with a shared loop Added environment-based poll interval support via CPU_POLL_INTERVAL_SECONDS Added python-dotenv in requirements.txt CPU collector design I built CPU collection around psutil.cpu_times(...) snapshots and delta math (single source), instead of calling both cpu_percent and cpu_times_percent per cycle. Key design points: No thread offloading ( to_thread ) for this workload First cycle is warm-up by design Supports basic and detailed output modes Optional per-core output Uses MonotonicTicker to keep fixed cadence without drift Memory collector design Memory collection is intentionally lightweight: One call eac
Continue reading on Dev.to
Opens in a new tab



