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:
- OTLP gRPC exporters
configured to send traces, metrics, and logs to a locally running
Splunk OpenTelemetry Collector
(
http://localhost:4317). - Unlimited default limits for configuration options to support full-fidelity traces.
- System metrics instrumentation.
- Python logging instrumentation.
The Splunk Distribution of OpenTelemetry Python requires Python 3.10 or later. Supported libraries are listed here.
For complete instructions on how to get started with the Splunk Distribution of OpenTelemetry Python, see Instrument a Python application for Splunk Observability Cloud in the official documentation.
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-opentelemetryInstall instrumentation packages for the libraries your application uses:
opentelemetry-bootstrap -a installThen run your application with opentelemetry-instrument:
OTEL_SERVICE_NAME=my-python-service opentelemetry-instrument python app.pyBy 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.
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:
OTEL_CONFIG_FILE=/path/to/config.yaml opentelemetry-instrument python app.pySee the basic declarative configuration example,
which exports traces, metrics, and logs to a local Collector at http://localhost:4317.
This support configures upstream OpenTelemetry SDK components. The GDI
distribution.splunk configuration block is not supported yet. Configure
exporters, including their endpoints and authentication headers, in the YAML file.
OpAMP does not report the declarative file as effective configuration and cannot
manage it remotely yet.
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.
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.
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.
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.