Interface MetricsConfig

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

public interface MetricsConfig extends Prototype.Api
Configuration settings for metrics.
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

      @Deprecated(forRemoval=true, since="27.0.0") static final String SCOPE_CONFIG_KEY
      Deprecated, for removal: This API element is subject to removal in a future version.
      Core metrics ignores scope configuration, and this constant will be removed.
      Legacy scope configuration key retained for compatibility.
      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
      Default JSON unit.
  • 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

      default 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
    • publishersConfigured

      default boolean publishersConfigured()
      Indicates if publishers were specified, either by the application adding any programmatically or if the config contained the publishers node.
      Returns:
      true if publishers were assigned or configured, false otherwise
    • isScopeEnabled

      @Deprecated(forRemoval=true, since="27.0.0") default boolean isScopeEnabled(String scope)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Core metrics does not apply scope filtering, and this method will be removed.
      Always returns true because core metrics does not apply scope filtering.
      Parameters:
      scope - ignored; must not be null
      Returns:
      true
    • isMeterEnabled

      default boolean isMeterEnabled(String name)
      Determines whether the meter with the specified name is enabled.
      Parameters:
      name - meter name
      Returns:
      whether the meter is enabled
    • isMeterEnabled

      @Deprecated(forRemoval=true, since="27.0.0") default boolean isMeterEnabled(String name, String scope)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use isMeterEnabled(String). Scope is ignored and this method will be removed.
      Determines whether the meter with the specified name is enabled, ignoring the scope.
      Parameters:
      name - meter name
      scope - ignored; must not be null
      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 metrics endpoint when this config is used by a metrics observer. This setting has no effect in the top-level metrics config which controls the shared registry.
      Returns:
      whether to permit access to the observer's metrics endpoint to anybody, defaults to true
      See Also:
    • roles

      List<String> roles()
      Role names allowed to access the metrics endpoint when this config is used by a metrics observer and permitAll() is false. This setting has no effect in the top-level metrics config which controls the shared registry.
      Returns:
      allowed role names
    • 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

      @Deprecated(since="27.0.0", forRemoval=true) ScopingConfig scoping()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Core metrics ignores these settings, and this method will be removed.
      Returns scope settings retained for compatibility; core metrics ignores them.
      Returns:
      configured scope 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
    • 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
    • warnOnMultipleRegistries

      boolean warnOnMultipleRegistries()
      Whether to log warnings when multiple registries are created.

      By far most applications use a single meter registry, but certain app or library programming errors can cause Helidon to create more than one. By default, Helidon logs warning messages for each additional meter registry created. This setting allows users with apps that need multiple meter registries to suppress those warnings.

      Returns:
      whether to log warnings upon creation of multiple meter registries
    • publishers

      List<MetricsPublisher> publishers()
      Metrics publishers which make the metrics data available to external systems. Helidon's Micrometer-based metrics provider includes publishers with the config keys prometheus (inferred by default) and otlp. See the config reference entries for io.helidon.metrics.providers.micrometer.PrometheusPublisher and io.helidon.metrics.providers.micrometer.OtlpPublisher.
      Returns:
      metrics publishers