Search in sources :

Example 1 with InfluxDbHttpSender

use of io.dropwizard.metrics.influxdb.InfluxDbHttpSender in project light-4j by networknt.

the class SendToLocalInfluxDB method startInfluxDbReporter.

private static InfluxDbReporter startInfluxDbReporter(MetricRegistry registry) throws Exception {
    final InfluxDbHttpSender influxDb = new InfluxDbHttpSender("http", "127.0.0.1", 8086, "dropwizard", "root", "root");
    final Map<String, String> tags = new HashMap<>();
    tags.put("host", "localhost");
    final InfluxDbReporter reporter = InfluxDbReporter.forRegistry(registry).withTags(tags).skipIdleMetrics(true).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(influxDb);
    reporter.start(10, TimeUnit.SECONDS);
    return reporter;
}
Also used : InfluxDbHttpSender(io.dropwizard.metrics.influxdb.InfluxDbHttpSender) HashMap(java.util.HashMap) InfluxDbReporter(io.dropwizard.metrics.influxdb.InfluxDbReporter)

Aggregations

InfluxDbHttpSender (io.dropwizard.metrics.influxdb.InfluxDbHttpSender)1 InfluxDbReporter (io.dropwizard.metrics.influxdb.InfluxDbReporter)1 HashMap (java.util.HashMap)1