Package io.dropwizard.metrics.common
Class MetricsFactory
java.lang.Object
io.dropwizard.metrics.common.MetricsFactory
A factory for configuring the metrics sub-system for the environment.
Configures an optional list of
reporters with a
default frequency.
Configuration Parameters:
| Name | Default | Description |
| frequency | 1 minute | The frequency to report metrics. Overridable per-reporter. |
| reporters | No reporters. | A list of reporters to report metrics. |
| reportOnStop | false |
To report metrics one last time when stopping Dropwizard. |
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(io.dropwizard.lifecycle.setup.LifecycleEnvironment environment, com.codahale.metrics.MetricRegistry registry) Configures the given lifecycle with thereportersconfigured for the given registry.io.dropwizard.util.DurationbooleanvoidsetFrequency(io.dropwizard.util.Duration frequency) voidsetReporters(List<ReporterFactory> reporters) voidsetReportOnStop(boolean reportOnStop) toString()
-
Constructor Details
-
MetricsFactory
public MetricsFactory()
-
-
Method Details
-
getReporters
-
setReporters
-
getFrequency
public io.dropwizard.util.Duration getFrequency() -
setFrequency
public void setFrequency(io.dropwizard.util.Duration frequency) -
isReportOnStop
public boolean isReportOnStop()- Since:
- 2.0
-
setReportOnStop
public void setReportOnStop(boolean reportOnStop) - Since:
- 2.0
-
configure
public void configure(io.dropwizard.lifecycle.setup.LifecycleEnvironment environment, com.codahale.metrics.MetricRegistry registry) Configures the given lifecycle with thereportersconfigured for the given registry. The reporters are tied in to the given lifecycle, such that theirfrequencyfor reporting metrics begins when the lifecyclestarts, and stops when the lifecyclestops.- Parameters:
environment- the lifecycle to manage the reporters.registry- the metric registry to report metrics from.
-
toString
-