@Override
public void addSampler(String group, String name, int period, int interval, Variable<Long> variable) {
if (scheduler == null) {
throw new IllegalStateException("scheduler not set, cannot sample");
}
Histogram histogram = new Histogram(new ExponentiallyDecayingReservoir());
Sampler sampler = new Sampler(variable, histogram);
scheduler.scheduleAtFixedRate(sampler, 0, interval, TimeUnit.SECONDS);
String key = MetricRegistry.name(group, name, "histogram");
try {
histogramsLock.lock();