lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject [17/50] [abbrv] lucene-solr:jira/solr-9045: SOLR-10226 JMX metric avgTimePerRequest broken.
Date Mon, 13 Mar 2017 15:40:12 GMT
SOLR-10226 JMX metric avgTimePerRequest broken.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2d51a42d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2d51a42d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2d51a42d

Branch: refs/heads/jira/solr-9045
Commit: 2d51a42d3cae3eddc89f407cd3611fa2cd5d55d0
Parents: 190f4b6
Author: Andrzej Bialecki <ab@apache.org>
Authored: Tue Mar 7 17:59:57 2017 +0100
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Tue Mar 7 18:09:58 2017 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                              | 6 ++++++
 .../src/java/org/apache/solr/handler/RequestHandlerBase.java  | 7 ++++++-
 .../core/src/java/org/apache/solr/util/stats/MetricUtils.java | 2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2d51a42d/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index db721da..5b0eb03 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -96,6 +96,10 @@ Detailed Change List
 
 Upgrade Notes
 ----------------------
+* SOLR-10226: JMX metric "avgTimePerRequest" (and the corresponding metric in the metrics
API for
+  each handler) used to be a simple non-decaying average based on total cumulative time and
the
+  number of requests. New Codahale Metrics implementation applies exponential decay to this
value,
+  which heavily biases the average towards the last 5 minutes. (ab)
 
 New Features
 ----------------------
@@ -212,6 +216,8 @@ Bug Fixes
 
 * SOLR-10088: Installer script does not put zoo.cfg in SOLR_HOME (janhoy)
 
+* SOLR-10226: add back "totalTime" metric to all handlers. See also the back-compat note.
(ab)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2d51a42d/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 3c6f5fa..1958e11 100644
--- a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
+++ b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
@@ -66,6 +66,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler,
SolrInfo
   private Meter numTimeouts = new Meter();
   private Counter requests = new Counter();
   private Timer requestTimes = new Timer();
+  private Counter totalTime = new Counter();
 
   private final long handlerStart;
 
@@ -143,6 +144,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler,
SolrInfo
     numTimeouts = manager.meter(registryName, "timeouts", getCategory().toString(), scope);
     requests = manager.counter(registryName, "requests", getCategory().toString(), scope);
     requestTimes = manager.timer(registryName, "requestTimes", getCategory().toString(),
scope);
+    totalTime = manager.counter(registryName, "totalTime", getCategory().toString(), scope);
   }
 
   public static SolrParams getSolrParamsFromNamedList(NamedList args, String key) {
@@ -209,7 +211,8 @@ public abstract class RequestHandlerBase implements SolrRequestHandler,
SolrInfo
         }
       }
     } finally {
-      timer.stop();
+      long elapsed = timer.stop();
+      totalTime.inc(elapsed);
     }
   }
 
@@ -292,6 +295,8 @@ public abstract class RequestHandlerBase implements SolrRequestHandler,
SolrInfo
     lst.add("serverErrors", numServerErrors.getCount());
     lst.add("clientErrors", numClientErrors.getCount());
     lst.add("timeouts", numTimeouts.getCount());
+    // convert totalTime to ms
+    lst.add("totalTime", MetricUtils.nsToMs(totalTime.getCount()));
     MetricUtils.addMetrics(lst, requestTimes);
     return lst;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2d51a42d/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java b/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
index 0d386ae..80f035b 100644
--- a/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
@@ -63,7 +63,7 @@ public class MetricUtils {
    * @param ns the amount of time in nanoseconds
    * @return the amount of time in milliseconds
    */
-  static double nsToMs(double ns) {
+  public static double nsToMs(double ns) {
     return ns / TimeUnit.MILLISECONDS.toNanos(1);
   }
 


Mime
View raw message