OpenTelemetry
The first step is to configure OpenTelemetry.1
Installation
Add the Splunk Agent Observability SDK and OpenTelemetry packages to your project:For Python, the
opentelemetry-api and opentelemetry-sdk packages provide the core OpenTelemetry functionality. The opentelemetry-exporter-otlp package enables sending traces to Splunk Agent Observability’s OTLP endpoint.2
Create environment variables for your Splunk Agent Observability settings
Set environment variables for your Splunk Agent Observability settings, for example in a
.env file.
These environment variables are consumed by the SplunkAOSpanProcessor to authenticate
and route traces to the correct Splunk Agent Observability Project and Agent Stream:3
Self-hosted deployments: Set the OTel endpoint
Skip this step if you are using a hosted version.
-
A cloud deployment, then you don’t need to provide a custom OTel endpoint.
The default endpoint
<your-splunk-ao-api-url>/otel/traceswill be used automatically. -
A self-hosted deployment, replace the
<your-splunk-ao-api-url>/otel/tracesendpoint with your deployment URL. The format of this URL is based on your console URL, appending/otel/traces.
SPLUNK_AO_CONSOLE_URL environment variable. For example:4
Initialize and create the Splunk Agent Observability span processor
The
SplunkAOSpanProcessor automatically configures authentication
and metadata using your environment variables. It also:- Auto-builds OTLP headers using your Splunk Agent Observability credentials
- Configures the correct OTLP trace endpoint
- Registers a batch span processor that exports traces to Splunk Agent Observability
5
Register the span processor
The span processor can now be registered with an OTel trace provider.
OpenInference
OpenInference instrumentors are currently available for Python only.
- Automatic capture of LLM calls, token usage, and model performance evaluators
- AI-specific span attributes like
gen_ai.request.model,gen_ai.response.content, andgen_ai.usage.* - Semantic conventions that make your traces more meaningful in Splunk Agent Observability’s dashboard
- Framework-specific instrumentation for LangGraph workflows and OpenAI API calls
Next steps
Learn how to integrate with some popular frameworks using OpenTelemetry and OpenInference.Google ADK
Learn how to integrate a Google ADK project with Splunk Agent Observability using OpenTelemetry and OpenInference.
Strands Agents
Learn how to integrate a Strands Agents project with Splunk Agent Observability using OpenTelemetry.
Vercel AI SDK
Learn how to integrate a Vercel AI SDK project with Splunk Agent Observability using OpenTelemetry.
Mastra
Learn how to integrate a Mastra project with Splunk Agent Observability using OpenTelemetry.