From af54df6ebc0d7ce0c68b0c84e235c0767d2a5121 Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Fri, 9 Oct 2026 12:02:24 +0200 Subject: [PATCH 1/3] test(node): Port baggage and metadata tests to span streaming Co-Authored-By: GPT-6 --- .../double-baggage/no-spans/instrument.mjs | 1 - .../tracing/double-baggage/no-spans/test.ts | 2 +- .../spans-no-parent/instrument.mjs | 1 - .../double-baggage/spans-no-parent/test.ts | 1 + .../spans-parent/instrument.mjs | 1 - .../double-baggage/spans-parent/test.ts | 74 ++++++++++--------- .../dsc-txn-name-update/scenario-events.ts | 1 - .../dsc-txn-name-update/scenario-headers.ts | 1 - .../tracing/dsc-txn-name-update/test.ts | 4 +- .../tracing/meta-tags-twp-errors/no-server.js | 1 - .../tracing/meta-tags-twp-errors/server.js | 1 - .../suites/tracing/meta-tags-twp/server.js | 1 - .../tracing/meta-tags/server-sdk-disabled.js | 1 - .../meta-tags/server-tracesSampleRate-zero.js | 1 - .../suites/tracing/meta-tags/server.js | 1 - 15 files changed, 44 insertions(+), 48 deletions(-) diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/instrument.mjs b/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/instrument.mjs index 59e56d82bbb7..7acd36926f22 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/instrument.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/instrument.mjs @@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0', // explicitly not setting tracesSampleRate, diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts b/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts index c517bca0d25b..6573c2632750 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts @@ -31,7 +31,7 @@ describe('double baggage prevention', () => { await createRunner() .withEnv({ SERVER_URL }) - .ignore('transaction') + .ignore('span') .expect({ event: { exception: { diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/instrument.mjs b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/instrument.mjs index 170ad6f6a702..46a27dd03b74 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/instrument.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/instrument.mjs @@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0', tracesSampleRate: 1.0, diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts index 6b5d20cdb5f7..60ee26bba4b7 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts @@ -31,6 +31,7 @@ describe('double baggage prevention', () => { await createRunner() .withEnv({ SERVER_URL }) + .ignore('span') .expect({ event: { exception: { diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/instrument.mjs b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/instrument.mjs index 170ad6f6a702..46a27dd03b74 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/instrument.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/instrument.mjs @@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0', tracesSampleRate: 1.0, diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/test.ts b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/test.ts index 22de5cb285b3..bc7e62105928 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-parent/test.ts @@ -1,3 +1,5 @@ +import { SENTRY_OP, URL_FULL } from '@sentry/conventions/attributes'; +import { HTTP_CLIENT } from '@sentry/conventions/op'; import { createTestServer } from '@sentry-internal/test-utils'; import { describe, expect } from 'vitest'; import { createEsmAndCjsTests } from '../../../../utils/runner'; @@ -6,7 +8,7 @@ import { expectConsistentTraceId, expectNoDuplicateSentryBaggageKeys, expectUser describe('double baggage prevention - http.client spans with parent span', () => { createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => { - let transactionTraceId = '000'; + let traceId = '000'; let fetchSpanId = '000'; let httpCustomHeadersSpanId = '000'; let fetchCustomHeadersSpanId = '000'; @@ -16,7 +18,7 @@ describe('double baggage prevention - http.client spans with parent span', () => .get('/api/fetch-custom-headers', headers => { // fetch with manual getTraceData() headers — core reproduction case const sentryTrace = extractTraceparentData(headers['sentry-trace'] as string); - transactionTraceId = sentryTrace!.traceId!; + traceId = sentryTrace!.traceId!; fetchCustomHeadersSpanId = sentryTrace!.parentSpanId!; expectNoDuplicateSentryBaggageKeys(headers['baggage']); expect(headers['sentry-trace']).not.toContain(','); @@ -46,42 +48,46 @@ describe('double baggage prevention - http.client spans with parent span', () => .withEnv({ SERVER_URL }) .ignore('event') .expect({ - transaction: txn => { - expect(transactionTraceId).toMatch(/^[a-f0-9]{32}$/); + span: container => { + expect(traceId).toMatch(/^[a-f0-9]{32}$/); - expect(txn).toMatchObject({ - transaction: 'parent_span', - spans: [ - { - op: 'http.client', - description: expect.stringMatching(/^GET .*\/api\/fetch-custom-headers$/), - data: {}, - // span id is expected to be different since users call getTraceData() before the - // http.client span is created - span_id: expect.not.stringContaining(fetchCustomHeadersSpanId), - start_timestamp: expect.any(Number), - trace_id: transactionTraceId, + expect(container.items.find(span => span.is_segment)?.name).toBe('parent_span'); + expect(container.items.filter(span => !span.is_segment)).toMatchObject([ + { + name: 'GET localhost', + attributes: { + [SENTRY_OP]: { type: 'string', value: HTTP_CLIENT }, + [URL_FULL]: { type: 'string', value: expect.stringMatching(/^.*\/api\/fetch-custom-headers$/) }, }, - { - op: 'http.client', - description: expect.stringMatching(/^GET .*\/api\/fetch$/), - data: {}, - span_id: fetchSpanId, - start_timestamp: expect.any(Number), - trace_id: transactionTraceId, + // span id is expected to be different since users call getTraceData() before the + // http.client span is created + span_id: expect.not.stringContaining(fetchCustomHeadersSpanId), + start_timestamp: expect.any(Number), + trace_id: traceId, + }, + { + name: 'GET localhost', + attributes: { + [SENTRY_OP]: { type: 'string', value: HTTP_CLIENT }, + [URL_FULL]: { type: 'string', value: expect.stringMatching(/^.*\/api\/fetch$/) }, }, - { - op: 'http.client', - description: expect.stringMatching(/^GET .*\/api\/http-custom-headers$/), - data: {}, - // span id is expected to be different since users call getTraceData() before the - // http.client span is created - span_id: expect.not.stringContaining(httpCustomHeadersSpanId), - start_timestamp: expect.any(Number), - trace_id: transactionTraceId, + span_id: fetchSpanId, + start_timestamp: expect.any(Number), + trace_id: traceId, + }, + { + name: 'GET localhost', + attributes: { + [SENTRY_OP]: { type: 'string', value: HTTP_CLIENT }, + [URL_FULL]: { type: 'string', value: expect.stringMatching(/^.*\/api\/http-custom-headers$/) }, }, - ], - }); + // span id is expected to be different since users call getTraceData() before the + // http.client span is created + span_id: expect.not.stringContaining(httpCustomHeadersSpanId), + start_timestamp: expect.any(Number), + trace_id: traceId, + }, + ]); }, }) .start() diff --git a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts index be9bb6c12b5b..37e20c8dc49b 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts @@ -3,7 +3,6 @@ import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0', tracesSampleRate: 1.0, diff --git a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts index 4dfae58a9059..33f1b78126c6 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts @@ -3,7 +3,6 @@ import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0', tracesSampleRate: 1.0, diff --git a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts index ddac08fe1b21..821662369b80 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts @@ -53,7 +53,7 @@ test('adds current transaction name to baggage when the txn name is high-quality await createRunner(__dirname, 'scenario-headers.ts') .withEnv({ SERVER_URL }) .expect({ - transaction: {}, + span: {}, }) .start() .completed(); @@ -106,7 +106,7 @@ test('adds current transaction name to trace envelope header when the txn name i }, }) .expectHeader({ - transaction: { + span: { trace: { environment: 'production', public_key: 'public', diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/no-server.js b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/no-server.js index 450a47635ef1..ac0122b48380 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/no-server.js +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/no-server.js @@ -2,7 +2,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests'); const Sentry = require('@sentry/node'); Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', release: '1.0', transport: loggingTransport, diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/server.js b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/server.js index f7a3ce3b9380..70e895389337 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/server.js +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/server.js @@ -2,7 +2,6 @@ const { loggingTransport, startExpressServerAndSendPortToRunner } = require('@se const Sentry = require('@sentry/node'); Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', transport: loggingTransport, }); diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp/server.js b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp/server.js index 0b47fbdf999d..dbea874b90f6 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp/server.js +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp/server.js @@ -2,7 +2,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests'); const Sentry = require('@sentry/node'); Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', transport: loggingTransport, }); diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-sdk-disabled.js b/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-sdk-disabled.js index b226bf98efdb..03eb3cf16c2d 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-sdk-disabled.js +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-sdk-disabled.js @@ -2,7 +2,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests'); const Sentry = require('@sentry/node'); Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', tracesSampleRate: 1.0, transport: loggingTransport, diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-tracesSampleRate-zero.js b/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-tracesSampleRate-zero.js index 32260783df21..be18fb9731ca 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-tracesSampleRate-zero.js +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags/server-tracesSampleRate-zero.js @@ -2,7 +2,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests'); const Sentry = require('@sentry/node'); Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', tracesSampleRate: 0, transport: loggingTransport, diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags/server.js b/dev-packages/node-integration-tests/suites/tracing/meta-tags/server.js index 5f85d27e1918..5050887b78fe 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags/server.js +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags/server.js @@ -2,7 +2,6 @@ const { loggingTransport } = require('@sentry-internal/node-integration-tests'); const Sentry = require('@sentry/node'); Sentry.init({ - traceLifecycle: 'static', dsn: 'https://public@dsn.ingest.sentry.io/1337', tracesSampleRate: 1.0, transport: loggingTransport, From 0e8bf6b306222d6c4e240e586d8f1c94064e55ba Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Fri, 9 Oct 2026 12:31:53 +0200 Subject: [PATCH 2/3] test(node): Assert parentless fetch spans in baggage test Co-Authored-By: GPT-6 --- .../double-baggage/spans-no-parent/test.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts index 60ee26bba4b7..601188c1d414 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/spans-no-parent/test.ts @@ -1,3 +1,5 @@ +import { SENTRY_OP, URL_FULL } from '@sentry/conventions/attributes'; +import { HTTP_CLIENT } from '@sentry/conventions/op'; import { createTestServer } from '@sentry-internal/test-utils'; import { describe, expect } from 'vitest'; import { createEsmAndCjsTests } from '../../../../utils/runner'; @@ -31,7 +33,7 @@ describe('double baggage prevention', () => { await createRunner() .withEnv({ SERVER_URL }) - .ignore('span') + .unordered() .expect({ event: { exception: { @@ -39,6 +41,20 @@ describe('double baggage prevention', () => { }, }, }) + .expect({ + span: container => { + const spans = container.items; + expect(spans.map(span => span.attributes[URL_FULL]?.value).sort()).toEqual([ + `${SERVER_URL}/api/fetch`, + `${SERVER_URL}/api/fetch-custom-headers`, + ]); + for (const span of spans) { + expect(span.attributes[SENTRY_OP]?.value).toBe(HTTP_CLIENT); + expect(span.is_segment).toBe(true); + expect(span.parent_span_id).toBeUndefined(); + } + }, + }) .start() .completed(); closeTestServer(); From 835e0dbb6c15085437777819778560c88c76b93c Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Fri, 9 Oct 2026 12:33:43 +0200 Subject: [PATCH 3/3] test(node): Remove redundant span ignore from no-tracing baggage test Co-Authored-By: GPT-6 --- .../suites/tracing/double-baggage/no-spans/test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts b/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts index 6573c2632750..283bd16b42df 100644 --- a/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/double-baggage/no-spans/test.ts @@ -31,7 +31,6 @@ describe('double baggage prevention', () => { await createRunner() .withEnv({ SERVER_URL }) - .ignore('span') .expect({ event: { exception: {