Repository navigation
[opentelemetry-instrumentation-genai-openai] Do not record gen_ai.request.stream on fetch_response spans - #709
Merged
lmolkova merged 1 commit intoSep 13, 2026
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation and corresponding tests align with the fetch-response semantic conventions.
Pull request overview
Removes the unsupported gen_ai.request.stream attribute from OpenAI fetch_response spans.
Changes:
- Stops passing
request_streamto fetch-response invocations. - Updates synchronous and asynchronous tests.
- Adds a changelog entry.
File summaries
| File | Description |
|---|---|
instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_utils.py |
Verifies the stream attribute is absent. |
instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_responses.py |
Updates synchronous response tests. |
instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_async_responses.py |
Updates asynchronous response tests. |
instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/patch_responses.py |
Removes fetch-response stream attribute setup. |
instrumentation/opentelemetry-instrumentation-genai-openai/.changelog/709.fixed |
Documents the fix. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
eternalcuriouslearner
approved these changes
Sep 13, 2026
Pull request dashboard statusMerged · refreshed 2026-09-17 06:33 UTC Status above doesn't look right?
|
eternalcuriouslearner
added a commit
to eternalcuriouslearner/opentelemetry-python-genai
that referenced
this pull request
Sep 21, 2026
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
eternalcuriouslearner
added a commit
to eternalcuriouslearner/opentelemetry-python-genai
that referenced
this pull request
Sep 22, 2026
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
lmolkova
pushed a commit
to lmolkova/opentelemetry-python-genai
that referenced
this pull request
Sep 22, 2026
…n-telemetry#755) * feat(google-genai): instrument interactions.get as fetch_response 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 * fix(google-genai): drop gen_ai.request.stream from fetch_response spans 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 * fix(google-genai): address review feedback on interactions.get - 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 * style: format the new error-type test 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.
Removes setting gen_ai.request.stream on fetch_response spans in the OpenAI instrumentation.
Per fetch_response semantic conventions, fetch_response operations do not define gen_ai.request.stream.
Proposing to add it to semconv in open-telemetry/semantic-conventions-genai#513
I'd prefer to proceed with this change anyway since I'd like to codegen most of utils and it's a blocker.