Class InfluxDbReporter

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

public class InfluxDbReporter
extends io.dropwizard.metrics5.ScheduledReporter
A reporter which publishes metric values to InfluxDB.

Metrics are reported according to the InfluxDB Line Protocol. Brief line protocol syntax as follows:

 measurement(,tag_key=tag_val)* field_key=field_val(,field_key_n=field_value_n)* (nanoseconds-timestamp)?
 

This InfluxDB reporter is "garbage free" in steady state. This means objects and buffers are reused and no temporary objects are allocated as much as possible.

  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  InfluxDbReporter.Builder
    A builder for InfluxDbReporter instances.
  • Constructor Summary

    Constructors
    Constructor Description
    InfluxDbReporter​(io.dropwizard.metrics5.MetricRegistry registry, InfluxDbSender sender, io.dropwizard.metrics5.Clock clock, io.dropwizard.metrics5.MetricName prefix, TimeUnit rateUnit, TimeUnit durationUnit, io.dropwizard.metrics5.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<io.dropwizard.metrics5.MetricAttribute> disabledMetricAttributes)
    Creates a new InfluxDbReporter instance.
  • Method Summary

    Modifier and Type Method Description
    static InfluxDbReporter.Builder forRegistry​(io.dropwizard.metrics5.MetricRegistry registry)
    Returns a new Builder for InfluxDbReporter.
    void report()  
    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)  
    void stop()  

    Methods inherited from class io.dropwizard.metrics5.ScheduledReporter

    close, convertDuration, convertRate, getDisabledMetricAttributes, getDurationUnit, getRateUnit, isShutdownExecutorOnStop, start, start

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InfluxDbReporter

      public InfluxDbReporter​(io.dropwizard.metrics5.MetricRegistry registry, InfluxDbSender sender, io.dropwizard.metrics5.Clock clock, io.dropwizard.metrics5.MetricName prefix, TimeUnit rateUnit, TimeUnit durationUnit, io.dropwizard.metrics5.MetricFilter filter, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<io.dropwizard.metrics5.MetricAttribute> disabledMetricAttributes)
      Creates a new InfluxDbReporter instance.
      Parameters:
      registry - the MetricRegistry containing the metrics this reporter will report
      sender - the InfluxDbSender which is responsible for sending metrics to a influxdb 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 - the disable metric attributes
  • Method Details

    • forRegistry

      public static InfluxDbReporter.Builder forRegistry​(io.dropwizard.metrics5.MetricRegistry registry)
      Returns a new Builder for InfluxDbReporter.
      Parameters:
      registry - the registry to report
      Returns:
      a Builder instance for a InfluxDbReporter
    • 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()
    • report

      public void report()
      Overrides:
      report in class io.dropwizard.metrics5.ScheduledReporter