The Splunk Distribution of OpenTelemetry Python extends
OpenTelemetry Python to automatically instrument Python
applications and export traces, metrics, and logs to Splunk Observability Cloud. It patches supported libraries at
runtime with OpenTelemetry-compatible instrumentation and provides Splunk-specific configuration defaults.
This distribution comes with the following defaults:
For the standard OpenTelemetry setup, install the Splunk Distribution of OpenTelemetry Python in your application
environment. The distribution configures OTLP exporters for traces, metrics, and logs, includes system metrics
instrumentation, and enables Python logging instrumentation.
pip install splunk-opentelemetry
Install instrumentation packages for the libraries your application uses:
opentelemetry-bootstrap -a install
Then run your application with opentelemetry-instrument:
By default, OTLP exporters send telemetry to a locally running
Splunk OpenTelemetry Collector
at http://localhost:4317. To send telemetry directly to Splunk Observability
Cloud instead, set SPLUNK_REALM and SPLUNK_ACCESS_TOKEN before starting your
application. SPLUNK_REALM configures direct ingest endpoints for traces and
metrics.
Experimental PostgreSQL trace correlation
Set SPLUNK_DB_TRACE_CONTEXT_PROPAGATION_ENABLED=true to link PostgreSQL
query samples to APM traces and database client spans. This feature is disabled
by default. See PostgreSQL trace correlation for setup,
supported drivers, and limitations.
Declarative configuration
The distribution includes experimental support for the OpenTelemetry declarative
configuration file format. Set OTEL_CONFIG_FILE to the path of the YAML
configuration file when you start the instrumented application:
This support configures upstream OpenTelemetry SDK components. Configure
exporters, including their endpoints and authentication headers, in the YAML file.
The GDI distribution.splunk configuration block supports continuous CPU profiling,
call graph profiling, and instrumentations.http.trace_response_header_enabled, which defaults to true.
To disable the trace response header, add this block to the YAML file:
OpAMP does not report the declarative file as effective configuration and cannot
manage it remotely yet.
Profiling
The Splunk Distribution of OpenTelemetry Python supports continuous profiling and
call graph profiling. Both modes export profiling data through OpenTelemetry logs
for correlation with traces in Splunk APM. See Profiling for
configuration and limitations.
Optional: Cisco SecureApp
To also install the Cisco SecureApp
OpenTelemetry extension, specify the secureapp extra:
pip install "splunk-opentelemetry[secureapp]"
This extra installs the SecureApp Python agent, which reports runtime Python
package dependencies through OpenTelemetry logs.
SecureApp dependency logs use the secureapp instrumentation scope. Collector
deployments must route those logs to the SecureApp event ingest endpoint
(/v3/event) and add the SecureApp instrumentation header on the outbound
exporter. See docs/secureapp.md for setup details and
docs/examples/secureapp-collector-config.yaml
for a collector example.
Fleet management with OpAMP
The Splunk Distribution of OpenTelemetry Python provides OpAMP support. When enabled, the OpAMP client connects to the
configured endpoint and reports the Python agent's status and settings. Agents connected to Splunk Observability Cloud
appear on the Fleet Management page.
Set SPLUNK_OPAMP_ENABLED=true to enable OpAMP. The default OpAMP endpoint is a local Splunk OpenTelemetry Collector.
See OpAMP for setup, configuration, and limits.
License
The Splunk Distribution of OpenTelemetry Python is a distribution of
OpenTelemetry Python. It is licensed under the terms of the
Apache Software License version 2.0. See the license file for more details.
Alternatives
Use instead of splunk-opentelemetry: tools that do the same job, closest first.