You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2016/05/28 18:20:16 UTC
lucene-solr:branch_6x: SOLR-9136: Separate out the error statistics
into server-side error vs client-side error
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 88dbd07f1 -> e4210b29a
SOLR-9136: Separate out the error statistics into server-side error vs client-side error
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e4210b29
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e4210b29
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e4210b29
Branch: refs/heads/branch_6x
Commit: e4210b29a83f676583d1db327d2a3d1e10bfb9ad
Parents: 88dbd07
Author: Erick <er...@apache.org>
Authored: Sat May 28 11:20:05 2016 -0700
Committer: Erick <er...@apache.org>
Committed: Sat May 28 11:20:05 2016 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 3 ++
.../apache/solr/handler/RequestHandlerBase.java | 29 ++++++++++++++------
2 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e4210b29/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ef3e462..50ca449 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -306,6 +306,9 @@ Other Changes
* SOLR-9160: Sync 6x and 7.0 move of UninvertingReader, SlowCompositeReaderWrapper for Solr (LUCENE-7283)
(yonik)
+* SOLR-9136: Separate out the error statistics into server-side error vs client-side error
+ (Jessica Cheng Mallet via Erick Erickson)
+
================== 6.0.1 ==================
(No Changes)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e4210b29/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
index cf3aa70..98f6896 100644
--- a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
+++ b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
@@ -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());