The declarative configuration interface allows for YAML based file configuration of OpenTelemetrySdk.
Usage:
File yamlConfigFile = new File("/path/to/config.yaml");
OpenTelemetrySdk openTelemetrySdk;
try (FileInputStream yamlConfigFileInputStream = new FileInputStream("/path/to/config.yaml")) {
openTelemetrySdk = DeclarativeConfiguration.parseAndCreate(yamlConfigFileInputStream).getSdk();
}
// ...proceed with application after successful initialization of OpenTelemetrySdkNotes:
- Environment variable substitution is supported as defined in the spec
- Customization is limited to customizing the in-memory config model, or exporters. See
DeclarativeConfigurationCustomizerSPI for details. - Custom SDK extension components which reference the ComponentProvider SPI can be referenced in declarative configuration. Supported types include:
ResourceSpanExporterMetricExporterLogRecordExporterSpanProcessorLogRecordProcessorTextMapPropagatorSampler
- You can use declarative configuration with autoconfigure to specify a configuration file via environment variable, e.g.
OTEL_CONFIG_FILE=/path/to/config.yaml.