mirror of https://github.com/apache/lucene.git
SOLR-8785: Use per-second rates for consistency in all stats outputs
This commit is contained in:
parent
dab2e24656
commit
f8fa2e998d
|
@ -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
|
||||
----------------------
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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()));
|
||||
|
|
Loading…
Reference in New Issue