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 three families:
- BEAM VM internals -
BeamMemory,BeamRunQueues,BeamSystemCounts,BeamPersistentTerm. Built intotelemetry_poller. - Distributed Erlang topology -
ClusterNodes. Custom measurement emitting[pharos, cluster, nodes]. - Per-process introspection -
ProcessInfo. Built intotelemetry_poller. - Host (OS) -
HostMemory,HostDisk. Scaffolded; the FFI emits placeholder events withstatus: unimplementeduntil real host probes land.
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
}
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. Scaffolded. -
HostDisk[pharos, host, disk]- OS-level disk usage. Scaffolded.
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.