reckon_db_resource_monitor (reckon_db v5.10.3)
View SourceSystem resource sampling for reckon-db (CPU + disk).
A node-wide singleton gen_server that samples host CPU and disk usage on a fixed interval and emits telemetry gauges — unlike reckon_db_memory, which fires only when a pressure LEVEL changes, this emits a fresh sample every tick so consumers can graph a live series.
Telemetry (see reckon_db_telemetry.hrl):
[reckon_db, cpu, sample]— measurementsbusy_percent,load1,load5,load15; metadatacores.[reckon_db, disk, sample]— one per mount; measurementsused_percent,total_kb,available_kb; metadatamount,data_dir_mount.
CPU/disk come from cpu_sup/disksup (os_mon). The monitor tries to start os_mon on init and DEGRADES GRACEFULLY if it can't: get_stats/0 reports os_mon => false and no CPU/disk telemetry is emitted (there is no pure-BEAM fallback for host CPU% or disk usage). Started from reckon_db_sup when resource_monitoring is enabled (the default).
Summary
Functions
Latest sampled resource snapshot: #{os_mon => boolean(), cpu => map()|undefined, disk => [map()], last_sample => ms}.
Force an immediate sample and return the fresh snapshot.
Start the monitor. Config keys: interval (ms, default 10000), data_dir (string; the store data root, to flag its mount — resolved from the configured stores when omitted).
Functions
-spec get_stats() -> map().
Latest sampled resource snapshot: #{os_mon => boolean(), cpu => map()|undefined, disk => [map()], last_sample => ms}.
-spec sample_now() -> map().
Force an immediate sample and return the fresh snapshot.
Start the monitor. Config keys: interval (ms, default 10000), data_dir (string; the store data root, to flag its mount — resolved from the configured stores when omitted).