Package com.codahale.metrics.graphite
Class GraphiteReporter.Builder
- java.lang.Object
-
- com.codahale.metrics.graphite.GraphiteReporter.Builder
-
- Enclosing class:
- GraphiteReporter
public static class GraphiteReporter.Builder extends java.lang.ObjectA builder forGraphiteReporterinstances. Defaults to not using a prefix, using the default clock, converting rates to events/second, converting durations to milliseconds, and not filtering metrics.
-
-
Field Summary
Fields Modifier and Type Field Description private Clockclockprivate java.util.concurrent.TimeUnitdurationUnitprivate MetricFilterfilterprivate java.lang.Stringprefixprivate 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 GraphiteReporterbuild(Graphite graphite)Builds aGraphiteReporterwith the given properties, sending metrics using the givenGraphiteclient.GraphiteReporter.BuilderconvertDurationsTo(java.util.concurrent.TimeUnit durationUnit)Convert durations to the given time unit.GraphiteReporter.BuilderconvertRatesTo(java.util.concurrent.TimeUnit rateUnit)Convert rates to the given time unit.GraphiteReporter.Builderfilter(MetricFilter filter)Only report metrics which match the given filter.GraphiteReporter.BuilderprefixedWith(java.lang.String prefix)Prefix all metric names with the given string.GraphiteReporter.BuilderwithClock(Clock clock)Use the givenClockinstance for the time.
-
-
-
Field Detail
-
registry
private final MetricRegistry registry
-
clock
private Clock clock
-
prefix
private java.lang.String prefix
-
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
-
withClock
public GraphiteReporter.Builder withClock(Clock clock)
Use the givenClockinstance for the time.- Parameters:
clock- aClockinstance- Returns:
this
-
prefixedWith
public GraphiteReporter.Builder prefixedWith(java.lang.String prefix)
Prefix all metric names with the given string.- Parameters:
prefix- the prefix for all metric names- Returns:
this
-
convertRatesTo
public GraphiteReporter.Builder convertRatesTo(java.util.concurrent.TimeUnit rateUnit)
Convert rates to the given time unit.- Parameters:
rateUnit- a unit of time- Returns:
this
-
convertDurationsTo
public GraphiteReporter.Builder convertDurationsTo(java.util.concurrent.TimeUnit durationUnit)
Convert durations to the given time unit.- Parameters:
durationUnit- a unit of time- Returns:
this
-
filter
public GraphiteReporter.Builder filter(MetricFilter filter)
Only report metrics which match the given filter.- Parameters:
filter- aMetricFilter- Returns:
this
-
build
public GraphiteReporter build(Graphite graphite)
Builds aGraphiteReporterwith the given properties, sending metrics using the givenGraphiteclient.- Parameters:
graphite- aGraphiteclient- Returns:
- a
GraphiteReporter
-
-