Interface MetricsConfig

All Superinterfaces:
Prototype.Api
All Known Implementing Classes:
MetricsConfig.BuilderBase.MetricsConfigImpl

public interface MetricsConfig extends Prototype.Api
Configuration settings for metrics.

Scope handling configuration

Helidon allows developers to associate a scope with each meter. The "scoping" subsection of the "metrics" configuration controls
  • the default scope value to use if a meter is registered without an explicit scope setting, and
  • whether and how Helidon records each meter's scope as a tag in the underlying implementation meter registry.

    Specifically, users can specify whether scope tags are used at all and, if so, what tag name to use.

See Also:
  • Field Details

    • METRICS_CONFIG_KEY

      static final String METRICS_CONFIG_KEY
      The config key containing settings for all of metrics.
      See Also:
    • SCOPE_CONFIG_KEY

      static final String SCOPE_CONFIG_KEY
      Config key for scope-related settings.
      See Also:
    • KEY_PERFORMANCE_INDICATORS_CONFIG_KEY

      static final String KEY_PERFORMANCE_INDICATORS_CONFIG_KEY
      Config key for KPI metrics settings.
      See Also:
    • DEFAULT_JSON_UNITS_DEFAULT

      static final TimeUnit DEFAULT_JSON_UNITS_DEFAULT
  • Method Details

    • builder

      static MetricsConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static MetricsConfig.Builder builder(MetricsConfig instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static MetricsConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      static MetricsConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • lookupConfig

      Optional<String> lookupConfig(String key)
      Looks up a single config value within the metrics configuration by config key.
      Parameters:
      key - config key to fetch
      Returns:
      config value
    • isScopeEnabled

      boolean isScopeEnabled(String scope)
      Reports whether the specified scope is enabled, according to any scope configuration that is part of this metrics configuration.
      Parameters:
      scope - scope name
      Returns:
      true if the scope as a whole is enabled; false otherwise
    • isMeterEnabled

      boolean isMeterEnabled(String name, String targetScope)
      Reports whether the specified meter within the indicated scope is enabled, according to the metrics configuration.
      Parameters:
      name - meter name
      targetScope - scope within which to check
      Returns:
      whether the meter is enabled
    • enabled

      boolean enabled()
      Whether metrics functionality is enabled.
      Returns:
      if metrics are configured to be enabled
    • permitAll

      boolean permitAll()
      Whether to allow anybody to access the endpoint.
      Returns:
      whether to permit access to metrics endpoint to anybody, defaults to true
      See Also:
    • roles

      List<String> roles()
      Hints for role names the user is expected to be in.
      Returns:
      list of hints
    • keyPerformanceIndicatorMetricsConfig

      KeyPerformanceIndicatorMetricsConfig keyPerformanceIndicatorMetricsConfig()
      Key performance indicator metrics settings.
      Returns:
      key performance indicator metrics settings
    • tags

      List<Tag> tags()
      Global tags.
      Returns:
      name/value pairs for global tags
    • appName

      Optional<String> appName()
      Value for the application tag to be added to each meter ID.
      Returns:
      application tag value
    • appTagName

      Optional<String> appTagName()
      Name for the application tag to be added to each meter ID.
      Returns:
      application tag name
    • scoping

      ScopingConfig scoping()
      Settings related to scoping management.
      Returns:
      scoping settings
    • restRequestEnabled

      boolean restRequestEnabled()
      Whether automatic REST request metrics should be measured.
      Returns:
      true/false
    • virtualThreadsEnabled

      boolean virtualThreadsEnabled()
      Whether Helidon should expose meters related to virtual threads.
      Returns:
      true to include meters related to virtual threads
    • virtualThreadsPinnedThreshold

      Duration virtualThreadsPinnedThreshold()
      Threshold for sampling pinned virtual threads to include in the pinned threads meter.
      Returns:
      threshold used to filter virtual thread pinning events
    • config

      Config config()
      Metrics configuration node.
      Returns:
      metrics configuration
    • gcTimeType

      @Deprecated(since="4.1", forRemoval=true) GcTimeType gcTimeType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Provided for backward compatibility only; no replacement
      Whether the gc.time meter should be registered as a gauge (vs. a counter). The gc.time meter is inspired by the MicroProfile Metrics spec, in which the meter was originally checked to be a counter but starting in 5.1 was checked be a gauge. For the duration of Helidon 4.x users can choose which type of meter Helidon registers for gc.time.
      Returns:
      the type of meter to use for registering gc.time
    • builtInMeterNameFormat

      BuiltInMeterNameFormat builtInMeterNameFormat()
      Output format for built-in meter names.

      BuiltInMeterNameFormat.SNAKE selects "snake_case" which does not conform to the MicroProfile Metrics specification.

      Returns:
      the output format for built-in meter names
    • jsonUnitsDefault

      Optional<TimeUnit> jsonUnitsDefault()
      Default units for timer output in JSON if not specified on a given timer.

      If the configuration key is absent, the Helidon JSON output uses TimeUnit.SECONDS. If the configuration key is present, Helidon formats each timer using that timer's specific units (if set) and the config value otherwise.

      Returns:
      default TimeUnit to use for JSON timer output