Skip to content

Conversation

@marcklingen
Copy link
Member

@marcklingen marcklingen commented Jan 2, 2025

Important

Add project_id to trace URLs in Langfuse and langfuse_context to ensure correct project context in Langfuse UI.

  • Behavior:
    • Add project_id to URLs in Langfuse.get_trace_url() and langfuse_context.get_current_trace_url().
    • Introduce _get_project_id() in Langfuse to fetch and cache project ID.
  • Tests:
    • Add test_get_project_id() in test_core_sdk.py to verify project ID retrieval.
    • Add test_get_current_trace_url() in test_decorators.py to check URL format with project ID.

This description was created by Ellipsis for 0dae388. It will automatically update as commits are pushed.

@marcklingen marcklingen marked this pull request as ready for review January 2, 2025 14:13
@marcklingen marcklingen requested a review from hassiebp January 2, 2025 14:13
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 the trace URL generation in the Python SDK to include project ID in the path, providing more context-rich URLs for better trace navigation and identification.

  • Modified get_current_trace_url in /langfuse/decorators/langfuse_decorator.py to support /project/{project_id}/traces/{trace_id} format
  • Added _get_project_id() method in /langfuse/client.py with caching for efficient project ID retrieval
  • Added test coverage in /tests/test_decorators.py and /tests/test_core_sdk.py to verify URL formatting with project IDs
  • Maintained backward compatibility by falling back to /trace/{trace_id} when project ID is unavailable

💡 (3/5) Reply to the bot's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

No significant changes found since the last review. The previous review comprehensively covered all major modifications related to adding project IDs to trace URLs, including the implementation details and test coverage.

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@marcklingen marcklingen merged commit 2d5872a into main Jan 2, 2025
7 of 8 checks passed
@marcklingen marcklingen deleted the marc/lfe-3308 branch January 2, 2025 21:43
@marcklingen marcklingen removed the request for review from hassiebp January 2, 2025 21:43
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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)

No significant changes found since the last reviews. The previous reviews comprehensively covered the addition of project IDs to trace URLs and associated test coverage.

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@marcklingen
Copy link
Member Author

@hassiebp fyi, tests fully covered this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants