Repository navigation
feat(langfuse): accept OTLP trace exports for the Langfuse v4 callback - #5
Merged
shin-berri merged 1 commit intoSep 26, 2026
Merged
Conversation
… can find v4 traces
LiteLLM's Langfuse integration now exports spans over OTLP to
/api/public/otel/v1/traces instead of the JSON ingestion route, so the mock
answered 404 and /langfuse/trace/{id} never saw the response id. The new
route parses the protobuf export and records the
langfuse.observation.metadata.response_id attribute into the same set the
lookup route reads.
This was referenced Sep 26, 2026
shin-berri
approved these changes
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
test_e2e_langfuse_callbacks_in_dbin litellm has been red on every CircleCI run sinceHow it solves it:
POST /api/public/otel/v1/tracesparses the OTLP protobuf exportlangfuse.observation.metadata.response_idinto the set/langfuse/trace/{id}already readsopentelemetry-proto==1.33.1, which supports the Dockerfile's Python 3.9Screenshots / Proof of Fix
Shared setup: this mock on 127.0.0.1:18090 (Python 3.9 venv from requirements.txt), and a litellm proxy from BerriAI/litellm main (1a58162630) on 127.0.0.1:14100 with one model
fake-gptpointed at the mock andsuccess_callback: ["langfuse"],LANGFUSE_HOST=http://127.0.0.1:18090Before (ab53af6)
curl -s http://127.0.0.1:14100/v1/chat/completions -H "Authorization: Bearer sk-1234" -d '{"model":"fake-gpt","messages":[{"role":"user","content":"hi"}]}'returns idchatcmpl-83c4c6cb255b4dab8c0f3b96959596e0POST /api/public/otel/v1/traces HTTP/1.1" 404 Not Found, and the proxy logsLangfuse rejected an export ... with HTTP 404curl -s http://127.0.0.1:18090/langfuse/trace/chatcmpl-83c4c6cb255b4dab8c0f3b96959596e0returns{"exists":false,...}, the same failure CircleCI showsAfter (f6d4d0c)
chatcmpl-74a6c7ce65494a9c9cb50a5f063e8e85Stored OTLP response IDs (total: 1): {'chatcmpl-74a6c7ce65494a9c9cb50a5f063e8e85'}thenPOST /api/public/otel/v1/traces HTTP/1.1" 200 OKcurl -s http://127.0.0.1:18090/langfuse/trace/chatcmpl-74a6c7ce65494a9c9cb50a5f063e8e85returns{"exists":true,...}curl -s http://127.0.0.1:18090/langfuse/trace/chatcmpl-never-sentstill returns{"exists":false,...}/api/public/otel/v1/tracesreturns 400Caveats (if any)
Medium