Skip to content

Commit e9de4b7

Browse files
committed
Merge branch 'develop' into fn/replay-unwrapped-setTimeout-billy
2 parents f7a60d5 + abe31ba commit e9de4b7

File tree

84 files changed

+1099
-496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1099
-496
lines changed

.size-limit.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,19 @@ module.exports = [
194194
'node:http',
195195
'node:https',
196196
'node:diagnostics_channel',
197+
'node:perf_hooks',
198+
'node:worker_threads',
199+
'node:inspector',
200+
'node:path',
201+
'node:fs',
202+
'node:stream',
203+
'node:os',
204+
'node:net',
205+
'node:zlib',
206+
'node:child_process',
207+
'node:tls',
208+
'node:async_hooks',
209+
'node:util',
197210
'async_hooks',
198211
'child_process',
199212
'fs',
@@ -220,6 +233,19 @@ module.exports = [
220233
'node:http',
221234
'node:https',
222235
'node:diagnostics_channel',
236+
'node:perf_hooks',
237+
'node:worker_threads',
238+
'node:inspector',
239+
'node:path',
240+
'node:fs',
241+
'node:stream',
242+
'node:os',
243+
'node:net',
244+
'node:zlib',
245+
'node:child_process',
246+
'node:tls',
247+
'node:async_hooks',
248+
'node:util',
223249
'async_hooks',
224250
'child_process',
225251
'perf_hooks',

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Functional Software, Inc. dba Sentry
3+
Copyright (c) 2012-2024 Functional Software, Inc. dba Sentry
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

dev-packages/e2e-tests/test-applications/node-connect/playwright.config.ts renamed to dev-packages/e2e-tests/test-applications/node-connect/playwright.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { PlaywrightTestConfig } from '@playwright/test';
21
import { devices } from '@playwright/test';
32

43
const connectPort = 3030;
@@ -7,7 +6,7 @@ const eventProxyPort = 3031;
76
/**
87
* See https://playwright.dev/docs/test-configuration.
98
*/
10-
const config: PlaywrightTestConfig = {
9+
const config = {
1110
testDir: './tests',
1211
/* Maximum time one test can run for. */
1312
timeout: 150_000,

dev-packages/e2e-tests/test-applications/node-connect/tests/transactions.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,22 @@ test('Sends an API route transaction', async ({ baseURL }) => {
7272
},
7373
{
7474
data: {
75-
'sentry.origin': 'manual',
75+
'sentry.origin': 'auto.http.otel.connect',
76+
'sentry.op': 'request_handler.connect',
7677
'http.route': '/test-transaction',
7778
'connect.type': 'request_handler',
7879
'connect.name': '/test-transaction',
7980
'otel.kind': 'INTERNAL',
8081
},
81-
description: 'request handler - /test-transaction',
82+
op: 'request_handler.connect',
83+
description: '/test-transaction',
8284
parent_span_id: expect.any(String),
8385
span_id: expect.any(String),
8486
start_timestamp: expect.any(Number),
8587
status: 'ok',
8688
timestamp: expect.any(Number),
8789
trace_id: expect.any(String),
88-
origin: 'manual',
90+
origin: 'auto.http.otel.connect',
8991
},
9092
],
9193
transaction: 'GET /test-transaction',

dev-packages/e2e-tests/test-applications/node-connect/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"strict": true,
77
"noEmit": true
88
},
9-
"include": ["*.ts"]
9+
"include": ["src/*.ts"]
1010
}

dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ test('Should record a transaction for route with parameters', async ({ request }
6868
'http.route': '/',
6969
'otel.kind': 'INTERNAL',
7070
'sentry.origin': 'auto.http.otel.express',
71+
'sentry.op': 'middleware.express',
7172
},
72-
description: 'middleware - query',
73+
op: 'middleware.express',
74+
description: 'query',
7375
origin: 'auto.http.otel.express',
7476
parent_span_id: expect.any(String),
7577
span_id: expect.any(String),
@@ -86,8 +88,10 @@ test('Should record a transaction for route with parameters', async ({ request }
8688
'http.route': '/',
8789
'otel.kind': 'INTERNAL',
8890
'sentry.origin': 'auto.http.otel.express',
91+
'sentry.op': 'middleware.express',
8992
},
90-
description: 'middleware - expressInit',
93+
op: 'middleware.express',
94+
description: 'expressInit',
9195
origin: 'auto.http.otel.express',
9296
parent_span_id: expect.any(String),
9397
span_id: expect.any(String),
@@ -104,8 +108,10 @@ test('Should record a transaction for route with parameters', async ({ request }
104108
'http.route': '/test-transaction/:param',
105109
'otel.kind': 'INTERNAL',
106110
'sentry.origin': 'auto.http.otel.express',
111+
'sentry.op': 'request_handler.express',
107112
},
108-
description: 'request handler - /test-transaction/:param',
113+
op: 'request_handler.express',
114+
description: '/test-transaction/:param',
109115
origin: 'auto.http.otel.express',
110116
parent_span_id: expect.any(String),
111117
span_id: expect.any(String),

dev-packages/e2e-tests/test-applications/node-express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@types/node": "18.15.1",
2121
"express": "4.19.2",
2222
"typescript": "4.9.5",
23-
"zod": "^3.22.4"
23+
"zod": "~3.22.4"
2424
},
2525
"devDependencies": {
2626
"@sentry-internal/event-proxy-server": "link:../../../event-proxy-server",

dev-packages/e2e-tests/test-applications/node-express/tests/transaction.test.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForTransaction } from '@sentry-internal/event-proxy-server';
3+
import axios, { AxiosError } from 'axios';
4+
5+
const authToken = process.env.E2E_TEST_AUTH_TOKEN;
6+
const sentryTestOrgSlug = process.env.E2E_TEST_SENTRY_ORG_SLUG;
7+
const sentryTestProject = process.env.E2E_TEST_SENTRY_TEST_PROJECT;
8+
const EVENT_POLLING_TIMEOUT = 90_000;
9+
10+
test('Sends an API route transaction', async ({ baseURL }) => {
11+
const pageloadTransactionEventPromise = waitForTransaction('node-express', transactionEvent => {
12+
return (
13+
transactionEvent?.contexts?.trace?.op === 'http.server' &&
14+
transactionEvent?.transaction === 'GET /test-transaction'
15+
);
16+
});
17+
18+
await axios.get(`${baseURL}/test-transaction`);
19+
20+
const transactionEvent = await pageloadTransactionEventPromise;
21+
const transactionEventId = transactionEvent.event_id;
22+
23+
expect(transactionEvent.contexts?.trace).toEqual({
24+
data: {
25+
'sentry.source': 'route',
26+
'sentry.origin': 'auto.http.otel.http',
27+
'sentry.op': 'http.server',
28+
'sentry.sample_rate': 1,
29+
url: 'http://localhost:3030/test-transaction',
30+
'otel.kind': 'SERVER',
31+
'http.response.status_code': 200,
32+
'http.url': 'http://localhost:3030/test-transaction',
33+
'http.host': 'localhost:3030',
34+
'net.host.name': 'localhost',
35+
'http.method': 'GET',
36+
'http.scheme': 'http',
37+
'http.target': '/test-transaction',
38+
'http.user_agent': 'axios/1.6.7',
39+
'http.flavor': '1.1',
40+
'net.transport': 'ip_tcp',
41+
'net.host.ip': expect.any(String),
42+
'net.host.port': expect.any(Number),
43+
'net.peer.ip': expect.any(String),
44+
'net.peer.port': expect.any(Number),
45+
'http.status_code': 200,
46+
'http.status_text': 'OK',
47+
'http.route': '/test-transaction',
48+
},
49+
op: 'http.server',
50+
span_id: expect.any(String),
51+
status: 'ok',
52+
trace_id: expect.any(String),
53+
origin: 'auto.http.otel.http',
54+
});
55+
56+
expect(transactionEvent).toEqual(
57+
expect.objectContaining({
58+
transaction: 'GET /test-transaction',
59+
type: 'transaction',
60+
transaction_info: {
61+
source: 'route',
62+
},
63+
}),
64+
);
65+
66+
const spans = transactionEvent.spans || [];
67+
68+
expect(spans).toContainEqual({
69+
data: {
70+
'sentry.origin': 'auto.http.otel.express',
71+
'sentry.op': 'middleware.express',
72+
'http.route': '/',
73+
'express.name': 'query',
74+
'express.type': 'middleware',
75+
'otel.kind': 'INTERNAL',
76+
},
77+
description: 'query',
78+
op: 'middleware.express',
79+
origin: 'auto.http.otel.express',
80+
parent_span_id: expect.any(String),
81+
span_id: expect.any(String),
82+
start_timestamp: expect.any(Number),
83+
status: 'ok',
84+
timestamp: expect.any(Number),
85+
trace_id: expect.any(String),
86+
});
87+
88+
expect(spans).toContainEqual({
89+
data: {
90+
'sentry.origin': 'auto.http.otel.express',
91+
'sentry.op': 'middleware.express',
92+
'http.route': '/',
93+
'express.name': 'expressInit',
94+
'express.type': 'middleware',
95+
'otel.kind': 'INTERNAL',
96+
},
97+
description: 'expressInit',
98+
op: 'middleware.express',
99+
origin: 'auto.http.otel.express',
100+
parent_span_id: expect.any(String),
101+
span_id: expect.any(String),
102+
start_timestamp: expect.any(Number),
103+
status: 'ok',
104+
timestamp: expect.any(Number),
105+
trace_id: expect.any(String),
106+
});
107+
108+
expect(spans).toContainEqual({
109+
data: {
110+
'sentry.origin': 'auto.http.otel.express',
111+
'sentry.op': 'request_handler.express',
112+
'http.route': '/test-transaction',
113+
'express.name': '/test-transaction',
114+
'express.type': 'request_handler',
115+
'otel.kind': 'INTERNAL',
116+
},
117+
description: '/test-transaction',
118+
op: 'request_handler.express',
119+
origin: 'auto.http.otel.express',
120+
parent_span_id: expect.any(String),
121+
span_id: expect.any(String),
122+
start_timestamp: expect.any(Number),
123+
status: 'ok',
124+
timestamp: expect.any(Number),
125+
trace_id: expect.any(String),
126+
});
127+
128+
await expect
129+
.poll(
130+
async () => {
131+
try {
132+
const response = await axios.get(
133+
`https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/events/${transactionEventId}/`,
134+
{ headers: { Authorization: `Bearer ${authToken}` } },
135+
);
136+
137+
return response.status;
138+
} catch (e) {
139+
if (e instanceof AxiosError && e.response) {
140+
if (e.response.status !== 404) {
141+
throw e;
142+
} else {
143+
return e.response.status;
144+
}
145+
} else {
146+
throw e;
147+
}
148+
}
149+
},
150+
{
151+
timeout: EVENT_POLLING_TIMEOUT,
152+
},
153+
)
154+
.toBe(200);
155+
});

dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,30 @@ test('Sends successful transaction', async ({ baseURL }) => {
5656
},
5757
}),
5858
);
59+
60+
const spans = transactionEvent.spans || [];
61+
62+
expect(spans).toEqual([
63+
{
64+
data: {
65+
'hapi.type': 'router',
66+
'http.method': 'GET',
67+
'http.route': '/test-success',
68+
'otel.kind': 'INTERNAL',
69+
'sentry.op': 'router.hapi',
70+
'sentry.origin': 'auto.http.otel.hapi',
71+
},
72+
description: 'GET /test-success',
73+
op: 'router.hapi',
74+
origin: 'auto.http.otel.hapi',
75+
parent_span_id: expect.any(String),
76+
span_id: expect.any(String),
77+
start_timestamp: expect.any(Number),
78+
status: 'ok',
79+
timestamp: expect.any(Number),
80+
trace_id: expect.any(String),
81+
},
82+
]);
5983
});
6084

6185
test('Sends parameterized transactions to Sentry', async ({ baseURL }) => {

0 commit comments

Comments
 (0)