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 68a9c536440..3c5f898fc29 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-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 65214624da5..a4e75ba0137 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 @@ -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 5ff14dd790a..2e78ef37441 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 c50414d01ad..9e993e48e44 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 cf290bcb708..fb736a39c3e 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; @@ -155,8 +156,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); + } } } }