use of org.openkilda.messaging.model.Metric in project open-kilda by telstra.
the class StatisticsBasicTest method getNumberOfDatapoints.
private List<Metric> getNumberOfDatapoints() throws Throwable {
System.out.println("\n==> OpenTSDB Metrics request");
long current = System.currentTimeMillis();
Client client = ClientBuilder.newClient(new ClientConfig());
Response response = client.target(opentsdbEndpoint).path("/api/query").queryParam("start", "24h-ago").queryParam("m", "sum:pen.switch.tx-bytes").queryParam("timezone", "Australia/Melbourne").request().get();
System.out.println(String.format("===> Response = %s", response));
System.out.println(String.format("===> OpenTSDB Metrics Time: %,.3f", getTimeDuration(current)));
List<Metric> metrics = new ObjectMapper().readValue(response.readEntity(String.class), new TypeReference<List<Metric>>() {
});
System.out.println(String.format("====> Metrics = %s", metrics));
return metrics;
}
Aggregations