You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/03/02 09:19:51 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #2995: HBASE-25460 : Expose drainingServers as cluster metric

virajjasani commented on a change in pull request #2995:
URL: https://github.com/apache/hbase/pull/2995#discussion_r585375638



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterWrapperImpl.java
##########
@@ -138,6 +138,24 @@ public int getNumDeadRegionServers() {
     return !(master.isStopped() || master.isStopping());
   }
 
+  @Override
+  public String getDrainingRegionServers() {
+    ServerManager serverManager = this.master.getServerManager();
+    if (serverManager == null) {
+        return "";
+    }
+    return StringUtils.join(serverManager.getDrainingServersList()  , ";");
+  }
+
+  @Override
+  public int getNumDrainingRegionServers() {
+    ServerManager serverManager = this.master.getServerManager();
+	if (serverManager == null) {
+	     return 0;
+	}
+	return serverManager.getDrainingServersList().size();
+  }
+

Review comment:
       nit: good to reformat this code once for alignment

##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java
##########
@@ -133,6 +133,7 @@ public void testDefaultMasterMetrics() throws Exception {
     metricsHelper.assertGauge("numRegionServers", 1 + (tablesOnMaster ? 1 : 0), masterSource);
     metricsHelper.assertGauge("averageLoad", 1, masterSource);
     metricsHelper.assertGauge("numDeadRegionServers", 0, masterSource);
+    metricsHelper.assertGauge( "numDrainingRegionServers", 0, masterSource);

Review comment:
       nit: reformat?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org