@Test public void testNoOpRequestMetricsIfRequestMetricsDisabled() { OverAllQueryMetrics noOpMetrics = new OverAllQueryMetrics(false, LogLevel.OFF); populateMetrics(noOpMetrics, numParallelScans, queryTimeouts, queryFailures, cacheRefreshesDueToSplits); Map<MetricType, Long> noOpMap = noOpMetrics.publish(); assertEquals(1, noOpMap.size()); assertEquals(0L, (long)noOpMap.get(NO_OP_METRIC)); }
public Map<MetricType, Long> publish() { Map<MetricType, Long> metricsForPublish = new HashMap<>(); metricsForPublish.put(numParallelScans.getMetricType(), numParallelScans.getValue()); metricsForPublish.put(wallClockTimeMS.getMetricType(), wallClockTimeMS.getValue()); metricsForPublish.put(resultSetTimeMS.getMetricType(), resultSetTimeMS.getValue()); metricsForPublish.put(queryTimedOut.getMetricType(), queryTimedOut.getValue()); metricsForPublish.put(queryFailed.getMetricType(), queryFailed.getValue()); metricsForPublish.put(cacheRefreshedDueToSplits.getMetricType(), cacheRefreshedDueToSplits.getValue()); return metricsForPublish; }
OverAllQueryMetrics { public Map<MetricType, Long> publish() { Map<MetricType, Long> metricsForPublish = new HashMap<>(); metricsForPublish.put(numParallelScans.getMetricType(), numParallelScans.getValue()); metricsForPublish.put(wallClockTimeMS.getMetricType(), wallClockTimeMS.getValue()); metricsForPublish.put(resultSetTimeMS.getMetricType(), resultSetTimeMS.getValue()); metricsForPublish.put(queryTimedOut.getMetricType(), queryTimedOut.getValue()); metricsForPublish.put(queryFailed.getMetricType(), queryFailed.getValue()); metricsForPublish.put(cacheRefreshedDueToSplits.getMetricType(), cacheRefreshedDueToSplits.getValue()); return metricsForPublish; } }
OverAllQueryMetrics { public Map<MetricType, Long> publish() { Map<MetricType, Long> metricsForPublish = new HashMap<>(); metricsForPublish.put(numParallelScans.getMetricType(), numParallelScans.getValue()); metricsForPublish.put(wallClockTimeMS.getMetricType(), wallClockTimeMS.getValue()); metricsForPublish.put(resultSetTimeMS.getMetricType(), resultSetTimeMS.getValue()); metricsForPublish.put(queryTimedOut.getMetricType(), queryTimedOut.getValue()); metricsForPublish.put(queryFailed.getMetricType(), queryFailed.getValue()); metricsForPublish.put(cacheRefreshedDueToSplits.getMetricType(), cacheRefreshedDueToSplits.getValue()); return metricsForPublish; } OverAllQueryMetrics(boolean isRequestMetricsEnabled, LogLevel connectionLogLevel); }
OverAllQueryMetrics { public Map<MetricType, Long> publish() { Map<MetricType, Long> metricsForPublish = new HashMap<>(); metricsForPublish.put(numParallelScans.getMetricType(), numParallelScans.getValue()); metricsForPublish.put(wallClockTimeMS.getMetricType(), wallClockTimeMS.getValue()); metricsForPublish.put(resultSetTimeMS.getMetricType(), resultSetTimeMS.getValue()); metricsForPublish.put(queryTimedOut.getMetricType(), queryTimedOut.getValue()); metricsForPublish.put(queryFailed.getMetricType(), queryFailed.getValue()); metricsForPublish.put(cacheRefreshedDueToSplits.getMetricType(), cacheRefreshedDueToSplits.getValue()); return metricsForPublish; } OverAllQueryMetrics(boolean isRequestMetricsEnabled, LogLevel connectionLogLevel); void updateNumParallelScans(long numParallelScans); void queryTimedOut(); void queryFailed(); void cacheRefreshedDueToSplits(); void startQuery(); void endQuery(); void startResultSetWatch(); void stopResultSetWatch(); Map<MetricType, Long> publish(); void reset(); OverAllQueryMetrics combine(OverAllQueryMetrics metric); }
OverAllQueryMetrics { public Map<MetricType, Long> publish() { Map<MetricType, Long> metricsForPublish = new HashMap<>(); metricsForPublish.put(numParallelScans.getMetricType(), numParallelScans.getValue()); metricsForPublish.put(wallClockTimeMS.getMetricType(), wallClockTimeMS.getValue()); metricsForPublish.put(resultSetTimeMS.getMetricType(), resultSetTimeMS.getValue()); metricsForPublish.put(queryTimedOut.getMetricType(), queryTimedOut.getValue()); metricsForPublish.put(queryFailed.getMetricType(), queryFailed.getValue()); metricsForPublish.put(cacheRefreshedDueToSplits.getMetricType(), cacheRefreshedDueToSplits.getValue()); return metricsForPublish; } OverAllQueryMetrics(boolean isRequestMetricsEnabled, LogLevel connectionLogLevel); void updateNumParallelScans(long numParallelScans); void queryTimedOut(); void queryFailed(); void cacheRefreshedDueToSplits(); void startQuery(); void endQuery(); void startResultSetWatch(); void stopResultSetWatch(); Map<MetricType, Long> publish(); void reset(); OverAllQueryMetrics combine(OverAllQueryMetrics metric);  }