SearchLatencyListener extends AbstractLifecycleComponent implements SearchOperationListener, SearchLatencyProbe { public List<LatencyStat> getLatencyStats(Set<Double> percentiles) { return statBuckets.entrySet().stream() .flatMap(entry -> percentiles.stream().map(percentile -> { TimeValue tv = entry.getValue().getTimeValueAtPercentile(percentile); return new LatencyStat(entry.getKey(), percentile, tv); })) .collect(toList()); } SearchLatencyListener(Settings settings, Supplier<ThreadPool> threadPoolSupplier); long getMillisAtPercentile(String bucket, double percentile); List<LatencyStat> getLatencyStats(Set<Double> percentiles); @SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS") @Override void onQueryPhase(SearchContext searchContext, long tookInNanos);  }
@Test public void startsWithNoBuckets() { SearchLatencyListener listener = newListener(); assertEquals(0, listener.getLatencyStats(Collections.singleton(42D)).size()); }