Skip to content

Conversation

@ChrisJBurns
Copy link
Collaborator

@ChrisJBurns ChrisJBurns commented Feb 9, 2026

Summary

  • Renames all telemetry span attributes to align with OpenTelemetry HTTP semantic conventions, MCP-specific conventions, and gen_ai namespace patterns
  • Adds --otel-use-legacy-attributes CLI flag and config option for backward-compatible dual emission (emits both old and new attribute names simultaneously during migration)
  • Updates span names to be more concise (e.g., mcp.tools/calltools/call {tool_name})
  • Fixes span status per OTEL spec: 4xx → Unset (client error, not server fault), 5xx → Error with error.type
  • Adds new standard attributes: mcp.protocol.version, gen_ai.operation.name, network.protocol.name/version, client.address/port, mcp.session.id
  • Includes migration guide (docs/telemetry-migration.md) with attribute mapping tables and PromQL examples

Attribute renames

Category Old New
HTTP http.method http.request.method
HTTP http.url url.full
HTTP http.status_code http.response.status_code
MCP mcp.method mcp.method.name
MCP mcp.request.id jsonrpc.request.id
MCP mcp.transport network.transport
Tool mcp.tool.name gen_ai.tool.name
Tool mcp.tool.arguments gen_ai.tool.call.arguments
Prompt mcp.prompt.name gen_ai.prompt.name

Full mapping in docs/telemetry-migration.md.

Backward compatibility

When --otel-use-legacy-attributes is enabled (or otel.use-legacy-attributes: true in config), every span includes both old and new attribute names. This allows gradual migration of dashboards and alerts.

Test plan

  • All existing unit tests pass (task test)
  • Lint passes with 0 issues (task lint)
  • Build compiles cleanly (go build ./...)
  • New dual emission tests verify both old+new attributes present when UseLegacyAttributes=true
  • New dual emission tests verify only new attributes present when UseLegacyAttributes=false
  • Integration tests verify end-to-end with real trace providers
  • Helper function tests: mapTransport, httpProtocolVersion, parseRemoteAddr
  • Manual verification with OTEL collector (recommended)

🤖 Generated with Claude Code

@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Feb 9, 2026
Copy link
Contributor

@github-actions github-actions bot left a 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 transformation

Alternative:

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
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 94.26230% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.35%. Comparing base (fa9e0bf) to head (0643d15).

Files with missing lines Patch % Lines
pkg/telemetry/middleware.go 94.26% 4 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 9, 2026
ChrisJBurns and others added 2 commits February 9, 2026 22:16
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 ChrisJBurns force-pushed the otel/pr1-span-attributes branch from 852c262 to 0643d15 Compare February 9, 2026 22:23
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 9, 2026
@ChrisJBurns ChrisJBurns changed the base branch from main to otel/add-use-legacy-attributes-flag February 9, 2026 22:25
@ChrisJBurns
Copy link
Collaborator Author

Superseded by the split PRs: #3729 (UseLegacyAttributes flag), #3734 (attribute rename + dual emission), #3735 (new attributes + span status fix).

@ChrisJBurns ChrisJBurns closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant