Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ afterAll(() => {
});

test('should send manually started parallel root spans in root context', async () => {
expect.assertions(6);

await createRunner(__dirname, 'scenario.ts')
.expect({ transaction: { transaction: 'test_span_1' } })
.expect({
transaction: transaction => {
expect(transaction).toBeDefined();
const traceId = transaction.contexts?.trace?.trace_id;
span: container => {
const span1 = container.items.find(span => span.name === 'test_span_1');
const span2 = container.items.find(span => span.name === 'test_span_2');
expect(span1?.is_segment).toBe(true);
expect(span2?.is_segment).toBe(true);
expect(span1?.start_timestamp).toEqual(expect.any(Number));
expect(span1?.end_timestamp).toEqual(expect.any(Number));

// Both root spans continue the scope's propagation context, matching the core SDK behavior.
expect(traceId).toBe('12345678901234567890123456789012');
expect(transaction.contexts?.trace?.parent_span_id).toBe('1234567890123456');
// Both root spans continue the scope's propagation context, including the parentSpanId.
expect(span1?.trace_id).toBe('12345678901234567890123456789012');
expect(span1?.parent_span_id).toBe('1234567890123456');
expect(span2?.parent_span_id).toBe('1234567890123456');

// Same trace ID as the first span
const trace1Id = transaction.contexts?.trace?.data?.spanIdTraceId;
expect(trace1Id).toBe('12345678901234567890123456789012');
expect(trace1Id).toBe(traceId);
expect(span2?.trace_id).toBe(span1?.trace_id);
expect(span2?.attributes.spanIdTraceId).toEqual({ type: 'string', value: span1?.trace_id });
},
})
.start()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ afterAll(() => {

test('should send manually started parallel root spans outside of root context with parentSpanId', async () => {
await createRunner(__dirname, 'scenario.ts')
.expect({ transaction: { transaction: 'test_span_1' } })
.expect({
transaction: transaction => {
expect(transaction).toBeDefined();
const traceId = transaction.contexts?.trace?.trace_id;
span: container => {
const span1 = container.items.find(span => span.name === 'test_span_1');
const span2 = container.items.find(span => span.name === 'test_span_2');
expect(span1?.is_segment).toBe(true);
expect(span2?.is_segment).toBe(true);
expect(span1?.start_timestamp).toEqual(expect.any(Number));
expect(span1?.end_timestamp).toEqual(expect.any(Number));

// Both root spans continue the scope's propagation context, including the parentSpanId,
// matching the core SDK behavior.
expect(traceId).toBe('12345678901234567890123456789012');
expect(transaction.contexts?.trace?.parent_span_id).toBe('1234567890123456');
// Both root spans continue the scope's propagation context, including the parentSpanId.
expect(span1?.trace_id).toBe('12345678901234567890123456789012');
expect(span1?.parent_span_id).toBe('1234567890123456');
expect(span2?.parent_span_id).toBe('1234567890123456');

// Same trace ID as the first span
const trace1Id = transaction.contexts?.trace?.data?.spanIdTraceId;
expect(trace1Id).toBe(traceId);
expect(span2?.trace_id).toBe(span1?.trace_id);
expect(span2?.attributes.spanIdTraceId).toEqual({ type: 'string', value: span1?.trace_id });
},
})
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ afterAll(() => {
});

test('should send manually started parallel root spans outside of root context', async () => {
expect.assertions(6);

await createRunner(__dirname, 'scenario.ts')
.expect({ transaction: { transaction: 'test_span_1' } })
.expect({
transaction: transaction => {
expect(transaction).toBeDefined();
const traceId = transaction.contexts?.trace?.trace_id;
expect(traceId).toBeDefined();
expect(transaction.contexts?.trace?.parent_span_id).toBeUndefined();
span: container => {
const span1 = container.items.find(span => span.name === 'test_span_1');
const span2 = container.items.find(span => span.name === 'test_span_2');
expect(span1?.is_segment).toBe(true);
expect(span2?.is_segment).toBe(true);
expect(span1?.start_timestamp).toEqual(expect.any(Number));
expect(span1?.end_timestamp).toEqual(expect.any(Number));

const trace1Id = transaction.contexts?.trace?.data?.spanIdTraceId;
expect(trace1Id).toBeDefined();
expect(span1?.trace_id).toMatch(/^[0-9a-f]{32}$/);
expect(span1?.parent_span_id).toBeUndefined();
expect(span2?.parent_span_id).toBeUndefined();

// Same trace ID as the first span - both root spans share the scope's propagation context
expect(trace1Id).toBe(traceId);
expect(span2?.trace_id).toBe(span1?.trace_id);
expect(span2?.attributes.spanIdTraceId).toEqual({ type: 'string', value: span1?.trace_id });
},
})
.start()
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading
Loading