Skip to content

feat(core): add support for observation events#1190

Merged
hassiebp merged 4 commits intomainfrom
make-create-trace-id-static
May 22, 2025
Merged

feat(core): add support for observation events#1190
hassiebp merged 4 commits intomainfrom
make-create-trace-id-static

Conversation

@hassiebp
Copy link
Copy Markdown
Contributor

@hassiebp hassiebp commented May 22, 2025

Important

Adds support for Langfuse observation events with new LangfuseEvent class and create_event() method, along with refactoring in client.py and span.py.

  • Behavior:
    • Adds create_event() method in client.py to create Langfuse observation events.
    • Introduces LangfuseEvent class in span.py for event-specific span handling.
    • Events are child spans of the current context span.
  • Refactoring:
    • Makes create_trace_id(), _format_otel_span_id(), and _format_otel_trace_id() static methods in client.py.
    • Removes unused update_finished_trace() method in client.py.
  • Span Types:
    • Extends LangfuseSpanWrapper to support event type spans in span.py.
    • Updates LangfuseSpanWrapper to handle event type in _set_processed_span_attributes() and other methods.

This description was created by Ellipsis for 7f2be0e. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

This PR adds support for observation events in the Langfuse Python SDK, integrating them with the existing OpenTelemetry-based tracing system and making several methods static for better efficiency.

  • Added new LangfuseEvent class and create_event() method in langfuse/_client/span.py for handling event-type observations
  • Made helper methods static (create_trace_id, _format_otel_span_id, _format_otel_trace_id) in langfuse/_client/client.py
  • Removed ABC inheritance and @abstractmethod decorator from LangfuseSpanWrapper in langfuse/_client/span.py
  • Added proper timestamp handling for events using time_ns() in langfuse/_client/client.py

Copy link
Copy Markdown
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.

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

hassiebp and others added 2 commits May 22, 2025 18:01
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@hassiebp hassiebp merged commit 57a134e into main May 22, 2025
5 of 8 checks passed
@hassiebp hassiebp deleted the make-create-trace-id-static branch May 22, 2025 16:02
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.

1 participant