Skip to content

fix(otel): restore error.* span attributes on v2 error spans (LIT-4179) - #32524

Merged
yucheng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_lit4179_otel_v2_error_details
Jul 8, 2026
Merged

yucheng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_lit4179_otel_v2_error_details

Conversation

@yucheng-berri

@yucheng-berri yucheng-berri commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Relevant issues

Linear ticket

Resolves LIT-4179

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Captured on macOS with a Jaeger v2.19.0 all-in-one binary receiving OTLP/HTTP on :4318 from a local litellm proxy running against a config that points gpt-4o at the IANA discard port so every completion fails with a real Connection error. Same request body in both runs, same Jaeger backend, same trace ID space; only the litellm binary differs.

Reproduction commands

# start Jaeger v2 (OTLP :4318, UI :16686), verify the release sha256sum
# sidecar before extracting:
curl -fSL -o jaeger.tar.gz \
  https://github.com/jaegertracing/jaeger/releases/download/v2.19.0/jaeger-2.19.0-darwin-arm64.tar.gz
curl -fSL -o jaeger.sha256sum.txt \
  https://github.com/jaegertracing/jaeger/releases/download/v2.19.0/jaeger-2.19.0-darwin-arm64.sha256sum.txt
shasum -a 256 -c jaeger.sha256sum.txt
tar -xzf jaeger.tar.gz
./jaeger-2.19.0-darwin-arm64/jaeger > /tmp/jaeger.log 2>&1 &

# proxy_config.yaml pins the model to the IANA discard port so completions
# fail with a real Connection error:
cat > /tmp/lit4179_config.yaml <<'YAML'
model_list:
  - model_name: gpt-4o
    litellm_params:
      model: openai/gpt-4o
      api_key: sk-lit4179-bogus-key
      api_base: http://127.0.0.1:9/lit4179
litellm_settings:
  callbacks: ["otel"]
general_settings:
  master_key: sk-lit4179-master
YAML

# launch the proxy with v2 on:
unset DATABASE_URL
export LITELLM_OTEL_V2=true \
  OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
  OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 \
  OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:4318/v1/traces \
  OTEL_BSP_SCHEDULE_DELAY=500
litellm --config /tmp/lit4179_config.yaml --port 4000 --num_workers 1 &

# the failing request under test:
curl -s -X POST http://127.0.0.1:4000/chat/completions \
  -H 'Authorization: Bearer sk-lit4179-master' \
  -H 'Content-Type: application/json' \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"verify LIT-4179 fix in Jaeger"}]}'

# response body (both runs, identical):
# {"error":{"message":"litellm.InternalServerError: InternalServerError:
#  OpenAIException - Connection error.. Received Model Group=gpt-4o\n
#  Available Model Group Fallbacks=None","type":null,"param":null,"code":"500"}}

# open http://localhost:16686 -> service=litellm -> the "chat gpt-4o" span

Before, unfixed baseline commit db2402754a

image

