feat(nextjs): Trace navigation transactions#5676
Merged
Conversation
Contributor
size-limit report 📦
|
AbhiPrasad
reviewed
Sep 1, 2022
added 9 commits
September 5, 2022 08:07
…tside-transitions
added 2 commits
September 6, 2022 11:16
AbhiPrasad
approved these changes
Sep 6, 2022
| } | ||
| } | ||
|
|
||
| function getNextRouteFromPathname(pathname: string): string | void { |
Contributor
There was a problem hiding this comment.
I'm not the biggest fan of union typing with void - can we just union type with undefined and have an early return? (see microsoft/TypeScript#42709 on some larger issues with void that I share similar opinions on)
AbhiPrasad
approved these changes
Sep 6, 2022
| readyCalled = true; | ||
| return cb(); | ||
| events: { | ||
| on(type: string, handler: (...args: any[]) => void) { |
Contributor
There was a problem hiding this comment.
should we also test if off was called on the listener?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref: #5505
Improves Next.js clientside tracing by starting transactions earlier. Previously, requests to Next.js data-fetchers were not instrumented with
baggageandsentry-traceheaders because the requests were done before the navigation transaction was even started.To get earlier navigation transactions we make use of the
routeChangeStartrouter event, which runs before the data fetching requests go out. Sadly, at that point in time, we have no real way of knowing which parameterized route the user will navigate to. To get around this, on navigation, we take a peek at the__BUILD_MANIFESTglobal that Next.js defines. It contains a list of all parameterized routes we can use to match the navigation target against.