Interface MetricsObserverConfig

All Superinterfaces:
ObserverConfigBase, Prototype.Api, Prototype.Factory<MetricsObserver>
All Known Implementing Classes:
MetricsObserverConfig.BuilderBase.MetricsObserverConfigImpl

public interface MetricsObserverConfig extends Prototype.Api, ObserverConfigBase
Metrics Observer configuration.
See Also:
  • Method Details

    • builder

      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      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 MetricsObserverConfig 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 MetricsObserverConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • endpoint

      String endpoint()
      Endpoint option.
      Returns:
      the endpoint option
    • autoHttpMetrics

      default Optional<AutoHttpMetricsConfig> autoHttpMetrics()
      Automatic metrics collection settings.
      Returns:
      auto metrics collection settings
    • metricsConfig

      MetricsConfig metricsConfig()
      Assigns metrics settings for the observer endpoint, including whether the endpoint is enabled and its access controls. With a custom MeterRegistry, the settings also describe the registry-specific behavior. With the shared registry, registry-specific behavior uses the settings from that registry's owning MetricsFactory while the endpoint settings assigned here still apply.
      Returns:
      metrics settings for the observer endpoint and, when configured, a custom registry
    • meterRegistry

      Optional<MeterRegistry> meterRegistry()
      If you want to have multiple meter registries with different endpoints, you may create them using
           MeterRegistry meterRegistry = io.helidon.service.registry.Services
                   .get(io.helidon.metrics.api.MetricsFactory.class)
                   .createMeterRegistry(metricsConfig);
           MetricsObserver.builder()
                   .endpoint("metrics-2")
                   .metricsConfig(metricsConfig)
                   .meterRegistry(meterRegistry) // further settings on the observer builder, etc.
                   .build();
      
      where metricsConfig can contain registry-specific settings. Configure a different endpoint() on each observer.

      A meter registry has one effective set of registry-specific settings. Multiple metrics observers may share the same registry only when their registry-specific settings are equivalent; endpoint settings may differ. Use separate meter registries for observers that require different registry-specific behavior.

      A custom meter registry passed to an observer remains caller-owned. Close it after all observers using it have stopped.

      If this method is not called, a registry-managed MetricsObserver uses the shared instance from its owning ServiceRegistry. A directly created observer uses the global shared instance as provided by Services.get(MeterRegistry.class).

      Returns:
      meterRegistry to use in this metric support
    • name

      String name()
      Description copied from interface: ObserverConfigBase
      Name of this observer. Each observer should provide its own default for this property.
      Specified by:
      name in interface ObserverConfigBase
      Returns:
      observer name