Package ratpack.dropwizard.metrics
Class DropwizardMetricsConfig
- java.lang.Object
-
- ratpack.dropwizard.metrics.DropwizardMetricsConfig
-
public class DropwizardMetricsConfig extends Object
The configuration object forDropwizardMetricsModule
.Request timing metrics and blocking execution timing metrics are enabled by default.
-
-
Field Summary
Fields Modifier and Type Field Description static Duration
DEFAULT_INTERVAL
-
Constructor Summary
Constructors Constructor Description DropwizardMetricsConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DropwizardMetricsConfig
blockingTimingMetrics(boolean blockingTimingMetrics)
The state of blocking timing metrics reporting.DropwizardMetricsConfig
byteBufAllocator()
DropwizardMetricsConfig
byteBufAllocator(Action<? super ByteBufAllocatorConfig> configure)
Configure the byte buf allocator metric set.DropwizardMetricsConfig
console()
DropwizardMetricsConfig
console(Action<? super ConsoleConfig> configure)
Configure the console metrics publisher.DropwizardMetricsConfig
csv(Action<? super CsvConfig> configure)
Configure the csv metrics publisher.Optional<ByteBufAllocatorConfig>
getByteBufAllocator()
Get the settings for the byte buf allocator metric set.Optional<ConsoleConfig>
getConsole()
Get the settings for the console metrics publisher.Optional<CsvConfig>
getCsv()
Get the settings for the csv metrics publisher.Optional<GraphiteConfig>
getGraphite()
Get the settings for the Graphite metrics publisher.Optional<HttpClientConfig>
getHttpClient()
Get the settings for the http client metric set.Optional<JmxConfig>
getJmx()
Get the settings for the JMX metrics publisher.Map<String,String>
getRequestMetricGroups()
A map of regular expressions used to group request metrics.Optional<Slf4jConfig>
getSlf4j()
Get the settings for the Slf4j Logger metrics publisher.Optional<WebsocketConfig>
getWebSocket()
Get the settings for the websockets metrics broadcaster.DropwizardMetricsConfig
graphite(Action<? super GraphiteConfig> configure)
Configure the Graphite metrics publisher.DropwizardMetricsConfig
httpClient()
DropwizardMetricsConfig
httpClient(Action<? super HttpClientConfig> configure)
Configure the http client metric set.boolean
isBlockingTimingMetrics()
The state of blocking timing metrics.boolean
isJvmMetrics()
The state of jvm metrics collection.boolean
isPrometheusCollection()
The state of the Prometheus metrics collector.boolean
isRequestTimingMetrics()
The state of request timing metrics.DropwizardMetricsConfig
jmx()
DropwizardMetricsConfig
jmx(Action<? super JmxConfig> configure)
Configure the JMX metrics publisher.DropwizardMetricsConfig
jvmMetrics(boolean jvmMetrics)
The state of JVM metrics reporting.DropwizardMetricsConfig
prometheusCollection(boolean prometheusCollection)
The state of Prometheus metrics collection.DropwizardMetricsConfig
requestMetricGroups(Map<String,String> requestMetricGroups)
Configure the request metric groups.DropwizardMetricsConfig
requestTimingMetrics(boolean requestTimingMetrics)
The state of request timing metrics reporting.DropwizardMetricsConfig
slf4j()
DropwizardMetricsConfig
slf4j(Action<? super Slf4jConfig> configure)
Configure the Slf4j logger metrics publisher.DropwizardMetricsConfig
webSocket()
DropwizardMetricsConfig
webSocket(Action<? super WebsocketConfig> configure)
Configure the websockets metrics broadcaster.
-
-
-
Field Detail
-
DEFAULT_INTERVAL
public static final Duration DEFAULT_INTERVAL
-
-
Method Detail
-
isJvmMetrics
public boolean isJvmMetrics()
The state of jvm metrics collection.- Returns:
- True if jvm metrics collection is enabled. False otherwise
-
jvmMetrics
public DropwizardMetricsConfig jvmMetrics(boolean jvmMetrics)
The state of JVM metrics reporting.- Parameters:
jvmMetrics
- True if JVM metrics are to be reported. False otherwise- Returns:
- this
-
isPrometheusCollection
public boolean isPrometheusCollection()
The state of the Prometheus metrics collector.- Returns:
- True if Prometheus metrics collection is enabled. False otherwise
- Since:
- 1.6
-
prometheusCollection
public DropwizardMetricsConfig prometheusCollection(boolean prometheusCollection)
The state of Prometheus metrics collection. This method only enables binding the metric registry to the Prometheus collector. The Prometheus formatted metrics can be exposed by adding theMetricsPrometheusHandler
to the handler chain.- Parameters:
prometheusCollection
- True if metrics should be collected into the Prometheus collector. False otherwise- Returns:
- this
- Since:
- 1.6
- See Also:
MetricsPrometheusHandler
-
getByteBufAllocator
public Optional<ByteBufAllocatorConfig> getByteBufAllocator()
Get the settings for the byte buf allocator metric set.- Returns:
- the metric set settings
- Since:
- 1.6
-
byteBufAllocator
public DropwizardMetricsConfig byteBufAllocator()
- Returns:
- this
- Since:
- 1.6
- See Also:
byteBufAllocator(Action)
-
byteBufAllocator
public DropwizardMetricsConfig byteBufAllocator(Action<? super ByteBufAllocatorConfig> configure)
Configure the byte buf allocator metric set.- Parameters:
configure
- the configuration for the byte buf allocator metric set- Returns:
- this
- Since:
- 1.6
-
isRequestTimingMetrics
public boolean isRequestTimingMetrics()
The state of request timing metrics.- Returns:
- True if request timing metrics is enabled. False otherwise
- Since:
- 1.2
-
requestTimingMetrics
public DropwizardMetricsConfig requestTimingMetrics(boolean requestTimingMetrics)
The state of request timing metrics reporting.- Parameters:
requestTimingMetrics
- True if request timing metrics are to be reported. False otherwise- Returns:
- this
- Since:
- 1.2
-
isBlockingTimingMetrics
public boolean isBlockingTimingMetrics()
The state of blocking timing metrics.- Returns:
- True if blocking timing metrics is enabled. False otherwise
- Since:
- 1.2
-
blockingTimingMetrics
public DropwizardMetricsConfig blockingTimingMetrics(boolean blockingTimingMetrics)
The state of blocking timing metrics reporting.- Parameters:
blockingTimingMetrics
- True if blocking timing metrics are to be reported. False otherwise- Returns:
- this
- Since:
- 1.2
-
getRequestMetricGroups
public Map<String,String> getRequestMetricGroups()
A map of regular expressions used to group request metrics.The value is a regular expression to test the current request path against for a match. If matched, the key is the name to use when recording the metric. Please note that request paths do not start with a
/
As soon as a match is made against a regular expression no further matches are attempted.
Should no matches be made the default metric grouping will be used.
- Returns:
- the request metric group expressions
- See Also:
DefaultRequestTimingHandler
-
requestMetricGroups
public DropwizardMetricsConfig requestMetricGroups(Map<String,String> requestMetricGroups)
Configure the request metric groups.- Parameters:
requestMetricGroups
- the request metric groups- Returns:
- this
-
getJmx
public Optional<JmxConfig> getJmx()
Get the settings for the JMX metrics publisher.- Returns:
- the jmx publisher settings
-
jmx
public DropwizardMetricsConfig jmx()
- Returns:
- this
- See Also:
jmx(Action)
-
jmx
public DropwizardMetricsConfig jmx(Action<? super JmxConfig> configure)
Configure the JMX metrics publisher.- Parameters:
configure
- the configuration for the publisher- Returns:
- this
-
getConsole
public Optional<ConsoleConfig> getConsole()
Get the settings for the console metrics publisher.- Returns:
- the console publisher settings
-
console
public DropwizardMetricsConfig console()
- Returns:
- this
- See Also:
console(Action)
-
console
public DropwizardMetricsConfig console(Action<? super ConsoleConfig> configure)
Configure the console metrics publisher.- Parameters:
configure
- the configuration for the publisher- Returns:
- this
-
getSlf4j
public Optional<Slf4jConfig> getSlf4j()
Get the settings for the Slf4j Logger metrics publisher.- Returns:
- the slf4j publisher settings
-
slf4j
public DropwizardMetricsConfig slf4j()
- Returns:
- this
- See Also:
slf4j(Action)
-
slf4j
public DropwizardMetricsConfig slf4j(Action<? super Slf4jConfig> configure)
Configure the Slf4j logger metrics publisher.- Parameters:
configure
- the configuration for the publisher- Returns:
- this
-
getWebSocket
public Optional<WebsocketConfig> getWebSocket()
Get the settings for the websockets metrics broadcaster.- Returns:
- the websockets broadcaster settings
-
webSocket
public DropwizardMetricsConfig webSocket()
- Returns:
- this
- See Also:
webSocket(Action)
-
webSocket
public DropwizardMetricsConfig webSocket(Action<? super WebsocketConfig> configure)
Configure the websockets metrics broadcaster.- Parameters:
configure
- the configuration for the broadcaster- Returns:
- this
-
getCsv
public Optional<CsvConfig> getCsv()
Get the settings for the csv metrics publisher.- Returns:
- the csv publisher settings
-
csv
public DropwizardMetricsConfig csv(Action<? super CsvConfig> configure)
Configure the csv metrics publisher.- Parameters:
configure
- the configuration for the publisher- Returns:
- this
-
getGraphite
public Optional<GraphiteConfig> getGraphite()
Get the settings for the Graphite metrics publisher.- Returns:
- the Graphite publisher settings
-
graphite
public DropwizardMetricsConfig graphite(Action<? super GraphiteConfig> configure)
Configure the Graphite metrics publisher.- Parameters:
configure
- the configuration for the publisher- Returns:
- this
-
getHttpClient
public Optional<HttpClientConfig> getHttpClient()
Get the settings for the http client metric set.- Returns:
- the metric set settings.
- Since:
- 1.6
-
httpClient
public DropwizardMetricsConfig httpClient()
- Returns:
- this
- Since:
- 1.6
- See Also:
httpClient(Action)
-
httpClient
public DropwizardMetricsConfig httpClient(Action<? super HttpClientConfig> configure)
Configure the http client metric set.- Parameters:
configure
- the configuration for the http client metric set.- Returns:
- this
- Since:
- 1.6
-
-