Class DeclarativeConfiguration

java.lang.Object
io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration

public final class DeclarativeConfiguration extends Object
Configure OpenTelemetrySdk using declarative configuration. For most users, this means calling parseAndCreate(InputStream) with a YAML configuration file.
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.opentelemetry.sdk.OpenTelemetrySdk
    create(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel)
    Interpret the configurationModel to create OpenTelemetrySdk instance corresponding to the configuration.
    static io.opentelemetry.sdk.OpenTelemetrySdk
    create(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel, io.opentelemetry.sdk.autoconfigure.internal.ComponentLoader componentLoader)
    Interpret the configurationModel to create OpenTelemetrySdk instance corresponding to the configuration.
    static io.opentelemetry.sdk.trace.samplers.Sampler
    createSampler(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties genericSamplerModel)
    Create a SamplerModel from the samplerModel representing the sampler config.
    static io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel
    parse(InputStream configuration)
    Parse the configuration YAML and return the OpenTelemetryConfigurationModel.
    static io.opentelemetry.sdk.OpenTelemetrySdk
    static io.opentelemetry.api.incubator.config.DeclarativeConfigProperties
    toConfigProperties(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel model)
    Convert the model to a generic DeclarativeConfigProperties.
    static io.opentelemetry.api.incubator.config.DeclarativeConfigProperties
    Convert the configuration YAML to a generic DeclarativeConfigProperties.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • parseAndCreate

      public static io.opentelemetry.sdk.OpenTelemetrySdk parseAndCreate(InputStream inputStream)
      Throws:
      io.opentelemetry.api.incubator.config.DeclarativeConfigException - if unable to parse or interpret
    • create

      public static io.opentelemetry.sdk.OpenTelemetrySdk create(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel)
      Interpret the configurationModel to create OpenTelemetrySdk instance corresponding to the configuration.
      Parameters:
      configurationModel - the configuration model
      Returns:
      the OpenTelemetrySdk
      Throws:
      io.opentelemetry.api.incubator.config.DeclarativeConfigException - if unable to interpret
    • create

      public static io.opentelemetry.sdk.OpenTelemetrySdk create(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel, io.opentelemetry.sdk.autoconfigure.internal.ComponentLoader componentLoader)
      Interpret the configurationModel to create OpenTelemetrySdk instance corresponding to the configuration.
      Parameters:
      configurationModel - the configuration model
      componentLoader - the component loader used to load ComponentProvider implementations
      Returns:
      the OpenTelemetrySdk
      Throws:
      io.opentelemetry.api.incubator.config.DeclarativeConfigException - if unable to interpret
    • parse

      public static io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel parse(InputStream configuration)
      Parse the configuration YAML and return the OpenTelemetryConfigurationModel.

      Before parsing, environment variable substitution is performed as described in DeclarativeConfiguration.EnvSubstitutionConstructor.

      Throws:
      io.opentelemetry.api.incubator.config.DeclarativeConfigException - if unable to parse
    • toConfigProperties

      public static io.opentelemetry.api.incubator.config.DeclarativeConfigProperties toConfigProperties(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel model)
      Convert the model to a generic DeclarativeConfigProperties.
      Parameters:
      model - the configuration model
      Returns:
      a generic DeclarativeConfigProperties representation of the model
    • toConfigProperties

      public static io.opentelemetry.api.incubator.config.DeclarativeConfigProperties toConfigProperties(InputStream configuration)
      Convert the configuration YAML to a generic DeclarativeConfigProperties.
      Parameters:
      configuration - configuration YAML
      Returns:
      a generic DeclarativeConfigProperties representation of the model
    • createSampler

      public static io.opentelemetry.sdk.trace.samplers.Sampler createSampler(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties genericSamplerModel)
      Create a SamplerModel from the samplerModel representing the sampler config.

      This is used when samplers are composed, with one sampler accepting one or more additional samplers as config properties. The ComponentProvider implementation can call this to configure a delegate SamplerModel from the DeclarativeConfigProperties corresponding to a particular config property.