Skip to content

Fix otelhttp span names to match the semantic conventions#8871

Merged
dmathieu merged 5 commits into
open-telemetry:mainfrom
dmathieu:otelhttp-default-span-name
May 4, 2026
Merged

Fix otelhttp span names to match the semantic conventions#8871
dmathieu merged 5 commits into
open-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.5%. Comparing base (975d448) to head (411f4ac).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8871   +/-   ##
=====================================
  Coverage   83.4%   83.5%           
=====================================
  Files        193     193           
  Lines      15850   15898   +48     
=====================================
+ Hits       13232   13285   +53     
+ Misses      2146    2141    -5     
  Partials     472     472           
Files with missing lines Coverage Δ
.../go-restful/otelrestful/internal/semconv/server.go 84.9% <100.0%> (+0.6%) ⬆️
...m/gin-gonic/gin/otelgin/internal/semconv/server.go 84.9% <100.0%> (+0.6%) ⬆️
...com/gorilla/mux/otelmux/internal/semconv/server.go 84.9% <100.0%> (+0.6%) ⬆️
.../labstack/echo/otelecho/internal/semconv/server.go 84.9% <100.0%> (+0.6%) ⬆️
...httptrace/otelhttptrace/internal/semconv/server.go 84.9% <100.0%> (+0.6%) ⬆️
instrumentation/net/http/otelhttp/handler.go 92.1% <100.0%> (ø)
...ation/net/http/otelhttp/internal/semconv/server.go 84.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.

@dmathieu dmathieu dismissed MrAlias’s stale review May 4, 2026 08:56

Requested changes have been applied.

@dmathieu dmathieu merged commit f226081 into open-telemetry:main May 4, 2026
29 checks passed
ps-mir pushed a commit to ps-mir/opentelemetry-go-contrib that referenced this pull request May 4, 2026
@pellared pellared added this to the v1.44.0 milestone May 27, 2026
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

5 participants