[opentelemetry-instrumentation-google-genai] Add response id attribute, cleanup dictutil code#119
Open
DylanRussell wants to merge 11 commits into
Open
[opentelemetry-instrumentation-google-genai] Add response id attribute, cleanup dictutil code#119DylanRussell wants to merge 11 commits into
dictutil code#119DylanRussell wants to merge 11 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds gen_ai.response.id propagation for Google GenAI generate_content so the response id can be attached to the inference span and the completion event, aligning with the GenAI semantic conventions.
Changes:
- Extract
response_idfromGenerateContentResponseand attach it to the util-genaiInferenceInvocation. - Update non-streaming tests to assert
gen_ai.response.idpresence/absence on spans/events.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py | Captures response attributes (including response id) into the invocation for span/event emission. |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/generate_content/nonstreaming_base.py | Adds non-streaming assertions validating the gen_ai.response.id attribute behavior. |
lmolkova
approved these changes
Jun 9, 2026
eternalcuriouslearner
approved these changes
Jun 10, 2026
dictutil code
Contributor
Author
|
@eternalcuriouslearner @lmolkova mind taking another look ? Ended up doing a bunch of code cleanup after noticing some messy code here.. |
eternalcuriouslearner
approved these changes
Jun 15, 2026
Contributor
Author
Contributor
Author
|
I think this PR should be good to be merged now |
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.
Description
Add response id attribute to inference span and completion event for Google GenAi...
See https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/
I also drastically cleaned up the
dict_utilcode which converts theGenerateContentConfigobject into OTEL Attributes dictionary.. I deleted some unused functionality and cleaned up the code.Type of change
How has this been tested?
Unit tests
Checklist
See CONTRIBUTING.md
for the style guide, changelog guidance, and more.