Skip to content

[opentelemetry-instrumentation-genai-openai-agents] Do not record gen_ai.provider.name on tool execution metrics - #710

Merged
lmolkova merged 2 commits into
open-telemetry:mainfrom
lmolkova:openai-agents-remove-tool-provider-metric
Sep 13, 2026
Merged

lmolkova merged 2 commits into
open-telemetry:mainfrom
lmolkova:openai-agents-remove-tool-provider-metric

Conversation

@lmolkova

Copy link
Copy Markdown
Member

Removes setting gen_ai.provider.name on ToolInvocation.metric_attributes.

Tool execution does not invoke a GenAI provider, so per note [3] on gen_ai.provider.name for gen_ai.client.operation.duration, it is only required when the operation involves a call to a GenAI provider.

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.

🟡 Changes recommended

Add a regression assertion verifying that gen_ai.provider.name is absent from tool metrics.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR removes gen_ai.provider.name from OpenAI Agents tool execution metrics.

Changes:

  • Removes provider attribution from tool metrics.
  • Updates the processor test and adds a changelog entry.
File summaries
File Summary
instrumentation/opentelemetry-instrumentation-genai-openai-agents/tests/test_processor.py Updates tool invocation metric expectations; absence of the provider attribute is not asserted.
instrumentation/opentelemetry-instrumentation-genai-openai-agents/src/opentelemetry/instrumentation/genai/openai_agents/processor.py Stops assigning the provider name to tool metrics.
instrumentation/opentelemetry-instrumentation-genai-openai-agents/.changelog/710.fixed Documents the metric correction.
Review details

Suppressed comments (1)

instrumentation/opentelemetry-instrumentation-genai-openai-agents/src/opentelemetry/instrumentation/genai/openai_agents/processor.py:117

  • After removing the assignment, GenAITracingProcessor._provider is never read. The instrumentor still computes the OpenAI provider and passes it only to populate this dead field, leaving misleading state and plumbing; remove the constructor parameter/field and update its call sites and tests.
            invocation = self._handler.tool(
                name=span_data.name,
                tool_type="function",
            )
            self._invocations[span] = invocation
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lmolkova
lmolkova marked this pull request as ready for review September 13, 2026 21:53
@lmolkova
lmolkova requested a review from a team as a code owner September 13, 2026 21:53

@eternalcuriouslearner eternalcuriouslearner 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.

LGTM!!

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-17 06:33 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@lmolkova
lmolkova added this pull request to the merge queue Sep 13, 2026
Merged via the queue into open-telemetry:main with commit cd6073a Sep 13, 2026
75 checks passed
@lmolkova
lmolkova deleted the openai-agents-remove-tool-provider-metric branch September 13, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants