GraphiteWithStormQuerier extends AbstractTimeSeriesQuerier { @Override public Map<String, Map<Long, Double>> getRawMetrics(String metricName, String parameters, long from, long to) { Map<String, String> queryParams = parseParameters(parameters); URI targetUri = composeRawQueryParameters(metricName, queryParams, from, to); log.debug("Calling {} for querying metric", targetUri.toString()); List<Map<String, ?>> responseList = JsonClientUtil.getEntity(client.target(targetUri), List.class); if (responseList.size() > 0) { Map<String, Map<Long, Double>> ret = new HashMap<>(responseList.size()); for (Map<String, ?> metric : responseList) { String target = (String) metric.get("target"); List<List<Number>> dataPoints = (List<List<Number>>) metric.get("datapoints"); Map<Long, Double> pointsForOutput = formatDataPointsFromGraphiteToMap(dataPoints); ret.put(target, pointsForOutput); } return ret; } else { return Collections.emptyMap(); } } GraphiteWithStormQuerier(); @Override void init(Map<String, String> conf); @Override Map<Long, Double> getTopologyLevelMetrics(String topologyName, String metricName,
                                                     AggregateFunction aggrFunction, long from, long to); @Override Map<Long, Double> getMetrics(String topologyName, String componentId, String metricName, AggregateFunction aggrFunction,
                                        long from, long to); @Override Map<String, Map<Long, Double>> getRawMetrics(String metricName, String parameters, long from, long to); static final String WILDCARD_ALL_COMPONENTS; }
@Test public void getRawMetrics() throws Exception { stubMetricUrl(); String metricName = "metric"; String parameters = ""; long from = 1234000L; long to = 5678000L; Map<String, Map<Long, Double>> metrics = querier.getRawMetrics(metricName, parameters, from, to); assertResult(metrics.get("metric")); verify(getRequestedFor(urlPathEqualTo(TEST_RENDER_API_PATH)) .withQueryParam("target", equalTo("metric")) .withQueryParam("format", equalTo("json")) .withQueryParam("from", equalTo("1234")) .withQueryParam("until", equalTo("5678"))); }