fix: carry the tracing span in the request store instead of copying the event - #16600
fix: carry the tracing span in the request store instead of copying the event#16600Nic-Polumeyv wants to merge 6 commits into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/1ad7c0a16f49b7dd1aaf8893fb11ec26dbe63489Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: 1ad7c0a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f5e6545 to
ba9fc1d
Compare
elliott-with-the-longest-name-on-github
left a comment
There was a problem hiding this comment.
This would be a breaking change. event.current is supposed to be the enclosing SvelteKit span, not whichever span happens to be active whenever it's accessed -- you should be able to call getReqeustEvent from some deeply-nested place and get access to the currently-active SvelteKit span.
| const url = new URL(event.url); | ||
| url.pathname = normalize_path(url.pathname, trailing_slash); | ||
|
|
||
| const new_event = { ...event, url }; | ||
|
|
There was a problem hiding this comment.
Is it actually safe to remove this? It seems like probably not?
There was a problem hiding this comment.
Yeah, fair. I'll switch back. Good thing it's just an easy commit revert. The single event identity and the copy deletions don't depend on the getter, so the rest of the PR is unchanged.
There was a problem hiding this comment.
It's still normalized, it just happens in respond.js now, so data requests get the same URL that page requests already get before handle runs.
…he sveltekit span
Breaking in a way that makes sense, or breaking in a way that we probably don't want to do? |
|
Breaking in a way we probably do not want to do. |
|
Already reverted in 1ad7c0a. tracing.current is the enclosing SvelteKit span again, carried in the request store. There's a test now pinning that attributes set via current land on the load span. |
|
This adds a lot of complexity to fix something that, at the end of the day, isn't actually a bug. You're not supposed to be able to write to top-level properties of |
Fixes #15040. Every server-side copy of the request event existed only to vary
tracing.currentper span. The span now travels in the request store instead, withcurrenta getter reading it, and the copies are gone.The data-request copy is gone too; the pathname is now normalized in place instead.
Part of #16519.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits