LatencyMetrics: Support path parameter
This change adds path parameter support, for the cases that the path parameter is the last on the path, for example in the ColumnFamily case Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
parent
0ae282b548
commit
2cfe02acb8
@ -252,13 +252,13 @@ public class ColumnFamilyMetrics {
|
|||||||
return c.getDoubleValue("/column_family/metrics/compression_ratio/");
|
return c.getDoubleValue("/column_family/metrics/compression_ratio/");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
readLatency = new LatencyMetrics("/column_family/metrics/read_latency/"
|
readLatency = new LatencyMetrics("/column_family/metrics/read_latency",
|
||||||
+ cfName, factory, "Read");
|
cfName, factory, "Read");
|
||||||
writeLatency = new LatencyMetrics(
|
writeLatency = new LatencyMetrics(
|
||||||
"/column_family/metrics/write_latency/" + cfName, factory,
|
"/column_family/metrics/write_latency", cfName, factory,
|
||||||
"Write");
|
"Write");
|
||||||
rangeLatency = new LatencyMetrics(
|
rangeLatency = new LatencyMetrics(
|
||||||
"/column_family/metrics/range_latency/" + cfName, factory,
|
"/column_family/metrics/range_latency", cfName, factory,
|
||||||
"Range");
|
"Range");
|
||||||
pendingFlushes = createColumnFamilyCounter(
|
pendingFlushes = createColumnFamilyCounter(
|
||||||
"/column_family/metrics/pending_flushes", "PendingFlushes");
|
"/column_family/metrics/pending_flushes", "PendingFlushes");
|
||||||
|
@ -102,6 +102,18 @@ public class LatencyMetrics {
|
|||||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
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
|
* Create LatencyMetrics with given group, type, prefix to append to each
|
||||||
* metric name, and scope. Any updates to this will also run on parent
|
* metric name, and scope. Any updates to this will also run on parent
|
||||||
@ -130,8 +142,8 @@ public class LatencyMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
APIMetrics.defaultRegistry().removeMetric(
|
APIMetrics.defaultRegistry()
|
||||||
factory.createMetricName(namePrefix + "Latency"));
|
.removeMetric(factory.createMetricName(namePrefix + "Latency"));
|
||||||
APIMetrics.defaultRegistry().removeMetric(
|
APIMetrics.defaultRegistry().removeMetric(
|
||||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user