Tags on the chat gpt-4o span carry error.type alone. The four other error.* fields never land on the span. Elastic APM's default APM ingest reads span attributes into labels.*, so on the customer's Kibana view labels.error_message / labels.error_code / labels.error_stack_trace / labels.error_llm_provider all render empty. Logs (1) still contains the exception event with exception.message (from PR #30380 / LIT-3758), so backends that consume the OTel exception event field continue to see the full untruncated message; Elastic's default ingest does not surface that on labels.*.

After, this branch
image

Same request, same Jaeger instance:

Tags now carry the full v1-shape error detail set: error.code = 500, error.llm_provider = openai, error.message = litellm.InternalServerError: ..., error.stack_trace = File "/Users/.../litellm/utils.py", line 1689, in wrapper_async ... with the full traceback preserved, error.type = InternalServerError. Logs (1) still shows the exception event with exception.message intact so PR #30380's Elasticsearch truncation fix stays in place.

Elastic APM's ingest maps recognized error.* attributes to labels.error_* by default, so downstream Kibana labels.error_message etc. panels populate as they did on v1.89.

Type

🐛 Bug Fix

Changes

Root cause

The v2 emitter (litellm/integrations/otel/emitter.py:SpanEmitter.finish_span) stamps only error.type as a span attribute; the message rides the span-status description plus, since PR #30380, a semconv-standard exception event under exception.message. The v1 integration (litellm/integrations/opentelemetry.py:_record_exception_on_span) stamps five span attributes (error.type, error.message, error.code, error.stack_trace, error.llm_provider). When v2 became the active integration on v1.90+ for otel_v2-flagged deployments, downstream backends that flatten span attributes into label indexes (Elastic APM labels.error_*, Datadog span tags) lost the four detail fields; v2 was never taught to stamp them.

The v2 emitter was born without these fields (commit d82eb33a60, "typed semconv-aligned OpenTelemetry instrumentation"); PR #30380 added the exception event, not the missing attributes. The regression surfaces on v1.90 because that is the release where v2 fully replaced v1 for otel_v2-flagged customers.

Fix

Additive; v2 now stamps the same four detail attributes as v1, with keys byte-for-byte matching litellm/integrations/_types/open_inference.py:ErrorAttributes so consumers do not care which integration produced the span. The exception event is preserved so PR #30380's Elasticsearch keyword-truncation fix stays in force; the message now lives in both places.

Attribute keys are split across two semconv classes so a reader can tell OTel-defined keys apart from litellm's namespace-extension keys at a glance:

  • class Error in semconv.py holds only the OTel-registry-defined keys — error.type (Stable) and error.message (Deprecated but still defined; kept for byte-for-byte parity with v1).
  • class LiteLLMError holds error.code, error.stack_trace, error.llm_provider. None of these three appears in the OTel error.* registry; per semconv extension rules a namespace may carry additional vendor keys as long as no defined name collides. The test_attribute_keys_are_unique_across_namespaces sources-of-truth test enforces the no-collision invariant across all attribute classes.

The wire is byte-for-byte unchanged from v1: all five keys still emit under the error.* namespace, so consumer dashboards continue to render labels.error_* without changes.

Files touched:

litellm/integrations/otel/model/payloads.py: SpanError grows three optional fields (code, stack_trace, llm_provider); _parse_error threads them from the payload's error_information block.

litellm/integrations/otel/model/semconv.py: Error grows a MESSAGE constant for the OTel-registry key; new LiteLLMError class carries the three litellm-namespaced extension keys with their rationale in the docstring.

litellm/integrations/otel/emitter.py: two module-level helpers, _stamp_otel_error_attributes (stamps Error.TYPE + Error.MESSAGE) and _stamp_litellm_error_attributes (stamps the three LiteLLMError.* keys, guarded per field so guardrail-shape errors that only carry a message are not polluted with empty-string attributes). Called in that order from finish_span's existing error branch.

litellm/integrations/otel/__init__.py: re-exports LiteLLMError alongside Error on the package surface.

Regression tests

Extended the mapped test files under tests/test_litellm/integrations/otel/:

test_otel_v2_components.py: test_error_details_stamped_as_span_attributes_for_labels_ingest pins the LIT-4179 regression against future drift, asserting both Error.* and LiteLLMError.* keys land on the span; test_error_details_omitted_when_span_error_carries_only_message locks the per-field guard on LiteLLMError.*; test_v2_error_attribute_keys_match_v1_error_attributes_byte_for_byte locks the vocabulary across both classes against v1; test_error_message_falls_back_to_error_type_when_message_absent pins the three-surface consistency invariant. The pre-existing test_error_message_recorded_as_full_exception_event_untruncated continues to cover the exception-event path.

test_otel_v2_sources_of_truth.py: test_llm_call_adapter_carries_error_detail_fields and test_llm_call_adapter_error_details_default_to_none_when_absent cover the payload-to-SpanError plumbing; test_attribute_keys_are_unique_across_namespaces now sweeps LiteLLMError so a future rename cannot silently collide with Error.

python -m pytest tests/test_litellm/integrations/otel/ -q reports 243 passed.

Blast radius

Every v2 failure span funnels through SpanEmitter.finish_span, so the fix covers LLM_CALL, GUARDRAIL, SERVICE, DB_CALL, MCP_TOOL_CALL, and MCP_LIST_TOOLS in one shot. No behavior change to success spans (the emitter's error branch is gated on error and (error.error_type or error.message)), no removals, no renames, no changes to v1.

Backward compatibility

Additive-only. SpanError's three new fields are optional with None defaults, so every existing SpanError(...) call site keeps compiling untouched. The new semconv constants have values byte-identical to v1's ErrorAttributes, so any consumer already reading labels.error_* from v1 spans reads the same key from v2 spans. The exception event, error.type attribute, and span-status description continue to emit exactly as before


Note

Low Risk
Additive observability-only changes on the existing v2 error path; success spans and v1 integration are untouched, with regression tests for key parity and optional fields.

Overview
Restores v1-parity error detail on OpenTelemetry v2 failure spans so observability backends that index span attributes (Elastic labels.error_*, Datadog tags) see the full error shape again, not only error.type.

SpanError and _parse_error now carry optional code, stack_trace, and llm_provider from error_information. SpanEmitter.finish_span stamps error.message plus those fields via Error / LiteLLMError helpers (detail keys only when set). The existing exception event and ERROR status behavior are unchanged.

Tests lock attribute keys against v1 ErrorAttributes, label-ingest behavior, message-only guardrail errors, and payload plumbing.

Reviewed by Cursor Bugbot for commit 5c21928. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Restores the four missing error.* span attributes (error.message, error.code, error.stack_trace, error.llm_provider) on v2 error spans so backends that flatten span attributes into label indexes (Elastic APM labels.*, Datadog span tags) see the same detail set they received from the v1 integration.

  • SpanError dataclass gains three optional fields (code, stack_trace, llm_provider); _parse_error threads them from error_information using the existing as_str coercion helpers.
  • semconv.py adds Error.MESSAGE (OTel-registry-defined, deprecated but still stamped for v1 parity) and a new LiteLLMError class holding the three litellm-namespaced extension keys; a uniqueness test prevents future naming collisions between the two classes.
  • emitter.finish_span now calls two helpers (_stamp_otel_error_attributes, _stamp_litellm_error_attributes) instead of the single span.set_attribute(Error.TYPE, ...) call; the exception event and span-status description continue to emit exactly as before, preserving the Elasticsearch truncation fix from PR fix(otel): record full error message on standard exception event in otel v2 #30380.

Confidence Score: 5/5

Additive-only change; all new SpanError fields default to None, the emitter's success path is untouched, and the exception event continues to emit unchanged.

Every modified call site is inside the existing error branch of finish_span. The three new SpanError fields are Optional with None defaults, so no existing SpanError construction site is broken. The _stamp_litellm_error_attributes helper guards each attribute behind a truthiness check, so guardrail-shape errors that carry only a message produce no spurious empty-string attributes. All assertions in the touched existing test remain identical.

No files require special attention.

Important Files Changed

Filename Overview
litellm/integrations/otel/emitter.py Adds two module-level helpers (_stamp_otel_error_attributes, _stamp_litellm_error_attributes) and calls them in finish_span's error branch; no logic change to success paths.
litellm/integrations/otel/model/payloads.py SpanError gains three optional fields (code, stack_trace, llm_provider); _parse_error threads them from error_information with None-safe as_str coercions.
litellm/integrations/otel/model/semconv.py Error class gains MESSAGE constant; new LiteLLMError class adds CODE, STACK_TRACE, LLM_PROVIDER under the error.* namespace for v1 byte-for-byte parity.
litellm/integrations/otel/init.py Re-exports LiteLLMError on the package surface alongside Error.
tests/test_litellm/integrations/otel/test_otel_v2_components.py Four new regression tests added; existing test_error_message_recorded_as_full_exception_event_untruncated has only its docstring and comment text updated — all assertions remain identical, no coverage weakened.
tests/test_litellm/integrations/otel/test_otel_v2_sources_of_truth.py Two new payload-level tests for _parse_error detail threading; uniqueness sweep extended to include LiteLLMError.

Reviews (2): Last reviewed commit: "fix(otel): restore error.* span attribut..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7e12b0027d81ef0f79ec41c3d52a700d5386d857. Configure here.

@codspeed

codspeed Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 30 untouched benchmarks


Comparing litellm_lit4179_otel_v2_error_details (5c21928) with litellm_internal_staging (9b7e6fb)

Open in CodSpeed

@yucheng-berri
yucheng-berri force-pushed the litellm_lit4179_otel_v2_error_details branch 2 times, most recently from 5d1c3b1 to 29f263a Compare July 8, 2026 18:58
The v2 emitter has never stamped error.message / error.code /
error.stack_trace / error.llm_provider as span attributes; only error.type
reached the wire. Backends that flatten span attributes into label
indexes (Elastic APM labels.error_*, Datadog span tags) lost these
four fields when v2 became the active integration on v1.90+ for
otel_v2-flagged deployments. The pre-existing exception span event
carrying the full message (LIT-3758) is unchanged; the message now
rides both places at once, matching v1s shape.

SpanError grows three optional detail fields; _parse_error threads
them from StandardLoggingPayloadErrorInformation; the emitters error
branch stamps them via a new module-level helper, guarded per field so
guardrail-shape errors are not polluted with empty attributes. New
semconv constants mirror open_inference.ErrorAttributes byte-for-byte,
so v1 and v2 consumers read the same keys.

Regression tests extend the mapped test files under
tests/test_litellm/integrations/otel/. pytest reports 243 passed.
@yucheng-berri
yucheng-berri force-pushed the litellm_lit4179_otel_v2_error_details branch from 29f263a to 5c21928 Compare July 8, 2026 20:20
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5c21928. Configure here.

@yucheng-berri
yucheng-berri merged commit 85d1fe6 into litellm_internal_staging Jul 8, 2026
81 checks passed
@yucheng-berri
yucheng-berri deleted the litellm_lit4179_otel_v2_error_details branch July 8, 2026 20:44
yuneng-berri added a commit that referenced this pull request Jul 8, 2026
chore(release): backport #32256, #32405, #32524 to stable/1.91.x and cut 1.91.1
yuneng-berri added a commit that referenced this pull request Jul 8, 2026
eleboucher pushed a commit to eleboucher/homelab that referenced this pull request Jul 9, 2026
….1) (#1475)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.91.0` → `v1.91.1` |

---

### Release Notes

<details>
<summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary>

### [`v1.91.1`](https://github.com/BerriAI/litellm/releases/tag/v1.91.1)

[Compare Source](BerriAI/litellm@v1.91.1...v1.91.1)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.91.1/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;32256](BerriAI/litellm#32256), [#&#8203;32405](BerriAI/litellm#32405), [#&#8203;32524](BerriAI/litellm#32524) to stable/1.91.x and cut 1.91.1 by [@&#8203;yuneng-berri](https://github.com/yuneng-berri) in [#&#8203;32552](BerriAI/litellm#32552)

**Full Changelog**: <BerriAI/litellm@v1.91.0...v1.91.1>

### [`v1.91.1`](https://github.com/BerriAI/litellm/releases/tag/v1.91.1)

[Compare Source](BerriAI/litellm@v1.91.0...v1.91.1)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.91.1/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;32256](BerriAI/litellm#32256), [#&#8203;32405](BerriAI/litellm#32405), [#&#8203;32524](BerriAI/litellm#32524) to stable/1.91.x and cut 1.91.1 by [@&#8203;yuneng-berri](https://github.com/yuneng-berri) in [#&#8203;32552](BerriAI/litellm#32552)

**Full Changelog**: <BerriAI/litellm@v1.91.0...v1.91.1>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/1475
doonga pushed a commit to greyrock-labs/home-ops that referenced this pull request Jul 9, 2026
….1) (#488)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.91.0` → `v1.91.1` |

---

### Release Notes

<details>
<summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary>

### [`v1.91.1`](https://github.com/BerriAI/litellm/releases/tag/v1.91.1)

[Compare Source](BerriAI/litellm@v1.91.1...v1.91.1)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.91.1/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;32256](BerriAI/litellm#32256), [#&#8203;32405](BerriAI/litellm#32405), [#&#8203;32524](BerriAI/litellm#32524) to stable/1.91.x and cut 1.91.1 by [@&#8203;yuneng-berri](https://github.com/yuneng-berri) in [#&#8203;32552](BerriAI/litellm#32552)

**Full Changelog**: <BerriAI/litellm@v1.91.0...v1.91.1>

### [`v1.91.1`](https://github.com/BerriAI/litellm/releases/tag/v1.91.1)

[Compare Source](BerriAI/litellm@v1.91.0...v1.91.1)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.91.1/cosign.pub \
  ghcr.io/berriai/litellm:v1.91.1
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;32256](BerriAI/litellm#32256), [#&#8203;32405](BerriAI/litellm#32405), [#&#8203;32524](BerriAI/litellm#32524) to stable/1.91.x and cut 1.91.1 by [@&#8203;yuneng-berri](https://github.com/yuneng-berri) in [#&#8203;32552](BerriAI/litellm#32552)

**Full Changelog**: <BerriAI/litellm@v1.91.0...v1.91.1>

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTIuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI1Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.greyrock.io/greyrock-labs/home-ops/pulls/488
stvnksslr pushed a commit to stvnksslr/litellm that referenced this pull request Jul 14, 2026
…9) (BerriAI#32524)

The v2 emitter has never stamped error.message / error.code /
error.stack_trace / error.llm_provider as span attributes; only error.type
reached the wire. Backends that flatten span attributes into label
indexes (Elastic APM labels.error_*, Datadog span tags) lost these
four fields when v2 became the active integration on v1.90+ for
otel_v2-flagged deployments. The pre-existing exception span event
carrying the full message (LIT-3758) is unchanged; the message now
rides both places at once, matching v1s shape.

SpanError grows three optional detail fields; _parse_error threads
them from StandardLoggingPayloadErrorInformation; the emitters error
branch stamps them via a new module-level helper, guarded per field so
guardrail-shape errors are not polluted with empty attributes. New
semconv constants mirror open_inference.ErrorAttributes byte-for-byte,
so v1 and v2 consumers read the same keys.

Regression tests extend the mapped test files under
tests/test_litellm/integrations/otel/. pytest reports 243 passed.

(cherry picked from commit 85d1fe6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants