SOLR-9136: Separate out the error statistics into server-side error vs client-side error

This commit is contained in:
Erick 2016-05-28 09:16:11 -07:00
parent 39dfa29622
commit 49c81bd869
2 changed files with 24 additions and 8 deletions

View File

@ -339,6 +339,9 @@ Other Changes
* SOLR-9161: SolrPluginUtils.invokeSetters now accommodates setter variants (Christine Poerschke)
* SOLR-9136: Separate out the error statistics into server-side error vs client-side error
(Jessica Chent Mallet via Erick Erickson)
================== 6.0.1 ==================
(No Changes)

View File

@ -56,7 +56,8 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
// Statistics
private final AtomicLong numRequests = new AtomicLong();
private final AtomicLong numErrors = new AtomicLong();
private final AtomicLong numServerErrors = new AtomicLong();
private final AtomicLong numClientErrors = new AtomicLong();
private final AtomicLong numTimeouts = new AtomicLong();
private final Timer requestTimes = new Timer();
@ -164,23 +165,33 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
}
}
} catch (Exception e) {
boolean incrementErrors = true;
boolean isServerError = true;
if (e instanceof SolrException) {
SolrException se = (SolrException)e;
if (se.code() == SolrException.ErrorCode.CONFLICT.code) {
// TODO: should we allow this to be counted as an error (numErrors++)?
} else {
SolrException.log(log, e);
incrementErrors = false;
} else if (se.code() >= 400 && se.code() < 500) {
isServerError = false;
}
} else {
SolrException.log(log, e);
if (e instanceof SyntaxError) {
isServerError = false;
e = new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
}
}
rsp.setException(e);
numErrors.incrementAndGet();
if (incrementErrors) {
SolrException.log(log, e);
if (isServerError) {
numServerErrors.incrementAndGet();
} else {
numClientErrors.incrementAndGet();
}
}
}
finally {
timer.stop();
@ -263,7 +274,9 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
Snapshot snapshot = requestTimes.getSnapshot();
lst.add("handlerStart",handlerStart);
lst.add("requests", numRequests.longValue());
lst.add("errors", numErrors.longValue());
lst.add("errors", numServerErrors.longValue() + numClientErrors.longValue());
lst.add("serverErrors", numServerErrors.longValue());
lst.add("clientErrors", numClientErrors.longValue());
lst.add("timeouts", numTimeouts.longValue());
lst.add("totalTime", requestTimes.getSum());
lst.add("avgRequestsPerSecond", requestTimes.getMeanRate());