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 class
GraphiteReporter.Builder
A builder forGraphiteReporter
instances.
-
Constructor Summary
Constructors Modifier Constructor Description 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
format(double v)
private java.lang.String
format(long n)
private java.lang.String
format(java.lang.Object o)
static GraphiteReporter.Builder
forRegistry(MetricRegistry registry)
Returns a newGraphiteReporter.Builder
forGraphiteReporter
.private java.lang.String
prefix(java.lang.String... components)
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)
Called periodically by the polling thread.private void
reportCounter(java.lang.String name, Counter counter, long timestamp)
private void
reportGauge(java.lang.String name, Gauge gauge, long timestamp)
private void
reportHistogram(java.lang.String name, Histogram histogram, long timestamp)
private void
reportMetered(java.lang.String name, Metered meter, long timestamp)
private void
reportTimer(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.Builder
forGraphiteReporter
.- Parameters:
registry
- the registry to report- Returns:
- a
GraphiteReporter.Builder
instance 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:ScheduledReporter
Called periodically by the polling thread. Subclasses should report all the given metrics.- Specified by:
report
in 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)
-
-