René's URL Explorer Experiment


Title: Improve Express Support · Issue #5510 · getsentry/sentry-javascript · GitHub

Open Graph Title: Improve Express Support · Issue #5510 · getsentry/sentry-javascript

X Title: Improve Express Support · Issue #5510 · getsentry/sentry-javascript

Description: Background In this (meta) Issue, we would like to summarize and categorize different opportunities to improve Sentry support for Express. Most things are related to Sentry's performance monitoring product but in case we come across impro...

Open Graph Description: Background In this (meta) Issue, we would like to summarize and categorize different opportunities to improve Sentry support for Express. Most things are related to Sentry's performance monitoring ...

X Description: Background In this (meta) Issue, we would like to summarize and categorize different opportunities to improve Sentry support for Express. Most things are related to Sentry's performance monitor...

Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/5510

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve Express Support","articleBody":"# Background\r\n\r\nIn this (meta) Issue, we would like to summarize and categorize different opportunities to improve Sentry support for Express. Most things are related to Sentry's performance monitoring product but in case we come across improvement opportunities for error monitoring, we're more than happy to collect them here.\r\n\r\n# Improvement Opportunities\r\n\r\nThe following sections list possible improvements for Express\r\n\r\n## Transaction names and URL Parameterization\r\n\r\nWe recently improved URL parameterization in #5450. Briefly summarized, we patch the Express router prototype to get to a fully parameterized route **before** that route's handler callback is executed. This solution isn't perfect (there are still timing issues) but it's probably the best we can do for now.\r\n\r\n_(In theory, we could explore building a tree of all possible routes and then matching incoming request URLs against this tree (with Express's matching strategies), but IMO we shouldn't open this box as it has a lot of potential to turn into an edge case nightmare without any guarantee for success. Possibly related: #5050)_ \r\n\r\n### Parameterization termination criterion\r\n\r\nOne thing we **could** look into, would be a detail in our current router instrumentation: The criterium that determines _when_ we have reached the \"last\" partial route and hence the full parameterized route was found. We currently do this by comparing the number of URL segments in the incoming vs. the accumulated parameterized route. This approach clearly has its limitations (e.g. it being brittle with regex and array routes).\r\n\r\n* [ ] [Research] is it possible to determine the final route layer more reliably\r\n\r\n### Transaction names of array routes\r\n\r\nIf users currently have a route defined with an array of paths (which can be strings or regexes (mixed)), like so:\r\n\r\n```js\r\nroute.get(['path', 'other_path/:id', /regex_path/], (req, res, next) => {...})\r\n```\r\n\r\nThe resulting transaction names they get will be a concatenation of all items in the array:\r\n\r\n```\r\nGET /path,/other_path/:id,/regex_path/\r\n```\r\n\r\nOne could argue that this is not a nice transaction name because it is not clear which item of the array actually matched the incoming array. Instead, a transaction name like so might be better:\r\n\r\n```\r\nGET /other_path/:id\r\n```\r\n\r\nFor more info and explanations see #5489\r\n\r\n* [ ] [Discussion] Is it preferrable to only take the part of the array that was matched as a transaction name?\r\n  * [ ] If yes, Change the transaction name (probably not trivial)\r\n\r\nIt's important to note that a change here does not improve transaction name cardinality. In fact, it would slightly increase the number of transactions because we would create separate (but still parameterized) transactions for each item in the routes array. \r\n\r\n## Express 5\r\n\r\n[Express 5 ](https://expressjs.com/en/guide/migrating-5.html) has been in beta for quite some time but we were recently notified that our new router instrumentation caused problems there (see #5501). For now we simply disabled early URL parameterization for the case that we don't encounter Express 4. Besides adapting our router instrumentation in the future for Express 5, we should investigate what else needs to be done to support Express 5.\r\nFor more information, see #5501\r\n\r\n* [ ] [Research] Investigate Changes in Express 5 more thoroughly\r\n  * [ ] Is the new route matching syntax problematic for our instrumentation?\r\n  * [ ] How can we access and instrument the new Router? \r\n  * [ ] Are errors reported correctly?\r\n* [ ] Make routing instrumentation/early URL parameterization compatible with Express 5\r\n* [ ] Make rest of Sentry product compatible with Express 5 if it isn't\r\n\r\n## Span Creation in Nested Routers\r\n\r\nDue to a timing conflict when nested routers are initialized vs. when Sentry is initialized, we mostly fail to instrument the registration methods (`router.get(...)`) of nested routers. These methods are usually executed when the nested router is imported, which happens before `Sentry.init` is called. This leads to missing spans of the child routers because we do not instrument the callbacks. \r\n\r\n* [ ] [Research] Can this be improved?\r\n  * [ ] Maybe a similar approach of patching prototypes like we did with the router?\r\n\r\nMore context: #3155\r\n\r\n## Proper `@sentry/express` package\r\n\r\nWe've discussed creating a `@sentry/express` package that builds on top of `@sentry/node`. Currently, our Express-specific support is limited to the Express integration users add to the Node SDK. Transactions are e.g. created in the Node SDK (in the `tracingHandler` middleware) and middleware spans + transaction parameterization happens in the Express integration. \r\n\r\nThis has already been requested by the community: #4700\r\n\r\n* [ ] [Discussion] is it worth to do this?\r\n\r\nPotential pros/cons:\r\n\\+ Signals proper Express support (similarly to what we intend to do for Svelte)\r\n\\+ Gives us the possibility to add more express-specific stuff without cluttering (or also influencing) the Node SDK used in other frameworks\r\n\\+ Might help us to declutter the Node SDK/define more clearly what's Express-specific and what was just added on top\r\n\\+ Lets us declare express versions as peer dependencies\r\n\\+ Gives us the possibility to track Express SDK vs. rest of Node SDK usage\r\n\\- What about other frameworks that build on top or are similar to Express (Koa, Connect)\r\n\\- Are there dependencies between Express stuff and NextJs/Serverless?\r\n\\~ We'd probably need to de-unify types (e.g. `CrossplatformRequest`) which might lead to a small portion of duplicated code. This, however, might not be too bad (or worth the sacrifice) considering that the type is problematic atm (https://github.com/getsentry/sentry-javascript/issues/5768) \r\n\r\n## Misc; Bugfixes\r\n\r\n* [x] #5458\r\n* [x] #5433\r\n\r\n# Call for Feedback\r\n\r\nAs always, we'd appreciate feedback! Have you been using our Node SDK (with Express) and you would like to see something changed or some feature implemented? Please let us know! Also, which of the items listed above would be most important to you? \r\n\r\nPlease feel free to give this post a 👍 if you would like to see us dedicating time to improving Express. Community feedback helps us prioritizing what to work on next.\r\n","author":{"url":"https://github.com/Lms24","@type":"Person","name":"Lms24"},"datePublished":"2022-08-02T09:21:02Z","url":"https://github.com/getsentry/sentry-javascript/issues/5510"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:93dd0a8b-f250-78d7-1ef8-9c2f26ced7ed
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id99A8:3F3939:A0EAD2:E17727:6B042F86
html-safe-nonceac2a4349d715ed1a6ecf369be4db4182751687bdb4d20b670094b05383944cab
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUE4OjNGMzkzOTpBMEVBRDI6RTE3NzI3OjZCMDQyRjg2IiwidmlzaXRvcl9pZCI6IjQ5NTAzMTk2OTczMTM5MzUyMzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4b86848babc30c55922322026c6568a0f511b2bf2043f8167c38724b6123ab13
hovercard-subject-tagissue:1325559841
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/5510/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c67217a61a7b296ae1261181d4a36282b0c1b1126252f0e139afba731990dc46/getsentry/sentry-javascript/issues/5510
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c67217a61a7b296ae1261181d4a36282b0c1b1126252f0e139afba731990dc46/getsentry/sentry-javascript/issues/5510
og:image:altBackground In this (meta) Issue, we would like to summarize and categorize different opportunities to improve Sentry support for Express. Most things are related to Sentry's performance monitoring ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameLms24
hostnamegithub.com
expected-hostnamegithub.com
Noneb7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec3dd496c3da6ea6b77e69c09279d2b81604654f1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/5510#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F5510
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F5510
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/5510
Reloadhttps://github.com/getsentry/sentry-javascript/issues/5510
Reloadhttps://github.com/getsentry/sentry-javascript/issues/5510
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues341 (341)https://github.com/getsentry/sentry-javascript/issues
Pull requests56 (56)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/5510
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/5510
Improve Express Supporthttps://github.com/getsentry/sentry-javascript/issues/5510#top
https://github.com/Lms24
Meta: Help Wantedhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Help%20Wanted%22
Type: Improvementhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Improvement%22
https://github.com/Lms24
Lms24https://github.com/Lms24
on Aug 2, 2022https://github.com/getsentry/sentry-javascript/issues/5510#issue-1325559841
#5450https://github.com/getsentry/sentry-javascript/pull/5450
#5050https://github.com/getsentry/sentry-javascript/issues/5050
#5489https://github.com/getsentry/sentry-javascript/issues/5489
Express 5 https://expressjs.com/en/guide/migrating-5.html
#5501https://github.com/getsentry/sentry-javascript/issues/5501
#5501https://github.com/getsentry/sentry-javascript/issues/5501
#3155https://github.com/getsentry/sentry-javascript/issues/3155
#4700https://github.com/getsentry/sentry-javascript/issues/4700
#5768https://github.com/getsentry/sentry-javascript/issues/5768
Cookies are being sent in an error-report by default in Express app #5458https://github.com/getsentry/sentry-javascript/issues/5458
Sentry Express instrumenting whole app instead of only router #5433https://github.com/getsentry/sentry-javascript/issues/5433
Lms24https://github.com/Lms24
on Aug 2, 2022https://github.com/getsentry/sentry-javascript/issues/5510#event-7108199573
Lms24https://github.com/Lms24
Meta: Help Wantedhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Help%20Wanted%22
Type: Improvementhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Improvement%22
Package: nodehttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Package%3A%20node%22
on Aug 2, 2022https://github.com/getsentry/sentry-javascript/issues/5510#event-7108243400
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Aug 25, 2022https://github.com/getsentry/sentry-javascript/issues/5510#issuecomment-1226631280
github-actionshttps://github.com/apps/github-actions
Status: Stalehttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Stale%22
on Aug 25, 2022https://github.com/getsentry/sentry-javascript/issues/5510#event-7255137281
Lms24https://github.com/Lms24
Status: Backloghttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Backlog%22
Status: Stalehttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Status%3A%20Stale%22
on Aug 25, 2022https://github.com/getsentry/sentry-javascript/issues/5510#event-7256789889
getsentryhttps://github.com/getsentry
on Oct 14, 2022https://github.com/getsentry/sentry-javascript/issues/5510#event-7590518791
vladanpaunovichttps://github.com/vladanpaunovic
#5962 https://github.com/getsentry/sentry-javascript/discussions/5962
on Oct 14, 2022https://github.com/getsentry/sentry-javascript/issues/5510#event-7590518860
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/5510
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/5510
Lms24https://github.com/Lms24
Meta: Help Wantedhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Meta%3A%20Help%20Wanted%22
Type: Improvementhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Type%3A%20Improvement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.