This is an automated email from the ASF dual-hosted git repository.
pankajkumar pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 63b17d1 HBASE-26154: Adds exception metrics for
QuotaExceededException and RpcThrottlingException (#3546)
63b17d1 is described below
commit 63b17d16745cd146432c87b187603144c198e2b2
Author: Bryan Beaudreault <[email protected]>
AuthorDate: Mon Aug 2 05:49:59 2021 -0400
HBASE-26154: Adds exception metrics for QuotaExceededException and
RpcThrottlingException (#3546)
Signed-off-by: Xiaolin Ha <[email protected]>
Signed-off-by: Pankaj Kumar<[email protected]>
---
.../hadoop/hbase/metrics/ExceptionTrackingSource.java | 4 ++++
.../hbase/metrics/ExceptionTrackingSourceImpl.java | 16 ++++++++++++++++
.../hadoop/hbase/test/MetricsAssertHelperImpl.java | 2 +-
.../org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java | 12 ++++++++++++
.../org/apache/hadoop/hbase/thrift/ThriftMetrics.java | 11 +++++++++++
.../hadoop/hbase/thrift/ErrorThrowingGetObserver.java | 10 +++++++++-
6 files changed, 53 insertions(+), 2 deletions(-)
diff --git
a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSource.java
index 53d3d18..6d72d85 100644
---
a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSource.java
+++
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSource.java
@@ -41,6 +41,8 @@ public interface ExceptionTrackingSource extends BaseSource {
"rest of the requests will have to be retried.";
String EXCEPTIONS_CALL_QUEUE_TOO_BIG = "exceptions.callQueueTooBig";
String EXCEPTIONS_CALL_QUEUE_TOO_BIG_DESC = "Call queue is full";
+ String EXCEPTIONS_QUOTA_EXCEEDED = "exceptions.quotaExceeded";
+ String EXCEPTIONS_RPC_THROTTLING = "exceptions.rpcThrottling";
void exception();
@@ -56,4 +58,6 @@ public interface ExceptionTrackingSource extends BaseSource {
void tooBusyException();
void multiActionTooLargeException();
void callQueueTooBigException();
+ void quotaExceededException();
+ void rpcThrottlingException();
}
diff --git
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
index 3af27d8..23dafad 100644
---
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
+++
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
@@ -38,6 +38,8 @@ public class ExceptionTrackingSourceImpl extends
BaseSourceImpl
protected MutableFastCounter exceptionsMoved;
protected MutableFastCounter exceptionsMultiTooLarge;
protected MutableFastCounter exceptionsCallQueueTooBig;
+ protected MutableFastCounter exceptionsQuotaExceeded;
+ protected MutableFastCounter exceptionsRpcThrottling;
public ExceptionTrackingSourceImpl(String metricsName, String
metricsDescription,
String metricsContext, String
metricsJmxContext) {
@@ -66,6 +68,10 @@ public class ExceptionTrackingSourceImpl extends
BaseSourceImpl
.newCounter(EXCEPTIONS_MULTI_TOO_LARGE_NAME,
EXCEPTIONS_MULTI_TOO_LARGE_DESC, 0L);
this.exceptionsCallQueueTooBig = this.getMetricsRegistry()
.newCounter(EXCEPTIONS_CALL_QUEUE_TOO_BIG,
EXCEPTIONS_CALL_QUEUE_TOO_BIG_DESC, 0L);
+ this.exceptionsQuotaExceeded = this.getMetricsRegistry()
+ .newCounter(EXCEPTIONS_QUOTA_EXCEEDED, EXCEPTIONS_TYPE_DESC, 0L);
+ this.exceptionsRpcThrottling = this.getMetricsRegistry()
+ .newCounter(EXCEPTIONS_RPC_THROTTLING, EXCEPTIONS_TYPE_DESC, 0L);
}
@Override
@@ -117,4 +123,14 @@ public class ExceptionTrackingSourceImpl extends
BaseSourceImpl
public void callQueueTooBigException() {
exceptionsCallQueueTooBig.incr();
}
+
+ @Override
+ public void quotaExceededException() {
+ exceptionsQuotaExceeded.incr();
+ }
+
+ @Override
+ public void rpcThrottlingException() {
+ exceptionsRpcThrottling.incr();
+ }
}
diff --git
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
index afe31f1..8062066 100644
---
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
+++
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
@@ -184,7 +184,7 @@ public class MetricsAssertHelperImpl implements
MetricsAssertHelper {
@Override
public void assertCounter(String name, long expected, BaseSource source) {
long found = getCounter(name, source);
- assertEquals("Metrics Counters should be equal", (long)
Long.valueOf(expected), found);
+ assertEquals(name + "(" + found + ") should be equal", (long)
Long.valueOf(expected), found);
}
@Override
diff --git
a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
index 9d5373c..1177333 100644
---
a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
+++
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
@@ -24,15 +24,21 @@ import org.apache.hadoop.hbase.MultiActionResultTooLarge;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.RegionTooBusyException;
import org.apache.hadoop.hbase.UnknownScannerException;
+import org.apache.hadoop.hbase.quotas.QuotaExceededException;
+import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
import org.apache.hadoop.hbase.exceptions.ScannerResetException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@InterfaceAudience.Private
public class MetricsHBaseServer {
+ private static final Logger LOG =
LoggerFactory.getLogger(MetricsHBaseServer.class);
+
private MetricsHBaseServerSource source;
private MetricsHBaseServerWrapper serverWrapper;
@@ -116,6 +122,12 @@ public class MetricsHBaseServer {
source.multiActionTooLargeException();
} else if (throwable instanceof CallQueueTooBigException) {
source.callQueueTooBigException();
+ } else if (throwable instanceof QuotaExceededException) {
+ source.quotaExceededException();
+ } else if (throwable instanceof RpcThrottlingException) {
+ source.rpcThrottlingException();
+ } else if (LOG.isDebugEnabled()) {
+ LOG.debug("Unknown exception type", throwable);
}
}
}
diff --git
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftMetrics.java
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftMetrics.java
index 5cc3d49..e362817 100644
---
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftMetrics.java
+++
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftMetrics.java
@@ -31,9 +31,13 @@ import
org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
import org.apache.hadoop.hbase.exceptions.ScannerResetException;
+import org.apache.hadoop.hbase.quotas.QuotaExceededException;
+import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
import org.apache.hadoop.hbase.thrift.generated.IOError;
import org.apache.hadoop.hbase.thrift2.generated.TIOError;
import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class is for maintaining the various statistics of thrift server
@@ -42,6 +46,7 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Private
public class ThriftMetrics {
+ private static final Logger LOG =
LoggerFactory.getLogger(ThriftMetrics.class);
public enum ThriftServerType {
ONE,
@@ -143,6 +148,12 @@ public class ThriftMetrics {
source.multiActionTooLargeException();
} else if (throwable instanceof CallQueueTooBigException) {
source.callQueueTooBigException();
+ } else if (throwable instanceof QuotaExceededException) {
+ source.quotaExceededException();
+ } else if (throwable instanceof RpcThrottlingException) {
+ source.rpcThrottlingException();
+ } else if (LOG.isDebugEnabled()) {
+ LOG.debug("Unknown exception type", throwable);
}
}
}
diff --git
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/ErrorThrowingGetObserver.java
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/ErrorThrowingGetObserver.java
index f190f14..98f190b 100644
---
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/ErrorThrowingGetObserver.java
+++
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/ErrorThrowingGetObserver.java
@@ -40,6 +40,8 @@ import
org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
import org.apache.hadoop.hbase.exceptions.ScannerResetException;
import org.apache.hadoop.hbase.metrics.ExceptionTrackingSource;
+import org.apache.hadoop.hbase.quotas.QuotaExceededException;
+import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
import org.apache.hadoop.hbase.util.Bytes;
/**
@@ -79,6 +81,10 @@ public class ErrorThrowingGetObserver implements
RegionCoprocessor, RegionObserv
throw new RegionTooBusyException("Failing for test");
case OUT_OF_ORDER_SCANNER_NEXT:
throw new OutOfOrderScannerNextException("Failing for test");
+ case QUOTA_EXCEEDED:
+ throw new QuotaExceededException("Failing for test");
+ case RPC_THROTTLING:
+ throw new RpcThrottlingException("Failing for test");
default:
throw new DoNotRetryIOException("Failing for test");
}
@@ -94,7 +100,9 @@ public class ErrorThrowingGetObserver implements
RegionCoprocessor, RegionObserv
SCANNER_RESET(ExceptionTrackingSource.EXCEPTIONS_SCANNER_RESET_NAME),
UNKNOWN_SCANNER(ExceptionTrackingSource.EXCEPTIONS_UNKNOWN_NAME),
REGION_TOO_BUSY(ExceptionTrackingSource.EXCEPTIONS_BUSY_NAME),
- OUT_OF_ORDER_SCANNER_NEXT(ExceptionTrackingSource.EXCEPTIONS_OOO_NAME);
+ OUT_OF_ORDER_SCANNER_NEXT(ExceptionTrackingSource.EXCEPTIONS_OOO_NAME),
+ QUOTA_EXCEEDED(ExceptionTrackingSource.EXCEPTIONS_QUOTA_EXCEEDED),
+ RPC_THROTTLING(ExceptionTrackingSource.EXCEPTIONS_RPC_THROTTLING);
private final String metricName;