Skip to content

DRAFT: Add network/client span attributes and fix span status per OTEL semconv - #3735

Closed
ChrisJBurns wants to merge 1 commit into
otel/pr2a-attribute-renamefrom
otel/pr2b-new-attributes
Closed

ChrisJBurns wants to merge 1 commit into
otel/pr2a-attribute-renamefrom
otel/pr2b-new-attributes

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Collaborator

Summary

  • Adds new additive span attributes: network.protocol.name, network.protocol.version, client.address, client.port, mcp.session.id
  • Fixes span status to follow OTEL semconv: 4xx → Unset (client errors), 5xx → Error with error.type
  • Adds httpProtocolVersion and parseRemoteAddr helper functions

These are new attributes that have no legacy equivalents — they are always emitted regardless of the UseLegacyAttributes setting.

Stacked on #3734 (attribute rename + dual emission).

Test plan

  • Unit tests for httpProtocolVersion helper (HTTP/1.0, 1.1, 2.0, 3.0, zero)
  • Unit tests for parseRemoteAddr helper (host:port, IPv6, empty, no port)
  • Updated TestHTTPMiddleware_FinalizeSpan_Logic for 4xx → Unset, 5xx → Error behavior
  • Migration doc updated with span status changes and new attributes
  • task lint passes
  • task test passes

🤖 Generated with Claude Code

@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Feb 9, 2026
@codecov

codecov Bot commented Feb 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.41%. Comparing base (2aa273b) to head (54bda5c).

Files with missing lines Patch % Lines
pkg/telemetry/middleware.go 90.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           otel/pr2a-attribute-rename    #3735      +/-   ##
==============================================================
+ Coverage                       66.40%   66.41%   +0.01%     
==============================================================
  Files                             427      427              
  Lines                           41860    41888      +28     
==============================================================
+ Hits                            27796    27822      +26     
+ Misses                          11953    11949       -4     
- Partials                         2111     2117       +6     

☔ 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.

@ChrisJBurns ChrisJBurns changed the title Add network/client span attributes and fix span status per OTEL semconv DRAFT: Add network/client span attributes and fix span status per OTEL semconv Feb 9, 2026
@ChrisJBurns
ChrisJBurns force-pushed the otel/pr2a-attribute-rename branch from 329ed9e to 2aa273b Compare February 10, 2026 14:25
Add new additive span attributes:
- network.protocol.name and network.protocol.version
- client.address and client.port from RemoteAddr
- mcp.session.id from Mcp-Session-Id header
- error.type on 5xx errors

Fix span status to follow OTEL semantic conventions:
- 4xx responses now leave span status Unset (client errors)
- 5xx responses set Error with error.type attribute
- 2xx/3xx remain Ok

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ChrisJBurns
ChrisJBurns force-pushed the otel/pr2b-new-attributes branch from 956dd9e to 54bda5c Compare February 10, 2026 14:26
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Feb 10, 2026
@ChrisJBurns

Copy link
Copy Markdown
Collaborator Author

Superseded by a new PR after rebasing onto the updated main branch (which now includes the feature-flag and attribute rename PRs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant