File tree Expand file tree Collapse file tree
spring-security-mvc-custom/src/main/java/org/baeldung/monitoring Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .baeldung .monitoring ;
22
3+ import java .util .concurrent .TimeUnit ;
4+
5+ import org .slf4j .Logger ;
6+ import org .slf4j .LoggerFactory ;
7+
38import com .codahale .metrics .MetricRegistry ;
9+ import com .codahale .metrics .Slf4jReporter ;
410
511public final class MetricRegistrySingleton {
612
713 public static final MetricRegistry metrics = new MetricRegistry ();
814
15+ static {
16+ Logger logger = LoggerFactory .getLogger ("org.baeldung.monitoring" );
17+ final Slf4jReporter reporter = Slf4jReporter .forRegistry (metrics ).outputTo (logger ).convertRatesTo (TimeUnit .SECONDS ).convertDurationsTo (TimeUnit .MILLISECONDS ).build ();
18+ reporter .start (5 , TimeUnit .MINUTES );
19+ }
20+
921 private MetricRegistrySingleton () {
1022 throw new AssertionError ();
1123 }
You can’t perform that action at this time.
0 commit comments