minor metrics reporting change

This commit is contained in:
eugenp 2013-08-02 13:53:46 +03:00
parent 6a77eb56b0
commit 17da38213c
1 changed files with 12 additions and 0 deletions

View File

@ -1,11 +1,23 @@
package org.baeldung.monitoring;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Slf4jReporter;
public final class MetricRegistrySingleton {
public static final MetricRegistry metrics = new MetricRegistry();
static {
Logger logger = LoggerFactory.getLogger("org.baeldung.monitoring");
final Slf4jReporter reporter = Slf4jReporter.forRegistry(metrics).outputTo(logger).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build();
reporter.start(5, TimeUnit.MINUTES);
}
private MetricRegistrySingleton() {
throw new AssertionError();
}