v0.6.0
·
132 commits
to master
since this release
Release v0.6.0
This release introduces major architectural improvements to telemetry accuracy, battery cycle accounting math, forensic tracking across system boots, and alert resilience. It resolves critical edge cases in low-power cycle integration, eliminates false-positive alerts via stateful debouncing, improves database pruning performance, and optimizes filesystem operations on modern Linux distributions.
🌟 Highlights
- Precision Cycle Accounting (Fixed Quantization Freeze): Previous accumulators rounded intermediate cycle deltas to 4 decimal places, which caused the cycle counter to completely freeze at low power draws (<10.8W on a 60Wh battery). Cycle accumulation now retains full IEEE 754 64-bit float precision in memory, writing high-precision estimations without loss.
- Kernel Forensics (
boot_id& Monotonic Uptime): Every sample now captures/proc/sys/kernel/random/boot_idand monotonic/proc/uptime. This prevents erroneous historical integrations across system reboots and cold boots. - Three-State Power Modeling: Refactored the telemetry layer from a naive charging/discharging boolean into an explicit three-state model (
charging,discharging,unknown). Low and critical alerts are strictly gated to active discharging to eliminate spurious notifications while plugged into AC. - Load-Normalized Thermal Anomaly Alerting: Added an intelligent alert that triggers when CPU temperatures remain dangerously elevated despite minimal system load—acting as an early-warning diagnostic for cooling fan failures, dry thermal paste, or clogged heatsinks.
- Alert Debounce & Hysteresis: Added a 3-tick consecutive threshold filter across all telemetry triggers to filter out instantaneous thermal spikes and electrical noise.
- Btrfs CoW Optimizations:
install.shnow configures the local SQLite directory withchattr +C(No-CoW) on Btrfs filesystems to prevent write amplification, fragmentation, and erratic WAL checkpoint latency. - Standalone Binary Target: Added standalone binary compilation via
bun build --compilefor direct deployment without requiring a system-wide Bun runtime.
🛠️ What's Changed
🔋 Telemetry & Hardware Forensics
- Sysfs Battery Presence: Guarded battery detection by verifying the physical sysfs battery directory exists before reporting
is_present, preventing phantom battery logs on AC-only desktops or disconnected batteries (0cfa587). - Environment Overrides: Added support for
BATMON_POWER_SUPPLY_BASEand sanitized empty-string path fallbacks (b8ecc3e). - UPower Property Throttling: Added rate-limiting to D-Bus /
busctlUPower queries to reduce IPC overhead and avoid blocking the 1-second flight recorder loop (b606558). - Power State Normalization: Safely normalized sysfs power supply statuses (
Not charging,Full, etc.) intocharging,discharging, orunknown(7f41e5c,2ce8084).
⚡ Battery Accounting & Cycle Math
- High-Precision Cycle Accumulator: Removed pre-accumulation rounding to ensure sub-milliwatt power draws accurately accumulate wear over time (
86d1450). - Sub-Minute Cycle Deltas: Cycle estimations now compute against the immediate preceding 1-second debug sample instead of the 60-second historical window, capturing micro-bursts accurately (
b0d1f5c). - Reboot Boundary Guard: Guarded cycle integration against reboots and time adjustments; drops in monotonic uptime or changes in
boot_idreset reference samples rather than creating false cycle spikes (6266891). - Legacy DB Compatibility: Ensured legacy integer power states from existing database rows are cleanly mapped through
derivePowerState(033f345).
🚨 Alert Engine & Diagnostics
- Thermal Anomaly Detection: Added detection for thermal dissipation failure when CPU temps exceed 75°C while system load and CPU usage remain low (
9bc21ed). - Debounce Hysteresis: Replaced immediate single-sample triggers with a 3-sample debounce latch (
9a66e71). - Alert Latch Lifecycle: Automatically resets thermal anomaly latches when AC is reconnected, with contextual message formatting that reflects whether load average or CPU percentage qualified the alert (
9d32635). - Charging Decoupling: Decoupled general CPU temperature alerts from AC charging states while gating low-battery warnings strictly to discharge mode (
fcc3971,2ce8084).
🗄️ Database, Storage & Migrations
- Indexed Pruning Performance: Migrated the 1-second debug telemetry cleanup job from dynamic SQLite
datetime('now', ...)calls to an indexed ISO timestamp string cutoff, eliminating full-table scans (7cf4e1b). - Strict Type Coercion: Ensured boolean columns stored as SQLite integers (
0/1) are consistently deserialized to TypeScript booleans (cb2ca83). - Migration Table Conflict Handling: Hardened migration step 2–5 table renaming logic when the target table already exists (
9f91cbb). - WAL Durability Documentation: Documented SQLite WAL commit boundaries, fsync frequency, and the 1000-page checkpoint threshold (
5e67b90,1e0548b).
🐧 Daemon, CLI & Installer
- Accurate Oneshot CLI Sampling:
batmonCLI now runs a double-sample pass in oneshot mode with a calibrated 500ms delay to report valid CPU deltas and process activity instead of zeros (323868e). - Daemon Tick Progression: Tick counters now advance unconditionally every second regardless of battery state (
9742c1b). - Verified Btrfs Setup: The installer verifies
chattr +Cexecution status before reporting success, warning the user if the filesystem prohibits attribute modifications (695804a). - Standalone Compilation: Added
npm run buildtargeting a standalone binary via Bun (3925d9b).
📦 Upgrading
Existing SQLite databases will automatically migrate schemas on first start via SQLite user_version tracking. No manual database alterations are required.
If you are running the systemd daemon:
git pull
bun run install-service
systemctl --user restart batmon