pharos/probe
Custom monitoring probes - the pluggable lane of pharos.
The built-in Statistic / Measurement / Threshold enums cover BEAM
and host signals. A Probe opens the same poll → decode → threshold →
alert pipeline to any signal a caller can express, without modifying
pharos: it bundles how to poll (a Source), the telemetry event it
emits, and how to decode that event into named numeric readings
(MetricSample). ProbeThresholds compare a single sample field against
a limit and feed the same soak/cool alert machinery the BEAM lane uses.
This is what lets a consumer such as logothetes monitor MicroVMs:
register a probe whose Source points at an emitter that reads
/proc/<pid> and telemetry:executes the readings, plus thresholds over
the decoded fields.
Types
Comparison applied by a ProbeThreshold to a sample field.
pub type Comparison {
Above(limit: Float)
Below(limit: Float)
}
Constructors
-
Above(limit: Float) -
Below(limit: Float)
A single probe reading reduced to named numeric scalars (field -> value).
Thresholds select a field by name and compare it against a limit.
pub type MetricSample =
dict.Dict(String, Float)
A threshold over one field of a probe’s MetricSample.
pub type ProbeThreshold {
ProbeThreshold(
probe_id: String,
field: String,
comparison: Comparison,
level: alert.AlertLevel,
)
}
Constructors
-
ProbeThreshold( probe_id: String, field: String, comparison: Comparison, level: alert.AlertLevel, )Arguments
- probe_id
-
The
Probe.idwhose sample this threshold reads. - field
-
Which
MetricSamplekey to compare. - comparison
-
How to compare the field value against the limit.
- level
-
Severity carried in
AlertFiringevents for this threshold.
How telemetry_poller drives a probe.
CustomMfa lowers to the poller’s {module, function, args} measurement:
the function is invoked every polling cycle and is expected to call
telemetry:execute/3 itself with the probe’s event name.
pub type Source {
CustomMfa(
module: atom.Atom,
function: atom.Atom,
args: List(dynamic.Dynamic),
)
}
Constructors
-
CustomMfa( module: atom.Atom, function: atom.Atom, args: List(dynamic.Dynamic), )
Values
pub fn decode(
probe: Probe,
event: measurement.TelemetryEvent,
) -> Result(dict.Dict(String, Float), String)
Decode a raw telemetry event into a MetricSample using the probe’s
decoder.
pub fn interval_ms(probe: Probe) -> Int
The probe’s polling interval in milliseconds.
pub fn new(
id id: String,
event_name event_name: List(atom.Atom),
interval_ms interval_ms: Int,
source source: Source,
decode decode: fn(measurement.TelemetryEvent) -> Result(
dict.Dict(String, Float),
String,
),
) -> Probe
Define a probe.
id- stable identifier, referenced byProbeThreshold.probe_id.event_name- the telemetry event thesourceemits (e.g.[atom.create("logothetes"), atom.create("vm"), atom.create("metrics")]).interval_ms- how often to poll.source- how the reading is produced.decode- lift the raw telemetry event into aMetricSample.
pub fn threshold_id(threshold: ProbeThreshold) -> String
Stable string id derived from a probe threshold. Used to register the
per-threshold alert manager under a deterministic name (mirrors
config.threshold_id for the BEAM lane).