Skip to content

Conversation

dinmukhamedm
Copy link
Member

@dinmukhamedm dinmukhamedm commented Oct 15, 2025

Important

Add event logging for chunk processing in streaming responses and update Laminar method calls to use full class name.

  • Behavior:
    • Add event llm.content.completion.chunk to spans in _build_from_streaming_response() and _abuild_from_streaming_response() in __init__.py.
    • Update Laminar method calls in laminar.py to use full class name instead of alias L.
  • Tests:
    • Add assertion in test_google_genai_streaming() in test_google_genai.py to verify event logging for each chunk processed.

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

olzhik11
olzhik11 previously approved these changes Oct 15, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 279e9ba in 1 minute and 28 seconds. Click for details.
  • Reviewed 44 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py:388
  • Draft comment:
    Adding an event per chunk is useful; consider checking if the span is recording (e.g. using span.is_recording()) before calling add_event to avoid unnecessary overhead.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py:439
  • Draft comment:
    Similarly, in the async streaming response, consider guarding the add_event call with a check for span.is_recording() to be consistent.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
3. tests/test_google_genai.py:847
  • Draft comment:
    The test now tracks the number of chunks (chunk_count) and later asserts that the number of span events matches; this is a clear and effective verification of the chunk event instrumentation.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. tests/test_google_genai.py:887
  • Draft comment:
    The additional assertions verifying that every event has the name 'llm.content.completion.chunk' effectively ensure correct event logging.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_JjqGlIvPyOH5OqUL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed fa4a934 in 1 minute and 2 seconds. Click for details.
  • Reviewed 20 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/lmnr/sdk/laminar.py:674
  • Draft comment:
    Replace alias 'L' with 'Laminar' in the docstring example for clarity and consistency.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_l3P6EVL8w1HXXIos

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed 7945365 in 1 minute and 23 seconds. Click for details.
  • Reviewed 38 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_h30LBWr84cZywref

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

try:
span.add_event("llm.content.completion.chunk")
except Exception:
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try/except block around span.add_event swallows all exceptions. Consider logging the exception (even at a debug level) so that unexpected failures in adding events aren’t silently ignored.

Suggested change
pass
logger.debug("Exception in span.add_event: ", exc_info=True)

try:
span.add_event("llm.content.completion.chunk")
except Exception:
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, the async version wraps span.add_event in a try/except without logging. It would be beneficial to log errors for visibility, even if instrumentation should continue.

Suggested change
pass
logger.exception('Failed to add event to span')

@dinmukhamedm dinmukhamedm merged commit 51fd6a4 into main Oct 16, 2025
7 checks passed
@dinmukhamedm dinmukhamedm deleted the gemini-ttft branch October 16, 2025 09:39
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