diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/instrument.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/src/instrument.ts new file mode 100644 index 000000000000..09376810454f --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/src/instrument.ts @@ -0,0 +1,9 @@ +import * as Sentry from '@sentry/node'; + +Sentry.init({ + environment: 'qa', // dynamic sampling bias to keep transactions + dsn: process.env.E2E_TEST_DSN, + tunnel: `http://localhost:3031/`, // proxy server + tracesSampleRate: 1, + tracePropagationTargets: ['http://localhost:3030', '/external-allowed'], +}); diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts index b168cc19e7c3..39bfec94b507 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts @@ -1,3 +1,7 @@ +// Import this first +import './instrument'; + +// Import other modules import { BaseExceptionFilter, HttpAdapterHost, NestFactory } from '@nestjs/core'; import * as Sentry from '@sentry/node'; import { AppModule1, AppModule2 } from './app.module'; @@ -6,14 +10,6 @@ const app1Port = 3030; const app2Port = 3040; async function bootstrap() { - Sentry.init({ - environment: 'qa', // dynamic sampling bias to keep transactions - dsn: process.env.E2E_TEST_DSN, - tunnel: `http://localhost:3031/`, // proxy server - tracesSampleRate: 1, - tracePropagationTargets: ['http://localhost:3030', '/external-allowed'], - }); - const app1 = await NestFactory.create(AppModule1); const { httpAdapter } = app1.get(HttpAdapterHost); diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts index 3fe5c1e65263..08a3998d0ecd 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts @@ -101,6 +101,24 @@ test('Sends an API route transaction', async ({ baseURL }) => { trace_id: expect.any(String), origin: 'manual', }, + { + span_id: expect.any(String), + trace_id: expect.any(String), + data: { + 'sentry.origin': 'manual', + component: '@nestjs/core', + 'nestjs.version': expect.any(String), + 'nestjs.type': 'handler', + 'nestjs.callback': 'testTransaction', + 'otel.kind': 'INTERNAL', + }, + description: 'testTransaction', + parent_span_id: expect.any(String), + start_timestamp: expect.any(Number), + timestamp: expect.any(Number), + status: 'ok', + origin: 'manual', + }, ]), transaction: 'GET /test-transaction', type: 'transaction',