-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: use projectid when generating trace urls #1024
feat: use projectid when generating trace urls #1024
Conversation
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.
Disclaimer: Experimental PR review
PR Summary
This PR adds project ID support to trace URL generation in the Python SDK, enabling proper linking to traces in the Langfuse UI by fetching and incorporating the project ID into the URL path.
- Added
project_id
attribute toLangfuse
class to store project context - Modified
get_trace_url()
to fetch project ID from API if not already set - Added
test_generate_trace_id()
to verify URL generation with project ID - Updated URL format to include project ID:
{base_url}/{project_id}/traces/{trace_id}
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
Modified test_generate_trace_id() to use HTTP protocol instead of HTTPS, maintaining consistency with the new URL format that includes project ID in the path.
- Changed protocol from 'https' to 'http' in
tests/test_core_sdk.py
for trace URL assertions - Test still uses hardcoded project ID (7a88fb47-b4e2-43b8-a06c-a5ce950dc53a) which should be made dynamic
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This PR continues to evolve the trace URL functionality by updating the test implementation in the Python SDK.
- Updated
test_core_sdk.py
to dynamically fetch project ID instead of using hardcoded value7a88fb47-b4e2-43b8-a06c-a5ce950dc53a
- Test now uses
langfuse.client.projects.get()
to retrieve actual project context - Ensures test is environment-independent and more maintainable
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
Updated the URL path structure in langfuse/client.py
to include '/project/' prefix before project ID in trace URLs, aligning with the latest API endpoint format.
- Modified URL format in
get_trace_url()
from/{project_id}/traces/{trace_id}
to/project/{project_id}/traces/{trace_id}
- Updated test assertions in
tests/test_core_sdk.py
to verify new URL path structure
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Important
The PR updates the
Langfuse
class to includeproject_id
in trace URLs and modifies tests to verify this behavior.get_trace_url()
inLangfuse
class to includeproject_id
in the URL if available.project_id
is not set, fetchproject_id
from the first project inself.client.projects.get()
.project_id
attribute toLangfuse
class to store the project ID associated with the API keys.test_generate_trace_id()
intest_core_sdk.py
to verify the trace URL includesproject_id
.This description was created by for e255492. It will automatically update as commits are pushed.