Upgrade Langfuse tracing integration to Python SDK v4
Author: hassiebpCreated Jul 15, 2026Updated Sep 29, 2026
LabelsStale
Hi Onyx team — I'm Hassieb from the Langfuse team.
Langfuse Cloud's Fast Preview is observations-first. For real-time data in the new UI, Python integrations should use SDK v4.7.0+.
I reviewed backend/onyx/tracing/langfuse_tracing_processor.py. The migration is fairly contained, with one important threading nuance:
- Move the exact
langfuse==3.10.0pin tolangfuse>=4.7,<5and regenerate the hash-locked requirements. - Remove the root observation's
.update_trace(...)call and usepropagate_attributes()for trace name, user, session, and metadata. - Onyx creates children across threads with explicit trace context, so apply those propagated attributes on each child-creation path rather than relying only on ambient context.
- Preserve the existing root input/output, generation usage/cost, masking, and parent-ID behavior.
- Add a regression test covering parallel/threaded children and confirming user/session fields appear on each observation.
The relevant guide is Python SDK v3→v4.
If you need support with the migration, we're happy to jump on a call or help review a PR.
Source: onyx-dot-app/onyx