Class DeclarativeConfiguration
java.lang.Object
io.opentelemetry.sdk.autoconfigure.declarativeconfig.DeclarativeConfiguration
Configure
OpenTelemetrySdk using declarative
configuration. For most users, this means calling parseAndCreate(InputStream) with a
YAML
configuration file.
For Implementers
External consumers needing to parse OpenTelemetry YAML configuration files should use the same
Jackson ObjectMapper configuration for compatibility. See ModelMapper.MAPPER.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DeclarativeConfigResultcreate(OpenTelemetryConfigurationModel configurationModel) Interpret theconfigurationModelto createOpenTelemetrySdkinstance corresponding to the configuration.static DeclarativeConfigResultcreate(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.parse(InputStream configuration) Parse theconfigurationYAML and return theOpenTelemetryConfigurationModel.static DeclarativeConfigResultparseAndCreate(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
Interpret theconfigurationModelto createOpenTelemetrySdkinstance corresponding to the configuration.- Parameters:
configurationModel- the configuration model- Returns:
- the
DeclarativeConfigResult - Throws:
io.opentelemetry.api.incubator.config.DeclarativeConfigException- if unable to interpret
-
create
public static DeclarativeConfigResult create(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
DeclarativeConfigResult - Throws:
io.opentelemetry.api.incubator.config.DeclarativeConfigException- if unable to interpret
-
parse
Parse theconfigurationYAML and return theOpenTelemetryConfigurationModel.During parsing, environment variable and system property 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.
-