Title: Consolidate request-handling utils · Issue #5599 · getsentry/sentry-javascript · GitHub
Open Graph Title: Consolidate request-handling utils · Issue #5599 · getsentry/sentry-javascript
X Title: Consolidate request-handling utils · Issue #5599 · getsentry/sentry-javascript
Description: Problem Statement So while I've been reviewing all the nextjs PRs + working on remix, I figured we should probably take some time to consolidate all the utils we have around managing requests and setting domains, perhaps exporting them a...
Open Graph Description: Problem Statement So while I've been reviewing all the nextjs PRs + working on remix, I figured we should probably take some time to consolidate all the utils we have around managing requests and s...
X Description: Problem Statement So while I've been reviewing all the nextjs PRs + working on remix, I figured we should probably take some time to consolidate all the utils we have around managing requests a...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/5599
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consolidate request-handling utils","articleBody":"### Problem Statement\n\nSo while I've been reviewing all the nextjs PRs + working on remix, I figured we should probably take some time to consolidate all the utils we have around managing requests and setting domains, perhaps exporting them all from `@sentry/node` so they can be consumed accordingly.\r\n\r\nWe now have a couple of steps we always need to do here, and there's probably a bunch I'm missing\r\n\r\n1. monkey-patch the request handler to consume some kind of req (either a fetch API req https://developer.mozilla.org/en-US/docs/Web/API/Request or a express-like req)\r\n2. Set up domain to prevent scope bleed\r\n3. extract sentry-trace and baggage from req\r\n4. Add request data through event processor\r\n5. extract method from req\r\n6. Get paramaterized name\r\n7. Start transaction with `op`: `http.server`, `name`: `${METHOD} ${PARAMETERIZED_NAME}`\r\n8. Automatically capture `5xx` as errors\r\n9. Call original request handler OR call next() in the case of middleware\r\n10. try-catch the request handler to process errors\r\n11. patch response end to end transaction and do cleanup\n\n### Solution Brainstorm\n\nIdeally the goal is as follows.\r\n\r\nWe have a common set of utilities that is all called under the hood, so framework instrumentation just calls `wrapRequestHandler(frameworkRequestHandler))` and everything should be done.\r\n\r\nThis way we can also tell folks in docs to just use our utils if they are using a framework we don't support.\r\n\r\nThis is tech debt - but worthwhile for us to work on since it'll help unblock future Node SDK work (and reduce all the duplication and inconsistency between express handlers, nextjs `withSentry`, nextjs data fetching instrumentation, and remix.","author":{"url":"https://github.com/AbhiPrasad","@type":"Person","name":"AbhiPrasad"},"datePublished":"2022-08-17T18:47:57Z","url":"https://github.com/getsentry/sentry-javascript/issues/5599"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:59e40baf-50dc-08c9-abc9-2ee507bccb2d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D90:2D8562:1016E8:15D613:6B042DDF |
| html-safe-nonce | 1f3a58d04813259fe1f326c4e8223feb7467d82f0dd06555e1587b51e3dc9ed0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDkwOjJEODU2MjoxMDE2RTg6MTVENjEzOjZCMDQyRERGIiwidmlzaXRvcl9pZCI6Ijc3MjU1NzE4MjQxODAwMTQ1NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 236f60801f16cc55e2f0d73d1912fe2352e65099a50e8b0b7c2f07255eb834e3 |
| hovercard-subject-tag | issue:1342146019 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/5599/issue_layout |
| twitter:image | https://opengraph.githubassets.com/40436676ed4e22c0e27ed4df71d721fc1acc075a32bf0cc1a21c9bd395adb8d0/getsentry/sentry-javascript/issues/5599 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/40436676ed4e22c0e27ed4df71d721fc1acc075a32bf0cc1a21c9bd395adb8d0/getsentry/sentry-javascript/issues/5599 |
| og:image:alt | Problem Statement So while I've been reviewing all the nextjs PRs + working on remix, I figured we should probably take some time to consolidate all the utils we have around managing requests and s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AbhiPrasad |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width