From c833b1c013950feec6e580d0864cd2961f1fdfba Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 1 Sep 2024 21:53:27 +0800 Subject: [PATCH] Doc: update doc of heartbeat metric --- openraft/src/metrics/mod.rs | 4 ++-- openraft/src/metrics/raft_metrics.rs | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openraft/src/metrics/mod.rs b/openraft/src/metrics/mod.rs index 16ba028be..b0c191adf 100644 --- a/openraft/src/metrics/mod.rs +++ b/openraft/src/metrics/mod.rs @@ -53,6 +53,6 @@ use crate::type_config::alias::NodeIdOf; use crate::type_config::alias::SerdeInstantOf; pub(crate) type ReplicationMetrics = BTreeMap, Option>>; -/// 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 = BTreeMap, Option>>; diff --git a/openraft/src/metrics/raft_metrics.rs b/openraft/src/metrics/raft_metrics.rs index 9a3e8638f..2dcca9d53 100644 --- a/openraft/src/metrics/raft_metrics.rs +++ b/openraft/src/metrics/raft_metrics.rs @@ -98,11 +98,12 @@ pub struct RaftMetrics { /// 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>, // --- @@ -227,11 +228,12 @@ pub struct RaftDataMetrics { /// 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>, }