portunus_counters (portunus v0.8.0)
View SourceOperational metrics for portunus, backed by seshat (one counter set
per node, per cluster).
Gauges are published per node by the machine's handle_aux/5 on each tick
(set_gauges/2), so every member reports its own view, not the leader's.
is_leader and leader_changes_total come from the machine's state_enter/2,
which fires on every member. Counters are bumped via incr/2 from the leader's
apply effects, never inside apply/3, which runs on every replica and would
N-fold over-count. The one exception is
failures_due_to_lack_of_online_quorum_total, bumped on the client side when
a command or query cannot be served because the Raft cluster has no online
majority, and so never reaches the machine.
Summary
Functions
Ensure a counter set exists for Cluster on this node. Returns its ref.
Bump a counter by one. Safe to call as a leader-only mod_call effect.
Create the seshat group and register the field spec. Idempotent.
Snapshot all counters for Cluster on this node.
Set a single gauge to Value.
Set gauges from a map of gauge field name to value.
Functions
-spec ensure(atom()) -> counters:counters_ref().
Ensure a counter set exists for Cluster on this node. Returns its ref.
Bump a counter by one. Safe to call as a leader-only mod_call effect.
-spec init() -> ok.
Create the seshat group and register the field spec. Idempotent.
Snapshot all counters for Cluster on this node.
Set a single gauge to Value.
Set gauges from a map of gauge field name to value.