Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jan 2, 2025

Important

Fixes trace ID assignment for top-level generations in langfuse_decorator.py and updates a test in test_singleton.py.

  • Behavior:
    • Fixes trace ID assignment in _prepare_call() in langfuse_decorator.py to use _root_trace_id_context.get() or id for top-level generations.
  • Tests:
    • Update test_reset_functionality() in test_singleton.py to assert shutdown is called instead of flush.

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

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

Fixed trace ID handling in the decorator system to ensure proper context propagation for dataset item observers when used with top-level generations.

  • Modified _prepare_call in langfuse/decorators/langfuse_decorator.py to check existing root trace ID before using provided ID
  • Ensures consistent trace ID propagation between dataset item observers and top-level generations
  • Prevents trace ID mismatches that could break dataset item observation functionality

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

@hassiebp hassiebp merged commit 9a65ead into main Jan 2, 2025
7 of 8 checks passed
@hassiebp hassiebp deleted the fix-dataset-item-observe-top-level-gen branch January 2, 2025 14:07
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)

This pull request continues work on fixing trace ID handling in the Langfuse decorator system, with additional changes focused on test updates.

  • Updated test_singleton.py to use shutdown() instead of flush() to align with renamed API method
  • Reordered imports in test_singleton.py to follow PEP8 style guidelines
  • Test coverage remains comprehensive for singleton behavior, thread safety, initialization and reset functionality

The changes are minimal but important for maintaining test consistency with the updated API. The core functionality changes were covered in the previous review.

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

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