PhiAccrual.Estimator
(phi_accrual v1.0.0)
View Source
Per-node estimator GenServer.
Each monitored node has its own estimator process, registered in
PhiAccrual.Registry under the node atom and supervised under
PhiAccrual.EstimatorSupervisor. Isolating per-node state means
one slow node's scheduling hiccups cannot block observations for
other nodes — a single shared GenServer would serialise every
observation behind one mailbox.
On a configurable tick (:phi_tick_ms, default 1_000) the estimator
emits a [:phi_accrual, :phi, :computed] telemetry event carrying
the current φ and state classification. Set phi_tick_ms: nil to
disable the gauge stream; consumers can still poll phi/1 directly.
phi is 0.0 when state is :insufficient_data or :stale;
consumers should filter on state if they want to graph only
meaningful values.
Summary
Functions
Return the current PhiAccrual.Core estimator state for node. Intended
for debugging and introspection — not for hot-path use.
Lower-level φ query. Most callers should use PhiAccrual.phi/1 instead,
which forwards here via the Registry.
Start an estimator process for a single node. Normally called via
PhiAccrual.track/2; use directly only when you need to inject a custom
:clock_fn (e.g., in tests).
Return the pid of the estimator tracking node, or nil if not tracked.
Types
@type start_opts() :: [ node: node(), core_opts: keyword(), clock_fn: (-> integer()), phi_tick_ms: pos_integer() | nil ]
Functions
@spec core_state(node()) :: PhiAccrual.Core.t() | {:error, :not_tracked}
Return the current PhiAccrual.Core estimator state for node. Intended
for debugging and introspection — not for hot-path use.
@spec phi(node()) :: PhiAccrual.Core.phi_result() | {:error, :not_tracked}
Lower-level φ query. Most callers should use PhiAccrual.phi/1 instead,
which forwards here via the Registry.
@spec start_link(start_opts()) :: GenServer.on_start()
Start an estimator process for a single node. Normally called via
PhiAccrual.track/2; use directly only when you need to inject a custom
:clock_fn (e.g., in tests).
Return the pid of the estimator tracking node, or nil if not tracked.