Skip to content

Fix otelhttp span names to match the semantic conventions#8871

Open
dmathieu wants to merge 4 commits intoopen-telemetry:mainfrom
dmathieu:otelhttp-default-span-name
Open

Fix otelhttp span names to match the semantic conventions#8871
dmathieu wants to merge 4 commits intoopen-telemetry:mainfrom
dmathieu:otelhttp-default-span-name

Conversation

@dmathieu
Copy link
Copy Markdown
Member

Closes #726

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.3%. Comparing base (f259866) to head (86696da).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8871   +/-   ##
=====================================
  Coverage   83.3%   83.3%           
=====================================
  Files        193     193           
  Lines      15830   15898   +68     
=====================================
+ Hits       13193   13250   +57     
- Misses      2153    2164   +11     
  Partials     484     484           
Files with missing lines Coverage Δ
.../go-restful/otelrestful/internal/semconv/server.go 83.9% <100.0%> (+0.6%) ⬆️
...m/gin-gonic/gin/otelgin/internal/semconv/server.go 83.9% <100.0%> (+0.6%) ⬆️
...com/gorilla/mux/otelmux/internal/semconv/server.go 83.9% <100.0%> (+0.6%) ⬆️
.../labstack/echo/otelecho/internal/semconv/server.go 83.9% <100.0%> (+0.6%) ⬆️
...httptrace/otelhttptrace/internal/semconv/server.go 83.9% <100.0%> (+0.6%) ⬆️
instrumentation/net/http/otelhttp/handler.go 92.1% <100.0%> (ø)
...ation/net/http/otelhttp/internal/semconv/server.go 83.9% <100.0%> (+0.6%) ⬆️

... and 2 files with indirect coverage changes

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

@dmathieu dmathieu marked this pull request as ready for review April 27, 2026 08:23
@dmathieu dmathieu requested a review from a team as a code owner April 27, 2026 08:23
@github-actions github-actions Bot requested a review from sonalgaud12 April 27, 2026 08:23
Copy link
Copy Markdown
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Copy Markdown
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is close, but I think the new default formatter still misses a couple of cases needed to actually match the HTTP span-name rules.

The main issue is that it uses r.Pattern verbatim, while the rest of otelhttp already treats that value as needing normalization before it becomes http.route. There is also still a gap for nonstandard methods, where the span name should fall back to HTTP instead of the raw method string.

I’d prefer to fix those in this PR so the new default naming is aligned with the existing route/method normalization logic.

Comment thread instrumentation/net/http/otelhttp/handler.go Outdated
Comment thread instrumentation/net/http/otelhttp/handler.go Outdated
@dmathieu dmathieu requested a review from flc1125 as a code owner April 28, 2026 07:27
@github-actions github-actions Bot requested a review from akats7 April 28, 2026 07:27
@dmathieu dmathieu requested a review from MrAlias April 28, 2026 07:27
@dmathieu
Copy link
Copy Markdown
Member Author

I have moved the span name computation into the semconv internal package, so we can reuse the http.route computation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spans created by HTTP instrumentation package does not conform to guidelines for span names

4 participants