-
Notifications
You must be signed in to change notification settings - Fork 76
feat!: prepare v5 release #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hassiebp
wants to merge
8
commits into
main
Choose a base branch
from
prepare-v5-release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1,285
−1,134
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, no comments
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.
Important
This PR introduces breaking changes for v5, refactoring trace-level attribute handling in the Langfuse SDK to improve OpenTelemetry context propagation.
updateTrace()from observation objects, replaced withpropagateAttributes().updateActiveTrace()tosetActiveTraceIO()and deprecated it.publishActiveTrace()to make traces public.startObservationtostartActiveObservationinCallbackHandler.tswithendOnExit: false.propagateAttributes()before creating observations.setTraceIO()andsetActiveTraceIO()for legacy evaluators.LangfuseTraceIOAttributestype for input/output only.This description was created by
for 7c61576. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Overview
Greptile Summary
This PR introduces breaking changes for v5 by refactoring how trace-level attributes are set in the Langfuse SDK.
Key Changes:
Breaking API Changes:
updateTrace()method from observation objects - replaced withpropagateAttributes()function that must be called before creating observationsupdateActiveTrace()tosetActiveTraceIO()and deprecated it (now only handles input/output for legacy platform features)publishActiveTrace()function to make traces public (replacesupdateTrace({public: true}))startObservationtostartActiveObservationinCallbackHandler.tswithendOnExit: falseoptionNew API Pattern:
propagateAttributes()before creating observationsBackward Compatibility:
setTraceIO()andsetActiveTraceIO()methods for legacy LLM-as-a-judge evaluators that rely on trace-level I/OLangfuseTraceIOAttributestype (restricted to input/output only)Testing:
Confidence Score: 4/5
CallbackHandler.tsproperly handles the callback return value frompropagateAttributes, and verifyendOnExit: falsebehavior is correctly documentedImportant Files Changed
updateActiveTracewithsetActiveTraceIO(deprecated) andpublishActiveTrace; exportspropagateAttributesfrom coreupdateTracemethod withsetTraceIO(deprecated) andpublishTracemethodspropagateAttributesandstartActiveObservationinstead ofupdateTrace; changed fromstartObservationtostartActiveObservationwithendOnExit: falsepropagateAttributesto set trace-level attributes before creating observationsSequence Diagram
sequenceDiagram participant User participant propagateAttributes participant OTelContext participant startActiveObservation participant Observation participant Span Note over User,Span: v5 Breaking Changes: propagateAttributes replaces updateTrace User->>propagateAttributes: propagateAttributes({userId, sessionId, tags, metadata}) activate propagateAttributes propagateAttributes->>OTelContext: Set context with trace attributes Note over OTelContext: Attributes propagated via OpenTelemetry context propagateAttributes->>startActiveObservation: Execute callback function activate startActiveObservation startActiveObservation->>Span: Create OTEL span with active context Note over Span: Span inherits trace attributes from context startActiveObservation->>Observation: Wrap span in LangfuseObservation activate Observation User->>Observation: observation.update({input, output, metadata}) Observation->>Span: Set observation-level attributes User->>Observation: observation.publishTrace() Note over Observation,Span: New method replaces updateTrace({public: true}) Observation->>Span: Set TRACE_PUBLIC attribute User->>Observation: observation.setTraceIO({input, output}) Note over Observation,Span: Deprecated method for legacy platform features Observation->>Span: Set trace I/O attributes Observation-->>User: Return observation deactivate Observation startActiveObservation-->>propagateAttributes: Return result deactivate startActiveObservation propagateAttributes-->>User: Return result deactivate propagateAttributes Note over User,Span: Key Change: Trace attributes must be set BEFORE creating observations