Skip to content

Instantly share code, notes, and snippets.

@chbatey
Last active August 29, 2015 14:16
Show Gist options
  • Save chbatey/ed5ae8f51131abc75cb3 to your computer and use it in GitHub Desktop.
Save chbatey/ed5ae8f51131abc75cb3 to your computer and use it in GitHub Desktop.
Metric and Graphite
@Inject
private Session session;
@Inject
private MetricRegistry metricRegistry;
@Bean
public MetricRegistry metricRegistry() {
return session.getCluster().getMetrics().getRegistry();
}
@Bean
public GraphiteReporter graphiteReporter() {
LOGGER.debug("Creating graphite reporter");
final Graphite graphite = new Graphite(new InetSocketAddress("192.168.10.120", 2003));
final GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith("KillrAuction")
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(30, TimeUnit.SECONDS);
return reporter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment