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

java.lang.Object
io.helidon.telemetry.otelconfig.OpenTelemetryConfig.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>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
OpenTelemetryConfig.Builder
Enclosing interface:
OpenTelemetryConfig

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

    • BuilderBase

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

    • from

      public BUILDER from(OpenTelemetryConfig 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(OpenTelemetryConfig.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

      @Deprecated 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 OpenTelemetryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends OpenTelemetryConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      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 OpenTelemetryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends OpenTelemetryConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • service

      public BUILDER service(String service)
      Service name used in sending telemetry data to the collector.
      Parameters:
      service - service name
      Returns:
      updated builder instance
      See Also:
    • enabled

      public BUILDER enabled(boolean enabled)
      Whether the OpenTelemetry support is enabled.
      Parameters:
      enabled - true if enabled; false otherwise
      Returns:
      updated builder instance
      See Also:
    • global

      public BUILDER global(boolean global)
      Whether the OpenTelemetry instance created from this configuration should be made the global one.
      Parameters:
      global - true if the configured instance should be made global; false otherwise
      Returns:
      updated builder instance
      See Also:
    • propagators

      public BUILDER propagators(List<? extends io.opentelemetry.context.propagation.TextMapPropagator> propagators)
      OpenTelemetry TextMapPropagator instances added explicitly by the app.

      Default: "tracecontext,baggage".

      Parameters:
      propagators - propagators
      Returns:
      updated builder instance
      See Also:
    • addPropagators

      public BUILDER addPropagators(List<? extends io.opentelemetry.context.propagation.TextMapPropagator> propagators)
      OpenTelemetry TextMapPropagator instances added explicitly by the app.

      Default: "tracecontext,baggage".

      Parameters:
      propagators - propagators
      Returns:
      updated builder instance
      See Also:
    • addPropagator

      public BUILDER addPropagator(io.opentelemetry.context.propagation.TextMapPropagator propagator)
      OpenTelemetry TextMapPropagator instances added explicitly by the app.

      Default: "tracecontext,baggage".

      Parameters:
      propagator - propagators
      Returns:
      updated builder instance
      See Also:
    • clearTracerProvider

      public BUILDER clearTracerProvider()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • tracerProvider

      public BUILDER tracerProvider(io.opentelemetry.api.trace.TracerProvider tracerProvider)
      Sets the tracer provider that OpenTelemetry should use.
      Parameters:
      tracerProvider - OpenTelemetry tracer provider
      Returns:
      updated builder instance
      See Also:
    • openTelemetry

      public BUILDER openTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry)
      The OpenTelemetry instance to use for telemetry.

      Typically, this value will be the OpenTelemetry SDK instance created using this configuration, but if some other code (such as the OpenTelemetry agent) has already set the OTel global instance, this value will be that global instance.

      Parameters:
      openTelemetry - the OpenTelemetry instance
      Returns:
      updated builder instance
      See Also:
    • service

      public Optional<String> service()
      Service name used in sending telemetry data to the collector.
      Returns:
      the service
    • enabled

      public boolean enabled()
      Whether the OpenTelemetry support is enabled.
      Returns:
      the enabled
    • global

      public boolean global()
      Whether the OpenTelemetry instance created from this configuration should be made the global one.
      Returns:
      the global
    • propagators

      public List<io.opentelemetry.context.propagation.TextMapPropagator> propagators()
      OpenTelemetry TextMapPropagator instances added explicitly by the app.

      Default: "tracecontext,baggage".

      Returns:
      the propagators
      See Also:
    • tracerProvider

      public Optional<io.opentelemetry.api.trace.TracerProvider> tracerProvider()
      Sets the tracer provider that OpenTelemetry should use.
      Returns:
      the tracer provider
    • openTelemetry

      public Optional<io.opentelemetry.api.OpenTelemetry> openTelemetry()
      The OpenTelemetry instance to use for telemetry.

      Typically, this value will be the OpenTelemetry SDK instance created using this configuration, but if some other code (such as the OpenTelemetry agent) has already set the OTel global instance, this value will be that global instance.

      Returns:
      the open telemetry
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.