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

(cherry picked from commit f8fa2e9)
This commit is contained in:
Shalin Shekhar Mangar 2016-11-23 23:20:48 +05:30
parent df242c8437
commit 8a5bb46663
4 changed files with 18 additions and 20 deletions

View File

@ -41,11 +41,15 @@ Upgrade Notes
* SOLR-8785: Metrics related classes in org.apache.solr.util.stats have been removed in favor of * 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 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 the equivalent classes from the metrics library.
exposed by Overseer Status API in previous versions has been removed because it is no longer supported As part of this, the following changes were made to the output of Overseer Status API:
by the metrics library. Also, the metrics "75thPctlRequestTime", "95thPctlRequestTime", "99thPctlRequestTime" * The "totalTime" metric has been removed because it is no longer supported
and "999thPctlRequestTime" in Overseer Status API have been renamed to "75thPcRequestTime", "95thPcRequestTime" * The metrics "75thPctlRequestTime", "95thPctlRequestTime", "99thPctlRequestTime"
and so on for consistency with stats output in other parts of Solr. 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 New Features
---------------------- ----------------------

View File

@ -27,8 +27,6 @@ import org.apache.solr.common.util.NamedList;
*/ */
public class TimerUtils { 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. * Adds metrics from a Timer to a NamedList, using well-known names.
* @param lst The NamedList to add the metrics data to * @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) { public static void addMetrics(NamedList<Object> lst, Timer timer) {
Snapshot snapshot = timer.getSnapshot(); Snapshot snapshot = timer.getSnapshot();
lst.add("avgRequestsPerMinute", convertRateToPerMinute(timer.getMeanRate())); lst.add("avgRequestsPerSecond", timer.getMeanRate());
lst.add("5minRateRequestsPerMinute", convertRateToPerMinute(timer.getFiveMinuteRate())); lst.add("5minRateRequestsPerSecond", timer.getFiveMinuteRate());
lst.add("15minRateRequestsPerMinute", convertRateToPerMinute(timer.getFifteenMinuteRate())); lst.add("15minRateRequestsPerSecond", timer.getFifteenMinuteRate());
lst.add("avgTimePerRequest", nsToMs(snapshot.getMean())); lst.add("avgTimePerRequest", nsToMs(snapshot.getMean()));
lst.add("medianRequestTime", nsToMs(snapshot.getMedian())); lst.add("medianRequestTime", nsToMs(snapshot.getMedian()));
lst.add("75thPcRequestTime", nsToMs(snapshot.get75thPercentile())); lst.add("75thPcRequestTime", nsToMs(snapshot.get75thPercentile()));
@ -57,8 +55,4 @@ public class TimerUtils {
return ns / TimeUnit.MILLISECONDS.toNanos(1); return ns / TimeUnit.MILLISECONDS.toNanos(1);
} }
static double convertRateToPerMinute(double rate) {
return rate * RATE_FACTOR;
}
} }

View File

@ -1071,9 +1071,9 @@ public class OverseerTest extends SolrTestCaseJ4 {
private void printTimingStats(Timer timer) { private void printTimingStats(Timer timer) {
Snapshot snapshot = timer.getSnapshot(); Snapshot snapshot = timer.getSnapshot();
log.info("\t avgRequestsPerMinute: {}", timer.getMeanRate()); log.info("\t avgRequestsPerSecond: {}", timer.getMeanRate());
log.info("\t 5minRateRequestsPerMinute: {}", timer.getFiveMinuteRate()); log.info("\t 5minRateRequestsPerSecond: {}", timer.getFiveMinuteRate());
log.info("\t 15minRateRequestsPerMinute: {}", timer.getFifteenMinuteRate()); log.info("\t 15minRateRequestsPerSecond: {}", timer.getFifteenMinuteRate());
log.info("\t avgTimePerRequest: {}", nsToMs(snapshot.getMean())); log.info("\t avgTimePerRequest: {}", nsToMs(snapshot.getMean()));
log.info("\t medianRequestTime: {}", nsToMs(snapshot.getMedian())); log.info("\t medianRequestTime: {}", nsToMs(snapshot.getMedian()));
log.info("\t 75thPcRequestTime: {}", nsToMs(snapshot.get75thPercentile())); log.info("\t 75thPcRequestTime: {}", nsToMs(snapshot.get75thPercentile()));

View File

@ -43,9 +43,9 @@ public class TimerUtilsTest extends SolrTestCaseJ4 {
assertEquals(lst.size(), 9); assertEquals(lst.size(), 9);
final Snapshot snapshot = timer.getSnapshot(); final Snapshot snapshot = timer.getSnapshot();
// cannot test avgRequestsPerMinute directly because mean rate changes as time increases! // cannot test avgRequestsPerMinute directly because mean rate changes as time increases!
// assertEquals(lst.get("avgRequestsPerMinute"), TimerUtils.convertRateToPerMinute(timer.getMeanRate())); // assertEquals(lst.get("avgRequestsPerSecond"), timer.getMeanRate());
assertEquals(lst.get("5minRateRequestsPerMinute"), TimerUtils.convertRateToPerMinute(timer.getFiveMinuteRate())); assertEquals(lst.get("5minRateRequestsPerSecond"), timer.getFiveMinuteRate());
assertEquals(lst.get("15minRateRequestsPerMinute"), TimerUtils.convertRateToPerMinute(timer.getFifteenMinuteRate())); assertEquals(lst.get("15minRateRequestsPerSecond"), timer.getFifteenMinuteRate());
assertEquals(lst.get("avgTimePerRequest"), TimerUtils.nsToMs(snapshot.getMean())); assertEquals(lst.get("avgTimePerRequest"), TimerUtils.nsToMs(snapshot.getMean()));
assertEquals(lst.get("medianRequestTime"), TimerUtils.nsToMs(snapshot.getMedian())); assertEquals(lst.get("medianRequestTime"), TimerUtils.nsToMs(snapshot.getMedian()));
assertEquals(lst.get("75thPcRequestTime"), TimerUtils.nsToMs(snapshot.get75thPercentile())); assertEquals(lst.get("75thPcRequestTime"), TimerUtils.nsToMs(snapshot.get75thPercentile()));