Skip to content

achmadns/metrics-influxdb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork of davidB library enabling support for InfluxDB v0.9.1+

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.

Installation & dependency

mvn clean install
<dependency>
	<groupId>com.pretius</groupId>
	<artifactId>metrics-influxdb</artifactId>
	<version>0.9-SNAPSHOT</version>
</dependency>

Usage sample

private static InfluxdbReporter startInfluxdbReporter(MetricRegistry registry) throws Exception {
	InfluxdbHttpConfig config = new InfluxdbHttpConfig();
	config.setHost("127.0.0.1");
	config.setPort(8086);
	config.setDatabase("db");
	
	final InfluxdbHttp influxdb = new InfluxdbHttp(config); // http transport
	
	// final InfluxdbUdp influxdb = new InfluxdbUdp("127.0.0.1", 8089); // udp transport
	
	influxdb.setDebug(true); // to log processing series
	
	influxdb.addTag("application", "app"); // only for 0.9.1+
	influxdb.addTag("instance", "instance1");
	
	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;
}

Field names change

To avoid wrapping in double quotes in queries, field names now starts with letter and doesn't contain dashes. The change affects following fields:

old name new name
std-dev std_dev
50-percentile percentile_50
75-percentile percentile_75
95-percentile percentile_95
99-percentile percentile_99
999-percentile percentile_999
one-minute one_minute
five-minute five_minute
fifteen-minute fifteen_minute
mean-rate mean_rate
run-count run_count

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%