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 ExtendedOpenTelemetrySdkcreate(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel) Interpret theconfigurationModelto createOpenTelemetrySdkinstance corresponding to the configuration.static ExtendedOpenTelemetrySdkcreate(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel, io.opentelemetry.common.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 ExtendedOpenTelemetrySdkparseAndCreate(InputStream inputStream) Combinesparse(InputStream)andcreate(OpenTelemetryConfigurationModel).static io.opentelemetry.api.incubator.config.DeclarativeConfigPropertiestoConfigProperties(InputStream configuration) Convert theconfigurationYAML to a genericDeclarativeConfigProperties.static io.opentelemetry.api.incubator.config.DeclarativeConfigPropertiestoConfigProperties(Object model) Convert themodelto 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 ExtendedOpenTelemetrySdk 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 ExtendedOpenTelemetrySdk create(io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel configurationModel, io.opentelemetry.common.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.During parsing, environment variable substitution is performed as defined in the OpenTelemetry Configuration Data Model specification.
- Throws:
io.opentelemetry.api.incubator.config.DeclarativeConfigException- if unable to parse
-
toConfigProperties
public static io.opentelemetry.api.incubator.config.DeclarativeConfigProperties toConfigProperties(Object 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.
-