Class GraphiteReporter

java.lang.Object
io.dropwizard.metrics5.ScheduledReporter
io.dropwizard.metrics5.graphite.GraphiteReporter
All Implemented Interfaces:
io.dropwizard.metrics5.Reporter, Closeable, AutoCloseable

public class GraphiteReporter
extends io.dropwizard.metrics5.ScheduledReporter
A reporter which publishes metric values to a Graphite server.
See Also:
Graphite - Scalable Realtime Graphing
  • Constructor Details

    • GraphiteReporter

      protected GraphiteReporter​(io.dropwizard.metrics5.MetricRegistry registry, GraphiteSender graphite, io.dropwizard.metrics5.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, io.dropwizard.metrics5.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<io.dropwizard.metrics5.MetricAttribute> disabledMetricAttributes)
      Creates a new GraphiteReporter instance.
      Parameters:
      registry - the MetricRegistry containing the metrics this reporter will report
      graphite - the GraphiteSender which is responsible for sending metrics to a Carbon server via a transport protocol
      clock - the instance of the time. Use Clock.defaultClock() for the default
      prefix - the prefix of all metric names (may be null)
      rateUnit - the time unit of in which rates will be converted
      durationUnit - the time unit of in which durations will be converted
      filter - the filter for which metrics to report
      executor - 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 reporter
      disabledMetricAttributes - do not report specific metric attributes
    • GraphiteReporter

      protected GraphiteReporter​(io.dropwizard.metrics5.MetricRegistry registry, GraphiteSender graphite, io.dropwizard.metrics5.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, io.dropwizard.metrics5.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<io.dropwizard.metrics5.MetricAttribute> disabledMetricAttributes, boolean addMetricAttributesAsTags)
      Creates a new GraphiteReporter instance.
      Parameters:
      registry - the MetricRegistry containing the metrics this reporter will report
      graphite - the GraphiteSender which is responsible for sending metrics to a Carbon server via a transport protocol
      clock - the instance of the time. Use Clock.defaultClock() for the default
      prefix - the prefix of all metric names (may be null)
      rateUnit - the time unit of in which rates will be converted
      durationUnit - the time unit of in which durations will be converted
      filter - the filter for which metrics to report
      executor - 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 reporter
      disabledMetricAttributes - do not report specific metric attributes
      addMetricAttributesAsTags - if true, then add metric attributes as tags instead of suffixes
    • GraphiteReporter

      protected GraphiteReporter​(io.dropwizard.metrics5.MetricRegistry registry, GraphiteSender graphite, io.dropwizard.metrics5.Clock clock, String prefix, TimeUnit rateUnit, TimeUnit durationUnit, io.dropwizard.metrics5.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<io.dropwizard.metrics5.MetricAttribute> disabledMetricAttributes, boolean addMetricAttributesAsTags, DoubleFunction<String> floatingPointFormatter)
      Creates a new GraphiteReporter instance.
      Parameters:
      registry - the MetricRegistry containing the metrics this reporter will report
      graphite - the GraphiteSender which is responsible for sending metrics to a Carbon server via a transport protocol
      clock - the instance of the time. Use Clock.defaultClock() for the default
      prefix - the prefix of all metric names (may be null)
      rateUnit - the time unit of in which rates will be converted
      durationUnit - the time unit of in which durations will be converted
      filter - the filter for which metrics to report
      executor - 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 reporter
      disabledMetricAttributes - do not report specific metric attributes
      addMetricAttributesAsTags - if true, then add metric attributes as tags instead of suffixes
      floatingPointFormatter - custom floating point formatter
  • Method Details

    • forRegistry

      public static GraphiteReporter.Builder forRegistry​(io.dropwizard.metrics5.MetricRegistry registry)
      Parameters:
      registry - the registry to report
      Returns:
      a GraphiteReporter.Builder instance for a GraphiteReporter
    • report

      public void report​(SortedMap<io.dropwizard.metrics5.MetricName,​io.dropwizard.metrics5.Gauge<?>> gauges, SortedMap<io.dropwizard.metrics5.MetricName,​io.dropwizard.metrics5.Counter> counters, SortedMap<io.dropwizard.metrics5.MetricName,​io.dropwizard.metrics5.Histogram> histograms, SortedMap<io.dropwizard.metrics5.MetricName,​io.dropwizard.metrics5.Meter> meters, SortedMap<io.dropwizard.metrics5.MetricName,​io.dropwizard.metrics5.Timer> timers)
      Specified by:
      report in class io.dropwizard.metrics5.ScheduledReporter
    • stop

      public void stop()
      Overrides:
      stop in class io.dropwizard.metrics5.ScheduledReporter
    • format

      protected String format​(double v)