summaryrefslogtreecommitdiffstats
path: root/container-search/src
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2021-02-03 16:37:26 +0100
committerGitHub <noreply@github.com>2021-02-03 16:37:26 +0100
commit16f6e4fbcdd3c57010427ef0ad4f46d219c3f77d (patch)
tree177a8cbe5ac8ed8550ab8af2c1dc2227b6bb6479 /container-search/src
parent263091b095c292c1a7b0b0e8955b6d787b2436e5 (diff)
parent76d859b8b2265c7fc15ade9476753153160f872d (diff)
Merge pull request #16338 from vespa-engine/gjoranv/hit-metrics-histogram
Gjoranv/hit metrics histogram
Diffstat (limited to 'container-search/src')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java
index 4940f707fd6..21f3e38ff4e 100644
--- a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java
@@ -77,6 +77,7 @@ public class StatisticsSearcher extends Searcher {
private final Value peakQPS; // peak 1s QPS
private final Counter emptyResults; // number of results containing no concrete hits
private final Value hitsPerQuery; // mean number of hits per query
+ private final Value totalHitsPerQuery;
private final PeakQpsReporter peakQpsReporter;
@@ -137,8 +138,12 @@ public class StatisticsSearcher extends Searcher {
queryLatencyBuckets = Value.buildValue(QUERY_LATENCY_METRIC, manager, null);
peakQPS = new Value(PEAK_QPS_METRIC, manager, new Value.Parameters().setLogRaw(false).setLogMax(true).setNameExtension(false));
hitsPerQuery = new Value(HITS_PER_QUERY_METRIC, manager, new Value.Parameters().setLogRaw(false).setLogMean(true).setNameExtension(false));
+ totalHitsPerQuery = new Value(TOTALHITS_PER_QUERY_METRIC, manager, new Value.Parameters().setLogRaw(false).setLogMean(true).setNameExtension(false));
+
emptyResults = new Counter(EMPTY_RESULTS_METRIC, manager, false);
metricReceiver.declareGauge(QUERY_LATENCY_METRIC, Optional.empty(), new MetricSettings.Builder().histogram(true).build());
+ metricReceiver.declareGauge(HITS_PER_QUERY_METRIC, Optional.empty(), new MetricSettings.Builder().histogram(true).build());
+ metricReceiver.declareGauge(TOTALHITS_PER_QUERY_METRIC, Optional.empty(), new MetricSettings.Builder().histogram(true).build());
scheduler.schedule(peakQpsReporter, 1000, 1000);
}
@@ -266,9 +271,13 @@ public class StatisticsSearcher extends Searcher {
metric.add(DOCS_TOTAL_METRIC, queryCoverage.getActive(), metricContext);
}
int hitCount = result.getConcreteHitCount();
- hitsPerQuery.put((double) hitCount);
+ hitsPerQuery.put(hitCount);
metric.set(HITS_PER_QUERY_METRIC, (double) hitCount, metricContext);
- metric.set(TOTALHITS_PER_QUERY_METRIC, (double) result.getTotalHitCount(), metricContext);
+
+ long totalHitCount = result.getTotalHitCount();
+ totalHitsPerQuery.put(totalHitCount);
+ metric.set(TOTALHITS_PER_QUERY_METRIC, (double) totalHitCount, metricContext);
+
metric.set(QUERY_OFFSET_METRIC, (double) (query.getHits() + query.getOffset()), metricContext);
if (hitCount == 0) {
emptyResults.increment();