Class Slf4jReporter.Builder

java.lang.Object
com.codahale.metrics.Slf4jReporter.Builder
Enclosing class:
Slf4jReporter

public static class Slf4jReporter.Builder extends Object
A builder for CsvReporter instances. Defaults to logging to metrics, not using a marker, converting rates to events/second, converting durations to milliseconds, and not filtering metrics.
  • Field Details

    • registry

      private final MetricRegistry registry
    • logger

      private org.slf4j.Logger logger
    • marker

      private org.slf4j.Marker marker
    • rateUnit

      private TimeUnit rateUnit
    • durationUnit

      private TimeUnit durationUnit
    • filter

      private MetricFilter filter
  • Constructor Details

  • Method Details

    • outputTo

      public Slf4jReporter.Builder outputTo(org.slf4j.Logger logger)
      Log metrics to the given logger.
      Parameters:
      logger - an SLF4J Logger
      Returns:
      this
    • markWith

      public Slf4jReporter.Builder markWith(org.slf4j.Marker marker)
      Mark all logged metrics with the given marker.
      Parameters:
      marker - an SLF4J Marker
      Returns:
      this
    • convertRatesTo

      public Slf4jReporter.Builder convertRatesTo(TimeUnit rateUnit)
      Convert rates to the given time unit.
      Parameters:
      rateUnit - a unit of time
      Returns:
      this
    • convertDurationsTo

      public Slf4jReporter.Builder convertDurationsTo(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 - a MetricFilter
      Returns:
      this
    • build

      public Slf4jReporter build()
      Builds a Slf4jReporter with the given properties.
      Returns:
      a Slf4jReporter