Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(nuxt): implement server middleware instrumentation #17796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
logaretm wants to merge 8 commits into develop
base: develop
Choose a base branch
Loading
from awad/instrument-nuxt-nitro-middlewares

Conversation

Copy link
Collaborator

@logaretm logaretm commented Sep 26, 2025
edited
Loading

This pull request introduces instrumentation for Nuxt middleware, ensuring that all middleware handlers are automatically wrapped with tracing and error reporting functionality. The integration is achieved through build-time transformation.

recap:

  • Adds a new build-time Rollup plugin (middlewareInstrumentationPlugin) that automatically wraps all detected middleware handlers with Sentry instrumentation during the Nitro build process.
  • Implements the wrapMiddlewareHandler utility, which wraps middleware handlers to start a Sentry span, capture request data, record exceptions, and flush events in serverless environments.
  • Updates the Nuxt module setup to inject Sentry middleware imports and instrumentation hooks during initialization, ensuring the new tracing logic is included in server builds.

TODO:

  • Test traces and span visibility.
  • Add unit/integration tests.
  • Add E2E tests.
  • Check to see if there are other ways to add middleware that would bypass the transformer.

@logaretm logaretm changed the title (削除) feat: implement nuxt server middleware instrumentation (削除ここまで) (追記) feat(nuxt): implement server middleware instrumentation (追記ここまで) Sep 26, 2025
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,588 - 8,926 -4%
GET With Sentry 1,338 16% 1,388 -4%
GET With Sentry (error only) 6,109 71% 6,167 -1%
POST Baseline 1,197 - 1,192 +0%
POST With Sentry 528 44% 521 +1%
POST With Sentry (error only) 1,063 89% 1,034 +3%
MYSQL Baseline 3,338 - 3,366 -1%
MYSQL With Sentry 513 15% 468 +10%
MYSQL With Sentry (error only) 2,754 83% 2,732 +1%

View base workflow run

@logaretm logaretm force-pushed the awad/instrument-nuxt-nitro-middlewares branch from e7b0353 to a8ce604 Compare September 26, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /