LiteLLM
LiteLLM emits GenAI spans for every model call it routes, from the SDK or the Proxy, across all its providers.
You will need:
OODLE_INSTANCE: your Oodle instance ID (ap1, us1)OODLE_API_KEY: an Oodle API key (ap1, us1)OTLP_ENDPOINT: your OTLP collector domain, shown on the tile
Open the LiteLLM tile on the ap1, us1 page to
get these filled in for you, or let an agent do the setup with
/oodle-onboarding set up the llm_observability_litellm integration.
Install
Install LiteLLM with the OpenTelemetry SDK and the OTLP exporter:
pip install litellm \
opentelemetry-exporter-otlp-proto-http \
opentelemetry-sdk
Instrument
Turn on the OTel callback. LiteLLM then traces every call it routes, whichever provider serves it:
import litellm
# LiteLLM builds its own tracer provider from the
# OTEL_EXPORTER_OTLP_* variables below, so there is no SDK
# setup to write here.
litellm.callbacks = ["otel"]
response = litellm.completion(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
# LiteLLM Proxy takes the same callback in config.yaml:
# litellm_settings:
# callbacks: ["otel"]
Environment
Point the application at Oodle:
# OTLP endpoint (points straight at Oodle)
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<OTLP_ENDPOINT>
export OTEL_EXPORTER_OTLP_HEADERS="X-API-KEY=<OODLE_API_KEY>,X-OODLE-INSTANCE=<OODLE_INSTANCE>"
# Required. Without it LiteLLM names the span litellm_request
# and writes no gen_ai.operation.name, and Agent Observability
# lists nothing.
export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
# Capture prompt/response content. `true` here means events
# only, which leaves the span attributes empty.
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=span_and_event
# LiteLLM has no code hook for the resource, so the service
# name comes from the environment. It defaults to "litellm".
export OTEL_SERVICE_NAME=my-llm-app
Verify
Run your application, then open ap1, us1. Spans
carry gen_ai.* attributes: the model, token counts, and the prompt and
response content. Click a trace for the Transcript, the waterfall, and
the cost breakdown.
If nothing arrives, check that the exporter can reach
https://<OTLP_ENDPOINT> and that the instance and key are set: the
OTLP gateway answers 401 without them.
Support
If you need assistance or have any questions, please reach out to us through:
- Email at [email protected]