Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 1.74 KB

File metadata and controls

28 lines (24 loc) · 1.74 KB

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.