try {
Influxdb influxdb = new Influxdb(address, port, database,
username, password);
final InfluxdbReporter reporter = InfluxdbReporter
.forRegistry(metricsService.getMetricRegistry())
.prefixedWith(hostname)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL).build(influxdb);
reporter.start(delay, TimeUnit.SECONDS);
log.info(
"Started InfluxDB Metrics reporter for '{}', updating every {}",
hostname, period);