kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/5] kudu git commit: log block manager: convert container metrics from counters to gauges
Date Thu, 11 May 2017 00:44:24 GMT
log block manager: convert container metrics from counters to gauges

Container deletion is just around the corner, so these metrics need to
become gauges so that they can be decremented.

As an aside, it's possible that we've already been mishandling these
counters: they should never drop in value, even across restarts, and we were
incrementing them every time a container was reopened at startup. However,
we may have been OK because the block manager loads before the web UI, so by
the time the metrics are fetchable, the counter values should be the same as
what they were pre-restart.

Change-Id: I343d99d42da7f4fbc0facb476c97f2ca8785031d
Reviewed-on: http://gerrit.cloudera.org:8080/6823
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <todd@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/501e4cd7
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/501e4cd7
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/501e4cd7

Branch: refs/heads/master
Commit: 501e4cd71d9f861a6fd05cadd1717ec4c220b324
Parents: f058049
Author: Adar Dembo <adar@cloudera.com>
Authored: Fri May 5 14:03:37 2017 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Thu May 11 00:43:42 2017 +0000

----------------------------------------------------------------------
 src/kudu/fs/log_block_manager-test.cc |  8 +++----
 src/kudu/fs/log_block_manager.cc      | 38 ++++++++++++------------------
 2 files changed, 19 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/501e4cd7/src/kudu/fs/log_block_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/log_block_manager-test.cc b/src/kudu/fs/log_block_manager-test.cc
index a193ff6..1118fb2 100644
--- a/src/kudu/fs/log_block_manager-test.cc
+++ b/src/kudu/fs/log_block_manager-test.cc
@@ -52,8 +52,8 @@ DECLARE_uint64(log_container_max_size);
 // Log block manager metrics.
 METRIC_DECLARE_gauge_uint64(log_block_manager_bytes_under_management);
 METRIC_DECLARE_gauge_uint64(log_block_manager_blocks_under_management);
-METRIC_DECLARE_counter(log_block_manager_containers);
-METRIC_DECLARE_counter(log_block_manager_full_containers);
+METRIC_DECLARE_gauge_uint64(log_block_manager_containers);
+METRIC_DECLARE_gauge_uint64(log_block_manager_full_containers);
 
 namespace kudu {
 namespace fs {
@@ -185,10 +185,10 @@ static void CheckLogMetrics(const scoped_refptr<MetricEntity>&
entity,
   ASSERT_EQ(blocks_under_management, down_cast<AtomicGauge<uint64_t>*>(
                 entity->FindOrNull(METRIC_log_block_manager_blocks_under_management)
                 .get())->value());
-  ASSERT_EQ(containers, down_cast<Counter*>(
+  ASSERT_EQ(containers, down_cast<AtomicGauge<uint64_t>*>(
                 entity->FindOrNull(METRIC_log_block_manager_containers)
                 .get())->value());
-  ASSERT_EQ(full_containers, down_cast<Counter*>(
+  ASSERT_EQ(full_containers, down_cast<AtomicGauge<uint64_t>*>(
                 entity->FindOrNull(METRIC_log_block_manager_full_containers)
                 .get())->value());
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/501e4cd7/src/kudu/fs/log_block_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/log_block_manager.cc b/src/kudu/fs/log_block_manager.cc
index dd181c9..d804e70 100644
--- a/src/kudu/fs/log_block_manager.cc
+++ b/src/kudu/fs/log_block_manager.cc
@@ -99,21 +99,15 @@ METRIC_DEFINE_gauge_uint64(server, log_block_manager_blocks_under_management,
                            kudu::MetricUnit::kBlocks,
                            "Number of data blocks currently under management");
 
-METRIC_DEFINE_counter(server, log_block_manager_containers,
-                      "Number of Block Containers",
-                      kudu::MetricUnit::kLogBlockContainers,
-                      "Number of log block containers");
-
-METRIC_DEFINE_counter(server, log_block_manager_full_containers,
-                      "Number of Full Block Counters",
-                      kudu::MetricUnit::kLogBlockContainers,
-                      "Number of full log block containers");
-
-METRIC_DEFINE_counter(server, log_block_manager_unavailable_containers,
-                      "Number of Unavailable Log Block Containers",
-                      kudu::MetricUnit::kLogBlockContainers,
-                      "Number of non-full log block containers that are under root paths
"
-                      "whose disks are full");
+METRIC_DEFINE_gauge_uint64(server, log_block_manager_containers,
+                           "Number of Block Containers",
+                           kudu::MetricUnit::kLogBlockContainers,
+                           "Number of log block containers");
+
+METRIC_DEFINE_gauge_uint64(server, log_block_manager_full_containers,
+                           "Number of Full Block Containers",
+                           kudu::MetricUnit::kLogBlockContainers,
+                           "Number of full log block containers");
 
 namespace kudu {
 
@@ -148,24 +142,22 @@ struct LogBlockManagerMetrics {
   // Implementation-agnostic metrics.
   BlockManagerMetrics generic_metrics;
 
-  scoped_refptr<AtomicGauge<uint64_t> > bytes_under_management;
-  scoped_refptr<AtomicGauge<uint64_t> > blocks_under_management;
+  scoped_refptr<AtomicGauge<uint64_t>> bytes_under_management;
+  scoped_refptr<AtomicGauge<uint64_t>> blocks_under_management;
 
-  scoped_refptr<Counter> containers;
-  scoped_refptr<Counter> full_containers;
+  scoped_refptr<AtomicGauge<uint64_t>> containers;
+  scoped_refptr<AtomicGauge<uint64_t>> full_containers;
 };
 
-#define MINIT(x) x(METRIC_log_block_manager_##x.Instantiate(metric_entity))
 #define GINIT(x) x(METRIC_log_block_manager_##x.Instantiate(metric_entity, 0))
 LogBlockManagerMetrics::LogBlockManagerMetrics(const scoped_refptr<MetricEntity>&
metric_entity)
   : generic_metrics(metric_entity),
     GINIT(bytes_under_management),
     GINIT(blocks_under_management),
-    MINIT(containers),
-    MINIT(full_containers) {
+    GINIT(containers),
+    GINIT(full_containers) {
 }
 #undef GINIT
-#undef MINIT
 
 ////////////////////////////////////////////////////////////
 // LogBlock (declaration)


Mime
View raw message