You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2016/11/23 17:50:58 UTC

lucene-solr:master: SOLR-8785: Use per-second rates for consistency in all stats outputs

Repository: lucene-solr
Updated Branches:
  refs/heads/master dab2e2465 -> f8fa2e998


SOLR-8785: Use per-second rates for consistency in all stats outputs


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

Branch: refs/heads/master
Commit: f8fa2e998d094223702e12d7bd8a84985859a747
Parents: dab2e24
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Wed Nov 23 23:20:48 2016 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Wed Nov 23 23:20:48 2016 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                      | 14 +++++++++-----
 .../java/org/apache/solr/util/stats/TimerUtils.java   | 12 +++---------
 .../src/test/org/apache/solr/cloud/OverseerTest.java  |  6 +++---
 .../org/apache/solr/util/stats/TimerUtilsTest.java    |  6 +++---
 4 files changed, 18 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f8fa2e99/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b463450..673b5a7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -88,11 +88,15 @@ Upgrade Notes
 
 * SOLR-8785: Metrics related classes in org.apache.solr.util.stats have been removed in favor of
   the dropwizard metrics library. Any custom plugins using these classes should be changed to use
-  the equivalent classes from the metrics library. As part of these changes, the "totalTime" metric
-  exposed by Overseer Status API in previous versions has been removed because it is no longer supported
-  by the metrics library. Also, the metrics "75thPctlRequestTime", "95thPctlRequestTime", "99thPctlRequestTime"
-  and "999thPctlRequestTime" in Overseer Status API have been renamed to "75thPcRequestTime", "95thPcRequestTime"
-  and so on for consistency with stats output in other parts of Solr.
+  the equivalent classes from the metrics library.
+  As part of this, the following changes were made to the output of Overseer Status API:
+  * The "totalTime" metric has been removed because it is no longer supported
+  * The metrics "75thPctlRequestTime", "95thPctlRequestTime", "99thPctlRequestTime"
+    and "999thPctlRequestTime" in Overseer Status API have been renamed to "75thPcRequestTime", "95thPcRequestTime"
+    and so on for consistency with stats output in other parts of Solr.
+  * The metrics "avgRequestsPerMinute", "5minRateRequestsPerMinute" and "15minRateRequestsPerMinute" have been
+    replaced by corresponding per-second rates viz. "avgRequestsPerSecond", "5minRateRequestsPerSecond"
+    and "15minRateRequestsPerSecond" for consistency with stats output in other parts of Solr.
 
 New Features
 ----------------------

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f8fa2e99/solr/core/src/java/org/apache/solr/util/stats/TimerUtils.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/util/stats/TimerUtils.java b/solr/core/src/java/org/apache/solr/util/stats/TimerUtils.java
index af65a3a..243c1ee 100644
--- a/solr/core/src/java/org/apache/solr/util/stats/TimerUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/stats/TimerUtils.java
@@ -27,8 +27,6 @@ import org.apache.solr.common.util.NamedList;
  */
 public class TimerUtils {
 
-  private static final double RATE_FACTOR = TimeUnit.MINUTES.toSeconds(1);
-
   /**
    * Adds metrics from a Timer to a NamedList, using well-known names.
    * @param lst The NamedList to add the metrics data to
@@ -36,9 +34,9 @@ public class TimerUtils {
    */
   public static void addMetrics(NamedList<Object> lst, Timer timer) {
     Snapshot snapshot = timer.getSnapshot();
-    lst.add("avgRequestsPerMinute", convertRateToPerMinute(timer.getMeanRate()));
-    lst.add("5minRateRequestsPerMinute", convertRateToPerMinute(timer.getFiveMinuteRate()));
-    lst.add("15minRateRequestsPerMinute", convertRateToPerMinute(timer.getFifteenMinuteRate()));
+    lst.add("avgRequestsPerSecond", timer.getMeanRate());
+    lst.add("5minRateRequestsPerSecond", timer.getFiveMinuteRate());
+    lst.add("15minRateRequestsPerSecond", timer.getFifteenMinuteRate());
     lst.add("avgTimePerRequest", nsToMs(snapshot.getMean()));
     lst.add("medianRequestTime", nsToMs(snapshot.getMedian()));
     lst.add("75thPcRequestTime", nsToMs(snapshot.get75thPercentile()));
@@ -57,8 +55,4 @@ public class TimerUtils {
     return ns / TimeUnit.MILLISECONDS.toNanos(1);
   }
 
-  static double convertRateToPerMinute(double rate) {
-    return rate * RATE_FACTOR;
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f8fa2e99/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
index 48b53d1..dccc2c6 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
@@ -1071,9 +1071,9 @@ public class OverseerTest extends SolrTestCaseJ4 {
 
   private void printTimingStats(Timer timer) {
     Snapshot snapshot = timer.getSnapshot();
-    log.info("\t avgRequestsPerMinute: {}", timer.getMeanRate());
-    log.info("\t 5minRateRequestsPerMinute: {}", timer.getFiveMinuteRate());
-    log.info("\t 15minRateRequestsPerMinute: {}", timer.getFifteenMinuteRate());
+    log.info("\t avgRequestsPerSecond: {}", timer.getMeanRate());
+    log.info("\t 5minRateRequestsPerSecond: {}", timer.getFiveMinuteRate());
+    log.info("\t 15minRateRequestsPerSecond: {}", timer.getFifteenMinuteRate());
     log.info("\t avgTimePerRequest: {}", nsToMs(snapshot.getMean()));
     log.info("\t medianRequestTime: {}", nsToMs(snapshot.getMedian()));
     log.info("\t 75thPcRequestTime: {}", nsToMs(snapshot.get75thPercentile()));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f8fa2e99/solr/core/src/test/org/apache/solr/util/stats/TimerUtilsTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/util/stats/TimerUtilsTest.java b/solr/core/src/test/org/apache/solr/util/stats/TimerUtilsTest.java
index c3881e1..851f768 100644
--- a/solr/core/src/test/org/apache/solr/util/stats/TimerUtilsTest.java
+++ b/solr/core/src/test/org/apache/solr/util/stats/TimerUtilsTest.java
@@ -43,9 +43,9 @@ public class TimerUtilsTest extends SolrTestCaseJ4 {
     assertEquals(lst.size(), 9);
     final Snapshot snapshot = timer.getSnapshot();
     // cannot test avgRequestsPerMinute directly because mean rate changes as time increases!
-    // assertEquals(lst.get("avgRequestsPerMinute"), TimerUtils.convertRateToPerMinute(timer.getMeanRate()));
-    assertEquals(lst.get("5minRateRequestsPerMinute"), TimerUtils.convertRateToPerMinute(timer.getFiveMinuteRate()));
-    assertEquals(lst.get("15minRateRequestsPerMinute"), TimerUtils.convertRateToPerMinute(timer.getFifteenMinuteRate()));
+    // assertEquals(lst.get("avgRequestsPerSecond"), timer.getMeanRate());
+    assertEquals(lst.get("5minRateRequestsPerSecond"), timer.getFiveMinuteRate());
+    assertEquals(lst.get("15minRateRequestsPerSecond"), timer.getFifteenMinuteRate());
     assertEquals(lst.get("avgTimePerRequest"), TimerUtils.nsToMs(snapshot.getMean()));
     assertEquals(lst.get("medianRequestTime"), TimerUtils.nsToMs(snapshot.getMedian()));
     assertEquals(lst.get("75thPcRequestTime"), TimerUtils.nsToMs(snapshot.get75thPercentile()));