Class MetricsObserverConfig.BuilderBase<BUILDER extends MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsObserverConfig>

java.lang.Object
io.helidon.webserver.observe.ObserverConfigBase.BuilderBase<BUILDER, PROTOTYPE>
io.helidon.webserver.observe.metrics.MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER, PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER, PROTOTYPE>
Direct Known Subclasses:
MetricsObserverConfig.Builder
Enclosing interface:
MetricsObserverConfig

public abstract static class MetricsObserverConfig.BuilderBase<BUILDER extends MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsObserverConfig> extends ObserverConfigBase.BuilderBase<BUILDER, PROTOTYPE> implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER, PROTOTYPE>
Fluent API builder base for MetricsObserverConfig.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(MetricsObserverConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(MetricsObserverConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsObserverConfig>
      Overrides:
      config in class ObserverConfigBase.BuilderBase<BUILDER extends MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsObserverConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • endpoint

      public BUILDER endpoint(String endpoint)
      Endpoint option.
      Parameters:
      endpoint - the endpoint option
      Returns:
      updated builder instance
      See Also:
    • clearAutoHttpMetrics

      public BUILDER clearAutoHttpMetrics()
      Clear existing value of autoHttpMetrics.
      Returns:
      updated builder instance
      See Also:
    • autoHttpMetrics

      public BUILDER autoHttpMetrics(AutoHttpMetricsConfig autoHttpMetrics)
      Automatic metrics collection settings.
      Parameters:
      autoHttpMetrics - auto metrics collection settings
      Returns:
      updated builder instance
      See Also:
    • autoHttpMetrics

      public BUILDER autoHttpMetrics(Consumer<AutoHttpMetricsConfig.Builder> consumer)
      Automatic metrics collection settings.
      Parameters:
      consumer - consumer of builder of auto metrics collection settings
      Returns:
      updated builder instance
      See Also:
    • autoHttpMetrics

      public BUILDER autoHttpMetrics(Supplier<? extends AutoHttpMetricsConfig> supplier)
      Automatic metrics collection settings.
      Parameters:
      supplier - supplier of auto metrics collection settings
      Returns:
      updated builder instance
      See Also:
    • metricsConfig

      public BUILDER 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.
      Parameters:
      metricsConfig - metrics settings for the observer endpoint and, when configured, a custom registry
      Returns:
      updated builder instance
      See Also:
    • metricsConfig

      public BUILDER metricsConfig(Consumer<MetricsConfig.Builder> consumer)
      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.
      Parameters:
      consumer - consumer of builder of metrics settings for the observer endpoint and, when configured, a custom registry
      Returns:
      updated builder instance
      See Also:
    • metricsConfig

      public BUILDER metricsConfig(Supplier<? extends MetricsConfig> supplier)
      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.
      Parameters:
      supplier - supplier of metrics settings for the observer endpoint and, when configured, a custom registry
      Returns:
      updated builder instance
      See Also:
    • clearMeterRegistry

      public BUILDER clearMeterRegistry()
      Clear existing value of meterRegistry.
      Returns:
      updated builder instance
      See Also:
    • meterRegistry

      public BUILDER meterRegistry(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).

      Parameters:
      meterRegistry - meterRegistry to use in this metric support
      Returns:
      updated builder instance
      See Also:
    • endpoint

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

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

      public 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

      public 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
    • toString

    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
      Overrides:
      preBuildPrototype in class ObserverConfigBase.BuilderBase<BUILDER extends MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsObserverConfig>
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
      Overrides:
      validatePrototype in class ObserverConfigBase.BuilderBase<BUILDER extends MetricsObserverConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsObserverConfig>