Package com.codahale.metrics
Class Slf4jReporter.Builder
- java.lang.Object
-
- com.codahale.metrics.Slf4jReporter.Builder
-
- Enclosing class:
- Slf4jReporter
public static class Slf4jReporter.Builder extends java.lang.ObjectA builder forCsvReporterinstances. Defaults to logging tometrics, not using a marker, converting rates to events/second, converting durations to milliseconds, and not filtering metrics.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.TimeUnitdurationUnitprivate MetricFilterfilterprivate org.slf4j.Loggerloggerprivate org.slf4j.Markermarkerprivate java.util.concurrent.TimeUnitrateUnitprivate MetricRegistryregistry
-
Constructor Summary
Constructors Modifier Constructor Description privateBuilder(MetricRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Slf4jReporterbuild()Builds aSlf4jReporterwith the given properties.Slf4jReporter.BuilderconvertDurationsTo(java.util.concurrent.TimeUnit durationUnit)Convert durations to the given time unit.Slf4jReporter.BuilderconvertRatesTo(java.util.concurrent.TimeUnit rateUnit)Convert rates to the given time unit.Slf4jReporter.Builderfilter(MetricFilter filter)Only report metrics which match the given filter.Slf4jReporter.BuildermarkWith(org.slf4j.Marker marker)Mark all logged metrics with the given marker.Slf4jReporter.BuilderoutputTo(org.slf4j.Logger logger)Log metrics to the given logger.
-
-
-
Field Detail
-
registry
private final MetricRegistry registry
-
logger
private org.slf4j.Logger logger
-
marker
private org.slf4j.Marker marker
-
rateUnit
private java.util.concurrent.TimeUnit rateUnit
-
durationUnit
private java.util.concurrent.TimeUnit durationUnit
-
filter
private MetricFilter filter
-
-
Constructor Detail
-
Builder
private Builder(MetricRegistry registry)
-
-
Method Detail
-
outputTo
public Slf4jReporter.Builder outputTo(org.slf4j.Logger logger)
Log metrics to the given logger.- Parameters:
logger- an SLF4JLogger- Returns:
this
-
markWith
public Slf4jReporter.Builder markWith(org.slf4j.Marker marker)
Mark all logged metrics with the given marker.- Parameters:
marker- an SLF4JMarker- Returns:
this
-
convertRatesTo
public Slf4jReporter.Builder convertRatesTo(java.util.concurrent.TimeUnit rateUnit)
Convert rates to the given time unit.- Parameters:
rateUnit- a unit of time- Returns:
this
-
convertDurationsTo
public Slf4jReporter.Builder convertDurationsTo(java.util.concurrent.TimeUnit durationUnit)
Convert durations to the given time unit.- Parameters:
durationUnit- a unit of time- Returns:
this
-
filter
public Slf4jReporter.Builder filter(MetricFilter filter)
Only report metrics which match the given filter.- Parameters:
filter- aMetricFilter- Returns:
this
-
build
public Slf4jReporter build()
Builds aSlf4jReporterwith the given properties.- Returns:
- a
Slf4jReporter
-
-