[Repo Assist] feat(tracing): add GenAIOperationName and GenAIAgentName to mcp.tool_call spans#7981
Merged
lpcox merged 1 commit intoJun 23, 2026
Conversation
…CallSpan
Add the two missing GenAI semantic convention attributes to the
mcp.tool_call span:
- gen_ai.operation.name = "execute_tool" (OTel GenAI semconv primary
grouping key for tool-call operations in Honeycomb/Grafana Tempo)
- gen_ai.agent.name = "mcp-gateway" (identifies the gateway component)
Both attribute keys (GenAIOperationName, GenAIAgentName) were already
defined in genai_attrs.go but never used. This fixes a gap flagged by
the Go Fan module review (#7972 items 1 and 2).
Update TestStartToolCallSpan to assert the two new attributes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enriches mcp.tool_call OpenTelemetry spans with two missing GenAI semantic convention attributes so tool-call traces are easier to group and identify in downstream observability tools.
Changes:
- Add
gen_ai.operation.name = "execute_tool"toStartToolCallSpan. - Add
gen_ai.agent.name = "mcp-gateway"toStartToolCallSpan. - Extend
TestStartToolCallSpanto assert both new attributes are present.
Show a summary per file
| File | Description |
|---|---|
| internal/tracing/span_helpers.go | Adds GenAI operation + agent name attributes to the tool-call span attributes set. |
| internal/tracing/span_helpers_test.go | Adds assertions verifying the new span attributes are emitted. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This was referenced Jun 24, 2026
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds two missing [OTel GenAI semantic convention]((opentelemetry.io/redacted) attributes to
StartToolCallSpan:gen_ai.operation.name"execute_tool"gen_ai.agent.name"mcp-gateway"Both constants (
GenAIOperationName,GenAIAgentName) were already defined ininternal/tracing/genai_attrs.gobut never referenced — a gap flagged in the Go Fan module review (#7972, items 1 and 2).Changes
internal/tracing/span_helpers.go—StartToolCallSpan:internal/tracing/span_helpers_test.go—TestStartToolCallSpan: two newhasAttrassertions for the added attributes.Rationale
gen_ai.operation.nameis the standard grouping dimension for GenAI spans. Observability dashboards that follow OTel semconv use it as the primary filter/grouping field.gen_ai.agent.namecompletes the standard GenAI identity attributes (alongside the already-setgen_ai.agent.id) so traces are self-describing.Test Status
Format check:
gofmt✅ — no formatting issues.make agent-finishedcould not run locally —proxy.golang.orgis blocked in the sandbox environment (infrastructure constraint). The CI pipeline will validate the build and tests. The change is a trivially correct attribute addition with no API changes.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgSee Network Configuration for more information.
Add this agentic workflows to your repo
To install this agentic workflow, run