Skip to content

Commit

Permalink
Doc: update doc of heartbeat metric
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC authored and drmingdrmer committed Sep 1, 2024
1 parent 8cde48f commit 0063194
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions openraft/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ use crate::type_config::alias::NodeIdOf;
use crate::type_config::alias::SerdeInstantOf;

pub(crate) type ReplicationMetrics<C> = BTreeMap<NodeIdOf<C>, Option<LogIdOf<C>>>;
/// Heartbeat metrics, a mapping between a node's ID and milliseconds since the
/// last acknowledged heartbeat or replication to this node.
/// Heartbeat metrics, a mapping between a node's ID and the time of the last
/// acknowledged heartbeat or replication to this node.
pub(crate) type HeartbeatMetrics<C> = BTreeMap<NodeIdOf<C>, Option<SerdeInstantOf<C>>>;
18 changes: 10 additions & 8 deletions openraft/src/metrics/raft_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ pub struct RaftMetrics<C: RaftTypeConfig> {

/// Heartbeat metrics. It is Some() only when this node is leader.
///
/// This field records a mapping between a node's ID and milliseconds since
/// the last acknowledged heartbeat or replication to this node.
/// This field records a mapping between a node's ID and the time of the
/// last acknowledged heartbeat or replication to this node.
///
/// This duration can be used by applications to guess if a follwer/learner
/// node is offline, longer duration suggests higher possibility of that.
/// This duration since the recorded time can be used by applications to
/// guess if a follwer/learner node is offline, longer duration suggests
/// higher possibility of that.
pub heartbeat: Option<HeartbeatMetrics<C>>,

// ---
Expand Down Expand Up @@ -227,11 +228,12 @@ pub struct RaftDataMetrics<C: RaftTypeConfig> {

/// Heartbeat metrics. It is Some() only when this node is leader.
///
/// This field records a mapping between a node's ID and milliseconds since
/// the last acknowledged heartbeat or replication to this node.
/// This field records a mapping between a node's ID and the time of the
/// last acknowledged heartbeat or replication to this node.
///
/// This duration can be used by applications to guess if a follwer/learner
/// node is offline, longer duration suggests higher possibility of that.
/// This duration since the recorded time can be used by applications to
/// guess if a follwer/learner node is offline, longer duration suggests
/// higher possibility of that.
pub heartbeat: Option<HeartbeatMetrics<C>>,
}

Expand Down

0 comments on commit 0063194

Please sign in to comment.