pharos/measurement
Decoded measurement values.
telemetry_poller and pharos’s custom emitters dispatch raw telemetry
events; decode/2 lifts them into typed Measurement records. Memory
values arrive in bytes and are scaled to the configured MemoryUnit.
Types
pub type BeamMemoryStats {
BeamMemoryStats(
unit: MemoryUnit,
total: Float,
processes: Float,
processes_used: Float,
system: Float,
atom: Float,
atom_used: Float,
binary: Float,
code: Float,
ets: Float,
)
}
Constructors
-
BeamMemoryStats( unit: MemoryUnit, total: Float, processes: Float, processes_used: Float, system: Float, atom: Float, atom_used: Float, binary: Float, code: Float, ets: Float, )
pub type ClusterNodeStats {
ClusterNodeStats(self: String, nodes: List(String))
}
Constructors
-
ClusterNodeStats(self: String, nodes: List(String))
OS-level CPU stats: util is busy percentage since the previous sample
(0-100); load1/load5/load15 are the 1/5/15-minute load averages.
pub type HostCpuStats {
HostCpuStats(
util: Float,
load1: Float,
load5: Float,
load15: Float,
)
}
Constructors
-
HostCpuStats( util: Float, load1: Float, load5: Float, load15: Float, )
pub type HostDiskStats {
HostDiskStats(
status: HostProbeStatus,
unit: MemoryUnit,
total: Float,
used: Float,
available: Float,
)
}
Constructors
-
HostDiskStats( status: HostProbeStatus, unit: MemoryUnit, total: Float, used: Float, available: Float, )
pub type HostMemoryStats {
HostMemoryStats(
status: HostProbeStatus,
unit: MemoryUnit,
total: Float,
used: Float,
available: Float,
)
}
Constructors
-
HostMemoryStats( status: HostProbeStatus, unit: MemoryUnit, total: Float, used: Float, available: Float, )
OS-level network throughput, summed across non-loopback interfaces and
expressed as per-second rates derived from /proc/net/dev counters.
pub type HostNetworkStats {
HostNetworkStats(
rx_bytes_per_sec: Float,
tx_bytes_per_sec: Float,
rx_packets_per_sec: Float,
tx_packets_per_sec: Float,
)
}
Constructors
-
HostNetworkStats( rx_bytes_per_sec: Float, tx_bytes_per_sec: Float, rx_packets_per_sec: Float, tx_packets_per_sec: Float, )
Status of a scaffolded host probe: Implemented once a real probe lands,
Unimplemented while the host module is a placeholder.
pub type HostProbeStatus {
Implemented
Unimplemented
}
Constructors
-
Implemented -
Unimplemented
pub type Measurement {
BeamMemory(BeamMemoryStats)
BeamRunQueues(RunQueueStats)
BeamSystemCounts(SystemCountStats)
BeamPersistentTerm(PersistentTermStats)
ProcessInfo(ProcessInfoStats)
ClusterNodes(ClusterNodeStats)
HostMemory(HostMemoryStats)
HostDisk(HostDiskStats)
HostCpu(HostCpuStats)
HostNetwork(HostNetworkStats)
BeamScheduler(SchedulerStats)
BeamReductions(ReductionStats)
}
Constructors
-
BeamMemory(BeamMemoryStats) -
BeamRunQueues(RunQueueStats) -
BeamSystemCounts(SystemCountStats) -
BeamPersistentTerm(PersistentTermStats) -
ProcessInfo(ProcessInfoStats) -
ClusterNodes(ClusterNodeStats) -
HostMemory(HostMemoryStats) -
HostDisk(HostDiskStats) -
HostCpu(HostCpuStats) -
HostNetwork(HostNetworkStats) -
BeamScheduler(SchedulerStats) -
BeamReductions(ReductionStats)
Unit to express BEAM memory values in. Raw erlang:memory/0 returns
bytes; decode_with_unit/2 scales them to the requested unit.
pub type MemoryUnit {
Kb
Mb
Gb
}
Constructors
-
Kb -
Mb -
Gb
pub type PersistentTermStats {
PersistentTermStats(
count: Int,
unit: MemoryUnit,
memory: Float,
)
}
Constructors
-
PersistentTermStats(count: Int, unit: MemoryUnit, memory: Float)
pub type ProcessInfoStats {
ProcessInfoStats(
name: atom.Atom,
info: dict.Dict(atom.Atom, dynamic.Dynamic),
)
}
Constructors
-
ProcessInfoStats( name: atom.Atom, info: dict.Dict(atom.Atom, dynamic.Dynamic), )
BEAM reduction count executed during the last polling interval, from the
“since last call” element of erlang:statistics(reductions).
pub type ReductionStats {
ReductionStats(count: Int)
}
Constructors
-
ReductionStats(count: Int)
pub type RunQueueStats {
RunQueueStats(total: Int, cpu: Int, io: Int)
}
Constructors
-
RunQueueStats(total: Int, cpu: Int, io: Int)
BEAM scheduler utilisation: busy percentage (0-100) across all schedulers
since the previous sample, from erlang:statistics(scheduler_wall_time).
pub type SchedulerStats {
SchedulerStats(utilization: Float)
}
Constructors
-
SchedulerStats(utilization: Float)
pub type SystemCountStats {
SystemCountStats(
process_count: Int,
atom_count: Int,
port_count: Int,
process_limit: Int,
atom_limit: Int,
port_limit: Int,
)
}
Constructors
-
SystemCountStats( process_count: Int, atom_count: Int, port_count: Int, process_limit: Int, atom_limit: Int, port_limit: Int, )
A telemetry event as dispatched by telemetry:execute/3.
pub type TelemetryEvent {
TelemetryEvent(
name: List(atom.Atom),
measurements: dict.Dict(atom.Atom, dynamic.Dynamic),
metadata: dict.Dict(atom.Atom, dynamic.Dynamic),
)
}
Constructors
-
TelemetryEvent( name: List(atom.Atom), measurements: dict.Dict(atom.Atom, dynamic.Dynamic), metadata: dict.Dict(atom.Atom, dynamic.Dynamic), )
Values
pub fn decode(
event: TelemetryEvent,
) -> Result(Measurement, String)
Decode a TelemetryEvent into a typed Measurement, scaling any memory
values to Mb by default.
pub fn decode_with_unit(
event: TelemetryEvent,
unit: MemoryUnit,
) -> Result(Measurement, String)
Decode a TelemetryEvent into a typed Measurement, scaling any memory
values to unit.