This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch fix_some_metrics_type
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit d228425ccd03a7a7d01082c9531e4a0e9a822a24
Author: Yingchun Lai <[email protected]>
AuthorDate: Thu Dec 19 16:46:46 2019 +0800

    [metrics] Modify metrics 'raft_term' and 'time_since_last_leader_heartbeat' 
to MAX merge type
---
 src/kudu/consensus/raft_consensus.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/kudu/consensus/raft_consensus.cc 
b/src/kudu/consensus/raft_consensus.cc
index c473d13..0a1942d 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -238,7 +238,9 @@ Status RaftConsensus::Start(const ConsensusBootstrapInfo& 
info,
   round_handler_ = DCHECK_NOTNULL(round_handler);
   mark_dirty_clbk_ = std::move(mark_dirty_clbk);
 
-  term_metric_ = metric_entity->FindOrCreateGauge(&METRIC_raft_term, 
CurrentTerm());
+  term_metric_ = metric_entity->FindOrCreateGauge(&METRIC_raft_term,
+                                                  CurrentTerm(),
+                                                  MergeType::kMax);
   follower_memory_pressure_rejections_ =
       
metric_entity->FindOrCreateCounter(&METRIC_follower_memory_pressure_rejections);
 
@@ -247,7 +249,9 @@ Status RaftConsensus::Start(const ConsensusBootstrapInfo& 
info,
                                        failed_elections_since_stable_leader_);
 
   METRIC_time_since_last_leader_heartbeat.InstantiateFunctionGauge(
-    metric_entity, Bind(&RaftConsensus::GetMillisSinceLastLeaderHeartbeat, 
Unretained(this)))
+      metric_entity,
+      Bind(&RaftConsensus::GetMillisSinceLastLeaderHeartbeat, 
Unretained(this)),
+      MergeType::kMax)
     ->AutoDetach(&metric_detacher_);
 
   // A single Raft thread pool token is shared between RaftConsensus and

Reply via email to