Package com.codahale.metrics
Class Slf4jReporter
- java.lang.Object
-
- com.codahale.metrics.ScheduledReporter
-
- com.codahale.metrics.Slf4jReporter
-
- All Implemented Interfaces:
Reporter,Closeable,AutoCloseable
public class Slf4jReporter extends ScheduledReporter
A reporter class for logging metrics values to a SLF4JLoggerperiodically, similar toConsoleReporterorCsvReporter, but using the SLF4J framework instead. It also supports specifying aMarkerinstance that can be used by custom appenders and filters for the bound logging toolkit to further process metrics reports.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSlf4jReporter.BuilderA builder forSlf4jReporterinstances.static classSlf4jReporter.LoggingLevel
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Slf4jReporter.BuilderforRegistry(MetricRegistry registry)Returns a newSlf4jReporter.BuilderforSlf4jReporter.protected StringgetRateUnit()voidreport(SortedMap<String,Gauge> gauges, SortedMap<String,Counter> counters, SortedMap<String,Histogram> histograms, SortedMap<String,Meter> meters, SortedMap<String,Timer> timers)Called periodically by the polling thread.-
Methods inherited from class com.codahale.metrics.ScheduledReporter
close, convertDuration, convertRate, getDisabledMetricAttributes, getDurationUnit, getScheduledFuture, isShutdownExecutorOnStop, report, start, start, stop
-
-
-
-
Method Detail
-
forRegistry
public static Slf4jReporter.Builder forRegistry(MetricRegistry registry)
Returns a newSlf4jReporter.BuilderforSlf4jReporter.- Parameters:
registry- the registry to report- Returns:
- a
Slf4jReporter.Builderinstance for aSlf4jReporter
-
report
public void report(SortedMap<String,Gauge> gauges, SortedMap<String,Counter> counters, SortedMap<String,Histogram> histograms, SortedMap<String,Meter> meters, SortedMap<String,Timer> timers)
Description copied from class:ScheduledReporterCalled periodically by the polling thread. Subclasses should report all the given metrics.- Specified by:
reportin 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
-
getRateUnit
protected String getRateUnit()
- Overrides:
getRateUnitin classScheduledReporter
-
-