Package com.codahale.metrics
Class CsvReporter
- java.lang.Object
-
- com.codahale.metrics.ScheduledReporter
-
- com.codahale.metrics.CsvReporter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class CsvReporter extends ScheduledReporter
A reporter which creates a comma-separated values file of the measurements for each metric.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CsvReporter.Builder
A builder forCsvReporter
instances.
-
Constructor Summary
Constructors Modifier Constructor Description private
CsvReporter(MetricRegistry registry, java.io.File directory, java.util.Locale locale, java.util.concurrent.TimeUnit rateUnit, java.util.concurrent.TimeUnit durationUnit, Clock clock, MetricFilter filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CsvReporter.Builder
forRegistry(MetricRegistry registry)
Returns a newCsvReporter.Builder
forCsvReporter
.private void
report(long timestamp, java.lang.String name, java.lang.String header, java.lang.String line, java.lang.Object... values)
void
report(java.util.SortedMap<java.lang.String,Gauge> gauges, java.util.SortedMap<java.lang.String,Counter> counters, java.util.SortedMap<java.lang.String,Histogram> histograms, java.util.SortedMap<java.lang.String,Meter> meters, java.util.SortedMap<java.lang.String,Timer> timers)
Called periodically by the polling thread.private void
reportCounter(long timestamp, java.lang.String name, Counter counter)
private void
reportGauge(long timestamp, java.lang.String name, Gauge gauge)
private void
reportHistogram(long timestamp, java.lang.String name, Histogram histogram)
private void
reportMeter(long timestamp, java.lang.String name, Meter meter)
private void
reportTimer(long timestamp, java.lang.String name, Timer timer)
protected java.lang.String
sanitize(java.lang.String name)
-
Methods inherited from class com.codahale.metrics.ScheduledReporter
close, convertDuration, convertRate, getDurationUnit, getRateUnit, report, start, stop
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
UTF_8
private static final java.nio.charset.Charset UTF_8
-
directory
private final java.io.File directory
-
locale
private final java.util.Locale locale
-
clock
private final Clock clock
-
-
Constructor Detail
-
CsvReporter
private CsvReporter(MetricRegistry registry, java.io.File directory, java.util.Locale locale, java.util.concurrent.TimeUnit rateUnit, java.util.concurrent.TimeUnit durationUnit, Clock clock, MetricFilter filter)
-
-
Method Detail
-
forRegistry
public static CsvReporter.Builder forRegistry(MetricRegistry registry)
Returns a newCsvReporter.Builder
forCsvReporter
.- Parameters:
registry
- the registry to report- Returns:
- a
CsvReporter.Builder
instance for aCsvReporter
-
report
public void report(java.util.SortedMap<java.lang.String,Gauge> gauges, java.util.SortedMap<java.lang.String,Counter> counters, java.util.SortedMap<java.lang.String,Histogram> histograms, java.util.SortedMap<java.lang.String,Meter> meters, java.util.SortedMap<java.lang.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
private void reportTimer(long timestamp, java.lang.String name, Timer timer)
-
reportMeter
private void reportMeter(long timestamp, java.lang.String name, Meter meter)
-
reportHistogram
private void reportHistogram(long timestamp, java.lang.String name, Histogram histogram)
-
reportCounter
private void reportCounter(long timestamp, java.lang.String name, Counter counter)
-
reportGauge
private void reportGauge(long timestamp, java.lang.String name, Gauge gauge)
-
report
private void report(long timestamp, java.lang.String name, java.lang.String header, java.lang.String line, java.lang.Object... values)
-
sanitize
protected java.lang.String sanitize(java.lang.String name)
-
-