hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [03/10] hbase git commit: HBASE-15662 Hook up JvmPauseMonitor to REST server
Date Thu, 21 Apr 2016 01:45:57 GMT
HBASE-15662 Hook up JvmPauseMonitor to REST server


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/81e654b0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/81e654b0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/81e654b0

Branch: refs/heads/0.98
Commit: 81e654b046fb8e062f8a2068d64ce8a0bb3d498d
Parents: d270220
Author: Andrew Purtell <apurtell@apache.org>
Authored: Mon Apr 18 14:06:17 2016 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Wed Apr 20 15:22:50 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/rest/MetricsRESTSource.java    |  3 +-
 .../hbase/rest/MetricsRESTSourceImpl.java       | 35 ++++++++++++++++++++
 .../hbase/rest/MetricsRESTSourceImpl.java       | 35 ++++++++++++++++++++
 .../apache/hadoop/hbase/rest/RESTServlet.java   |  9 ++++-
 4 files changed, 80 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/81e654b0/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSource.java
index 4ecd73b..ceec41d 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSource.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSource.java
@@ -19,11 +19,12 @@
 package org.apache.hadoop.hbase.rest;
 
 import org.apache.hadoop.hbase.metrics.BaseSource;
+import org.apache.hadoop.hbase.metrics.JvmPauseMonitorSource;
 
 /**
  * Interface of the Metrics Source that will export data to Hadoop's Metrics2 system.
  */
