The `splunk-opentelemetry` Python distribution provides automatic and manual instrumentation for Python applications, collecting traces, metrics, and logs using OpenTelemetry. It bundles OpenTelemetry SDK and API components, along with exporters and instrumentations specifically configured for Splunk Observability Cloud. The current version is 2.9.0, with regular releases tied to upstream OpenTelemetry Python component updates.
pip install splunk-opentelemetryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates programmatic initialization of the Splunk OpenTelemetry Python SDK and a simple traced operation. Ensure that `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_SERVICE_NAME`, and optionally `SPLUNK_ACCESS_TOKEN` environment variables are set before running, pointing to your OpenTelemetry Collector or Splunk HEC endpoint.
Consult the [v2 Release Notes](https://github.com/signalfx/splunk-otel-python/blob/v2/VERSION_2_RELEASE_NOTES.md) and migrate to the new `SplunkOpenTelemetryConfigurator` for programmatic setup or use `splunk-py-trace` for auto-instrumentation.
Always ensure the necessary `OTEL_` and `SPLUNK_` environment variables are correctly set in the application's environment before startup or before calling `SplunkOpenTelemetryConfigurator().configure()`.
For simple scripts or applications, `splunk-py-trace` is often sufficient. For complex applications (e.g., Flask/Django), programmatic configuration and manual instrumentation, possibly alongside specific OTel framework instrumentations, provides more control. Choose one primary method.
Periodically review the release notes for `splunk-opentelemetry` and the upstream OpenTelemetry Python project. Ensure all OTel-related packages in your environment are compatible. Pinning `splunk-opentelemetry` to a minor version can help manage this.