-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Client performance monitoring #3552
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(nextjs): Client performance monitoring #3552
Conversation
size-limit report
|
AbhiPrasad
left a comment
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.
quick review to double check some stuff
packages/nextjs/src/index.client.ts
Outdated
| scope.setTag('runtime', 'browser'); | ||
| }); | ||
|
|
||
| startClientPerfMonitoring(); |
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.
We should only do this if they have set tracesSampleRate in client options.
The order is determined by the exposed `wrapRouter` function. This function fills the router in the same order as Next.js docs, for clarity.
As the docstring say, wrapping `changeState` in the Router should be enough to get performance monitoring on the frontend. The previous approach was based on wrapping all the exposed Router methods users could use; but these are using the `changeState` underneath (it seems router actions always call it but not 100% about it, although it _may_ work implementing far less complexity). The approach and some code has been taken from https://github.com/getsentry/sentry-javascript/tree/abhi/next-client-names
|
Ok, I added some preliminary tests by mocking out the next/router object, but they are mostly sanity checks. I think we shouldn't spend too much time on them, let's just focus on the end to end tests instead. Also, I couldn't get |
AbhiPrasad
left a comment
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.
Think we are good after the variable name change
Adds front-end performance monitoring in the Next.js SDK, by providing a router instrumentation.