-public interface MetricsRESTSource extends BaseSource {
+public interface MetricsRESTSource extends BaseSource, JvmPauseMonitorSource {
 
   String METRICS_NAME = "REST";
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/81e654b0/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
index 64316bb..b05922d 100644
--- a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
+++ b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hbase.rest;
 
 import org.apache.hadoop.hbase.metrics.BaseSourceImpl;
+import org.apache.hadoop.metrics2.MetricHistogram;
 import org.apache.hadoop.metrics2.lib.MetricMutableCounterLong;
 
 /**
@@ -39,6 +40,12 @@ public class MetricsRESTSourceImpl extends BaseSourceImpl implements MetricsREST
   private MetricMutableCounterLong fDel;
   private MetricMutableCounterLong fScan;
 
+  // pause monitor metrics
+  private final MetricMutableCounterLong infoPauseThresholdExceeded;
+  private final MetricMutableCounterLong warnPauseThresholdExceeded;
+  private final MetricHistogram pausesWithGc;
+  private final MetricHistogram pausesWithoutGc;
+
   public MetricsRESTSourceImpl() {
     this(METRICS_NAME, METRICS_DESCRIPTION, CONTEXT, JMX_CONTEXT);
   }
@@ -48,6 +55,14 @@ public class MetricsRESTSourceImpl extends BaseSourceImpl implements MetricsREST
                                String metricsContext,
                                String metricsJmxContext) {
     super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
+
+    // pause monitor metrics
+    infoPauseThresholdExceeded = getMetricsRegistry().newCounter(INFO_THRESHOLD_COUNT_KEY,
+      INFO_THRESHOLD_COUNT_DESC, 0L);
+    warnPauseThresholdExceeded = getMetricsRegistry().newCounter(WARN_THRESHOLD_COUNT_KEY,
+      WARN_THRESHOLD_COUNT_DESC, 0L);
+    pausesWithGc = getMetricsRegistry().newTimeHistogram(PAUSE_TIME_WITH_GC_KEY);
+    pausesWithoutGc = getMetricsRegistry().newTimeHistogram(PAUSE_TIME_WITHOUT_GC_KEY);
   }
 
   @Override
@@ -110,4 +125,24 @@ public class MetricsRESTSourceImpl extends BaseSourceImpl implements
MetricsREST
   public void incrementFailedScanRequests(int inc) {
     fScan.incr(inc);
   }
+
+  @Override
+  public void incInfoThresholdExceeded(int count) {
+    infoPauseThresholdExceeded.incr(count);
+  }
+
+  @Override
+  public void incWarnThresholdExceeded(int count) {
+    warnPauseThresholdExceeded.incr(count);
+  }
+
+  @Override
+  public void updatePauseTimeWithGc(long t) {
+    pausesWithGc.add(t);
+  }
+
+  @Override
+  public void updatePauseTimeWithoutGc(long t) {
+    pausesWithoutGc.add(t);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/81e654b0/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
index 9eae18b..c0af045 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/rest/MetricsRESTSourceImpl.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.rest;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.metrics.BaseSourceImpl;
+import org.apache.hadoop.metrics2.MetricHistogram;
 import org.apache.hadoop.metrics2.lib.MutableCounterLong;
 
 /**
@@ -41,6 +42,12 @@ public class MetricsRESTSourceImpl extends BaseSourceImpl implements MetricsREST
   private MutableCounterLong fDel;
   private MutableCounterLong fScan;
 
+  // pause monitor metrics
+  private final MutableCounterLong infoPauseThresholdExceeded;
+  private final MutableCounterLong warnPauseThresholdExceeded;
+  private final MetricHistogram pausesWithGc;
+  private final MetricHistogram pausesWithoutGc;
+
   public MetricsRESTSourceImpl() {
     this(METRICS_NAME, METRICS_DESCRIPTION, CONTEXT, JMX_CONTEXT);
   }
@@ -50,6 +57,14 @@ public class MetricsRESTSourceImpl extends BaseSourceImpl implements MetricsREST
                                String metricsContext,
                                String metricsJmxContext) {
     super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
+
+    // pause monitor metrics
+    infoPauseThresholdExceeded = getMetricsRegistry().newCounter(INFO_THRESHOLD_COUNT_KEY,
+      INFO_THRESHOLD_COUNT_DESC, 0L);
+    warnPauseThresholdExceeded = getMetricsRegistry().newCounter(WARN_THRESHOLD_COUNT_KEY,
+      WARN_THRESHOLD_COUNT_DESC, 0L);
+    pausesWithGc = getMetricsRegistry().newTimeHistogram(PAUSE_TIME_WITH_GC_KEY);
+    pausesWithoutGc = getMetricsRegistry().newTimeHistogram(PAUSE_TIME_WITHOUT_GC_KEY);
   }
 
   @Override
@@ -112,4 +127,24 @@ public class MetricsRESTSourceImpl extends BaseSourceImpl implements
MetricsREST
   public void incrementFailedScanRequests(int inc) {
    fScan.incr(inc);
   }
+
+  @Override
+  public void incInfoThresholdExceeded(int count) {
+    infoPauseThresholdExceeded.incr(count);
+  }
+
+  @Override
+  public void incWarnThresholdExceeded(int count) {
+    warnPauseThresholdExceeded.incr(count);
+  }
+
+  @Override
+  public void updatePauseTimeWithGc(long t) {
+    pausesWithGc.add(t);
+  }
+
+  @Override
+  public void updatePauseTimeWithoutGc(long t) {
+    pausesWithoutGc.add(t);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/81e654b0/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
index a98663e..7e65b2a 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.security.UserProvider;
 import org.apache.hadoop.hbase.util.ConnectionCache;
+import org.apache.hadoop.hbase.util.JvmPauseMonitor;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.authorize.ProxyUsers;
 
@@ -36,9 +37,10 @@ import org.apache.hadoop.security.authorize.ProxyUsers;
 public class RESTServlet implements Constants {
   private static RESTServlet INSTANCE;
   private final Configuration conf;
-  private final MetricsREST metrics = new MetricsREST();
+  private final MetricsREST metrics;
   private final ConnectionCache connectionCache;
   private final UserGroupInformation realUser;
+  private final JvmPauseMonitor pauseMonitor;
 
   static final String CLEANUP_INTERVAL = "hbase.rest.connection.cleanup-interval";
   static final String MAX_IDLETIME = "hbase.rest.connection.max-idletime";
@@ -92,6 +94,11 @@ public class RESTServlet implements Constants {
     if (supportsProxyuser()) {
       ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
     }
+
+    metrics = new MetricsREST();
+
+    pauseMonitor = new JvmPauseMonitor(conf, metrics.getSource());
+    pauseMonitor.start();
   }
 
   HBaseAdmin getAdmin() throws IOException {


Mime
View raw message