1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Raft metrics for observability.
//!
//! 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. Applications may also
//! use this data to trigger events within higher levels of the parent application.
//!
//! Metrics are observed on a running Raft node via the [`Raft::metrics() ->
//! watch::Receiver<RaftMetrics>`](`crate::Raft::metrics`) method, which will return a stream of
//! metrics.
//!
//!
//! ## [`RaftMetrics`]
//!
//! [`RaftMetrics`] contains useful information such as:
//!
//! - Server state(leader/follower/learner/candidate) of this raft node,
//! - The current leader,
//! - Last log and applied log.
//! - Replication state, if this node is a Leader,
//! - Snapshot state,
//! - etc.
//!
//! Metrics can be used as a trigger of application events, as a monitoring data
//! source, etc.
//!
//! Metrics is not a stream thus it only guarantees to provide the latest state but
//! not every change of the state.
//! Because internally, `watch::channel()` only stores one last state.
use BTreeMap;
pub use Metric;
pub use RaftDataMetrics;
pub use RaftMetrics;
pub use RaftServerMetrics;
pub use Wait;
pub use WaitError;
pub use Condition;
use crateLogId;
pub type ReplicationMetrics<NID> = ;