com.palominolabs.metrics.guice.JmxReporterProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metrics-guice Show documentation
Show all versions of metrics-guice Show documentation
com.palominolabs.metrics:metrics-guice
package com.palominolabs.metrics.guice;
import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@Singleton
public class JmxReporterProvider implements Provider {
private final MetricRegistry metricRegistry;
@Inject
public JmxReporterProvider(MetricRegistry metricRegistry) {
this.metricRegistry = metricRegistry;
}
@Override
public JmxReporter get() {
final JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).build();
reporter.start();
return reporter;
}
}