Class DropwizardMetricsConfig


  • public class DropwizardMetricsConfig
    extends Object
    The configuration object for DropwizardMetricsModule.

    Request timing metrics and blocking execution timing metrics are enabled by default.

    • Field Detail

      • DEFAULT_INTERVAL

        public static final Duration DEFAULT_INTERVAL
    • Constructor Detail

      • DropwizardMetricsConfig

        public DropwizardMetricsConfig()
    • 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 the MetricsPrometheusHandler 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​(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​(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​(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​(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​(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
      • 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​(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