minor metrics reporting change
This commit is contained in:
parent
6a77eb56b0
commit
17da38213c
|
@ -1,11 +1,23 @@
|
||||||
package org.baeldung.monitoring;
|
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.MetricRegistry;
|
||||||
|
import com.codahale.metrics.Slf4jReporter;
|
||||||
|
|
||||||
public final class MetricRegistrySingleton {
|
public final class MetricRegistrySingleton {
|
||||||
|
|
||||||
public static final MetricRegistry metrics = new MetricRegistry();
|
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() {
|
private MetricRegistrySingleton() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue