Instrument LiteLLM Applications with OpenTelemetry
Learn how to instrument LiteLLM and LiteLLM Proxy applications with OpenTelemetry and export large language model (LLM) telemetry via OTLP into Cribl Search. Once your data is in Cribl Search, you can explore and investigate it to troubleshoot issues, analyze model behavior, and monitor performance.
You’ll complete the following high-level steps:
- Configure an OpenTelemetry (OTel) Source in Cribl Search to receive OTLP data.
- Instrument your LiteLLM application (Python SDK or Proxy Server) with OpenTelemetry.
- Explore LLM telemetry use cases in Cribl Search.
Telemetry Captured
LiteLLM emits trace spans (and optional metrics or events) with attributes such as:
| Category | Data | Example |
|---|---|---|
| Timing | Request and upstream LLM call duration. | 1.2s for a chat completion. |
| Model usage | Model ID, provider, token counts, and cost when available. | gpt-4o-mini, 150 input / 85 output tokens. |
| Proxy context | User, team, org, and key metadata on Proxy requests. | metadata.user_api_key_team_id. |
| Structure | Span hierarchy for Proxy routes, guardrails, and provider calls. | Received Proxy Server Request, raw_gen_ai_request. |
| Errors | HTTP status, provider errors, and proxy failures. | 429 Rate limit exceeded. |
| Content | Prompt and completion text. | (enabled by default in LiteLLM, unlike other providers.) |
Semantic conventions follow OpenTelemetry GenAI Semantic Conventions where applicable. Set OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental to opt in to the latest GenAI semantic conventions.
LiteLLM also emits several attribute families outside the standard GenAI spec. These are useful for Proxy-level visibility but may not be recognized by all OTel backends:
metadata.*: Proxy key, user, team, and org metadata (for examplemetadata.user_api_key_team_id).llm.*andlitellm.*: LiteLLM-specific request fields such asllm.is_streamingandlitellm.call_id.gen_ai.cost.*: LiteLLM cost breakdown attributes (for examplegen_ai.cost.total_cost).llm.{provider}.*: Raw provider request and response payload (default mode only; suppressed in semconv mode and when content capture is disabled).
Prerequisites
You’ll need:
- Cribl.Cloud Enterprise.
- Search Admin permission or higher.
- Python 3.9+.
- A LiteLLM installation or a running LiteLLM Proxy instance.
- Provider API keys for the models you call through LiteLLM (for example
OPENAI_API_KEY,ANTHROPIC_API_KEY, or keys configured in your Proxyconfig.yaml).
Get Data Into Cribl Search
Complete these steps before you instrument your LLM application:
- Add a lakehouse engine. This provides storage and compute for data you’re going to ingest into Cribl Search.
- Add a Cribl Search OpenTelemetry Source to start ingesting the data.
- Set up your Datatype rules to parse and structure the incoming data.
- Set up your Dataset rules to route ingested events into individual Search Datasets. This will let you scope your queries and control retention.
Add a Lakehouse Engine
A lakehouse engine is the storage-and-compute unit in Cribl Search that holds ingested OTLP (and other Source data) until Dataset retention expires. See Lakehouse Engines in Cribl Search to learn how to set up a new lakehouse engine.
Configure the OpenTelemetry (OTel) Source in Cribl Search
To receive OTLP from your LLM application directly in Cribl Search, add an OpenTelemetry Source.
On the Cribl.Cloud top bar, select Products > Search. Under Data, select Add Source > OpenTelemetry.
In the New Source modal, configure the following under General Settings:
- ID: Unique Source ID across your Cribl.Cloud Workspace. Use letters, numbers, underscores, and hyphens.
- Description (optional): Describe the Source (for example, OTLP from LLM-instrumented apps).
- Address: Hostname that your OpenTelemetry collector or agent connects to. You will use this in exporter configuration.
- Port: Network port to listen on. Defaults to
4317for gRPC and4318for HTTP (OTLP standard). Change if you use a custom port. - OTLP version: Version that matches your upstream sender (default
1.3.1). - Protocol: gRPC (default) or HTTP. This must match your OpenTelemetry exporter.
Under Authentication, choose None, Basic, Basic (Credentials Secret), Auth Tokens, or Auth Token (Text Secret) as required. See Set up Authentication.
Under Encrypt, enable TLS and set the minimum TLS version when senders must connect over TLS. See Set Up Encryption.
Select Save to create the Source.
Set Datatype Rules
Next, configure Datatype rules to parse, filter, and normalize your data into structured fields.
On the Cribl.Cloud top bar, select Products > Search > Data > Datatyping (auto). Here, you can:
- Use Auto-Datatyping to parse your data automatically.
- Check for uncategorized data that didn’t match any Datatype rules.
- Handle the uncategorized data by adding custom Datatype rules.
See also:
- Datatypes in Cribl Search
- v2 Datatypes in Cribl Search
- List of Stock v2 Datatypes
- Add a Custom v2 Datatype
Add a Dataset and Set Dataset Rules
Next, create a Dataset and add Dataset rules to route parsed events into it.
Add a Dataset
- On the Cribl.Cloud top bar, select Products > Search > Data > Datasets.
- Select Add Dataset.
- Enter a unique ID.
- Optionally add a Description and Tags.
- Set Dataset Provider to lakehouse.
- Select the Lakehouse engine that will store the data.
- Set the Retention period.
- Select Save.
Set Dataset Rules
Dataset rules enable you to route ingested events into individual Search Datasets so you can scope your queries and control retention.
See Organize Your Data for details around how to configure your Dataset rules and plan your Search Datasets based on estimated future storage costs.
Instrument Your Application
Select Python SDK or Proxy Server from the tabs. Both paths use LiteLLM’s built-in OpenTelemetry callback to emit OTLP spans into the Source you configured earlier.
LiteLLM OpenTelemetry export is Python-only. Install the OpenTelemetry SDK packages alongside
litellm, then enable theotelcallback in code or in your Proxyconfig.yaml. See the LiteLLM OpenTelemetry documentation for the full configuration reference.
Use the LiteLLM Python SDK when your application calls litellm.completion, litellm.acompletion, or related helpers directly.
- Install LiteLLM and the OpenTelemetry SDK:
pip install litellm opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlpFor gRPC export to Cribl, also install grpcio:
pip install "litellm[grpc]"- Enable the OpenTelemetry callback before you make LiteLLM calls:
import litellm
litellm.callbacks = ["otel"]
response = litellm.completion(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)- Set environment variables and run your application:
python app.pyIn SDK-only use, LiteLLM emits a litellm_request root span when no parent trace context exists.
Use the LiteLLM Proxy when clients send OpenAI-compatible requests to a centralized gateway. This section covers the OTel v2 integration, which produces one clean trace per request and fully follows the OTel GenAI semantic conventions. To use the legacy v1 integration instead, see the LiteLLM OpenTelemetry documentation.
- Install LiteLLM with OpenTelemetry dependencies on the Proxy host:
pip install "litellm[proxy]" opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation-fastapiFor gRPC export, also install grpcio:
pip install "litellm[grpc]"- Add your models to your Proxy
config.yaml. No callbacks entry is needed – OTel v2 is activated entirely via theLITELLM_OTEL_V2environment variable:
model_list:
- model_name: gpt-4o-mini
litellm_params:
model: openai/gpt-4o-mini
api_key: os.environ/OPENAI_API_KEY- Set environment variables – including
LITELLM_OTEL_V2=true– and start the Proxy:
litellm --config config.yaml- Send a test request to an LLM route (for example
/v1/chat/completions) to generate spans.
Each Proxy request produces one trace with the full request lifecycle nested in a single tree:
POST /v1/chat/completions ← HTTP request span
├── auth /v1/chat/completions ← authentication and key lookup
├── execute_guardrail ← each guardrail that runs (if configured)
├── chat gpt-4o-mini ← LLM call with gen_ai.* attributes
└── batch_write_to_db ← spend and usage written to DBSet Environment Variables
Set these environment variables before running your instrumented application. Replace <cribl-host> with your Cribl host address, and <token> with your Bearer token if authentication is enabled on the OTel Source.
Use gRPC (port 4317)
Set environment variables using gRPC. This is the recommended method:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<cribl-host>:4317"
export OTEL_EXPORTER_OTLP_PROTOCOL="grpc"
export OTEL_SERVICE_NAME="my-litellm-app"
# Only if you enabled auth on the Cribl OTEL Source:
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"Use HTTP/protobuf (port 4318)
If your OTLP exporter or network path requires HTTP/protobuf instead of gRPC, use port 4318 and set the protocol as shown.
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<cribl-host>:4318"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_SERVICE_NAME="my-litellm-app"
# Only if you enabled auth on the Cribl OTEL Source:
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"Environment Variable Reference
Use this table to set OTLP export options, optional auth headers for the Cribl Source, and LiteLLM-specific toggles.
| Variable | Required | Description |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Yes | Cribl Search OpenTelemetry Source URL (http://<cribl-host>:4317 for gRPC, :4318 for HTTP). LiteLLM also accepts the alias OTEL_ENDPOINT. |
OTEL_EXPORTER_OTLP_PROTOCOL | Yes | grpc or http/protobuf. LiteLLM also accepts the alias OTEL_EXPORTER (for example otlp_grpc or otlp_http). |
OTEL_SERVICE_NAME | Yes | Logical name for your application (appears in traces). Defaults to litellm if unset. |
OTEL_EXPORTER_OTLP_HEADERS | No | Auth header if the Source requires it (e.g., Authorization=Bearer <token>). LiteLLM also accepts the alias OTEL_HEADERS. |
| Provider API keys | As needed | For example OPENAI_API_KEY, ANTHROPIC_API_KEY, or keys defined in your Proxy config.yaml. |
LITELLM_OTEL_V2 | Proxy only | Set to true to enable the OTel v2 integration for the Proxy. Has no effect on the Python SDK. |
OTEL_SEMCONV_STABILITY_OPT_IN | No | Python SDK only. Set to gen_ai_latest_experimental to emit the latest GenAI semantic conventions. Proxy v2 follows GenAI semconv natively and does not require this flag. |
USE_OTEL_LITELLM_REQUEST_SPAN | No | Python SDK and Proxy v1 only. Set to true to emit a nested litellm_request span per LLM call. Not applicable to Proxy v2. |
LITELLM_OTEL_INTEGRATION_ENABLE_METRICS | No | Set to true to export GenAI client metrics (token usage, cost, latency). |
Capture Prompt/Completion Content
Content capture behavior differs between the Python SDK and the Proxy:
- Python SDK: Content is captured by default. To disable it:
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT="NO_CONTENT"You can also set litellm.turn_off_message_logging=True in code to suppress content globally.
- Proxy v2: Content is not captured by default. To enable it:
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT="span_only"Other accepted values are event_only and span_and_event.
When content capture is enabled for the Proxy, use Cribl’s masking and redaction features to sanitize data before it reaches downstream destinations.
Verify Data Flow in Cribl Search
After completing the instrumentation process, confirm OTLP events flow from your instrumented app into Cribl Search.
- On the Cribl.Cloud top bar, select Products > Search > Data > Live Data.
- Select your OpenTelemetry Source and confirm that events appear while you trigger traffic from your LiteLLM application or Proxy.
- For full Live Data behavior and troubleshooting, check See Live Data Flow.
Common Search Issues and Fixes
| Symptom | Cause | Fix |
|---|---|---|
| No events returned. | OpenTelemetry Source is not receiving data, or Dataset rules are not routing data correctly. | Verify the Source address, port, protocol, and auth settings. Check Data > Live Data for the OpenTelemetry Source, then confirm your Dataset rule sends matching events to the correct Search Dataset. |
| Empty time range. | No recent traffic, or event timestamps are outside your selected window. | Widen Time range; send a test LiteLLM call or Proxy /v1/chat/completions request. Review timestamp parsing in your Datatype configuration. |
| No spans from LiteLLM (Python SDK). | otel callback not enabled. | Set litellm.callbacks = ["otel"] in code. |
| No traces from Proxy v2. | LITELLM_OTEL_V2 not set, or FastAPI instrumentation package missing. | Confirm LITELLM_OTEL_V2=true is set in the Proxy environment. Verify opentelemetry-instrumentation-fastapi is installed. Try OTEL_EXPORTER=console first to confirm spans are emitted before troubleshooting the endpoint. |
| Only infrastructure spans (auth, postgres, redis). | Request hit a management route, not an LLM route. | Send traffic to /v1/chat/completions or another LLM endpoint. Management routes such as /key/info and /user/info do not produce LLM spans. |
| Connection or export errors. | Protocol mismatch or missing gRPC dependency. | Match gRPC (4317) vs HTTP/protobuf (4318) to your Cribl Source. For gRPC, install grpcio (pip install "litellm[grpc]"). Set OTEL_DEBUG=true to surface exporter errors. |
| 401 from a model provider. | Missing or invalid API key. | Set the correct provider environment variables or Proxy model credentials. |
| Fields not where you expect. | Auto-Datatyping did not classify the events as expected, or your Datatype rules need refinement. | Review the data in Live Data, check for Uncategorized events, and update or add Datatype rules so the data parses into the fields you expect. |
| Slow or expensive searches. | Large partitions scanned. | Narrow time range, increase sampling, or pre-aggregate in Stream. |
| Permission errors. | Insufficient Search role. | Ask an Admin to grant Editor (or higher) for Dataset management, or User for running searches per org policy. |
LLM Telemetry Use Cases
With data flowing into Cribl Search, you can explore and gain visibility towards your LiteLLM telemetry:
- Explore LLM telemetry: Explore your Search Dataset in Cribl Search and query it with KQL. Filter and slice by service, model, provider, environment, token usage, cost signals, and error or status fields.
- Investigate incidents and performance regressions: During elevated errors or latency, investigate your LLM Search Dataset. Use aggregations such as
summarizeortimestatsto break down failures by model, deployment, feature, tenant, or region. Usejoinor related patterns with infrastructure, gateway, or security Datasets for end-to-end context. - Build dashboards for LLM usage and cost: Use Cribl Search Dashboards to track requests over time by model or app, token usage and derived cost, error rates by environment or tenant, and latency percentiles (for example P95/P99) plus token distributions and traffic share.
- Automate checks with scheduled searches and notifications: Turn important queries (for example, when estimated LLM cost or error rate crosses a threshold over a time window) into Scheduled Searches and attach Notifications to email, Slack, SNS, webhooks, and other targets.
Learn how to instrument LiteLLM and LiteLLM Proxy applications with OpenTelemetry, export large language model (LLM) telemetry via OTLP, and send it into Cribl Stream. Once data is in Cribl Stream, you can route, mask, and enrich it before it reaches your observability backends.
You’ll complete the following high-level steps:
- Configure an OpenTelemetry (OTel) Source in Cribl Stream to receive OTLP data.
- Instrument your LiteLLM application (Python SDK or Proxy Server) with OpenTelemetry.
- Explore LLM telemetry use cases for Cribl Stream.
Telemetry Captured
LiteLLM emits trace spans (and optional metrics or events) with attributes such as:
| Category | Data | Example |
|---|---|---|
| Timing | Request and upstream LLM call duration. | 1.2s for a chat completion. |
| Model usage | Model ID, provider, token counts, and cost when available. | gpt-4o-mini, 150 input / 85 output tokens. |
| Proxy context | User, team, org, and key metadata on Proxy requests. | metadata.user_api_key_team_id. |
| Structure | Span hierarchy for Proxy routes, guardrails, and provider calls. | Received Proxy Server Request, raw_gen_ai_request. |
| Errors | HTTP status, provider errors, and proxy failures. | 429 Rate limit exceeded. |
| Content | Prompt and completion text. | (enabled by default in LiteLLM, unlike other providers.) |
Semantic conventions follow OpenTelemetry GenAI Semantic Conventions where applicable. Set OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental to opt in to the latest GenAI semantic conventions.
LiteLLM also emits several attribute families outside the standard GenAI spec. These are useful for Proxy-level visibility but may not be recognized by all OTel backends:
metadata.*: Proxy key, user, team, and org metadata (for examplemetadata.user_api_key_team_id).llm.*andlitellm.*: LiteLLM-specific request fields such asllm.is_streamingandlitellm.call_id.gen_ai.cost.*: LiteLLM cost breakdown attributes (for examplegen_ai.cost.total_cost).llm.{provider}.*: Raw provider request and response payload (default mode only; suppressed in semconv mode and when content capture is disabled).
Prerequisites
- A Cribl Stream instance (v4.x+) with an OpenTelemetry (OTEL) Source enabled.
- Python 3.9+.
- A LiteLLM installation or a running LiteLLM Proxy instance.
- Provider API keys for the models you call through LiteLLM.
Configure the OpenTelemetry (OTel) Source in Cribl Stream
Before instrumenting your LiteLLM app, configure Cribl Stream to receive OTLP data.
Configure an OTel Source
You do not need a separate OpenTelemetry Source for each LLM or agent provider. Configure one OTel Source in Cribl Stream and point all instrumented applications at the same endpoint. Per application, only the service name and provider API key typically differ. Use Routes and Pipelines in Cribl Stream to filter and process events by
service.name.
To receive OTLP from your LLM application, add or edit an OpenTelemetry Source on your Worker Group as follows.
On the top bar, select Products, and then select Cribl Stream. Under Worker Groups, select a Worker Group. Next, you have two options:
- To configure via QuickConnect, navigate to Routing > QuickConnect (Stream) or Collect (Edge). Select Add Source and select the Source you want from the list, choosing either Select Existing or Add New.
- To configure via the Routes, select Data > Sources (Stream) or More > Sources (Edge). Select the Source you want. Next, select Add Source.
In the New Source modal, configure the following under General Settings:
- Input ID: Unique ID for this Source. For example,
OTel042. - Description: Optionally, enter a description.
- OTLP version: The drop-down offers
0.10.0and1.3.1(default). - Protocol: Use the drop-down to choose the protocol matching the data you will ingest:
gRPC(default), orHTTP. - Address: Enter the hostname/IP to listen on. Defaults to
0.0.0.0(all addresses, IPv4 format). - Port: By default, OTel applications send output to port
4317when using the gRPC protocol, and port4318when using HTTP. This setting defaults to4317- you must change it if you set Protocol (below) toHTTP, or you want Cribl Stream to collect data from an OTel application that is using a different port.
Port
4318is not available on Cribl-managed Worker Groups in Cribl.Cloud.- The Extract spans, Extract metrics, and Extract logs settings are specific to the OpenTelemetry Source. By default, these options are toggled off, allowing Cribl Stream to act as a pass-through that generates a single event for each incoming OTel payload. This is useful when you want to forward complete OTel events to downstream systems, such as persistent storage, without breaking them apart. You can enable these settings to extract and process individual records from within OTel events:
- Extract spans: Generates an individual event for each span in a trace. Traces typically contain multiple spans.
- Extract metrics: Generates an individual event for each data point in a metric event. OTel metrics often contain multiple data points per event.
- Extract logs: Available only when OTLP version is set to
1.3.1. Generates an individual event for each log record. Cribl recommends enabling this option to simplify log transformation and manipulation.
- Tags: Optionally, add tags to help filter and group Sources within Cribl Stream’s UI. Tags are not included in the event data. Separate tag names using a tab or hard return.
- Input ID: Unique ID for this Source. For example,
Optionally, you can adjust the Authentication, TLS, Persistent Queue Settings, Processing, and Advanced settings, or Connected Destinations.
Select Save, then Commit & Deploy.
Instrument Your Application
Select Python SDK or Proxy Server from the tabs. Both paths use LiteLLM’s built-in OpenTelemetry callback to emit OTLP spans into the Source you configured earlier.
LiteLLM OpenTelemetry export is Python-only. Install the OpenTelemetry SDK packages alongside
litellm, then enable theotelcallback in code or in your Proxyconfig.yaml. See the LiteLLM OpenTelemetry documentation for the full configuration reference.
Use the LiteLLM Python SDK when your application calls litellm.completion, litellm.acompletion, or related helpers directly.
- Install LiteLLM and the OpenTelemetry SDK:
pip install litellm opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlpFor gRPC export to Cribl, also install grpcio:
pip install "litellm[grpc]"- Enable the OpenTelemetry callback before you make LiteLLM calls:
import litellm
litellm.callbacks = ["otel"]
response = litellm.completion(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)- Set environment variables and run your application:
python app.pyIn SDK-only use, LiteLLM emits a litellm_request root span when no parent trace context exists.
Use the LiteLLM Proxy when clients send OpenAI-compatible requests to a centralized gateway. This section covers the OTel v2 integration, which produces one clean trace per request and fully follows the OTel GenAI semantic conventions. To use the legacy v1 integration instead, see the LiteLLM OpenTelemetry documentation.
- Install LiteLLM with OpenTelemetry dependencies on the Proxy host:
pip install "litellm[proxy]" opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation-fastapiFor gRPC export, also install grpcio:
pip install "litellm[grpc]"- Add your models to your Proxy
config.yaml. No callbacks entry is needed – OTel v2 is activated entirely via theLITELLM_OTEL_V2environment variable:
model_list:
- model_name: gpt-4o-mini
litellm_params:
model: openai/gpt-4o-mini
api_key: os.environ/OPENAI_API_KEY- Set environment variables – including
LITELLM_OTEL_V2=true– and start the Proxy:
litellm --config config.yaml- Send a test request to an LLM route (for example
/v1/chat/completions) to generate spans.
Each Proxy request produces one trace with the full request lifecycle nested in a single tree:
POST /v1/chat/completions ← HTTP request span
├── auth /v1/chat/completions ← authentication and key lookup
├── execute_guardrail ← each guardrail that runs (if configured)
├── chat gpt-4o-mini ← LLM call with gen_ai.* attributes
└── batch_write_to_db ← spend and usage written to DBSet Environment Variables
Set these environment variables before running your instrumented application. Replace <cribl-host> with your Cribl host address, and <token> with your Bearer token if authentication is enabled on the OTel Source.
Use gRPC (port 4317)
Set environment variables using gRPC. This is the recommended method:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<cribl-host>:4317"
export OTEL_EXPORTER_OTLP_PROTOCOL="grpc"
export OTEL_SERVICE_NAME="my-litellm-app"
# Only if you enabled auth on the Cribl OTEL Source:
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"Use HTTP/protobuf (port 4318)
If your OTLP exporter or network path requires HTTP/protobuf instead of gRPC, use port 4318 and set the protocol as shown.
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<cribl-host>:4318"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_SERVICE_NAME="my-litellm-app"
# Only if you enabled auth on the Cribl OTEL Source:
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"Environment Variable Reference
Use this table to set OTLP export options, optional auth headers for the Cribl Source, and LiteLLM-specific toggles.
| Variable | Required | Description |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Yes | Cribl Stream OTEL Source URL (http://<cribl-host>:4317 for gRPC, :4318 for HTTP). LiteLLM also accepts the alias OTEL_ENDPOINT. |
OTEL_EXPORTER_OTLP_PROTOCOL | Yes | grpc or http/protobuf. LiteLLM also accepts the alias OTEL_EXPORTER (for example otlp_grpc or otlp_http). |
OTEL_SERVICE_NAME | Yes | Logical name for your application (appears in traces). Defaults to litellm if unset. |
OTEL_EXPORTER_OTLP_HEADERS | No | Auth header if Cribl Source requires it (e.g., Authorization=Bearer <token>). LiteLLM also accepts the alias OTEL_HEADERS. |
| Provider API keys | As needed | For example OPENAI_API_KEY or keys defined in your Proxy config.yaml. |
LITELLM_OTEL_V2 | Proxy only | Set to true to enable the OTel v2 integration for the Proxy. Has no effect on the Python SDK. |
OTEL_SEMCONV_STABILITY_OPT_IN | No | Python SDK only. Set to gen_ai_latest_experimental to emit the latest GenAI semantic conventions. Proxy v2 follows GenAI semconv natively and does not require this flag. |
USE_OTEL_LITELLM_REQUEST_SPAN | No | Python SDK and Proxy v1 only. Set to true to emit a nested litellm_request span per LLM call. Not applicable to Proxy v2. |
LITELLM_OTEL_INTEGRATION_ENABLE_METRICS | No | Set to true to export GenAI client metrics (token usage, cost, latency). |
Capture Prompt/Completion Content
Content capture behavior differs between the Python SDK and the Proxy:
- Python SDK: Content is captured by default. To disable it:
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT="NO_CONTENT"You can also set litellm.turn_off_message_logging=True in code to suppress content globally.
- Proxy v2: Content is not captured by default. To enable it:
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT="span_only"Other accepted values are event_only and span_and_event.
When content capture is enabled for the Proxy, use Cribl Stream’s masking and redaction functions to sanitize data before routing to downstream destinations.
Verify Data Flow in Cribl Stream
After completing the instrumentation process, confirm OTLP events flow from your instrumented app into Cribl Stream.
- In Cribl Stream, go to Monitoring > Sources and select your OTel Source.
- Open the Live Data tab.
- Select Start Capture.
- Trigger a request in your LiteLLM application or Proxy.
- Confirm that events appear in Live Data for your OTel Source.
Route Data to Cribl Search
After LiteLLM OTLP data reaches Cribl Stream, add a Cribl Search Destination so you can explore and investigate LLM telemetry to troubleshoot issues, analyze model behavior, and monitor performance. See the Cribl Search Destination guide for setup instructions.
Common Stream Issues and Fixes
If spans are missing or the exporter cannot reach Cribl Stream, use this table to narrow down endpoint, authentication, TLS, library versions, and how instrumentation is loaded.
| Symptom | Cause | Fix |
|---|---|---|
| No data in Cribl Stream. | Wrong endpoint or port. | Verify OTEL_EXPORTER_OTLP_ENDPOINT matches the Cribl OTEL Source address and port. |
| Connection refused. | Source not running or firewall blocking. | Ensure the OTEL Source is enabled and the port is open. |
| 401 Unauthorized. | Auth mismatch. | Check OTEL_EXPORTER_OTLP_HEADERS matches the auth config on the Cribl Source. |
| No spans from LiteLLM (Python SDK). | otel callback not enabled. | Set litellm.callbacks = ["otel"] in code. |
| No traces from Proxy v2. | LITELLM_OTEL_V2 not set, or FastAPI instrumentation package missing. | Confirm LITELLM_OTEL_V2=true is set in the Proxy environment. Verify opentelemetry-instrumentation-fastapi is installed. Try OTEL_EXPORTER=console first to confirm spans are emitted before troubleshooting the endpoint. |
| Only infrastructure spans (auth, postgres, redis). | Request hit a management route, not an LLM route. | Send traffic to /v1/chat/completions or another LLM endpoint. Management routes such as /key/info and /user/info do not produce LLM spans. |
| Connection or export errors. | Protocol mismatch or missing gRPC dependency. | Match gRPC (4317) vs HTTP/protobuf (4318) to your Cribl Source. For gRPC, install grpcio (pip install "litellm[grpc]"). Set OTEL_DEBUG=true to surface exporter errors. |
| 401 from a model provider. | Invalid or missing API key. | Set the correct provider environment variables or Proxy model credentials. |
| TLS errors. | TLS mismatch. | Use https:// in the endpoint if TLS is enabled on the Source, or disable TLS on the Source for local testing. |
LLM Telemetry Use Cases
With data flowing into Cribl Stream, you can route LiteLLM telemetry to any supported Destination. For example:
- Cribl Search: Search and analyze full-fidelity LLM traces and logs interactively.
- Cribl Lake: Store and search traces natively with partitioning optimized for Cribl Search, so you can query LiteLLM traces at scale without re-ingesting them into a separate system.
- Amazon S3 or other object storage: Archive traces for compliance or long-term analysis using partitioning schemes aligned with Cribl Search, so you can query data in place without moving it.
- OpenTelemetry: Forward LLM traces in standard OTLP format to downstream systems.
To set up routing:
- Add Routes in Routing > Data Routes to match OTel data and direct it to your chosen Destinations.
- Go to Processing > Pipelines and create a Pipeline to process data flowing down your Route.
- Use Functions to enrich, filter, sample, or redact data before delivery. For example:
- Mask prompt/completion content containing sensitive information.
- Sample high-volume traces to reduce cost.
- Aggregate token usage metrics by model or service.
For more detailed LLM telemetry use cases, see LLM Telemetry Use Cases in Cribl.