This is an automated email from the ASF dual-hosted git repository.
haxiaolin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new ec71417 HBASE-26175 MetricsHBaseServer should record all kinds of
Exceptions (#4248)
ec71417 is described below
commit ec7141720fa3097d78e67ff3cafbec3a59fadbd3
Author: Xiaolin Ha <[email protected]>
AuthorDate: Thu Mar 24 19:03:22 2022 +0800
HBASE-26175 MetricsHBaseServer should record all kinds of Exceptions (#4248)
Signed-off-by: Pankaj Kumar <[email protected]>
---
.../hadoop/hbase/metrics/ExceptionTrackingSource.java | 4 ++++
.../hbase/metrics/ExceptionTrackingSourceImpl.java | 16 ++++++++++++++++
.../apache/hadoop/hbase/ipc/MetricsHBaseServer.java | 10 ++++++++--
.../org/apache/hadoop/hbase/ipc/TestRpcMetrics.java | 18 +++++++++++++++---
.../org/apache/hadoop/hbase/thrift/ThriftMetrics.java | 10 ++++++++--
5 files changed, 51 insertions(+), 7 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 68a9c53..3c5f898 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
@@ -45,6 +45,8 @@ public interface ExceptionTrackingSource extends BaseSource {
String EXCEPTIONS_RPC_THROTTLING = "exceptions.rpcThrottling";
String EXCEPTIONS_CALL_DROPPED = "exceptions.callDropped";
String EXCEPTIONS_CALL_TIMED_OUT = "exceptions.callTimedOut";
+ String EXCEPTIONS_REQUEST_TOO_BIG = "exceptions.requestTooBig";
+ String OTHER_EXCEPTIONS = "exceptions.otherExceptions";
void exception();
@@ -64,4 +66,6 @@ public interface ExceptionTrackingSource extends BaseSource {
void rpcThrottlingException();
void callDroppedException();
void callTimedOut();
+ void requestTooBigException();
+ void otherExceptions();
}
diff --git
a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
index 6521462..a4e75ba 100644
---
a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
+++
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/metrics/ExceptionTrackingSourceImpl.java
@@ -42,6 +42,8 @@ public class ExceptionTrackingSourceImpl extends
BaseSourceImpl
protected MutableFastCounter exceptionsRpcThrottling;
protected MutableFastCounter exceptionsCallDropped;
protected MutableFastCounter exceptionsCallTimedOut;
+ protected MutableFastCounter exceptionRequestTooBig;
+ protected MutableFastCounter otherExceptions;
public ExceptionTrackingSourceImpl(String metricsName, String
metricsDescription,
String metricsContext, String
metricsJmxContext) {
@@ -78,6 +80,10 @@ public class ExceptionTrackingSourceImpl extends
BaseSourceImpl
.newCounter(EXCEPTIONS_CALL_DROPPED, EXCEPTIONS_TYPE_DESC, 0L);
this.exceptionsCallTimedOut = this.getMetricsRegistry()
.newCounter(EXCEPTIONS_CALL_TIMED_OUT, EXCEPTIONS_TYPE_DESC, 0L);
+ this.exceptionRequestTooBig = this.getMetricsRegistry()
+ .newCounter(EXCEPTIONS_REQUEST_TOO_BIG, EXCEPTIONS_TYPE_DESC, 0L);
+ this.otherExceptions = this.getMetricsRegistry()
+ .newCounter(OTHER_EXCEPTIONS, EXCEPTIONS_TYPE_DESC, 0L);
}
@Override
@@ -149,4 +155,14 @@ public class ExceptionTrackingSourceImpl extends
BaseSourceImpl
public void callTimedOut() {
exceptionsCallTimedOut.incr();
}
+
+ @Override
+ public void requestTooBigException() {
+ exceptionRequestTooBig.incr();
+ }
+
+ @Override
+ public void otherExceptions() {
+ otherExceptions.incr();
+ }
}
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 5ff14dd..2e78ef3 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
@@ -25,6 +25,7 @@ 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.exceptions.RequestTooBigException;
import org.apache.hadoop.hbase.quotas.QuotaExceededException;
import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
import org.apache.yetus.audience.InterfaceAudience;
@@ -129,8 +130,13 @@ public class MetricsHBaseServer {
source.rpcThrottlingException();
} else if (throwable instanceof CallDroppedException) {
source.callDroppedException();
- } else if (LOG.isDebugEnabled()) {
- LOG.debug("Unknown exception type", throwable);
+ } else if (throwable instanceof RequestTooBigException) {
+ source.requestTooBigException();
+ } else {
+ source.otherExceptions();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Unknown exception type", throwable);
+ }
}
}
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
index c50414d..9e993e4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
@@ -17,16 +17,17 @@
*/
package org.apache.hadoop.hbase.ipc;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
import org.apache.hadoop.hbase.CallDroppedException;
import org.apache.hadoop.hbase.CompatibilityFactory;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.RegionTooBusyException;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
+import org.apache.hadoop.hbase.exceptions.RequestTooBigException;
import org.apache.hadoop.hbase.test.MetricsAssertHelper;
import org.apache.hadoop.hbase.testclassification.RPCTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
@@ -145,12 +146,23 @@ public class TestRpcMetrics {
mrpc.exception(new OutOfOrderScannerNextException());
mrpc.exception(new NotServingRegionException());
mrpc.exception(new CallDroppedException());
+ mrpc.exception(new RequestTooBigException());
+ mrpc.exception(new FakeException());
HELPER.assertCounter("exceptions.RegionMovedException", 1, serverSource);
HELPER.assertCounter("exceptions.RegionTooBusyException", 1, serverSource);
HELPER.assertCounter("exceptions.OutOfOrderScannerNextException", 1,
serverSource);
HELPER.assertCounter("exceptions.NotServingRegionException", 1,
serverSource);
HELPER.assertCounter("exceptions.callDropped", 1, serverSource);
- HELPER.assertCounter("exceptions", 6, serverSource);
+ HELPER.assertCounter("exceptions.requestTooBig", 1, serverSource);
+ HELPER.assertCounter("exceptions.otherExceptions", 1, serverSource);
+ HELPER.assertCounter("exceptions", 8, serverSource);
+ }
+
+ private class FakeException extends DoNotRetryIOException {
+
+ public FakeException() {
+ super();
+ }
}
@Test
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 4f88a53..207db00 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,6 +31,7 @@ import
org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil;
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.RequestTooBigException;
import org.apache.hadoop.hbase.exceptions.ScannerResetException;
import org.apache.hadoop.hbase.quotas.QuotaExceededException;
import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
@@ -157,8 +158,13 @@ public class ThriftMetrics {
source.rpcThrottlingException();
} else if (throwable instanceof CallDroppedException) {
source.callDroppedException();
- } else if (LOG.isDebugEnabled()) {
- LOG.debug("Unknown exception type", throwable);
+ } else if (throwable instanceof RequestTooBigException) {
+ source.requestTooBigException();
+ } else {
+ source.otherExceptions();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Unknown exception type", throwable);
+ }
}
}
}