8000 feat(node): Migrate to `@fastify/otel` · getsentry/sentry-javascript@6c347ee · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c347ee

Browse files
committed
feat(node): Migrate to @fastify/otel
1 parent f024ccf commit 6c347ee

33 files changed

+1625
-87
lines changed

dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/transactions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
5555
data: {
5656
'sentry.origin': 'manual',
5757
'fastify.type': 'middleware',
58-
'plugin.name': 'fastify -> @fastify/middie',
58+
'plugin.name': '@fastify/middie',
5959
'hook.name': 'onRequest',
6060
},
6161
description: 'middleware - runMiddie',
@@ -71,7 +71,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
7171
data: {
7272
'sentry.origin': 'auto.http.otel.fastify',
7373
'sentry.op': 'request_handler.fastify',
74-
'plugin.name': 'fastify -> @fastify/middie',
74+
'plugin.name': '@fastify/middie',
7575
'fastify.type': 'request_handler',
7676
'http.route': '/test-transaction',
7777
},

dev-packages/e2e-tests/test-applications/node-fastify/package.json renamed to dev-packages/e2e-tests/test-applications/node-fastify-3/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "node-fastify",
2+
"name": "node-fastify-3",
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
@@ -15,7 +15,7 @@
1515
"@sentry/core": "latest || *",
1616
"@sentry/opentelemetry": "latest || *",
1717
"@types/node": "^18.19.1",
18-
"fastify": "4.23.2",
18+
"fastify": "3.29.5",
1919
"typescript": "~5.0.0",
2020
"ts-node": "10.9.1"
2121
},

dev-packages/e2e-tests/test-applications/node-fastify/start-event-proxy.mjs renamed to dev-packages/e2e-tests/test-applications/node-fastify-3/start-event-proxy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { startEventProxyServer } from '@sentry-internal/test-utils';
22

33
startEventProxyServer({
44
port: 3031,
5-
proxyServerName: 'node-fastify',
5+
proxyServerName: 'node-fastify-3',
66
});

dev-packages/e2e-tests/test-applications/node-fastify/tests/errors.test.ts renamed to dev-packages/e2e-tests/test-applications/node-fastify-3/tests/errors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
22
import { waitForError } from '@sentry-internal/test-utils';
33

44
test('Sends correct error event', async ({ baseURL }) => {
5-
const errorEventPromise = waitForError('node-fastify', event => {
5+
const errorEventPromise = waitForError('node-fastify-3', event => {
66
return !event.type && event.exception?.values?.[0]?.value === 'This is an exception with id 123';
77
});
88

dev-packages/e2e-tests/test-applications/node-fastify/tests/propagation.test.ts renamed to dev-packages/e2e-tests/test-applications/node-fastify-3/tests/propagation.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { SpanJSON } from '@sentry/core';
66
test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
77
const id = crypto.randomUUID();
88

9-
const inboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
9+
const inboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
1010
return (
1111
transactionEvent.contexts?.trace?.op === 'http.server' &&
1212
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-inbound-headers/${id}`
1313
);
1414
});
1515

16-
const outboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
16+
const outboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
1717
return (
1818
transactionEvent.contexts?.trace?.op === 'http.server' &&
1919
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-http/${id}`
@@ -120,14 +120,14 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
120120
test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
121121
const id = crypto.randomUUID();
122122

123-
const inboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
123+
const inboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
124124
return (
125125
transactionEvent?.contexts?.trace?.op === 'http.server' &&
126126
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-inbound-headers/${id}`
127127
);
128128
});
129129

130-
const outboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
130+
const outboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
131131
return (
132132
transactionEvent?.contexts?.trace?.op === 'http.server' &&
133133
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-fetch/${id}`
@@ -232,7 +232,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
232232
});
233233

234234
test('Propagates trace for outgoing external http requests', async ({ baseURL }) => {
235-
const inboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
235+
const inboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
236236
return (
237237
transactionEvent?.contexts?.trace?.op === 'http.server' &&
238238
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-http-external-allowed`
@@ -269,7 +269,7 @@ test('Propagates trace for outgoing external http requests', async ({ baseURL })
269269
});
270270

271271
test('Does not propagate outgoing http requests not covered by tracePropagationTargets', async ({ baseURL }) => {
272-
const inboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
272+
const inboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
273273
return (
274274
transactionEvent?.contexts?.trace?.op === 'http.server' &&
275275
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-http-external-disallowed`
@@ -293,7 +293,7 @@ test('Does not propagate outgoing http requests not covered by tracePropagationT
293293
});
294294

295295
test('Propagates trace for outgoing external fetch requests', async ({ baseURL }) => {
296-
const inboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
296+
const inboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
297297
return (
298298
transactionEvent?.contexts?.trace?.op === 'http.server' &&
299299
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-fetch-external-allowed`
@@ -330,7 +330,7 @@ test('Propagates trace for outgoing external fetch requests', async ({ baseURL }
330330
});
331331

332332
test('Does not propagate outgoing fetch requests not covered by tracePropagationTargets', async ({ baseURL }) => {
333-
const inboundTransactionPromise = waitForTransaction('node-fastify', transactionEvent => {
333+
const inboundTransactionPromise = waitForTransaction('node-fastify-3', transactionEvent => {
334334
return (
335335
transactionEvent?.contexts?.trace?.op === 'http.server' &&
336336
transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-fetch-external-disallowed`

dev-packages/e2e-tests/test-applications/node-fastify/tests/transactions.test.ts renamed to dev-packages/e2e-tests/test-applications/node-fastify-3/tests/transactions.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
22
import { waitForTransaction } from '@sentry-internal/test-utils';
33

44
test('Sends an API route transaction', async ({ baseURL }) => {
5-
const pageloadTransactionEventPromise = waitForTransaction('node-fastify', transactionEvent => {
5+
const pageloadTransactionEventPromise = waitForTransaction('node-fastify-3', transactionEvent => {
66
return (
77
transactionEvent?.contexts?.trace?.op === 'http.server' &&
88
transactionEvent?.transaction === 'GET /test-transaction'
@@ -60,7 +60,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
6060

6161
expect(spans).toContainEqual({
6262
data: {
63-
'plugin.name': 'fastify -> sentry-fastify-error-handler',
63+
'plugin.name': 'sentry-fastify-error-handler',
6464
'fastify.type': 'middleware',
6565
'hook.name': 'onRequest',
6666
'sentry.origin': 'auto.http.otel.fastify',
@@ -79,7 +79,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
7979

8080
expect(spans).toContainEqual({
8181
data: {
82-
'plugin.name': 'fastify -> sentry-fastify-error-handler',
82+
'plugin.name': 'sentry-fastify-error-handler',
8383
'fastify.type': 'request_handler',
8484
'http.route': '/test-transaction',
8585
'sentry.op': 'request_handler.fastify',

0 commit comments

Comments
 (0)
0