@SuppressWarnings("unchecked") @RequestMapping( value = "timeAggregation", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<TimeAggregation> getTimeAggregation() { return Arrays.asList(TimeAggregation.values()); }
/** * Count of metric per timestamp and {@link Metric#getName()}. * * @param name * @param start * @param end * @return */ @RequestMapping( value = "countByMetricNameTimestamp/{name}&{timeAgg}&{start}&{end}", method = RequestMethod.GET, produces = "application/json") public @ResponseBody GraphResponse countByMetricNameTimestamp( @PathVariable String name, @PathVariable String timeAgg, @PathVariable Long start, @PathVariable Long end) { long startT = new Date().getTime(); List<Count> counts = metricService.getRepository().getCountByMetricNameBetween(name, start, end); long endT = new Date().getTime(); LOG.info( "we have loaded metrics count from repo : " + counts.size() + " took : " + (endT - startT) + "ms"); return MetricUtility.buildGraphResponse(counts, TimeAggregation.valueOf(timeAgg)); }