docs: replace removed v2 langfuse_context with v3 get_client() in empty-trace FAQ#3094
Open
i-anubhav-anand wants to merge 1 commit into
Open
Conversation
|
@i-anubhav-anand is attempting to deploy a commit to the langfuse Team on Vercel. A member of the Team first needs to authorize it. |
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.
What does this PR do?
The "Empty trace input and output" FAQ page mixes SDK versions. The first Python tab correctly uses the v3+ API:
…but the
@observe()decorator example just below it still uses the removed v2 API:langfuse_contextis not importable from thelangfusepackage in v3/v4 (in v2 it lived underlangfuse.decorators, never top-level), so copying this snippet raisesImportError. This PR aligns it with the v3+ pattern already used elsewhere on the same page:Type of change
Checklist
Greptile Summary
This PR fixes a single MDX documentation file where the
@observe()decorator example incorrectly imported and called the removed v2langfuse_contextAPI instead of the v3+get_client()pattern already used everywhere else on the same page.from langfuse import observe, langfuse_context→from langfuse import observe, get_clientto match the v3 import convention used in the surrounding snippets.langfuse_context.flush()→get_client().flush(), making the flush call consistent with the standalone (non-decorator) Python example directly above it.Confidence Score: 5/5
Single-line docs-only change that removes a broken import/call and replaces it with the correct v3 pattern already used on the same page.
The change is minimal and targeted — two lines in one MDX file. The replacement get_client().flush() is the canonical v3 flush pattern and is used correctly outside any function (after main() returns), matching the singleton-client pattern already demonstrated in the snippet directly above it. No logic, config, or runtime code is touched.
No files require special attention.
Sequence Diagram
sequenceDiagram participant User as User Script participant Observe as @observe() decorator participant Client as get_client() participant Queue as Background Queue participant API as Langfuse API User->>Observe: main() Observe->>Queue: enqueue span/trace data Observe-->>User: return User->>Client: get_client().flush() Client->>Queue: drain all pending events Queue->>API: POST /ingestion (batch) API-->>Queue: 200 OK Client-->>User: flush completeReviews (1): Last reviewed commit: "docs: replace removed v2 langfuse_contex..." | Re-trigger Greptile