Package com.codahale.metrics.graphite
Class GraphiteReporter
- java.lang.Object
-
- com.codahale.metrics.ScheduledReporter
-
- com.codahale.metrics.graphite.GraphiteReporter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class GraphiteReporter extends ScheduledReporter
A reporter which publishes metric values to a Graphite server.- See Also:
- Graphite - Scalable Realtime Graphing
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGraphiteReporter.BuilderA builder forGraphiteReporterinstances.
-
Constructor Summary
Constructors Modifier Constructor Description privateGraphiteReporter(MetricRegistry registry, Graphite graphite, Clock clock, java.lang.String prefix, java.util.concurrent.TimeUnit rateUnit, java.util.concurrent.TimeUnit durationUnit, MetricFilter filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Stringformat(double v)private java.lang.Stringformat(long n)private java.lang.Stringformat(java.lang.Object o)static GraphiteReporter.BuilderforRegistry(MetricRegistry registry)Returns a newGraphiteReporter.BuilderforGraphiteReporter.private java.lang.Stringprefix(java.lang.String... components)voidreport(java.util.SortedMap<java.lang.String,Gauge> gauges, java.util.SortedMap<java.lang.String,Counter> counters, java.util.SortedMap<java.lang.String,Histogram> histograms, java.util.SortedMap<java.lang.String,Meter> meters, java.util.SortedMap<java.lang.String,Timer> timers)Called periodically by the polling thread.private voidreportCounter(java.lang.String name, Counter counter, long timestamp)private voidreportGauge(java.lang.String name, Gauge gauge, long timestamp)private voidreportHistogram(java.lang.String name, Histogram histogram, long timestamp)private voidreportMetered(java.lang.String name, Metered meter, long timestamp)private voidreportTimer(java.lang.String name, Timer timer, long timestamp)-
Methods inherited from class com.codahale.metrics.ScheduledReporter
close, convertDuration, convertRate, getDurationUnit, getRateUnit, report, start, stop
-
-
-
-
Constructor Detail
-
GraphiteReporter
private GraphiteReporter(MetricRegistry registry, Graphite graphite, Clock clock, java.lang.String prefix, java.util.concurrent.TimeUnit rateUnit, java.util.concurrent.TimeUnit durationUnit, MetricFilter filter)
-
-
Method Detail
-
forRegistry
public static GraphiteReporter.Builder forRegistry(MetricRegistry registry)
Returns a newGraphiteReporter.BuilderforGraphiteReporter.- Parameters:
registry- the registry to report- Returns:
- a
GraphiteReporter.Builderinstance for aGraphiteReporter
-
report
public void report(java.util.SortedMap<java.lang.String,Gauge> gauges, java.util.SortedMap<java.lang.String,Counter> counters, java.util.SortedMap<java.lang.String,Histogram> histograms, java.util.SortedMap<java.lang.String,Meter> meters, java.util.SortedMap<java.lang.String,Timer> timers)
Description copied from class:ScheduledReporterCalled periodically by the polling thread. Subclasses should report all the given metrics.- Specified by:
reportin classScheduledReporter- Parameters:
gauges- all of the gauges in the registrycounters- all of the counters in the registryhistograms- all of the histograms in the registrymeters- all of the meters in the registrytimers- all of the timers in the registry
-
reportTimer
private void reportTimer(java.lang.String name, Timer timer, long timestamp) throws java.io.IOException- Throws:
java.io.IOException
-
reportMetered
private void reportMetered(java.lang.String name, Metered meter, long timestamp) throws java.io.IOException- Throws:
java.io.IOException
-
reportHistogram
private void reportHistogram(java.lang.String name, Histogram histogram, long timestamp) throws java.io.IOException- Throws:
java.io.IOException
-
reportCounter
private void reportCounter(java.lang.String name, Counter counter, long timestamp) throws java.io.IOException- Throws:
java.io.IOException
-
reportGauge
private void reportGauge(java.lang.String name, Gauge gauge, long timestamp) throws java.io.IOException- Throws:
java.io.IOException
-
format
private java.lang.String format(java.lang.Object o)
-
prefix
private java.lang.String prefix(java.lang.String... components)
-
format
private java.lang.String format(long n)
-
format
private java.lang.String format(double v)
-
-