APIClient: Add a getter for estimated histogram buckets

This method returns the estimated histogram buckets. It is based on the
module definied in utils.json in the API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman 2015-08-05 15:29:09 +03:00
parent 4a3af8ce03
commit bde40aed53
1 changed files with 15 additions and 0 deletions

View File

@ -539,4 +539,19 @@ public class APIClient {
public HistogramValues getHistogramValue(String url) {
return getHistogramValue(url, null);
}
public long[] getEstimatedHistogramAsLongArrValue(String string,
MultivaluedMap<String, String> queryParams) {
JsonObject obj = getJsonObj(string, queryParams);
JsonArray arr = obj.getJsonArray("buckets");
long res[] = new long[arr.size()];
for (int i = 0; i< arr.size(); i++) {
res[i] = arr.getJsonNumber(i).longValue();
}
return res;
}
public long[] getEstimatedHistogramAsLongArrValue(String string) {
return getEstimatedHistogramAsLongArrValue(string, null);
}
}