-
-
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(nextjs): Use spans generated by Next.js for App Router #12729
Merged
Merged
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
7034d96
this will break in a million ways
lforst c4fc30b
Apply isolation scope to transaction
lforst e4b3f1d
Fix generation function tests
lforst 5bd6e0b
Fix request instrumentation tests
lforst d35762a
Fix next-15 e2e tests
lforst 79fabbf
Fix some nextjs-app-dir tests
lforst 1cdfdc9
test: Fix e2e test race condition by buffering events
lforst f98a72f
Merge branch 'lforst-event-proxy-no-race-condition' into lforst-otel-…
lforst 8737b7e
Merge branch 'develop' into lforst-otel-for-nextjs
lforst 9ca8137
stuff
lforst 0ba02be
interesting
lforst cda4fb3
Merge branch 'develop' into lforst-otel-for-nextjs
lforst 8e75acf
wut
lforst 18fe54d
test
lforst a3146c9
Merge branch 'develop' into lforst-otel-for-nextjs
lforst d4aa8f1
.
lforst 84d9bd7
logic
lforst 403b28e
Merge branch 'develop' into lforst-otel-for-nextjs
lforst a949cce
fix some stuff
lforst 1dd7c77
dum dum
lforst 1a8a2db
meep moop
lforst 542bcda
drop ingest spans
lforst 19260d6
span quality
lforst c5bd534
Merge branch 'develop' into lforst-otel-for-nextjs
lforst 88f9a54
Add test
lforst 2ecb806
Merge remote-tracking branch 'origin/develop' into lforst-otel-for-ne…
lforst df0c49e
Review feedback
lforst ceb9d2c
Add changelog entry
lforst 690a07d
Merge branch 'develop' into lforst-otel-for-nextjs
lforst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
49 changes: 10 additions & 39 deletions
49
.../e2e-tests/test-applications/nextjs-app-dir/tests/connected-servercomponent-trace.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,21 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
||
test('Will capture a connected trace for all server components and generation functions when visiting a page', async ({ | ||
test('Will create a transaction with spans for every server component and metadata generation functions when visiting a page', async ({ | ||
page, | ||
}) => { | ||
const someConnectedEvent = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
return ( | ||
transactionEvent?.transaction === 'Layout Server Component (/(nested-layout)/nested-layout)' || | ||
transactionEvent?.transaction === 'Layout Server Component (/(nested-layout))' || | ||
transactionEvent?.transaction === 'Page Server Component (/(nested-layout)/nested-layout)' || | ||
transactionEvent?.transaction === 'Page.generateMetadata (/(nested-layout)/nested-layout)' | ||
); | ||
const serverTransactionEventPromise = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
return transactionEvent?.transaction === 'GET /nested-layout'; | ||
}); | ||
|
||
const layout1Transaction = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
return ( | ||
transactionEvent?.transaction === 'Layout Server Component (/(nested-layout)/nested-layout)' && | ||
(await someConnectedEvent).contexts?.trace?.trace_id === transactionEvent.contexts?.trace?.trace_id | ||
); | ||
}); | ||
|
||
const layout2Transaction = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
return ( | ||
transactionEvent?.transaction === 'Layout Server Component (/(nested-layout))' && | ||
(await someConnectedEvent).contexts?.trace?.trace_id === transactionEvent.contexts?.trace?.trace_id | ||
); | ||
}); | ||
|
||
const pageTransaction = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
return ( | ||
transactionEvent?.transaction === 'Page Server Component (/(nested-layout)/nested-layout)' && | ||
(await someConnectedEvent).contexts?.trace?.trace_id === transactionEvent.contexts?.trace?.trace_id | ||
); | ||
}); | ||
await page.goto('/nested-layout'); | ||
|
||
const generateMetadataTransaction = waitForTransaction('nextjs-app-dir', async transactionEvent => { | ||
return ( | ||
transactionEvent?.transaction === 'Page.generateMetadata (/(nested-layout)/nested-layout)' && | ||
(await someConnectedEvent).contexts?.trace?.trace_id === transactionEvent.contexts?.trace?.trace_id | ||
); | ||
const spanDescriptions = (await serverTransactionEventPromise).spans?.map(span => { | ||
return span.description; | ||
}); | ||
|
||
await page.goto('/nested-layout'); | ||
|
||
expect(await layout1Transaction).toBeDefined(); | ||
expect(await layout2Transaction).toBeDefined(); | ||
expect(await pageTransaction).toBeDefined(); | ||
expect(await generateMetadataTransaction).toBeDefined(); | ||
expect(spanDescriptions).toContainEqual('Layout Server Component (/(nested-layout)/nested-layout)'); | ||
expect(spanDescriptions).toContainEqual('Layout Server Component (/(nested-layout))'); | ||
expect(spanDescriptions).toContainEqual('Page Server Component (/(nested-layout)/nested-layout)'); | ||
expect(spanDescriptions).toContainEqual('Page.generateMetadata (/(nested-layout)/nested-layout)'); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
🤞
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.
my thought was: If the tests leak, the tests are bad anyways.
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.
👍