[pull] main from apache:main#188
Merged
Merged
Conversation
* feat: add Langfuse integration (LangfuseBridge) (#206) Implements all features scoped in #206 via lifecycle hooks, built on OpenTelemetryBridge and the OTel-native Langfuse SDK: - One trace per application execution call (via the #203 interface) - One span per step; one span per __tracer span call - State observations: action inputs/read state and results/written state as observation input/output (capture_state=False to disable); log_attributes as observation metadata - Access to the Langfuse client via bridge.langfuse_client - app_id/partition_key map to Langfuse session/user (overridable) - Injects a should_export_span filter so Burr spans survive langfuse v4's default LLM-only export filtering (public: burr_span_export_filter) Uses the OTel bridge instead of the tracking/client.py pattern per the issue thread (May 31): the SDK's OTel rewrite and the closure of #205 made this the cleaner path, and it nests third-party OTel LLM instrumentation inside step spans automatically. Includes tests, docs, a runnable example, and a langfuse pyproject extra. * fix: JSON-serialize complex logged attributes for Langfuse metadata OTel attributes reject sequences of non-primitives, so list-of-dict values (e.g. chat_history logged by @trace) were dropped with a warning. Complex values are now JSON-serialized into observation metadata. * fix(langfuse): preserve OTel provider context Route Burr spans through custom tracer providers and propagate session and user attributes to child instrumentation. Serialize mixed-type sequences before passing them to OpenTelemetry. * fix: import propagate_attributes defensively for langfuse<3.9 Propagate_attributes was added in langfuse 3.9.0 and Python 3.9 CI resolves an older 3.x (v4 requires py3.10+), so the unconditional import failed and was masked as 'plugin missing'. Falls back to per-span session/user attributes on older SDKs, with a regression test. * fix(langfuse): support v3 attribute API Langfuse 3.7 is the latest SDK available on Python 3.9 and does not export propagate_attributes. Fall back to per-span legacy attributes. --------- Co-authored-by: jernejfrank <jernej@safeintelligence.ai>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )