Align telemetry span attributes with MCP OTEL semantic conventions - #3727
Closed
ChrisJBurns wants to merge 2 commits into
Closed
ChrisJBurns wants to merge 2 commits into
ChrisJBurns wants to merge 2 commits into
Conversation
ChrisJBurns
requested review from
JAORMX,
amirejaz,
eleftherias,
jerm-dro,
jhrozek,
lujunsan,
rdimitrov and
yrobla
as code owners
February 9, 2026 21:10
Contributor
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## otel/add-use-legacy-attributes-flag #3727 +/- ##
=======================================================================
+ Coverage 66.30% 66.35% +0.05%
=======================================================================
Files 427 427
Lines 41800 41888 +88
=======================================================================
+ Hits 27714 27795 +81
- Misses 11975 11979 +4
- Partials 2111 2114 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Rename all span attributes to match OpenTelemetry HTTP semantic
conventions, MCP-specific conventions, and gen_ai namespace patterns.
Add --otel-use-legacy-attributes flag for backward-compatible dual
emission that emits both old and new attribute names simultaneously
during migration.
Key changes:
- HTTP attributes: http.method→http.request.method, http.url→url.full,
http.scheme→url.scheme, http.host→server.address, etc.
- MCP attributes: mcp.method→mcp.method.name,
mcp.request.id→jsonrpc.request.id, mcp.resource.id→mcp.resource.uri,
mcp.transport→network.transport
- Tool/prompt attributes: mcp.tool.name→gen_ai.tool.name,
mcp.tool.arguments→gen_ai.tool.call.arguments,
mcp.prompt.name→gen_ai.prompt.name
- Span names: mcp.tools/call→tools/call {tool}, mcp.prompts/get→prompts/get {prompt}
- Span status: 4xx→Unset (not server error), 5xx→Error with error.type
- New attributes: mcp.protocol.version, gen_ai.operation.name,
network.protocol.name/version, client.address/port, mcp.session.id
- Migration guide documenting all changes and PromQL examples
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback on the OTEL semantic convention migration: - Default UseLegacyAttributes to true for backward compatibility - Restore http.duration_ms emission in legacy mode - Gate mcp.resource.uri to resource-related methods only - Always emit rpc.system and add jsonrpc.protocol.version - Fix dual emission in recordSSEConnection - Add K8s operator section to migration docs - Regenerate CRD manifests with useLegacyAttributes default Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ChrisJBurns
force-pushed
the
otel/pr1-span-attributes
branch
from
February 9, 2026 22:23
852c262 to
0643d15
Compare
ChrisJBurns
changed the base branch from
main
to
otel/add-use-legacy-attributes-flag
February 9, 2026 22:25
Collaborator
Author
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.
Summary
gen_ainamespace patterns--otel-use-legacy-attributesCLI flag and config option for backward-compatible dual emission (emits both old and new attribute names simultaneously during migration)mcp.tools/call→tools/call {tool_name})Unset(client error, not server fault), 5xx →Errorwitherror.typemcp.protocol.version,gen_ai.operation.name,network.protocol.name/version,client.address/port,mcp.session.iddocs/telemetry-migration.md) with attribute mapping tables and PromQL examplesAttribute renames
http.methodhttp.request.methodhttp.urlurl.fullhttp.status_codehttp.response.status_codemcp.methodmcp.method.namemcp.request.idjsonrpc.request.idmcp.transportnetwork.transportmcp.tool.namegen_ai.tool.namemcp.tool.argumentsgen_ai.tool.call.argumentsmcp.prompt.namegen_ai.prompt.nameFull mapping in
docs/telemetry-migration.md.Backward compatibility
When
--otel-use-legacy-attributesis enabled (orotel.use-legacy-attributes: truein config), every span includes both old and new attribute names. This allows gradual migration of dashboards and alerts.Test plan
task test)task lint)go build ./...)UseLegacyAttributes=trueUseLegacyAttributes=falsemapTransport,httpProtocolVersion,parseRemoteAddr🤖 Generated with Claude Code