8 views
-/https://github.com/berriai/litellm/issues/32996
GitHub ยท issue

#32996 [Bug] OTEL content events (enable_events) silently dropped: OTLP exporter raises "Invalid type NoneType" on None in log records

  • State: open
  • Author: @abrekhov

### What happened?

With the `otel` logging integration and semantic content events enabled (`OpenTelemetryConfig.enable_events` / `LITELLM_OTEL_INTEGRATION_ENABLE_EVENTS=true`), `OpenTelemetry._emit_semantic_logs` emits `gen_ai.content.prompt` / `gen_ai.content.completion` log records whose **attributes and body contain `None`**:

- `attrs["finish_reason"] = choice.get("finish_reason")` โ†’ `None` for streaming/partial choices - `attrs["gen_ai.system"]` โ†’ `None` when `custom_llm_provider` is unresolved - `body = msg.copy()` โ†’ raw message fields such as `content` / `tool_calls` are frequently `None`

OTLP `AnyValue` has no representation for `None`, so when the OTLP logs exporter encodes the record it raises and `BatchLogRecordProcessor` drops the **entire batch** โ€” the content events are silently lost and the log fills with tracebacks.

### Traceback

``` Exception while exporting logs. .../opentelemetry/sdk/_logs/_internal/export/__init__.py in _export_batch .../opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py in export .../opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py in encode_logs .../opentelemetry/exporter/otlp/proto/common/โ€ฆ

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 ยท 31d18h7m38s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #2728
Fixing the telemetry issue requires tracing exporter behavior, normalizing nullable structured data without breaking semantic conventions, and adding regression coverage across streaming and provider variants. The model-price request is a narrowly scoped dual-file metadata update with limited implementation risk.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search