Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Declarative Configuration

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 OpenTelemetrySdk

Notes:

  • Environment variable substitution is supported as defined in the spec
  • Customization is limited to customizing the in-memory config model, or exporters. See DeclarativeConfigurationCustomizer SPI for details.
  • Custom SDK extension components which reference the ComponentProvider SPI can be referenced in declarative configuration. Supported types include:
    • Resource
    • SpanExporter
    • MetricExporter
    • LogRecordExporter
    • SpanProcessor
    • LogRecordProcessor
    • TextMapPropagator
    • Sampler
  • You can use declarative configuration with autoconfigure to specify a configuration file via environment variable, e.g. OTEL_CONFIG_FILE=/path/to/config.yaml.