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 Object
A builder forGraphiteReporter
instances. Defaults to not using a prefix, using the default clock, converting rates to events/second, converting durations to milliseconds, and not filtering metrics.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphiteReporter
build(Graphite graphite)
Builds aGraphiteReporter
with the given properties, sending metrics using the givenGraphiteSender
.GraphiteReporter
build(GraphiteSender graphite)
Builds aGraphiteReporter
with the given properties, sending metrics using the givenGraphiteSender
.GraphiteReporter.Builder
convertDurationsTo(TimeUnit durationUnit)
Convert durations to the given time unit.GraphiteReporter.Builder
convertRatesTo(TimeUnit rateUnit)
Convert rates to the given time unit.GraphiteReporter.Builder
disabledMetricAttributes(Set<MetricAttribute> disabledMetricAttributes)
Don't report the passed metric attributes for all metrics (e.g.GraphiteReporter.Builder
filter(MetricFilter filter)
Only report metrics which match the given filter.GraphiteReporter.Builder
prefixedWith(String prefix)
Prefix all metric names with the given string.GraphiteReporter.Builder
scheduleOn(ScheduledExecutorService executor)
Specifies the executor to use while scheduling reporting of metrics.GraphiteReporter.Builder
shutdownExecutorOnStop(boolean shutdownExecutorOnStop)
Specifies whether or not, the executor (used for reporting) will be stopped with same time with reporter.GraphiteReporter.Builder
withClock(Clock clock)
Use the givenClock
instance for the time.
-
-
-
Method Detail
-
shutdownExecutorOnStop
public GraphiteReporter.Builder shutdownExecutorOnStop(boolean shutdownExecutorOnStop)
Specifies whether or not, the executor (used for reporting) will be stopped with same time with reporter. Default value is true. Setting this parameter to false, has the sense in combining with providing external managed executor viascheduleOn(ScheduledExecutorService)
.- Parameters:
shutdownExecutorOnStop
- if true, then executor will be stopped in same time with this reporter- Returns:
this
-
scheduleOn
public GraphiteReporter.Builder scheduleOn(ScheduledExecutorService executor)
Specifies the executor to use while scheduling reporting of metrics. Default value is null. Null value leads to executor will be auto created on start.- Parameters:
executor
- the executor to use while scheduling reporting of metrics.- Returns:
this
-
withClock
public GraphiteReporter.Builder withClock(Clock clock)
Use the givenClock
instance for the time.- Parameters:
clock
- aClock
instance- Returns:
this
-
prefixedWith
public GraphiteReporter.Builder prefixedWith(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(TimeUnit rateUnit)
Convert rates to the given time unit.- Parameters:
rateUnit
- a unit of time- Returns:
this
-
convertDurationsTo
public GraphiteReporter.Builder convertDurationsTo(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
-
disabledMetricAttributes
public GraphiteReporter.Builder disabledMetricAttributes(Set<MetricAttribute> disabledMetricAttributes)
Don't report the passed metric attributes for all metrics (e.g. "p999", "stddev" or "m15"). SeeMetricAttribute
.- Parameters:
disabledMetricAttributes
- a set ofMetricAttribute
- Returns:
this
-
build
public GraphiteReporter build(Graphite graphite)
Builds aGraphiteReporter
with the given properties, sending metrics using the givenGraphiteSender
.Present for binary compatibility
- Parameters:
graphite
- aGraphite
- Returns:
- a
GraphiteReporter
-
build
public GraphiteReporter build(GraphiteSender graphite)
Builds aGraphiteReporter
with the given properties, sending metrics using the givenGraphiteSender
.- Parameters:
graphite
- aGraphiteSender
- Returns:
- a
GraphiteReporter
-
-