Conversation
Pull request dashboard statusMerged · refreshed 2026-09-22 18:31 UTC Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (4)
What changed in this PR
Adds fetch_response tracing for Google GenAI interactions.get, extending the existing instrumentation and shared GenAI telemetry utilities.
Changes:
- Adds sync/async fetch spans with status, model, cursor, content, and error handling.
- Adds streamed, resumed-streamed, raw-response, and conformance coverage.
- Updates documentation, changelog, tests, and VCR cassettes.
| File | Description |
|---|---|
| instrumentation/opentelemetry-instrumentation-google-genai/tests/test_instrumentor.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/test_conformance.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/util.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/test_fetch_sync.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/test_fetch_async.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/test_e2e.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/fetch_base.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_with_streaming_response.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_with_raw_response.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_streaming.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_stream_error.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_resumed_stream.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_not_found.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_sync_interactions_get_failed_status.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_async_interactions_get.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/cassettes/test_async_interactions_get_with_raw_response.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/conformance/fetch_response.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/cassettes/interactions_fetch_response_conformance.yaml | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/interactions.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/README.rst | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-google-genai/.changelog/PR_NUMBER.added | Updated as part of this pull request. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
lmolkova
approved these changes
Sep 21, 2026
| return | ||
| self._self_invocation.stop() | ||
|
|
||
| def _on_stream_error(self, error: Exception) -> None: |
Member
There was a problem hiding this comment.
_on_stream_error should accept BaseException to match the _StreamTelemetry base class signature and handle cancellation cleanly (same on line 923 for AsyncFetchInteractionStreamWrapper):
Suggested change
| def _on_stream_error(self, error: Exception) -> None: | |
| def _on_stream_error(self, error: BaseException) -> None: |
Emit a `fetch_response` span for `client.interactions.get`, sync and async, covering non-streaming, streamed and resumed-streamed retrieval. A fetch performs no inference, so the fetched interaction's token counts are deliberately not reported. Fixes open-telemetry#561 Assisted-by: Claude Opus 5
The attribute is not part of the fetch_response span in the GenAI semantic conventions; a resumed fetch is identified by gen_ai.request.stream_cursor. Matches the same removal made for the OpenAI package in open-telemetry#709. Also name the changelog fragment after the PR and sort imports. Assisted-by: Claude Opus 5
- Only serialize tool definitions when content capture is on; the attribute is opt-in, so the work is otherwise discarded. - Widen `_on_stream_error` to `BaseException`, matching the base hook and the cancellation it actually receives. - Report the HTTP status as `error.type` for interactions errors: they raise from the SDK's own hierarchy, unrelated to `google.genai.errors.APIError`, and carry the status as `status_code`. - Cover `aio.interactions.with_streaming_response.get`. - Mark the two synthesized cassettes for re-recording, and drop a stray interaction a record run appended to the failed-status one. Assisted-by: Claude Opus 5
eternalcuriouslearner
force-pushed
the
feat/interactions-get-instrumentation
branch
from
September 22, 2026 10:51
b647d1f to
441b66a
Compare
Assisted-by: Claude Opus 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Adds
fetch_responsespans forclient.interactions.get(sync and async), covering non-streaming, streamed and resumed-streamed retrieval, plus thewith_raw_response/with_streaming_responseentry points. Fixes #561.A fetch performs no inference, so the fetched interaction's token counts are deliberately not reported;
gen_ai.response.statusmapsbudget_exceededontoincompleteand passesrequires_actionthrough as a provider-specific value.Known gaps:
# TODO: this is generated by AI, re-recordmarker: thefailed_statusone needs a genuinely failed generation, and the two streaming ones needbackground=trueplus model capacity (the API returnedservice_unavailablewhile recording). The other four are real recordings, including one of an in-band stream error.interactions.create's stream wrappers have several of the same defects this fixes on the fetch path (the SSE completion event is compared againstinteraction_completedrather thaninteraction.completed, so streamedcreatespans silently lose response model, id, token usage and content). I'll file those separately.🤖 Generated with Claude Code