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.Object
A builder forCsvReporter
instances. 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.TimeUnit
durationUnit
private MetricFilter
filter
private org.slf4j.Logger
logger
private org.slf4j.Marker
marker
private java.util.concurrent.TimeUnit
rateUnit
private MetricRegistry
registry
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder(MetricRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Slf4jReporter
build()
Builds aSlf4jReporter
with the given properties.Slf4jReporter.Builder
convertDurationsTo(java.util.concurrent.TimeUnit durationUnit)
Convert durations to the given time unit.Slf4jReporter.Builder
convertRatesTo(java.util.concurrent.TimeUnit rateUnit)
Convert rates to the given time unit.Slf4jReporter.Builder
filter(MetricFilter filter)
Only report metrics which match the given filter.Slf4jReporter.Builder
markWith(org.slf4j.Marker marker)
Mark all logged metrics with the given marker.Slf4jReporter.Builder
outputTo(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 aSlf4jReporter
with the given properties.- Returns:
- a
Slf4jReporter
-
-