Skip to content

Commit

Permalink
Use histogram instead of Meter
Browse files Browse the repository at this point in the history
  • Loading branch information
noblepaul committed Oct 2, 2023
1 parent f75b3cb commit ad951bf
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.apache.solr.util.stats.InstrumentedHttpListenerFactory.KNOWN_METRIC_NAME_STRATEGIES;

import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import java.lang.invoke.MethodHandles;
import java.util.Iterator;
Expand Down Expand Up @@ -96,7 +97,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory

private String scheme = null;

private Meter delayedRequests;
private Histogram delayedRequests;

private InstrumentedHttpListenerFactory.NameStrategy metricNameStrategy;

Expand Down Expand Up @@ -297,8 +298,12 @@ public void init(PluginInfo info) {
new LBHttp2SolrClient.Builder(defaultClient)
.setDelayedRequestListener(
it -> {
if (it > DELAY_WARN_THRESHOLD && delayedRequests != null) {
delayedRequests.mark(it);
if (it > DELAY_WARN_THRESHOLD) {
long millis = TimeUnit.MILLISECONDS.convert(it, TimeUnit.NANOSECONDS);
log.info("Remote shard request delayed by {} milliseconds", millis);
if(delayedRequests != null) {
delayedRequests.update(millis);
}
}
})
.build();
Expand Down Expand Up @@ -423,7 +428,7 @@ private String buildUrl(String url) {
public void initializeMetrics(SolrMetricsContext parentContext, String scope) {
solrMetricsContext = parentContext.getChildContext(this);
String expandedScope = SolrMetricManager.mkName(scope, SolrInfoBean.Category.QUERY.name());
delayedRequests = solrMetricsContext.meter("delayedInterNodeRequests", expandedScope);
delayedRequests = solrMetricsContext.histogram("delayedInterNodeRequests", expandedScope);
httpListenerFactory.initializeMetrics(solrMetricsContext, expandedScope);
commExecutor =
MetricUtils.instrumentedExecutorService(
Expand Down

0 comments on commit ad951bf

Please sign in to comment.