-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Frontend + withSentry Performance Monitoring #3580
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
Merged
Conversation
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
Adds front-end performance monitoring in the Next.js SDK, by providing a router instrumentation.
Contributor
size-limit report
|
Member
…request data (#3577) This PR does two things: 1) It wraps two more methods on `next`'s `Server` class, one of which is called on every API request, and the other of which is called on every page request. Both methods are passed a parameterized version of the path, which our wrappers grab and use to modify the name of the currently active transaction. 2) It adds an event processor which pulls data off of the request and adds it to the event. This runs whether or not tracing is enabled, in order to add data to both error and transaction events. The only other thing of minor interest is that the type for `Event.request.query_string` is expanded to include objects, which is okay according to the dev docs: https://develop.sentry.dev/sdk/event-payloads/request/#attribute).
Just a bunch of random housekeeping. - No longer return project root directory from `instrumentServer` since it's not yet defined at that point. - No longer store transaction on `res`, since our new use of domains means that `getActiveTransaction` is safe. As a result, change `NextResponse` from an interface to a type which is purely an alias. - Store a pointer to the live `Server` instance directly on the top scope rather than in an object, and get rid of the other stuff being stored in that object (`closure`) since it can all be gotten off of the aforementioned `Server` instance. - Fix/expand/tweak various docstrings and comments. - Improve log message when tracing an outgoing HTTP request.
1) Fix a bug which prevented the "don't overwrite these keys" warning from working correctly. 2) Restrict the warning to appearing when overwriting keys which actually have values.
Automatically enable `BrowserTracing` if a traceSampler or tracesSample Rate is set. Co-authored-by: Abhijeet Prasad <[email protected]>
Use the stripUrlQueryAndFragment function from @sentry/utils instead of using our implementation.
1 task
tm1000
reviewed
May 26, 2021
| import { addIntegration, UserIntegrations } from './utils/userIntegrations'; | ||
|
|
||
| export * from '@sentry/react'; | ||
| export { nextRouterInstrumentation } from './performance/client'; |
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 is imported twice
When instrumenting the nextjs server, we should check if the public directory exists.
Update default tracingOrigins for NextJS BrowserTracing to include api routes so we can add sentry-trace header correctly.
iker-barriocanal
approved these changes
May 31, 2021
9 tasks
9 tasks
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.
This enables front end and API route performance monitoring in
@sentry/nextjs. Hat tip to @iker-barriocanal, @AbhiPrasad, and @HazAT - this was a group effort.