Package com.codahale.metrics.graphite
Class GraphiteReporter.Builder
java.lang.Object
com.codahale.metrics.graphite.GraphiteReporter.Builder
- Enclosing class:
- GraphiteReporter
A builder for
GraphiteReporter 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
Modifier and TypeMethodDescriptionaddMetricAttributesAsTags(boolean addMetricAttributesAsTags) Specifies whether or not metric attributes (e.g.Builds aGraphiteReporterwith the given properties, sending metrics using the givenGraphiteSender.build(GraphiteSender graphite) Builds aGraphiteReporterwith the given properties, sending metrics using the givenGraphiteSender.convertDurationsTo(TimeUnit durationUnit) Convert durations to the given time unit.convertRatesTo(TimeUnit rateUnit) Convert rates to the given time unit.disabledMetricAttributes(Set<com.codahale.metrics.MetricAttribute> disabledMetricAttributes) Don't report the passed metric attributes for all metrics (e.g.filter(com.codahale.metrics.MetricFilter filter) Only report metrics which match the given filter.prefixedWith(String prefix) Prefix all metric names with the given string.scheduleOn(ScheduledExecutorService executor) Specifies the executor to use while scheduling reporting of metrics.shutdownExecutorOnStop(boolean shutdownExecutorOnStop) Specifies whether or not, the executor (used for reporting) will be stopped with same time with reporter.withClock(com.codahale.metrics.Clock clock) Use the givenClockinstance for the time.withFloatingPointFormatter(DoubleFunction<String> floatingPointFormatter) Use custom floating point formatter.
-
Method Details
-
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
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
Use the givenClockinstance for the time.- Parameters:
clock- aClockinstance- Returns:
this
-
prefixedWith
Prefix all metric names with the given string.- Parameters:
prefix- the prefix for all metric names- Returns:
this
-
convertRatesTo
Convert rates to the given time unit.- Parameters:
rateUnit- a unit of time- Returns:
this
-
convertDurationsTo
Convert durations to the given time unit.- Parameters:
durationUnit- a unit of time- Returns:
this
-
filter
Only report metrics which match the given filter.- Parameters:
filter- aMetricFilter- Returns:
this
-
disabledMetricAttributes
public GraphiteReporter.Builder disabledMetricAttributes(Set<com.codahale.metrics.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
-
addMetricAttributesAsTags
Specifies whether or not metric attributes (e.g. "p999", "stddev" or "m15") should be reported in the traditional dot delimited format or in the tag based format. Without tags (default): `my.metric.p99` With tags: `my.metric;metricattribute=p99` Note that this setting only modifies the metric attribute, and will not convert any other portion of the metric name to use tags. For mor information on Graphite tag support see https://graphite.readthedocs.io/en/latest/tags.html SeeMetricAttribute.- Parameters:
addMetricAttributesAsTags- if true, then metric attributes will be added as tags- Returns:
this
-
withFloatingPointFormatter
public GraphiteReporter.Builder withFloatingPointFormatter(DoubleFunction<String> floatingPointFormatter) Use custom floating point formatter.- Parameters:
floatingPointFormatter- a custom formatter for floating point values- Returns:
this
-
build
Builds aGraphiteReporterwith the given properties, sending metrics using the givenGraphiteSender.Present for binary compatibility
- Parameters:
graphite- aGraphite- Returns:
- a
GraphiteReporter
-
build
Builds aGraphiteReporterwith the given properties, sending metrics using the givenGraphiteSender.- Parameters:
graphite- aGraphiteSender- Returns:
- a
GraphiteReporter
-