Skip to content

Next.js: Stop setting http.route to middleware GET on proxy root spans #27067

Todo

Description

@chargome

handleMiddlewareSpanStart in packages/nextjs/src/server/serverSpanHooks.ts copies the span name of the proxy into http.route on the root span. The value is middleware GET, which is not a route.

Effect

  • Grouping and filtering by http.route gets a value that is not a route.
  • The span description becomes GET middleware GET, because it is built from the method and http.route.

To do

  • Do not write the proxy name into http.route.
  • Check that nothing depends on it. maybeHoistRouteToRootSpan skips hoisting when http.route is already set, so removing the value can change how later route spans rename the root.

Activity

  1. linear-code commented on Dec 2, 2026

    @linear-code
  2. Gerakaustubh commented on Dec 4, 2026

    @Gerakaustubh

    Would a maintainer be open to a PR for this? I’d keep the middleware span name separate from http.route and add regression coverage for both a middleware-only response and a request that reaches a named Next.js route.

  3. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Dec 4, 2026
  4. chargome commented on Dec 4, 2026

    @chargome
    MemberAuthor

    @Gerakaustubh we'll handle this internally but thanks for reaching out!

  5. self-assigned this
    on Dec 4, 2026
  6. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions