/metrics-influxdb

A reporter for metrics which announces measurements to an InfluxDB server.

Primary LanguageJavaCreative Commons Zero v1.0 UniversalCC0-1.0

The library provide :

  • a lighter client than influxdb-java to push only series to an InfluxDB server.
  • A reporter for metrics which announces measurements.

The library provide a lighter client than influxdb-java to push only metrics.

Dependencies :

  • slf4j-api for logging.
  • metrics-core, to provide, if you use InfluxdbReporter.

Usage sample :

private static InfluxdbReporter startInfluxdbReporter(MetricRegistry registry) throws Exception {
	final InfluxdbHttp influxdb = new InfluxdbHttp("127.0.0.1", 8086, "mydb", "user", "pass"); // http transport
	// = new InfluxDbUdp("127.0.0.1", 1234); // udp transport
	//influxdb.debugJson = true; // to print json on System.err
	//influxdb.jsonBuilder = new MyJsonBuildler(); // to use MyJsonBuilder to create json
	final InfluxdbReporter reporter = InfluxdbReporter
			.forRegistry(registry)
			.prefixedWith("test")
			.convertRatesTo(TimeUnit.SECONDS)
			.convertDurationsTo(TimeUnit.MILLISECONDS)
			.filter(MetricFilter.ALL)
			.skipIdleMetrics(true) // Only report metrics that have changed.
			.build(influxdb);
	reporter.start(10, TimeUnit.SECONDS);
	return reporter;
}

CC0
To the extent possible under law, Novaquark has waived all copyright and related or neighboring rights to this work.

Bitdeli Badge