Title: Improve paramaterization of transaction names · Issue #5342 · getsentry/sentry-javascript · GitHub
Open Graph Title: Improve paramaterization of transaction names · Issue #5342 · getsentry/sentry-javascript
X Title: Improve paramaterization of transaction names · Issue #5342 · getsentry/sentry-javascript
Description: Describe the idea We need to revisit how the JS SDK captures transactions (URL routes) and sends them to sentry. Reasons for doing this and things we need to consider: parameterization: We should parameterize URLs whenever possible Becau...
Open Graph Description: Describe the idea We need to revisit how the JS SDK captures transactions (URL routes) and sends them to sentry. Reasons for doing this and things we need to consider: parameterization: We should p...
X Description: Describe the idea We need to revisit how the JS SDK captures transactions (URL routes) and sends them to sentry. Reasons for doing this and things we need to consider: parameterization: We should p...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/5342
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve paramaterization of transaction names","articleBody":"## **Describe the idea**\r\nWe need to revisit how the JS SDK captures transactions (URL routes) and sends them to sentry.\r\n\r\nReasons for doing this and things we need to consider:\r\n* parameterization: We should parameterize URLs **whenever possible** \r\n\r\nBecause\r\n\r\n* grouping: transaction name influences transaction grouping; raw URL names lead to ungroupted transactions \r\n* indexing and high cardinality: Raw URL transaction names lead to a high cardinality of transactions (because they're not grouped)\r\n* PII: Raw URL transaction names can contain sensitive data/PII (e.g. IDs, auth tokens, etc.)\r\n* Dynamic Sampling: Propagating raw URLs in DSC vs. showing parameterized routes in the Sentry UI (and the DS settings) creates a lot of user confusion\r\n\r\nBest effort has been decent so far, but the fallback to unparameterized or whole URL maybe sub-optimal.\r\n\r\n### Examples:\r\n* Low-cardinality transaction name:\r\n * `{\"transaction\": \"/users/{username}\", \"transaction_source\": \"route\"}`\r\n* Presumably a high-cardinality transaction name:\r\n * `{\"transaction\": \"/users/123235\", \"transaction_source\": \"uri\"}`\r\n* User-defined transaction name, cardinality unknown:\r\n * `{\"transaction\": \"my_transaction_name\", \"transaction_source\": \"custom\"}`\r\n\r\n## Requirement:\r\n\r\n\r\n_what should be sent and where?_\r\n\r\n[baggage header](https://develop.sentry.dev/sdk/performance/dynamic-sampling-context/#baggage-header)\r\n- `sentry-transaction`\r\n[`trace` Envelope Header](https://develop.sentry.dev/sdk/performance/dynamic-sampling-context/#envelope-header)\r\n- `transaction` (string) \r\n- transaction envelope payload\r\n\r\n\u003cimg src=\"https://user-images.githubusercontent.com/47563310/176677083-84cdf9b7-3507-4c36-af7a-7021b82e7cba.png\">\r\n\r\n- error envelope payload\r\n\r\n\u003cimg src=\"https://user-images.githubusercontent.com/47563310/176677351-e54c9b4d-32ed-41b9-b6be-3e1dfb89045f.png\">\r\n\r\n- in the envelope header\r\n\r\n\r\n## **Possible implementation**\r\n\r\nThere's a couple of things we can do or at least check:\r\n\r\n### Existing Routing Instrumentations with parameterization\r\n\r\nAs listed in #5345, we have a lot of popular routers covered with routing instrumentations. However, we might be able to improve paramenterizations in some of them. Hence, for each instrumentation\r\n\r\n- check if there is a way to parameterize earlier\r\n- try to match routes better (if it turns out that there are cases where our current matching fails)\r\n- (send source information; tracked in #5345)\r\n\r\n### Existing Routing Instrumentations without parameterization\r\n\r\nTODO: Check to which routers this applies\r\n\r\nThere are some routing instrumentations that don't parameterize currently. \r\n\r\n- add parameterization whenever possible \r\n\r\n### TBD: Approximative Parameterization\r\n\r\nThis has been discussed quite a bit in the past but given that we have to make our best effort for parameterization, let's revisit this topic. The idea is seemingly simple: We could try to add a mechanism that takes a raw URL and tries to guess parts of that URL that might be parameters (e.g. IDs, tokens, etc). The mechanism would then replace these parts with a generic param placeholder.\r\n\r\nExample:\r\n\r\n`/users/1235/credentials` ==> `users/:id/credentials`\r\n\r\nThere are a lot of possible issues with this because obviously, there are going to be loads of edge cases, where this approximation might be off or miss parameters completely. \r\n\r\n\r\n## _Why is this challenging?_\r\n\r\n* In the product, we have to explain why DSC might have another (or no) transaction name than what's visible in the UI\r\n* We have to explain why unparameterized routes are sent and even full URLs. \r\n* Some frameworks and routers provide unique challenges\r\n* What about custom routing instrumentations we don't control? \r\n\r\n\r\n## Places to improve parameterization \r\n- [x] nextjs (@lobsterkatie ) https://github.com/getsentry/sentry-javascript/issues/5505\r\n- [x] express integration (#5450, @Lms24)\r\n- [x] angular (#5416, @Lms24)\r\n- [x] vue (I think Vue is pretty much optimal, @lforst)\r\n- [x] react router (pretty much optimal) \r\n - [x] react router v6 https://github.com/getsentry/sentry-javascript/pull/5515\r\n- [x] without framework (https://github.com/getsentry/sentry-javascript/pull/5411, @lforst)\n- [x] remix https://github.com/getsentry/sentry-javascript/pull/5491\n- [x] Ember\n- [ ] Gatsby\r\n\r\n\r\n","author":{"url":"https://github.com/smeubank","@type":"Person","name":"smeubank"},"datePublished":"2022-06-30T12:35:00Z","url":"https://github.com/getsentry/sentry-javascript/issues/5342"}
| 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:e22376af-cc78-bd92-d6ae-2ece3a62f6d0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3C2:14278D:2EA8D:3E19D:6B04452E |
| html-safe-nonce | 8fe3280ffdcd76c7345715d444d9d7c47b56062f2f454a803c941337ce8e443e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0MyOjE0Mjc4RDoyRUE4RDozRTE5RDo2QjA0NDUyRSIsInZpc2l0b3JfaWQiOiI1NTA5MzA3ODM5NzU3NDM2MjA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c795bffde47e2e8bd052b9fc441d195b54fcf826981b3a6eabfdc57ae571acc9 |
| hovercard-subject-tag | issue:1290072539 |
| 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/5342/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5d125a3b41db130a8bd94062caf46aa54107f81524da6c63828670e739e700c5/getsentry/sentry-javascript/issues/5342 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5d125a3b41db130a8bd94062caf46aa54107f81524da6c63828670e739e700c5/getsentry/sentry-javascript/issues/5342 |
| og:image:alt | Describe the idea We need to revisit how the JS SDK captures transactions (URL routes) and sends them to sentry. Reasons for doing this and things we need to consider: parameterization: We should p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | smeubank |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| 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 | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| 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