Skip to content

techtraits/hosted-graphite-reporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hosted-graphite-reporter

A simple library to report codahale metrics to hosted graphite from google app engine

Building from source

  • Install maven 3
  • Configure repos in settings.xml
  • git clone git://github.com/usmanismail/hosted-graphite-reporter.git
  • cd hosted-graphite-reporter
  • mvn clean install

Installing

Usage

import com.google.appengine.api.urlfetch.URLFetchService;
import com.yammer.metrics.core.Meter;
import com.yammer.metrics.Metrics;
//...

public class MetricsSample {

	public void runMetricsSample(String hostedGraphiteSecret, String hostedGraphiteUrl, URLFetchService fetcher) {
		HostedGraphiteReporter reporter = new HostedGraphiteReporter(hostedGraphiteSecret, hostedGraphiteUrl, fetcher);
		Meter meter = Metrics.newMeter(this.class, "MeterMetric");

		meter.mark();

		//Report one metric
		reportMeterView(new MetricName(this.getClass(), "somename"), meter, System.currentTimeMillis());

		//Report lots of metrics
		Map<MetricName, Metric> metrics = new HashMap<MetricName, Metric>();
		metrics.put(new MetricName(this.getClass(), "somename"), meter);
		reportMetrics(metrics, System.currentTimeMillis());

		//Report Arbitrary Values
		List<MetricRecord> metricsRecords = new List<MetricRecord>();
		metricsRecords.add(new MetricRecord(new MetricName(this.getClass(), "somename"), 
			"postfix", 1.5, System.currentTimeMillis()));
		postMetrics(metricsRecords);
	}
}

Authors

About

A simple library to report codahale metrics to hosted graphite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%