Registry / observability / splunk-opentelemetry

splunk-opentelemetry

JSON →
library2.11.0pypypi✓ verified 82d ago

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-opentelemetry
INSTALL
IMPORT
SIG · SPLUNK-OPENTELEMET
S
splunk-opentelemetry
observabilitypythonv2.11.0
Install
5.5s avg
Import
Disk
51MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.11.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 52.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.5s · import 0.000s · 51MB
51MB installed
● package 51MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SplunkConfigurator
from splunk_otel import SplunkConfigurator
from splunk_opentelemetry.instrumentation import SplunkOpenTelemetryConfigurator
init_splunk_otel
from splunk_otel import init_splunk_otel
from splunk_opentelemetry.instrumentation import SplunkOpenTelemetryConfigurator
SplunkDistro
from splunk_otel import SplunkDistro
from splunk_opentelemetry.instrumentation import SplunkOpenTelemetryConfigurator

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.

import os from opentelemetry import trace from splunk_opentelemetry.instrumentation import SplunkOpenTelemetryConfigurator # Set required environment variables for the Splunk OTLP exporter # In a real application, these would typically be set in the shell or deployment config. # For a local OpenTelemetry Collector (e.g., Splunk Distribution of OpenTelemetry Collector), # the endpoint might be http://localhost:4318 for HTTP or http://localhost:4317 for gRPC. os.environ['OTEL_SERVICE_NAME'] = os.environ.get('OTEL_SERVICE_NAME', 'my-python-app') os.environ['OTEL_EXPORTER_OTLP_ENDPOINT'] = os.environ.get('OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4318') os.environ['SPLUNK_ACCESS_TOKEN'] = os.environ.get('SPLUNK_ACCESS_TOKEN', 'YOUR_SPLUNK_ACCESS_TOKEN') # Only required if sending directly to Splunk HEC # Configure the OpenTelemetry SDK for Splunk Observability Cloud # This initializes the TracerProvider, MeterProvider, and sets up # the OTLP exporter with Splunk-specific resource attributes. # It reads configuration from environment variables. SplunkOpenTelemetryConfigurator().configure() # Get a tracer configured by the Splunk OpenTelemetry SDK tracer = trace.get_tracer(__name__) # Perform a simple operation within a trace with tracer.start_as_current_span("my-quickstart-operation") as span: print(f"Starting span: {span.name}") # Add an attribute to the span span.set_attribute("http.method", "GET") span.set_attribute("http.url", "/api/data") # Simulate some work import time time.sleep(0.1) with tracer.start_as_current_span("inner-work") as inner_span: print(f" Starting inner span: {inner_span.name}") inner_span.set_attribute("data.size", 1024) time.sleep(0.05) print(f" Finishing inner span: {inner_span.name}") print(f"Finishing span: {span.name}") print("\nTracing complete. Data should be sent to the configured OTLP endpoint.") print("Ensure an OpenTelemetry Collector or Splunk HEC is listening at the endpoint.")
splunk-py-trace --version
Debug
Known issues
breakingVersion 2.0.0 introduced significant breaking changes, including a complete rewrite of the API and underlying instrumentation. Direct usage of `opentelemetry-sdk` components might need adjustment, and the overall instrumentation approach changed.
fix
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.
affects: >=2.0.0
gotchaConfiguration of the OpenTelemetry SDK (e.g., OTLP endpoint, service name, access token) relies heavily on environment variables (e.g., `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_SERVICE_NAME`, `SPLUNK_ACCESS_TOKEN`). Misconfiguration or missing variables will result in no telemetry being exported or being exported to the wrong location.
fix
Always ensure the necessary `OTEL_` and `SPLUNK_` environment variables are correctly set in the application's environment before startup or before calling `SplunkOpenTelemetryConfigurator().configure()`.
affects: All versions
gotchaThere are two main ways to instrument: automatic via `splunk-py-trace` (which wraps your application command) and programmatic using `SplunkOpenTelemetryConfigurator.configure()` and manual instrumentation. Mixing these can lead to unexpected behavior or double instrumentation.
fix
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.
affects: All versions
gotchaThe `splunk-opentelemetry` package frequently upgrades its underlying OpenTelemetry Python dependencies (API and SDK). This means that if you rely on specific OTel API features or have other OTel-related packages installed, there might be version conflicts or unexpected changes in behavior between `splunk-opentelemetry` releases.
fix
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.
affects: All versions
Upgrade
Version history
2.11.0latest on PyPI · released Jun 9, 2026
Audit
Dependencies
protobufrequiredTransitive dependency of OpenTelemetry components; specific version pinned to avoid conflicts/issues.
Agent activity
51 hits · last 30 days
node
46
OpenAI (training)
1
Resources
splunk-opentelemetry — pip install splunk-opentelemetry · libregistry