Package com.codahale.metrics.graphite
Class GraphiteReporter
- java.lang.Object
-
- com.codahale.metrics.ScheduledReporter
-
- com.codahale.metrics.graphite.GraphiteReporter
-
- All Implemented Interfaces:
com.codahale.metrics.Reporter,Closeable,AutoCloseable
public class GraphiteReporter extends com.codahale.metrics.ScheduledReporterA 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 protectedGraphiteReporter(com.codahale.metrics.MetricRegistry registry, GraphiteSender graphite, com.codahale.metrics.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, com.codahale.metrics.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes)Creates a newGraphiteReporterinstance.protectedGraphiteReporter(com.codahale.metrics.MetricRegistry registry, GraphiteSender graphite, com.codahale.metrics.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, com.codahale.metrics.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes, boolean addMetricAttributesAsTags)Creates a newGraphiteReporterinstance.protectedGraphiteReporter(com.codahale.metrics.MetricRegistry registry, GraphiteSender graphite, com.codahale.metrics.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, com.codahale.metrics.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes, boolean addMetricAttributesAsTags, DoubleFunction<String> floatingPointFormatter)Creates a newGraphiteReporterinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Stringformat(double v)static GraphiteReporter.BuilderforRegistry(com.codahale.metrics.MetricRegistry registry)Returns a newGraphiteReporter.BuilderforGraphiteReporter.voidreport(SortedMap<String,com.codahale.metrics.Gauge> gauges, SortedMap<String,com.codahale.metrics.Counter> counters, SortedMap<String,com.codahale.metrics.Histogram> histograms, SortedMap<String,com.codahale.metrics.Meter> meters, SortedMap<String,com.codahale.metrics.Timer> timers)voidstop()
-
-
-
Constructor Detail
-
GraphiteReporter
protected GraphiteReporter(com.codahale.metrics.MetricRegistry registry, GraphiteSender graphite, com.codahale.metrics.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, com.codahale.metrics.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes)Creates a newGraphiteReporterinstance.- Parameters:
registry- theMetricRegistrycontaining the metrics this reporter will reportgraphite- theGraphiteSenderwhich is responsible for sending metrics to a Carbon server via a transport protocolclock- the instance of the time. UseClock.defaultClock()for the defaultprefix- the prefix of all metric names (may be null)rateUnit- the time unit of in which rates will be converteddurationUnit- the time unit of in which durations will be convertedfilter- the filter for which metrics to reportexecutor- the executor to use while scheduling reporting of metrics (may be null).shutdownExecutorOnStop- if true, then executor will be stopped in same time with this reporterdisabledMetricAttributes- do not report specific metric attributes
-
GraphiteReporter
protected GraphiteReporter(com.codahale.metrics.MetricRegistry registry, GraphiteSender graphite, com.codahale.metrics.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, com.codahale.metrics.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes, boolean addMetricAttributesAsTags)Creates a newGraphiteReporterinstance.- Parameters:
registry- theMetricRegistrycontaining the metrics this reporter will reportgraphite- theGraphiteSenderwhich is responsible for sending metrics to a Carbon server via a transport protocolclock- the instance of the time. UseClock.defaultClock()for the defaultprefix- the prefix of all metric names (may be null)rateUnit- the time unit of in which rates will be converteddurationUnit- the time unit of in which durations will be convertedfilter- the filter for which metrics to reportexecutor- the executor to use while scheduling reporting of metrics (may be null).shutdownExecutorOnStop- if true, then executor will be stopped in same time with this reporterdisabledMetricAttributes- do not report specific metric attributesaddMetricAttributesAsTags- if true, then add metric attributes as tags instead of suffixes
-
GraphiteReporter
protected GraphiteReporter(com.codahale.metrics.MetricRegistry registry, GraphiteSender graphite, com.codahale.metrics.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, com.codahale.metrics.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes, boolean addMetricAttributesAsTags, DoubleFunction<String> floatingPointFormatter)Creates a newGraphiteReporterinstance.- Parameters:
registry- theMetricRegistrycontaining the metrics this reporter will reportgraphite- theGraphiteSenderwhich is responsible for sending metrics to a Carbon server via a transport protocolclock- the instance of the time. UseClock.defaultClock()for the defaultprefix- the prefix of all metric names (may be null)rateUnit- the time unit of in which rates will be converteddurationUnit- the time unit of in which durations will be convertedfilter- the filter for which metrics to reportexecutor- the executor to use while scheduling reporting of metrics (may be null).shutdownExecutorOnStop- if true, then executor will be stopped in same time with this reporterdisabledMetricAttributes- do not report specific metric attributesaddMetricAttributesAsTags- if true, then add metric attributes as tags instead of suffixesfloatingPointFormatter- custom floating point formatter
-
-
Method Detail
-
forRegistry
public static GraphiteReporter.Builder forRegistry(com.codahale.metrics.MetricRegistry registry)
Returns a newGraphiteReporter.BuilderforGraphiteReporter.- Parameters:
registry- the registry to report- Returns:
- a
GraphiteReporter.Builderinstance for aGraphiteReporter
-
report
public void report(SortedMap<String,com.codahale.metrics.Gauge> gauges, SortedMap<String,com.codahale.metrics.Counter> counters, SortedMap<String,com.codahale.metrics.Histogram> histograms, SortedMap<String,com.codahale.metrics.Meter> meters, SortedMap<String,com.codahale.metrics.Timer> timers)
- Specified by:
reportin classcom.codahale.metrics.ScheduledReporter
-
stop
public void stop()
- Overrides:
stopin classcom.codahale.metrics.ScheduledReporter
-
format
protected String format(double v)
-
-