LatencyMetrics: Support totalLatencyHistogram and recentLatencyHistogram
This adds the depricated total and recent estimated histogram. It uses the new RecentEstimatedHistogram for the recent value and the API based estimated histogram for the total latency. Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
parent
6df716e5f7
commit
960aa6f509
@ -29,6 +29,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import com.cloudius.urchin.metrics.APIMetrics;
|
||||
import com.cloudius.urchin.metrics.DefaultNameFactory;
|
||||
import com.cloudius.urchin.metrics.MetricNameFactory;
|
||||
import com.cloudius.urchin.utils.EstimatedHistogram;
|
||||
import com.cloudius.urchin.utils.RecentEstimatedHistogram;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.yammer.metrics.core.Counter;
|
||||
@ -49,6 +51,12 @@ public class LatencyMetrics {
|
||||
protected final MetricNameFactory factory;
|
||||
protected final String namePrefix;
|
||||
|
||||
@Deprecated public EstimatedHistogramWrapper totalLatencyHistogram;
|
||||
/*
|
||||
* It should not be called directly, use the getRecentLatencyHistogram
|
||||
*/
|
||||
@Deprecated protected final RecentEstimatedHistogram recentLatencyHistogram = new RecentEstimatedHistogram();
|
||||
|
||||
protected long lastLatency;
|
||||
protected long lastOpCount;
|
||||
|
||||
@ -106,6 +114,7 @@ public class LatencyMetrics {
|
||||
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
||||
totalLatency = APIMetrics.newCounter(url + paramName,
|
||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||
totalLatencyHistogram = new EstimatedHistogramWrapper(url + "/estimated_histogram" + paramName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,4 +164,8 @@ public class LatencyMetrics {
|
||||
lastOpCount = ops;
|
||||
}
|
||||
}
|
||||
|
||||
public long[] getRecentLatencyHistogram() {
|
||||
return recentLatencyHistogram.getBuckets(totalLatencyHistogram.getBuckets(false));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user