Repository navigation
Conversation
s1gr1d
added this pull request to stack #25455
October 16, 2026 12:14
Contributor
size-limit report 📦
|
Hono 5 removes c.req.matchedRoutes, so every request was named "GET ". It also restores c.req.routeIndex after next(), so the Sentry middleware can no longer see which handler responded. Read the match result through the getter that hono/route uses, and let each route handler record its routeIndex when it starts. A request with no matched route keeps the runtime's span name. On Hono 4 the names stay the same, except where the old rule picked a later catch-all, for example for a route handler declared with an unused next parameter. Refs #25223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
On Hono 5, every request got the span name
GETand an emptyhttp.route. With this PR, names look the same as on Hono 4:GET /users/:id, withhttp.routeset to/users/:id.Why they broke:
c.req.matchedRoutes.composeresetsc.req.routeIndexafternext()(honojs/hono#4424), so the Sentry middleware cannot see which handler responded.How the name is built now:
hono/routeuses (matchResult.ts).routeIndexon theContext.next(),resolveRouteName()uses the route at that index. If no route handler ran (a middleware returned early, or a 404), it falls back to the last matched route, as before.Hono 4 names do not change.
Refs #25223