-
Notifications
You must be signed in to change notification settings - Fork 178
Align telemetry span attributes with MCP OTEL semantic conventions #3727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align telemetry span attributes with MCP OTEL semantic conventions #3727
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
852c262 to
0643d15
Compare
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