pharos/statistic
What pharos can poll, and how often.
A Statistic pairs a StatisticKind (the what) with a per-statistic
polling interval (the how often). Use poll/1 to accept the kind’s
default interval, or poll_every/2 to override it.
Statistics group into these families:
- BEAM VM internals -
BeamMemory,BeamRunQueues,BeamSystemCounts,BeamPersistentTerm. Built intotelemetry_poller.BeamScheduler(scheduler utilisation) andBeamReductionsare custom emitters. - Distributed Erlang topology -
ClusterNodes. Custom measurement emitting[pharos, cluster, nodes]. - Per-process introspection -
ProcessInfo. Built intotelemetry_poller. - Host (OS) -
HostMemory(/proc/meminfo, Linux),HostDisk(path)andHostCpu(os_mon’sdisksup/cpu_sup), andHostNetwork(/proc/net/dev). Host probes degrade tostatus: unimplementedwhen the underlying source is unavailable.
Types
A polling instruction: a kind to collect plus how often (in milliseconds).
pub type Statistic {
Statistic(kind: StatisticKind, interval_ms: Int)
}
Constructors
-
Statistic(kind: StatisticKind, interval_ms: Int)
What kind of measurement to collect.
pub type StatisticKind {
BeamMemory
BeamRunQueues
BeamSystemCounts
BeamPersistentTerm
ProcessInfo(
name: atom.Atom,
event: List(atom.Atom),
keys: List(atom.Atom),
)
ClusterNodes
HostMemory
HostDisk(path: String)
HostCpu
HostNetwork
BeamScheduler
BeamReductions
}
Constructors
-
BeamMemory[vm, memory]- all keys fromerlang:memory/0. -
BeamRunQueues[vm, total_run_queue_lengths]- total / cpu / io queue depths. -
BeamSystemCounts[vm, system_counts]- process / atom / port counts and limits. -
BeamPersistentTerm[vm, persistent_term]- persistent term count and memory usage. -
[pharos, process, <name>]-process_infosnapshot for a named process.eventoverrides the emitted event name;keysselects whichprocess_infokeys to collect (e.g.memory,message_queue_len). -
ClusterNodes[pharos, cluster, nodes]- this node’s name plus the list of connected distributed Erlang nodes. -
HostMemory[pharos, host, memory]- OS-level memory totals, read from/proc/meminfo(Linux). -
HostDisk(path: String)[pharos, host, disk]- usage of the filesystem containingpath, via os_mon’sdisksup. -
HostCpu[pharos, host, cpu]- host CPU utilisation % and load averages, via os_mon’scpu_sup. -
HostNetwork[pharos, host, network]- per-second network throughput summed across non-loopback interfaces, from/proc/net/dev. -
BeamScheduler[pharos, vm, scheduler]- BEAM scheduler utilisation %, fromscheduler_wall_time. -
BeamReductions[pharos, vm, reductions]- BEAM reductions executed in the last interval.
Values
pub fn default_interval_ms(kind: StatisticKind) -> Int
Default polling cadence for each kind. Tuned to match the cost and volatility of the underlying signal: cheap, fast-changing things (run queues) poll often; expensive or slow-changing things (cluster topology, disk) poll rarely.
pub fn poll_every(
kind: StatisticKind,
interval_ms: Int,
) -> Statistic
Poll kind every interval_ms milliseconds.