CachedTSDBService extends DefaultService implements TSDBService { boolean isQueryHavingHistogram(MetricQuery query) { return (query.getShowHistogramBuckets() == true || query.getPercentile() != null); } @Inject private  CachedTSDBService(SystemConfiguration config, MonitorService monitorService,
    		CacheService cacheService, @NamedBinding TSDBService tsdbService); @Override Map<MetricQuery, List<Metric>> getMetrics(List<MetricQuery> queries); @Override void dispose(); @Override void putMetrics(List<Metric> metrics); @Override void putHistograms(List<Histogram> histograms); @Override void putAnnotations(List<Annotation> annotations); @Override List<Annotation> getAnnotations(List<AnnotationQuery> queries);  }
@Test public void testIfQueryHasHistogram() { long startTime = System.currentTimeMillis()-60*60*1000, endTime = System.currentTimeMillis(); MetricQuery query = new MetricQuery("scope", "metric", new HashMap<>(), startTime, endTime); assertFalse(cachedTSDBService.isQueryHavingHistogram(query)); query = new MetricQuery("scope", "metric", new HashMap<>(),startTime, endTime); query.setShowHistogramBuckets(true); assertTrue(cachedTSDBService.isQueryHavingHistogram(query)); query = new MetricQuery("scope", "metric", new HashMap<>(),startTime, endTime); query.setPercentile(new String[]{"50"}); assertTrue(cachedTSDBService.isQueryHavingHistogram(query)); }