Package org.dhatim.dropwizard.prometheus
Class PrometheusReporter.Builder
- java.lang.Object
-
- org.dhatim.dropwizard.prometheus.PrometheusReporter.Builder
-
- Enclosing class:
- PrometheusReporter
public static class PrometheusReporter.Builder extends Object
A builder forPrometheusReporterinstances. Defaults to not using a prefix, and not filtering metrics.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PrometheusReporterbuild(PrometheusSender prometheus)Builds aPrometheusReporterwith the given properties, sending metrics using the givenPrometheusSender.PrometheusReporterbuild(Pushgateway prometheus)Builds aPrometheusReporterwith the given properties, sending metrics using the givenPrometheusSender.PrometheusReporter.Builderfilter(com.codahale.metrics.MetricFilter filter)Only report metrics which match the given filter.PrometheusReporter.BuilderprefixedWith(String prefix)Prefix all metric names with the given string.PrometheusReporter.BuilderscheduleOn(ScheduledExecutorService executor)Specifies the executor to use while scheduling reporting of metrics.PrometheusReporter.BuildershutdownExecutorOnStop(boolean shutdownExecutorOnStop)Specifies whether or not, the executor (used for reporting) will be stopped with same time with reporter.
-
-
-
Method Detail
-
shutdownExecutorOnStop
public PrometheusReporter.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 PrometheusReporter.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
-
prefixedWith
public PrometheusReporter.Builder prefixedWith(String prefix)
Prefix all metric names with the given string.- Parameters:
prefix- the prefix for all metric names- Returns:
this
-
filter
public PrometheusReporter.Builder filter(com.codahale.metrics.MetricFilter filter)
Only report metrics which match the given filter.- Parameters:
filter- aMetricFilter- Returns:
this
-
build
public PrometheusReporter build(Pushgateway prometheus)
Builds aPrometheusReporterwith the given properties, sending metrics using the givenPrometheusSender. Present for binary compatibility- Parameters:
prometheus- aPushgateway- Returns:
- a
PrometheusReporter
-
build
public PrometheusReporter build(PrometheusSender prometheus)
Builds aPrometheusReporterwith the given properties, sending metrics using the givenPrometheusSender.- Parameters:
prometheus- aPrometheusSender- Returns:
- a
PrometheusReporter
-
-