Skip to content

Conversation

@alexkuzmik
Copy link

@alexkuzmik alexkuzmik commented Oct 13, 2025

Fixed bug when OpikLogger didn't attach new spans to existing traces

Relevant issues

BerriAI#14282

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • * My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

* - there are some failures, but they don't seem related.
image

Type

🐛 Bug Fix
🧹 Refactoring
✅ Test

Changes

There was a regression introduced in this PR. OpikLogger began ignoring cases where existing trace IDs are passed as part of Opik metadata, causing it always to create new traces, even when it should have attached the span to an existing one.

Tests pass (including the new one):
image

Additionally, the OpikLogger has been significantly refactored to improve its maintainability.

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