public class StatisticsSearcher extends Searcher
A searcher to gather statistics such as queries completed and query latency. There may be more than 1 StatisticsSearcher in the Searcher chain, each identified by a Searcher ID. The statistics accumulated by all StatisticsSearchers are stored in the singleton StatisticsManager object.
TODO: Fix events to handle more than one of these searchers properly.
Modifier and Type | Class and Description |
---|---|
private class |
StatisticsSearcher.ActivitySampler |
private class |
StatisticsSearcher.PeakQpsReporter |
Modifier and Type | Field and Description |
---|---|
private static String |
ACTIVE_QUERIES_METRIC |
private com.yahoo.statistics.Value |
activeQueries |
private Map<String,com.yahoo.jdisc.Metric.Context> |
chainContexts |
private static String |
EMPTY_RESULTS_METRIC |
private com.yahoo.statistics.Counter |
emptyResults |
private static String |
FAILED_QUERIES_METRIC |
private com.yahoo.statistics.Counter |
failedQueries |
private static String |
HITS_PER_QUERY_METRIC |
private com.yahoo.statistics.Value |
hitsPerQuery |
private com.yahoo.statistics.Counter |
illegalQueries |
private static String |
MAX_QUERY_LATENCY_METRIC |
private com.yahoo.statistics.Value |
maxQueryLatency |
private static String |
MEAN_QUERY_LATENCY_METRIC |
private com.yahoo.jdisc.Metric |
metric |
private com.yahoo.statistics.Counter |
nullQueries |
private static String |
PEAK_QPS_METRIC |
private com.yahoo.statistics.Value |
peakQPS |
private StatisticsSearcher.PeakQpsReporter |
peakQpsReporter |
private com.yahoo.statistics.Counter |
queries |
private static String |
QUERIES_METRIC |
private static String |
QUERY_LATENCY_METRIC |
private com.yahoo.statistics.Value |
queryLatency |
private com.yahoo.statistics.Value |
queryLatencyBuckets |
private Timer |
scheduler |
private Map<String,com.yahoo.jdisc.Metric.Context> |
statePageOnlyContexts |
private static String |
TOTALHITS_PER_QUERY_METRIC |
Constructor and Description |
---|
StatisticsSearcher(com.yahoo.jdisc.Metric metric) |
StatisticsSearcher(com.yahoo.statistics.Statistics manager,
com.yahoo.jdisc.Metric metric,
com.yahoo.metrics.simple.MetricReceiver metricReceiver) |
Modifier and Type | Method and Description |
---|---|
private void |
addLatency(long latency,
com.yahoo.jdisc.Metric.Context metricContext) |
void |
deconstruct() |
private com.yahoo.jdisc.Metric.Context |
getChainMetricContext(String chainName) |
private com.yahoo.jdisc.Metric.Context |
getDimensions(String source,
Result r,
Execution execution) |
String |
getMyID() |
private void |
incrementStatePageOnlyErrors(Result result,
Execution execution)
Creates error metric for StateHandler only.
|
private void |
incrErrorCount(Result result,
com.yahoo.jdisc.Metric.Context metricContext) |
private void |
incrQueryCount(com.yahoo.jdisc.Metric.Context metricContext) |
private void |
initEvents(com.yahoo.statistics.Statistics manager,
com.yahoo.metrics.simple.MetricReceiver metricReceiver) |
private void |
logQuery(Query query) |
private void |
qps(com.yahoo.jdisc.Metric.Context metricContext) |
Result |
search(Query query,
Execution execution)
Generate statistics for the query passing through this Searcher
1) Add 1 to total query count
2) Add response time to total response time (time from entry to return)
3) .....
|
ensureFilled, fill, getLogger, process, toString
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
private static final String MAX_QUERY_LATENCY_METRIC
private static final String EMPTY_RESULTS_METRIC
private static final String HITS_PER_QUERY_METRIC
private static final String TOTALHITS_PER_QUERY_METRIC
private static final String FAILED_QUERIES_METRIC
private static final String MEAN_QUERY_LATENCY_METRIC
private static final String QUERY_LATENCY_METRIC
private static final String QUERIES_METRIC
private static final String ACTIVE_QUERIES_METRIC
private static final String PEAK_QPS_METRIC
private com.yahoo.statistics.Counter queries
private com.yahoo.statistics.Counter failedQueries
private com.yahoo.statistics.Counter nullQueries
private com.yahoo.statistics.Counter illegalQueries
private com.yahoo.statistics.Value queryLatency
private com.yahoo.statistics.Value queryLatencyBuckets
private com.yahoo.statistics.Value maxQueryLatency
private com.yahoo.statistics.Value activeQueries
private com.yahoo.statistics.Value peakQPS
private com.yahoo.statistics.Counter emptyResults
private com.yahoo.statistics.Value hitsPerQuery
private final StatisticsSearcher.PeakQpsReporter peakQpsReporter
private com.yahoo.jdisc.Metric metric
private Timer scheduler
StatisticsSearcher(com.yahoo.jdisc.Metric metric)
public StatisticsSearcher(com.yahoo.statistics.Statistics manager, com.yahoo.jdisc.Metric metric, com.yahoo.metrics.simple.MetricReceiver metricReceiver)
private void initEvents(com.yahoo.statistics.Statistics manager, com.yahoo.metrics.simple.MetricReceiver metricReceiver)
public void deconstruct()
deconstruct
in class com.yahoo.component.AbstractComponent
public String getMyID()
private void qps(com.yahoo.jdisc.Metric.Context metricContext)
private com.yahoo.jdisc.Metric.Context getChainMetricContext(String chainName)
public Result search(Query query, Execution execution)
private void logQuery(Query query)
private void addLatency(long latency, com.yahoo.jdisc.Metric.Context metricContext)
private void incrQueryCount(com.yahoo.jdisc.Metric.Context metricContext)
private void incrErrorCount(Result result, com.yahoo.jdisc.Metric.Context metricContext)
private void incrementStatePageOnlyErrors(Result result, Execution execution)
result
- The result to check for errorsCopyright © 2017. All rights reserved.