Skip to content

[opentelemetry-instrumentation-google-genai] Update generate_content streaming variants to use AsyncStreamWrapper and SyncStreamWrapper from utils#167

Open
DylanRussell wants to merge 6 commits into
open-telemetry:mainfrom
DylanRussell:streamingupdate
Open

[opentelemetry-instrumentation-google-genai] Update generate_content streaming variants to use AsyncStreamWrapper and SyncStreamWrapper from utils#167
DylanRussell wants to merge 6 commits into
open-telemetry:mainfrom
DylanRussell:streamingupdate

Conversation

@DylanRussell

Copy link
Copy Markdown
Contributor

Description

Update the generate_content streaming variants to use/return the util streaming wrappers.. This makes the code a bit cleaner and also ensures we let the user invoke the stream when they want to instead of us doing it immediately..

Fixes # (issue)

Type of change

  • [x ] Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Unit tests

Checklist

See CONTRIBUTING.md
for the style guide, changelog guidance, and more.

  • [x ] Followed the style guidelines of this project
  • Changelog updated if the change requires an entry
  • [ x] Unit tests added
  • [x ] Documentation updated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Google GenAI generate_content_stream (sync + async) instrumentation to return the shared opentelemetry-util-genai stream wrappers, aligning streaming lifecycle finalization with the util’s standardized SyncStreamWrapper/AsyncStreamWrapper behavior.

Changes:

  • Introduces GenerateContentStreamWrapper and AsyncGenerateContentStreamWrapper subclasses to drive per-chunk telemetry and finalize spans on stream completion/error.
  • Refactors both streaming instrumentations to return the util wrappers instead of hand-rolled generator wrappers.
  • Adjusts imports to support the new wrapper types.

@DylanRussell DylanRussell changed the title [opentelemetry-instrumentation-google-genai] Update generate_content streaming variants to use AsyncStreamWrapper and SyncStreamWrapper` and [opentelemetry-instrumentation-google-genai] Update generate_content streaming variants to use AsyncStreamWrapper and SyncStreamWrapper from utils Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants