Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracing): Try parameterizing URLs in default routing instrumentation #5411

Conversation

lforst
Copy link
Member

@lforst lforst commented Jul 12, 2022

Ref: #5342

This PR adds parameterization of URLs in the default browser route instrumentation based on some patterns (numbers, SHA1 hashes, MD hashes, and uuids).

This will not work for all URLs.

Example: https://sentry.io/organization/some-random-org/user/14

14 will be identified as a parameter while some-random-org will not. some-random-org looks so much like a resource/pathname that we cannot with good conscience parameterize it.

This is also the reason why we're keeping the transaction source 'url' for now - simply to avoid cardinality issues downstream.

@lforst lforst self-assigned this Jul 12, 2022
@AbhiPrasad
Copy link
Member

AbhiPrasad commented Jul 12, 2022

This is technically a breaking change. Can we somhow record how many incoming transaction names will be “fixed” by applying this?

Also, do we think this needs to happen to all transactions (for ex, if we create a fallback from routing instrumentation, do we apply the heuristic to those names)?

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.36 KB (+0.01% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 59.89 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.95 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 52.8 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.71 KB (0%)
@sentry/browser - Webpack (minified) 64.15 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.73 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 44.23 KB (+0.48% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.11 KB (+1.11% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.29 KB (+0.95% 🔺)

* Keeps track of what found parameters in the URL evaluate to, e.g:
* { "uuid-1": "2778216e-b40c-46...", "uuid-2": "86024957-1789-47ec-be7..." }
*/
const pathnameParameterValues: Record<string, string> = {};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question for reviewers: Do you think we actually need to include the parameters somewhere in the transaction data?

I am leaning towards no because we also include originalPathname in the transaction data which is enough for users to figure out what the parameters were.

Transaction data is currently also not queriable in discover so there wouldn't even be an immediate upside to including it in that regard.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back to this even though the PR is closed (😿)

I think we don't include the parameters, it's un-needed bloat on the event JSON.

@lforst
Copy link
Member Author

lforst commented Jul 13, 2022

Closing this because it is breaking (behaviour wise, and also in some hooks we provide top level for processing transactions). Right now we will switch to evaluating whether such a change would be helpful. Might revisit in the future.

Good night sweet prince.

@lforst lforst closed this Jul 13, 2022
@lforst lforst deleted the lforst-parameterize-urls-default-routing-instrumentation branch August 29, 2022 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants