Deprecate otel plugin: route tagging is now built into the Goa muxer#242
Merged
Deprecate otel plugin: route tagging is now built into the Goa muxer#242
Conversation
The Goa HTTP muxer now sets r.Pattern on every dispatched request (using the Go 1.22+ convention), which otelhttp v0.65.0+ reads automatically to tag spans and metrics with the matched route. This makes the otel plugin unnecessary — its Generate function is now a no-op. The package is marked Deprecated with migration instructions to simply remove the blank import. Fixes #241
raphael
added a commit
to goadesign/goa
that referenced
this pull request
Feb 16, 2026
The default HTTP muxer now populates r.Pattern with "METHOD /path" on
every matched request, following the Go 1.22+ convention established by
http.ServeMux. This enables observability middleware such as otelhttp
(v0.65.0+) to automatically tag spans and metrics with the matched
route without any per-handler wrapping.
The pattern is captured before chi's internal wildcard rewriting, so
r.Pattern always reflects the original Goa route (e.g. GET /users/{id},
GET /files/{*path}).
This replaces the need for the otel plugin in goa.design/plugins which
has been deprecated (goadesign/plugins#242).
Fixes #3896
3 tasks
raphael
added a commit
to goadesign/goa
that referenced
this pull request
Feb 16, 2026
#3897) The default HTTP muxer now populates r.Pattern with "METHOD /path" on every matched request, following the Go 1.22+ convention established by http.ServeMux. This enables observability middleware such as otelhttp (v0.65.0+) to automatically tag spans and metrics with the matched route without any per-handler wrapping. The pattern is captured before chi's internal wildcard rewriting, so r.Pattern always reflects the original Goa route (e.g. GET /users/{id}, GET /files/{*path}). This replaces the need for the otel plugin in goa.design/plugins which has been deprecated (goadesign/plugins#242). Fixes #3896
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generatefunction is now a no-op — it returns files unchangedDeprecatedwith clear migration instructionsContext
otelhttp.WithRouteTagwas removed in otelhttp v0.65.0. The replacement isr.Pattern(Go 1.22+), which otelhttp now reads automatically.The companion change in goadesign/goa updates the default HTTP muxer to set
r.Pattern = "METHOD /path"on every dispatched request, making the plugin unnecessary. This approach:Migration
Remove the blank import from design packages and regenerate:
- import _ "goa.design/plugins/v3/otel"Fixes #241
Test plan
go test ./otel/passes — golden files match unmodified handler outputassert.Sameverifies Generate returns the input slice unchanged