axhixh / metrics-influxdb

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:Creative Commons Zero v1.0 Universal


Languages

Language:Java 100.0%