HBASE-26175 MetricsHBaseServer should record all kinds of Exceptions (#4248)
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
This commit is contained in:
parent
2d1dc5349e
commit
7906703569
|
@ -45,6 +45,8 @@ public interface ExceptionTrackingSource extends BaseSource {
|
||||||
String EXCEPTIONS_RPC_THROTTLING = "exceptions.rpcThrottling";
|
String EXCEPTIONS_RPC_THROTTLING = "exceptions.rpcThrottling";
|
||||||
String EXCEPTIONS_CALL_DROPPED = "exceptions.callDropped";
|
String EXCEPTIONS_CALL_DROPPED = "exceptions.callDropped";
|
||||||
String EXCEPTIONS_CALL_TIMED_OUT = "exceptions.callTimedOut";
|
String EXCEPTIONS_CALL_TIMED_OUT = "exceptions.callTimedOut";
|
||||||
|
String EXCEPTIONS_REQUEST_TOO_BIG = "exceptions.requestTooBig";
|
||||||
|
String OTHER_EXCEPTIONS = "exceptions.otherExceptions";
|
||||||
|
|
||||||
void exception();
|
void exception();
|
||||||
|
|
||||||
|
@ -64,4 +66,6 @@ public interface ExceptionTrackingSource extends BaseSource {
|
||||||
void rpcThrottlingException();
|
void rpcThrottlingException();
|
||||||
void callDroppedException();
|
void callDroppedException();
|
||||||
void callTimedOut();
|
void callTimedOut();
|
||||||
|
void requestTooBigException();
|
||||||
|
void otherExceptions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ public class ExceptionTrackingSourceImpl extends BaseSourceImpl
|
||||||
protected MutableFastCounter exceptionsRpcThrottling;
|
protected MutableFastCounter exceptionsRpcThrottling;
|
||||||
protected MutableFastCounter exceptionsCallDropped;
|
protected MutableFastCounter exceptionsCallDropped;
|
||||||
protected MutableFastCounter exceptionsCallTimedOut;
|
protected MutableFastCounter exceptionsCallTimedOut;
|
||||||
|
protected MutableFastCounter exceptionRequestTooBig;
|
||||||
|
protected MutableFastCounter otherExceptions;
|
||||||
|
|
||||||
public ExceptionTrackingSourceImpl(String metricsName, String metricsDescription,
|
public ExceptionTrackingSourceImpl(String metricsName, String metricsDescription,
|
||||||
String metricsContext, String metricsJmxContext) {
|
String metricsContext, String metricsJmxContext) {
|
||||||
|
@ -78,6 +80,10 @@ public class ExceptionTrackingSourceImpl extends BaseSourceImpl
|
||||||
.newCounter(EXCEPTIONS_CALL_DROPPED, EXCEPTIONS_TYPE_DESC, 0L);
|
.newCounter(EXCEPTIONS_CALL_DROPPED, EXCEPTIONS_TYPE_DESC, 0L);
|
||||||
this.exceptionsCallTimedOut = this.getMetricsRegistry()
|
this.exceptionsCallTimedOut = this.getMetricsRegistry()
|
||||||
.newCounter(EXCEPTIONS_CALL_TIMED_OUT, EXCEPTIONS_TYPE_DESC, 0L);
|
.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
|
@Override
|
||||||
|
@ -149,4 +155,14 @@ public class ExceptionTrackingSourceImpl extends BaseSourceImpl
|
||||||
public void callTimedOut() {
|
public void callTimedOut() {
|
||||||
exceptionsCallTimedOut.incr();
|
exceptionsCallTimedOut.incr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestTooBigException() {
|
||||||
|
exceptionRequestTooBig.incr();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void otherExceptions() {
|
||||||
|
otherExceptions.incr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.MultiActionResultTooLarge;
|
||||||
import org.apache.hadoop.hbase.NotServingRegionException;
|
import org.apache.hadoop.hbase.NotServingRegionException;
|
||||||
import org.apache.hadoop.hbase.RegionTooBusyException;
|
import org.apache.hadoop.hbase.RegionTooBusyException;
|
||||||
import org.apache.hadoop.hbase.UnknownScannerException;
|
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.QuotaExceededException;
|
||||||
import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
|
import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
|
||||||
import org.apache.yetus.audience.InterfaceAudience;
|
import org.apache.yetus.audience.InterfaceAudience;
|
||||||
|
@ -129,8 +130,13 @@ public class MetricsHBaseServer {
|
||||||
source.rpcThrottlingException();
|
source.rpcThrottlingException();
|
||||||
} else if (throwable instanceof CallDroppedException) {
|
} else if (throwable instanceof CallDroppedException) {
|
||||||
source.callDroppedException();
|
source.callDroppedException();
|
||||||
} else if (LOG.isDebugEnabled()) {
|
} else if (throwable instanceof RequestTooBigException) {
|
||||||
LOG.debug("Unknown exception type", throwable);
|
source.requestTooBigException();
|
||||||
|
} else {
|
||||||
|
source.otherExceptions();
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Unknown exception type", throwable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,16 +17,17 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.ipc;
|
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.CallDroppedException;
|
||||||
import org.apache.hadoop.hbase.CompatibilityFactory;
|
import org.apache.hadoop.hbase.CompatibilityFactory;
|
||||||
|
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||||
import org.apache.hadoop.hbase.NotServingRegionException;
|
import org.apache.hadoop.hbase.NotServingRegionException;
|
||||||
import org.apache.hadoop.hbase.RegionTooBusyException;
|
import org.apache.hadoop.hbase.RegionTooBusyException;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
|
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
|
||||||
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
|
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.test.MetricsAssertHelper;
|
||||||
import org.apache.hadoop.hbase.testclassification.RPCTests;
|
import org.apache.hadoop.hbase.testclassification.RPCTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
||||||
|
@ -145,12 +146,23 @@ public class TestRpcMetrics {
|
||||||
mrpc.exception(new OutOfOrderScannerNextException());
|
mrpc.exception(new OutOfOrderScannerNextException());
|
||||||
mrpc.exception(new NotServingRegionException());
|
mrpc.exception(new NotServingRegionException());
|
||||||
mrpc.exception(new CallDroppedException());
|
mrpc.exception(new CallDroppedException());
|
||||||
|
mrpc.exception(new RequestTooBigException());
|
||||||
|
mrpc.exception(new FakeException());
|
||||||
HELPER.assertCounter("exceptions.RegionMovedException", 1, serverSource);
|
HELPER.assertCounter("exceptions.RegionMovedException", 1, serverSource);
|
||||||
HELPER.assertCounter("exceptions.RegionTooBusyException", 1, serverSource);
|
HELPER.assertCounter("exceptions.RegionTooBusyException", 1, serverSource);
|
||||||
HELPER.assertCounter("exceptions.OutOfOrderScannerNextException", 1, serverSource);
|
HELPER.assertCounter("exceptions.OutOfOrderScannerNextException", 1, serverSource);
|
||||||
HELPER.assertCounter("exceptions.NotServingRegionException", 1, serverSource);
|
HELPER.assertCounter("exceptions.NotServingRegionException", 1, serverSource);
|
||||||
HELPER.assertCounter("exceptions.callDropped", 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
|
@Test
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil;
|
||||||
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
|
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
|
||||||
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
|
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
|
||||||
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
|
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.exceptions.ScannerResetException;
|
||||||
import org.apache.hadoop.hbase.quotas.QuotaExceededException;
|
import org.apache.hadoop.hbase.quotas.QuotaExceededException;
|
||||||
import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
|
import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
|
||||||
|
@ -155,8 +156,13 @@ public class ThriftMetrics {
|
||||||
source.rpcThrottlingException();
|
source.rpcThrottlingException();
|
||||||
} else if (throwable instanceof CallDroppedException) {
|
} else if (throwable instanceof CallDroppedException) {
|
||||||
source.callDroppedException();
|
source.callDroppedException();
|
||||||
} else if (LOG.isDebugEnabled()) {
|
} else if (throwable instanceof RequestTooBigException) {
|
||||||
LOG.debug("Unknown exception type", throwable);
|
source.requestTooBigException();
|
||||||
|
} else {
|
||||||
|
source.otherExceptions();
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Unknown exception type", throwable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue