Package com.codahale.metrics.graphite
Class GraphiteReporter
java.lang.Object
com.codahale.metrics.ScheduledReporter
com.codahale.metrics.graphite.GraphiteReporter
- All Implemented Interfaces:
Closeable
,AutoCloseable
A reporter which publishes metric values to a Graphite server.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
GraphiteReporter
(MetricRegistry registry, Graphite graphite, Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, MetricFilter filter) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
format
(double v) private String
format
(long n) private String
static GraphiteReporter.Builder
forRegistry
(MetricRegistry registry) Returns a newGraphiteReporter.Builder
forGraphiteReporter
.private String
void
report
(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) Called periodically by the polling thread.private void
reportCounter
(String name, Counter counter, long timestamp) private void
reportGauge
(String name, Gauge gauge, long timestamp) private void
reportHistogram
(String name, Histogram histogram, long timestamp) private void
reportMetered
(String name, Metered meter, long timestamp) private void
reportTimer
(String name, Timer timer, long timestamp) Methods inherited from class com.codahale.metrics.ScheduledReporter
close, convertDuration, convertRate, getDurationUnit, getRateUnit, report, start, stop
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
graphite
-
clock
-
prefix
-
-
Constructor Details
-
GraphiteReporter
private GraphiteReporter(MetricRegistry registry, Graphite graphite, Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, MetricFilter filter)
-
-
Method Details
-
forRegistry
Returns a newGraphiteReporter.Builder
forGraphiteReporter
.- Parameters:
registry
- the registry to report- Returns:
- a
GraphiteReporter.Builder
instance for aGraphiteReporter
-
report
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<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
- Throws:
IOException
-
reportMetered
- Throws:
IOException
-
reportHistogram
- Throws:
IOException
-
reportCounter
- Throws:
IOException
-
reportGauge
- Throws:
IOException
-
format
-
prefix
-
format
-
format
-