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:
- Do we need to emit two spans/what is the purpose of the inner one?
- 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.
The
http.server.middlewarespan 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:sentry.opvalues here. Depending on (1), either emit anhttp.server/middleware.nextjspair, or just amiddlewarespanBackground: 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
opthan usual.