mirror of https://github.com/apache/lucene.git
SOLR-10226 JMX metric avgTimePerRequest broken.
This commit is contained in:
parent
190f4b6b93
commit
2d51a42d3c
|
@ -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
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue