Class DeclarativeConfiguration
java.lang.Object
io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration
Configure
OpenTelemetrySdk using declarative
configuration. For most users, this means calling parseAndCreate(InputStream) with a
YAML
configuration file.-
Method Summary
Modifier and TypeMethodDescriptionstatic io.opentelemetry.sdk.OpenTelemetrySdkcreate(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel) Interpret theconfigurationModelto createOpenTelemetrySdkinstance corresponding to the configuration.static io.opentelemetry.sdk.OpenTelemetrySdkcreate(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel, io.opentelemetry.sdk.autoconfigure.internal.ComponentLoader componentLoader) Interpret theconfigurationModelto createOpenTelemetrySdkinstance corresponding to the configuration.static io.opentelemetry.sdk.trace.samplers.SamplercreateSampler(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties genericSamplerModel) Create aSamplerModelfrom thesamplerModelrepresenting the sampler config.static io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModelparse(InputStream configuration) Parse theconfigurationYAML and return theOpenTelemetryConfigurationModel.static io.opentelemetry.sdk.OpenTelemetrySdkparseAndCreate(InputStream inputStream) Combinesparse(InputStream)andcreate(OpenTelemetryConfigurationModel).static io.opentelemetry.api.incubator.config.DeclarativeConfigPropertiestoConfigProperties(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel model) Convert themodelto a genericDeclarativeConfigProperties.static io.opentelemetry.api.incubator.config.DeclarativeConfigPropertiestoConfigProperties(InputStream configuration) Convert theconfigurationYAML to a genericDeclarativeConfigProperties.
-
Method Details
-
parseAndCreate
Combinesparse(InputStream)andcreate(OpenTelemetryConfigurationModel).- 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 theconfigurationModelto createOpenTelemetrySdkinstance 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 theconfigurationModelto createOpenTelemetrySdkinstance corresponding to the configuration.- Parameters:
configurationModel- the configuration modelcomponentLoader- the component loader used to loadComponentProviderimplementations- 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 theconfigurationYAML and return theOpenTelemetryConfigurationModel.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 themodelto a genericDeclarativeConfigProperties.- Parameters:
model- the configuration model- Returns:
- a generic
DeclarativeConfigPropertiesrepresentation of the model
-
toConfigProperties
public static io.opentelemetry.api.incubator.config.DeclarativeConfigProperties toConfigProperties(InputStream configuration) Convert theconfigurationYAML to a genericDeclarativeConfigProperties.- Parameters:
configuration- configuration YAML- Returns:
- a generic
DeclarativeConfigPropertiesrepresentation of the model
-
createSampler
public static io.opentelemetry.sdk.trace.samplers.Sampler createSampler(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties genericSamplerModel) Create aSamplerModelfrom thesamplerModelrepresenting the sampler config.This is used when samplers are composed, with one sampler accepting one or more additional samplers as config properties. The
ComponentProviderimplementation can call this to configure a delegateSamplerModelfrom theDeclarativeConfigPropertiescorresponding to a particular config property.
-