Skip to content

[opentelemetry-instrumentation-google-genai] Add response ID attribute to the interactions API telemetry (inference span and event)#233

Merged
lmolkova merged 12 commits into
open-telemetry:mainfrom
DylanRussell:add_coversation_id
Jul 13, 2026
Merged

[opentelemetry-instrumentation-google-genai] Add response ID attribute to the interactions API telemetry (inference span and event)#233
lmolkova merged 12 commits into
open-telemetry:mainfrom
DylanRussell:add_coversation_id

Conversation

@DylanRussell

@DylanRussell DylanRussell commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

Set response id attribute to interactions.id

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Unit tests

Checklist

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

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

@DylanRussell DylanRussell requested a review from a team as a code owner July 9, 2026 14:39
Copilot AI review requested due to automatic review settings July 9, 2026 14:39
@DylanRussell DylanRussell changed the title [`opentelemetry-instrumentation-google-genai'] Add conversation ID attribute to the interactions API telemetry (inference span and event) [opentelemetry-instrumentation-google-genai] Add conversation ID attribute to the interactions API telemetry (inference span and event) Jul 9, 2026

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

Adds support for the GenAI semantic convention gen_ai.conversation.id in the shared opentelemetry-util-genai inference invocation, and wires it into the opentelemetry-instrumentation-google-genai Interactions API by mapping previous_interaction_id to that attribute.

Changes:

  • Add conversation_id to InferenceInvocation and include it in span + inference-operation-details event attributes.
  • Populate invocation.conversation_id for interactions.create (sync + async) from previous_interaction_id / config.
  • Add unit tests and changelog fragments for both the util and google-genai instrumentation packages.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
util/opentelemetry-util-genai/tests/test_utils.py Adds a unit test for InferenceInvocation.conversation_id on spans (suggested to also assert the emitted event).
util/opentelemetry-util-genai/src/opentelemetry/util/genai/_inference_invocation.py Adds conversation_id field and emits gen_ai.conversation.id via _get_attributes() (affecting span + event).
util/opentelemetry-util-genai/.changelog/233.added Changelog entry for util-genai conversation_id support.
instrumentation/opentelemetry-instrumentation-google-genai/tests/interactions/base.py Adds a test asserting gen_ai.conversation.id is set from previous_interaction_id (suggested to also assert the event).
instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/interactions.py Sets invocation.conversation_id from previous_interaction_id for sync/async interactions.create.
instrumentation/opentelemetry-instrumentation-google-genai/.changelog/233.added Changelog entry for google-genai interactions telemetry including conversation.id.

Comment thread util/opentelemetry-util-genai/tests/test_utils.py Outdated
@opentelemetry-pr-dashboard

Copy link
Copy Markdown

This PR has review comments. Review suggestions, whether from maintainers or automated reviewers, aren't always correct or required. Please evaluate each comment on its merits, then make sure each thread has a clear outcome.

For example, link to the commit if you applied a suggestion, explain why it wasn't applied, or ask a follow-up question.

Automation flags a PR for human review once every review thread has a reply or is marked as resolved.

Status across open PRs is visible on the pull request dashboard.

@DylanRussell DylanRussell changed the title [opentelemetry-instrumentation-google-genai] Add conversation ID attribute to the interactions API telemetry (inference span and event) [opentelemetry-instrumentation-google-genai] Add response ID attribute to the interactions API telemetry (inference span and event) Jul 10, 2026
@lmolkova lmolkova added this pull request to the merge queue Jul 13, 2026
Merged via the queue into open-telemetry:main with commit f38a2f2 Jul 13, 2026
66 checks passed
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.

4 participants