Conversation
This adds the `patchExpressModule` function from `@sentry/core`, along with a short integration test. Note that the express integration only takes effect if some *other* span is already started for the http server handler. A future port of the OpenTelemetryJS http instrumentation can provide this in a manner consistent to the Sentry Node SDK.
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| setupOpenTelemetryTracer(); | ||
| } | ||
|
|
||
| setAsyncLocalStorageAsyncContextStrategy(); |
There was a problem hiding this comment.
Reinit resets async context strategy
Medium Severity
Calling setAsyncLocalStorageAsyncContextStrategy() inside every init() replaces the global async context strategy each time. If init() runs again while requests are in flight, existing async chains keep running but getCurrentScope() starts reading from a new AsyncLocalStorage, which can drop or mix request scope data.
| responses = await Promise.all([ | ||
| fetch(`http://localhost:15443/user/user1/error/true`), | ||
| fetch(`http://localhost:15443/user/user2`), | ||
| fetch(`http://localhost:15443/user/user3/error/true`), |
There was a problem hiding this comment.
Express test ignores configured port
Low Severity
The server listens on PORT, but requests are sent to hardcoded 15443. When process.env.PORT is set, listen(PORT) and fetch('http://localhost:15443/...') target different ports, causing false test failures unrelated to patchExpressModule.
Additional Locations (1)
size-limit report 📦
|


This adds the
patchExpressModulefunction from@sentry/core, along with a short integration test.Note that the express integration only takes effect if some other span is already started for the http server handler. A future port of the OpenTelemetryJS http instrumentation can provide this in a manner consistent to the Sentry Node SDK.
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).Closes #JS-2030 #20058