Package io.dropwizard.metrics5.influxdb
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 classInfluxDbReporter.BuilderA builder forInfluxDbReporterinstances. -
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.BuilderforRegistry(io.dropwizard.metrics5.MetricRegistry registry)Returns a new Builder forInfluxDbReporter.voidreport()voidreport(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)voidstop()Methods inherited from class io.dropwizard.metrics5.ScheduledReporter
close, convertDuration, convertRate, getDisabledMetricAttributes, getDurationUnit, getRateUnit, isShutdownExecutorOnStop, start, start
-
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 reportsender- the InfluxDbSender which is responsible for sending metrics to a influxdb 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- the disable metric attributes
-
-
Method Details
-
forRegistry
Returns a new Builder forInfluxDbReporter.- 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:
reportin classio.dropwizard.metrics5.ScheduledReporter
-
stop
public void stop() -
report
public void report()- Overrides:
reportin classio.dropwizard.metrics5.ScheduledReporter
-