lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [1/2] lucene-solr:master: SOLR-9136: Separate out the error statistics into server-side error vs client-side error
Date Sat, 28 May 2016 18:09:57 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 39dfa2962 -> 6e2aed308


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/49c81bd8
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/49c81bd8
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/49c81bd8

Branch: refs/heads/master
Commit: 49c81bd8691305cc7d7f8b3d58ed3bfb1dc1e7dc
Parents: 39dfa29
Author: Erick <erick@apache.org>
Authored: Sat May 28 09:16:11 2016 -0700
Committer: Erick <erick@apache.org>
Committed: Sat May 28 09:16:11 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/49c81bd8/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5a9c12a..5ccccc6 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -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)
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/49c81bd8/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());


Mime
View raw message