Created
May 24, 2018 13:50
-
-
Save mykidong/54bdfa69d27ff81ac023a1aa67ccdf40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.codahale.metrics.JmxReporter; | |
import com.codahale.metrics.MetricRegistry; | |
import org.springframework.beans.factory.InitializingBean; | |
public class JMXMetricsReporter implements InitializingBean { | |
private MetricRegistry metricRegistry; | |
// metricRegistry injected. | |
public void setMetricRegistry(MetricRegistry metricRegistry) { | |
this.metricRegistry = metricRegistry; | |
} | |
@Override | |
public void afterPropertiesSet() throws Exception { | |
JmxReporter reporter = JmxReporter.forRegistry(this.metricRegistry).build(); | |
reporter.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.