File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
dev-packages/e2e-tests/test-applications/nextjs-14
app/request-instrumentation Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ import http from 'http' ;
2
+
3
+ export const dynamic = 'force-dynamic' ;
4
+
5
+ export default async function Page ( ) {
6
+ await fetch ( 'http://example.com/' ) ;
7
+ await new Promise < void > ( resolve => {
8
+ http . get ( 'http://example.com/' , ( ) => {
9
+ resolve ( ) ;
10
+ } ) ;
11
+ } ) ;
12
+ return < p > Hello World!</ p > ;
13
+ }
Original file line number Diff line number Diff line change
1
+ import { expect , test } from '@playwright/test' ;
2
+ import { waitForTransaction } from '../event-proxy-server' ;
3
+
4
+ test ( 'Should send a transaction with a fetch span' , async ( { page } ) => {
5
+ const transactionPromise = waitForTransaction ( 'nextjs-14' , async transactionEvent => {
6
+ return transactionEvent ?. transaction === 'Page Server Component (/request-instrumentation)' ;
7
+ } ) ;
8
+
9
+ await page . goto ( `/request-instrumentation` ) ;
10
+
11
+ expect ( ( await transactionPromise ) . spans ) . toContainEqual (
12
+ expect . objectContaining ( {
13
+ data : expect . objectContaining ( {
14
+ 'http.method' : 'GET' ,
15
+ 'sentry.op' : 'http.client' ,
16
+ 'sentry.origin' : 'auto.http.node.undici' ,
17
+ } ) ,
18
+ description : 'GET http://example.com/' ,
19
+ } ) ,
20
+ ) ;
21
+
22
+ expect ( ( await transactionPromise ) . spans ) . toContainEqual (
23
+ expect . objectContaining ( {
24
+ data : expect . objectContaining ( {
25
+ 'http.method' : 'GET' ,
26
+ 'sentry.op' : 'http.client' ,
27
+ 'sentry.origin' : 'auto.http.node.http' ,
28
+ } ) ,
29
+ description : 'GET http://example.com/' ,
30
+ } ) ,
31
+ ) ;
32
+ } ) ;
You can’t perform that action at this time.
0 commit comments