feat!: Use middleware span op for web-server middleware - #22852
Open
msonnb wants to merge 4 commits into
Open
Conversation
Middleware spans across the web-server integrations now use the single generic `middleware` op instead of library-specific leaves (`middleware.express`, `middleware.koa`, `middleware.hono`, `middleware.elysia`, `middleware.nestjs`, `middleware.nuxt`, `middleware.nitro`, `middleware.tanstackstart`, and Fastify's `hook.fastify`). The framework is already identified by the span's `sentry.origin` (`auto.http.express`, `auto.middleware.hono`, `auto.middleware.nestjs.guard`, ...), so the library-specific op leaf was redundant. Origins, mechanism types, and the sibling `router.*` / `request_handler.*` / `handler.*` / `function.*` ops are left untouched — those are separate rows in the op cleanup and keep their current values. Fastify's instance hooks map to `middleware`; its handler hook keeps `request_handler.fastify`. Elysia's lifecycle map collapses to `middleware` except `Handle`, which keeps `request_handler.elysia`. nitro and nuxt gain a `@sentry/conventions` dependency (matching the other server packages) so they can import the shared op constant. Part of #22446 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
Span creation sites set the op through the `sentry.op` attribute rather than the `op:` shorthand. hono and tanstackstart set both before; koa set only `op:` and now sets only the attribute (matching express, nestjs, nuxt, nitro, and elysia, which were already attribute-only). Unit tests that assert on the start-span call arguments are updated accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The shared fastify hook wrapper set its op through the `op:` shorthand; it now sets `sentry.op` in attributes instead, matching koa/hono/ tanstackstart. The op is only added when defined so route-hooks (which carry no op) stay unchanged; instance hooks keep `middleware` and the handler hook keeps `request_handler.fastify`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
bugbot run |
middleware span op for web-server middlewaremiddleware span op for web-server middleware
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 26befb7. Configure here.
msonnb
force-pushed
the
ms/js-3105-middleware-span-op
branch
from
July 30, 2026 12:25
26befb7 to
e938d57
Compare
msonnb
marked this pull request as ready for review
July 31, 2026 07:19
msonnb
requested review from
isaacs,
mydea,
nicohrubec and
s1gr1d
and removed request for
a team
July 31, 2026 07:19
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.

Migrates every web-server middleware span to the single generic
middlewareop from conventions, replacing the library-specific ops (middleware.express,middleware.koa,middleware.hono,middleware.elysia,middleware.nestjs,middleware.nuxt,middleware.nitro,middleware.tanstackstart, and Fastify’shook.fastify).Part of #22446