Skip to content

Adjust NextJS http.server.middleware spans and ops #21718

Description

@Lms24

The http.server.middleware span op is currently emitted for NextJS middleware spans. More specifically, for a root middleware span as well as one child span of said root. There are two things I'd like to investigate and adjust:

  1. Do we need to emit two spans/what is the purpose of the inner one?
  2. We should change the sentry.op values here. Depending on (1), either emit an http.server/ middleware.nextjs pair, or just a middleware span

Background: NextJS middleware runs in process isolation (I think as an edge function) during request handling, causing the outermost span of said middleware execution to become a segment span (transaction) rather than a conventional child span. This makes it behave a bit differently to conventional middleware, which likely caused us to use a different op than usual.

Metadata

Metadata

Assignees

Labels

javascriptPull requests that update javascript code

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions