sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

feat(nextjs): remove tracing from pages router API routes

Open logaretm opened this issue 1 month ago • 2 comments

This is a big PR because of the tests added, the logic changes themselves are pretty minimal, so make sure to filter out the files when reviewing.

Actual Changes

Removed traces from wrapApiHandlerWithSentry for both the server runtime and the edge runtime

Tests Added

Since we are dropping explicit trace wrapping logic from the pages router templates, we needed to have tests on Next 16 to make sure the page router there still works in both Turbopack and Webpack with minimal differences in the quality of the traces.

We have around 36 test case to check, but only 20 can pass at this time due to the wrapping logic still present, ideally as we move towards removing templates entirely, we can then unskip those tests and tighten many of the assertions we have to accommodate for it.

I added TODOs and a TEST_STATUS.md document to detail what we should update once the SDK drops more of the wrapping logic it currently has.

Closes #18450 (added automatically)

logaretm avatar Dec 03 '25 10:12 logaretm

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 11,022 - 8,535 +29%
GET With Sentry 1,954 18% 1,608 +22%
GET With Sentry (error only) 7,856 71% 5,850 +34%
POST Baseline 1,145 - 1,166 -2%
POST With Sentry 578 50% 546 +6%
POST With Sentry (error only) 1,022 89% 1,023 -0%
MYSQL Baseline 4,044 - 3,188 +27%
MYSQL With Sentry 530 13% 427 +24%
MYSQL With Sentry (error only) 3,313 82% 2,607 +27%

View base workflow run

github-actions[bot] avatar Dec 03 '25 12:12 github-actions[bot]