Skip to content

Commit c4a5142

Browse files
committed
add tests
1 parent e86eeac commit c4a5142

File tree

8 files changed

+60
-1
lines changed

8 files changed

+60
-1
lines changed

dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestPath,
3636
start_timestamp: expect.any(Number),
3737
timestamp: expect.any(Number),
3838
trace_id: tracingEvent.contexts?.trace?.trace_id,
39+
data: {
40+
'http.method': 'GET',
41+
'http.url': `http://example.com/${index}`,
42+
url: `http://example.com/${index}`,
43+
'server.address': 'example.com',
44+
type: 'fetch',
45+
},
3946
}),
4047
);
4148
});

dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ sentryTest('should create spans for XHR requests', async ({ getLocalTestPath, pa
2424
start_timestamp: expect.any(Number),
2525
timestamp: expect.any(Number),
2626
trace_id: eventData.contexts?.trace?.trace_id,
27+
data: {
28+
'http.method': 'GET',
29+
'http.url': `http://example.com/${index}`,
30+
url: `http://example.com/${index}`,
31+
'server.address': 'example.com',
32+
type: 'xhr',
33+
},
2734
}),
2835
);
2936
});

packages/browser/src/tracing/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ export function xhrCallback(
321321
attributes: {
322322
type: 'xhr',
323323
'http.method': sentryXhrData.method,
324+
'http.url': sentryXhrData.url,
324325
url: sentryXhrData.url,
325326
'server.address': parsedUrl.host,
326327
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',

packages/core/src/fetch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export function instrumentFetchRequest(
9494
url,
9595
type: 'fetch',
9696
'http.method': method,
97+
'http.url': url,
9798
'server.address': parsedUrl.host,
9899
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
99100
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',

packages/nextjs/test/integration/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@sentry/nextjs": "file:../../",
15-
"next": "latest",
15+
"next": "13.2.0",
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0"
1818
},
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "with-typescript",
3+
"license": "MIT",
4+
"scripts": {
5+
"dev": "next",
6+
"build": "next build",
7+
"predebug": "source ../integration_test_utils.sh && link_monorepo_packages '../../..' && yarn build",
8+
"start": "next start",
9+
"pretest": "yarn build",
10+
"test:client": "playwright test",
11+
"test:server": "jest --forceExit --runInBand"
12+
},
13+
"dependencies": {
14+
"@sentry/nextjs": "file:../../",
15+
"next": "latest",
16+
"react": "^18.2.0",
17+
"react-dom": "^18.2.0"
18+
},
19+
"devDependencies": {
20+
"@types/node": "^15.3.1",
21+
"@types/react": "17.0.47",
22+
"@types/react-dom": "17.0.17",
23+
"nock": "^13.1.0",
24+
"typescript": "4.9.5",
25+
"yargs": "^16.2.0"
26+
},
27+
"resolutions": {
28+
"@sentry/browser": "file:../../../browser",
29+
"@sentry/core": "file:../../../core",
30+
"@sentry/node": "file:../../../node",
31+
"@sentry/opentelemetry": "file:../../../opentelemetry",
32+
"@sentry/react": "file:../../../react",
33+
"@sentry-internal/browser-utils": "file:../../../browser-utils",
34+
"@sentry-internal/replay": "file:../../../replay-internal",
35+
"@sentry-internal/replay-canvas": "file:../../../replay-canvas",
36+
"@sentry-internal/feedback": "file:../../../feedback",
37+
"@sentry/types": "file:../../../types",
38+
"@sentry/utils": "file:../../../utils",
39+
"@sentry/vercel-edge": "file:../../../vercel-edge"
40+
}
41+
}

packages/nextjs/test/integration/test/client/tracingFetch.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ test('should correctly instrument `fetch` for performance tracing', async ({ pag
3333
data: {
3434
'http.method': 'GET',
3535
url: 'http://example.com',
36+
'http.url': 'http://example.com',
37+
'server.address': 'example.com',
3638
type: 'fetch',
3739
'http.response_content_length': expect.any(Number),
3840
'http.response.status_code': 200,

0 commit comments

Comments
 (0)