Merge "Support empty histogram from the API" from Amnon
"This series support API calls that returns an empty histogram. This is a typical scenario with counters that are not implemented yet, for example range latency. The trigger for this series is the nodetoold proxyhistograms command After this series: ./bin/nodetool proxyhistograms proxy histograms Percentile Read Latency Write Latency Range Latency (micros) (micros) (micros) 50% 654949.00 315852.00 NaN 75% 8409007.00 4055269.00 NaN 95% 20924300.00 17436917.00 NaN 98% 25109160.00 20924300.00 NaN 99% 25109160.00 25109160.00 NaN Min 11865.00 11865.00 NaN Max 25109160.00 25109160.00 NaN"
This commit is contained in:
commit
c7df07ac70
@ -677,6 +677,9 @@ public class APIClient {
|
||||
MultivaluedMap<String, String> queryParams) {
|
||||
JsonObject obj = getJsonObj(string, queryParams);
|
||||
JsonArray arr = obj.getJsonArray("buckets");
|
||||
if (arr == null) {
|
||||
return new long[0];
|
||||
}
|
||||
long res[] = new long[arr.size()];
|
||||
for (int i = 0; i< arr.size(); i++) {
|
||||
res[i] = arr.getJsonNumber(i).longValue();
|
||||
|
@ -74,6 +74,9 @@ public class EstimatedHistogram {
|
||||
}
|
||||
|
||||
private static long[] newOffsets(int size) {
|
||||
if (size <= 0) {
|
||||
return new long[0];
|
||||
}
|
||||
long[] result = new long[size];
|
||||
long last = 1;
|
||||
result[0] = last;
|
||||
|
@ -50,6 +50,9 @@ public class RecentEstimatedHistogram extends EstimatedHistogram {
|
||||
* @return a long[] containing the current histogram difference buckets
|
||||
*/
|
||||
public long[] getBuckets(long[] bucketData) {
|
||||
if (bucketData.length == 0) {
|
||||
return new long[0];
|
||||
}
|
||||
final int len = buckets.length();
|
||||
long[] rv = new long[len];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user