private void setupGraphiteReporter() {
if (graphiteSettings.getGraphiteHost().isPresent()) {
InetSocketAddress address = new InetSocketAddress(
graphiteSettings.getGraphiteHost().get(), graphiteSettings.getGraphitePort().or(2003));
logger.info("Initializing Metrics Graphite reporting to {}", address);
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metrics)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build(new Graphite(address));
graphiteReporter.start(graphiteSettings.getFrequency().get(),
TimeUnit.valueOf(graphiteSettings.getFrequencyUnit().get()));
}
}