Merge "Adding the row estimated histogram to column family" from Amnon
"This series adds the JMX API to the row estimated histogram. It adds a get function in the APIClient to fetch the data. The implementation is based on the column_family.json for the API call and on utils.json for the estimated histogram definition."
This commit is contained in:
commit
4598323f02
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
|
||||
@Deprecated
|
||||
public long[] getEstimatedRowSizeHistogram() {
|
||||
log(" getEstimatedRowSizeHistogram()");
|
||||
return c.getLongArrValue("");
|
||||
return c.getEstimatedHistogramAsLongArrValue("/column_family/metrics/estimated_row_size_histogram/" + getCFName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,7 +225,7 @@ public class ColumnFamilyMetrics {
|
||||
factory.createMetricName("EstimatedRowSizeHistogram"),
|
||||
new Gauge<long[]>() {
|
||||
public long[] value() {
|
||||
return c.getLongArrValue("/column_family/metrics/estimated_row_size_histogram/"
|
||||
return c.getEstimatedHistogramAsLongArrValue("/column_family/metrics/estimated_row_size_histogram/"
|
||||
+ cfName);
|
||||
}
|
||||
});
|
||||
@ -233,7 +233,7 @@ public class ColumnFamilyMetrics {
|
||||
factory.createMetricName("EstimatedColumnCountHistogram"),
|
||||
new Gauge<long[]>() {
|
||||
public long[] value() {
|
||||
return c.getLongArrValue("/column_family/metrics/estimated_column_count_histogram/"
|
||||
return c.getEstimatedHistogramAsLongArrValue("/column_family/metrics/estimated_column_count_histogram/"
|
||||
+ cfName);
|
||||
}
|
||||
});
|
||||
@ -252,13 +252,13 @@ public class ColumnFamilyMetrics {
|
||||
return c.getDoubleValue("/column_family/metrics/compression_ratio/");
|
||||
}
|
||||
});
|
||||
readLatency = new LatencyMetrics("/column_family/metrics/read_latency/"
|
||||
+ cfName, factory, "Read");
|
||||
readLatency = new LatencyMetrics("/column_family/metrics/read_latency",
|
||||
cfName, factory, "Read");
|
||||
writeLatency = new LatencyMetrics(
|
||||
"/column_family/metrics/write_latency/" + cfName, factory,
|
||||
"/column_family/metrics/write_latency", cfName, factory,
|
||||
"Write");
|
||||
rangeLatency = new LatencyMetrics(
|
||||
"/column_family/metrics/range_latency/" + cfName, factory,
|
||||
"/column_family/metrics/range_latency", cfName, factory,
|
||||
"Range");
|
||||
pendingFlushes = createColumnFamilyCounter(
|
||||
"/column_family/metrics/pending_flushes", "PendingFlushes");
|
||||
|
@ -102,6 +102,18 @@ public class LatencyMetrics {
|
||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||
}
|
||||
|
||||
public LatencyMetrics(String url, String paramName,
|
||||
MetricNameFactory factory, String namePrefix) {
|
||||
this.factory = factory;
|
||||
this.namePrefix = namePrefix;
|
||||
|
||||
latency = APIMetrics.newTimer(url + "/histogram/" + paramName,
|
||||
factory.createMetricName(namePrefix + "Latency"),
|
||||
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
||||
totalLatency = APIMetrics.newCounter(url + "/" + paramName,
|
||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create LatencyMetrics with given group, type, prefix to append to each
|
||||
* metric name, and scope. Any updates to this will also run on parent
|
||||
@ -130,8 +142,8 @@ public class LatencyMetrics {
|
||||
}
|
||||
|
||||
public void release() {
|
||||
APIMetrics.defaultRegistry().removeMetric(
|
||||
factory.createMetricName(namePrefix + "Latency"));
|
||||
APIMetrics.defaultRegistry()
|
||||
.removeMetric(factory.createMetricName(namePrefix + "Latency"));
|
||||
APIMetrics.defaultRegistry().removeMetric(
|
||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user