9 views
-/https://github.com/berriai/litellm/issues/24516
GitHub · issue

#24516 Bug: OpenTelemetry callback crashes on Usage AI chat due to non-dict `response_obj`

  • State: open
  • Author: @metalshanked
  • Labels: stale

### Summary When using the Usage dashboard AI chat feature with OpenTelemetry enabled, the request may complete but the OpenTelemetry success logging path crashes afterward.

The OpenTelemetry integration appears to assume `response_obj` is always a dict-like object and calls `.get(...)` on it. In this flow, `response_obj` can be a `list`, which causes the logging callback to fail.

There is also a secondary issue where `gen_ai.system` is sometimes set to `None`, which OpenTelemetry rejects because attributes must be a supported primitive type.

### Expected behavior OpenTelemetry logging should not crash regardless of the shape of `response_obj`.

If `response_obj` is not dict-like, the callback should safely skip dict-specific fields or normalize the value before logging.

### Actual behavior The OpenTelemetry callback throws errors such as:

```text AttributeError: 'list' object has no attribute 'get' ```

and:

```text Invalid type NoneType for attribute 'gen_ai.system' value ```

### Example errors ```text OpenTelemetry logging error in set_attributes 'list' object has no attribute 'get' ```

```text AttributeError: 'list' object has no attribute 'get' ```

```text Invalid typ…

GitHub resolver

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

Refresh page
vote history (8 events)
#0 of 0 · 31d19h13m14s ago — entered · #import:https:::github.com:berriai:litellm post #1641
The first requires tracing a runtime callback across varied response types, preserving telemetry semantics, handling invalid attributes safely, and adding regression coverage. The second is a comparatively localized Helm template change with focused conditional rendering and chart validation.
The right issue is harder because it spans an observability callback, heterogeneous runtime values, and attribute-validation behavior, requiring broader compatibility checks and regression coverage. The left issue is comparatively localized to parameter translation and input handling in one provider path.
#26233 is harder because it involves cache configuration precedence, initialization behavior, and distributed spend-accounting correctness across deployment modes, requiring broader regression testing. #24516 is comparatively localized to defensive handling and validation in an observability callback.
The right issue is harder because it involves defensive handling across an observability callback, compatibility with multiple response shapes, validation of attribute types, and regression testing across integration paths. The left issue appears localized to parameter propagation at a single health-check call site.
29756 has broader cross-path normalization work and requires careful compatibility testing across tracing representations; 24516 is comparatively localized defensive handling with limited regression surface.
The right-hand task carries more engineering risk because it requires debugging runtime behavior across callback paths, enforcing telemetry-safe data handling, and adding regression coverage; the left-hand task is a localized configuration update with limited code impact.
33681 requires provider-specific multimodal embedding translation, usage accounting across modalities, compatibility with existing per-input semantics, and likely tests/docs across response paths. 24516 is a localized observability hardening change involving type checks and attribute validation. Therefore 33681 carries substantially greater integration and regression risk.
#0 of 0 · 31d17h43m47s ago — current · #import:https:::github.com:berriai:litellm post #3132
The left task has broader cross-cutting scope, involving data validation, temporal edge cases, authorization enforcement, backward compatibility, and extensive testing. The right task is comparatively localized to defensive telemetry handling and attribute validation.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search