[][src]Module actix_raft::metrics

Raft metrics for observability.

The RaftMetrics type derives the actix::Message type, so applications are expected to implement a handler for receiving these metrics, and then should pass its actix::Receiver<RaftMetrics> to the Raft instance constructor when starting a Raft node.

The RaftMetrics type holds the baseline metrics on the state of the Raft node the metrics are coming from, its current role in the cluster, its current membership config, as well as information on the Raft log and the last index to be applied to the state machine.

Applications may use this data in whatever way is needed. The obvious use cases are to expose these metrics to a metrics collection system like Prometheus or Influx. Applications may also use this data to trigger events within higher levels of the parent application.

Metrics will be exported at a regular interval according to the Config.metrics_rate value, but will also emit a new metrics record any time the state of the Raft node changes, the membership_config changes, or the current_leader changes.

Structs

RaftMetrics

Baseline metrics of the current state of the subject Raft node.

Enums

State

All possible states of a Raft node.