-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(sveltekit): Add partial instrumentation for client-side fetch
#7626
Conversation
fetch
size-limit report 📦
|
51eca27
to
ab20d0b
Compare
ea8a521
to
df10ac4
Compare
...(urlObject.hash && { 'http.hash': urlObject.hash.substring(1) }), | ||
}; | ||
|
||
// TODO: extract this to a util function (and use it in breadcrumbs integration as well) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do this in a separate PR as this spans multiple packages
(host && | ||
host | ||
// Always filter out authority | ||
.replace(/^.*@/, '[filtered]:[filtered]@') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ain't pretty, I know... turns out finding a proper authority regex that isn't ReDos vulnerable is very hard. I think we can leave this as is for now and maybe revisit whenever we sanitize URLs everywhere on the browser side.
(I'd argue that this function should nevertheless be a good base we can reuse later on).
7cafcd7
to
5f05517
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
properly sanitize url, add url data apply data to breadcrumbs cleanup set span status add tests sorry fix authority url "fix" authority regex again cleanup move addTracingHeadersToFetchRequest back to tracing-internal cleanup apply suggestions re-activate request object test adjust types after exporting
b7ce245
to
0314949
Compare
This PR adds partial instrumentation to the client-side
fetch
passed to the universalload
functions. It enables distributed traces of fetch calls happening inside aload
function.Limitation:
fetch
requests made by SvelteKit (e.g. to call server-only load functions) are not touched by this instrumentation because we cannot access the Kit-internal fetch function at this time. Opened an issue on the SvelteKit repo to find a solution for this.Anyway, here's a fancy screenshot of a successful trace:
My guess is that sveltejs/kit#9542 and sveltejs/kit#9530 are gonna take a little while longer to be resolved. I'd say, we add this in for the moment so that we at least get these traces connected. We should take it out/adjust whenever we have
handleLoad
orhandleFetch
available.ref: #7413