File-based configuration for Python in Splunk Observability Cloud
Use an experimental OpenTelemetry YAML configuration file with the Splunk Distribution of OpenTelemetry Python.
Overview
The Splunk Distribution of OpenTelemetry Python supports the OpenTelemetry declarative configuration file format as an experimental feature. The YAML file configures upstream OpenTelemetry SDK components.
Environment variable
| Name | Description | Type |
|---|---|---|
OTEL_CONFIG_FILE |
Path to the YAML configuration file. | String |
Activate file-based configuration
Set OTEL_CONFIG_FILE to the path of your YAML configuration file when you start the instrumented application:
OTEL_CONFIG_FILE=/path/to/config.yaml opentelemetry-instrument python app.py
Configuration example
The basic declarative configuration example exports traces, metrics, and logs to a local Splunk OpenTelemetry Collector at http://localhost:4317.
Configuration notes
The declarative configuration file configures upstream OpenTelemetry SDK components. Configure exporters, including their endpoints and authentication headers, in the YAML file.
Splunk-specific configuration. Declarative configuration does not yet support Splunk Distribution settings generally. The supported exception is distribution.splunk.instrumentations.http.trace_response_header_enabled, which defaults to true. To disable the trace response header, add this block to the YAML file:
distribution:
splunk:
instrumentations:
http:
trace_response_header_enabled: false
OpAMP and declarative configuration. Declarative configuration is still in development upstream. Its initial implementation landed after the initial OpAMP implementation, and declarative configuration has not yet been integrated into OpAMP reporting. At this stage, OpAMP reports on the environment-variable configuration. You can't manage the YAML file using OpAMP yet.
Splunk Distribution features. When OTEL_CONFIG_FILE is set, the distribution does not enable continuous profiling, call graph profiling, or PostgreSQL trace correlation.
Learn more
For more information, see Declarative configuration in the Splunk Distribution of OpenTelemetry Python repository.