You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/12/21 00:08:51 UTC

[kudu] 02/02: [metrics] Modify metrics 'raft_term' and 'time_since_last_leader_heartbeat' to MAX merge type

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

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

commit ac960b220e6e80ee427c6dc747d66c8cf7c4f956
Author: Yingchun Lai <40...@qq.com>
AuthorDate: Thu Dec 19 16:52:08 2019 +0800

    [metrics] Modify metrics 'raft_term' and 'time_since_last_leader_heartbeat' to MAX merge type
    
    Change-Id: I915e4a4121175ff58bd814090f67fe99edef7141
    Reviewed-on: http://gerrit.cloudera.org:8080/14933
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 src/kudu/consensus/raft_consensus.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/kudu/consensus/raft_consensus.cc b/src/kudu/consensus/raft_consensus.cc
index c473d13..77966e4 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -31,7 +31,6 @@
 
 #include <boost/optional/optional.hpp>
 #include <gflags/gflags.h>
-#include <gflags/gflags_declare.h>
 #include <google/protobuf/util/message_differencer.h>
 
 #include "kudu/common/timestamp.h"
@@ -238,7 +237,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 +248,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