Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: update doc of heartbeat metric #1241

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading