Skip to content

Commit 76c4c26

Browse files
authored
feat(core): Use serialized spans in transaction event (#10912)
Previously, we passed the span instance, which is a) tricky because it keeps references etc, and b) doesn't work with the new span schema anyhow (because nothing is readable off the spans). This also means we can get rid of the `SerializedEvent` again, as this is now just the regular `Event` again.
1 parent e08e1ec commit 76c4c26

File tree

30 files changed

+122
-150
lines changed

30 files changed

+122
-150
lines changed

dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -10,7 +10,7 @@ sentryTest('should send a transaction in an envelope', async ({ getLocalTestPath
1010
}
1111

1212
const url = await getLocalTestPath({ testDir: __dirname });
13-
const transaction = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
13+
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
1414

1515
expect(transaction.transaction).toBe('parent_span');
1616
expect(transaction.spans).toBeDefined();
@@ -22,7 +22,7 @@ sentryTest('should report finished spans as children of the root transaction', a
2222
}
2323

2424
const url = await getLocalTestPath({ testDir: __dirname });
25-
const transaction = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
25+
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
2626

2727
expect(transaction.spans).toHaveLength(1);
2828

dev-packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -10,7 +10,7 @@ sentryTest('should report a transaction in an envelope', async ({ getLocalTestPa
1010
}
1111

1212
const url = await getLocalTestPath({ testDir: __dirname });
13-
const transaction = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
13+
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
1414

1515
expect(transaction.transaction).toBe('root_span');
1616
expect(transaction.spans).toBeDefined();
@@ -22,7 +22,7 @@ sentryTest('should report finished spans as children of the root span', async ({
2222
}
2323

2424
const url = await getLocalTestPath({ testDir: __dirname });
25-
const transaction = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
25+
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
2626

2727
const rootSpanId = transaction?.contexts?.trace?.span_id;
2828

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -23,7 +23,7 @@ sentryTest('should create fetch spans with http timing @firefox', async ({ brows
2323

2424
const url = await getLocalTestPath({ testDir: __dirname });
2525

26-
const envelopes = await getMultipleSentryEnvelopeRequests<SerializedEvent>(page, 2, { url, timeout: 10000 });
26+
const envelopes = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url, timeout: 10000 });
2727
const tracingEvent = envelopes[envelopes.length - 1]; // last envelope contains tracing data on all browsers
2828

2929
const requestSpans = tracingEvent.spans?.filter(({ op }) => op === 'http.client');

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { SerializedEvent } from '@sentry/types';
3+
import type { Event } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -15,7 +15,7 @@ sentryTest('should not capture long task when flag is disabled.', async ({ brows
1515

1616
const url = await getLocalTestPath({ testDir: __dirname });
1717

18-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
18+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
1919
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui'));
2020

2121
expect(uiSpans?.length).toBe(0);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { SerializedEvent } from '@sentry/types';
3+
import type { Event } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -15,7 +15,7 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestPath,
1515

1616
const url = await getLocalTestPath({ testDir: __dirname });
1717

18-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
18+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
1919
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui'));
2020

2121
expect(uiSpans?.length).toBeGreaterThan(0);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadWithHeartbeatTimeout/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -16,7 +16,7 @@ sentryTest(
1616

1717
const url = await getLocalTestPath({ testDir: __dirname });
1818

19-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
19+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
2020

2121
expect(eventData.contexts?.trace?.op).toBe('pageload');
2222
expect(

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -11,7 +11,7 @@ sentryTest('should add browser-related spans to pageload transaction', async ({
1111

1212
const url = await getLocalTestPath({ testDir: __dirname });
1313

14-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
14+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
1515
const browserSpans = eventData.spans?.filter(({ op }) => op === 'browser');
1616

1717
// Spans `connect`, `cache` and `DNS` are not always inside `pageload` transaction.

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { SerializedEvent } from '@sentry/types';
3+
import type { Event } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -17,7 +17,7 @@ sentryTest('should add resource spans to pageload transaction', async ({ getLoca
1717

1818
const url = await getLocalTestPath({ testDir: __dirname });
1919

20-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
20+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
2121
const resourceSpans = eventData.spans?.filter(({ op }) => op?.startsWith('resource'));
2222

2323
// Webkit 16.0 (which is linked to Playwright 1.27.1) consistently creates 2 consectutive spans for `css`,

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fid/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -16,7 +16,7 @@ sentryTest('should capture a FID vital.', async ({ browserName, getLocalTestPath
1616
// To trigger FID
1717
await page.locator('#fid-btn').click();
1818

19-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page);
19+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page);
2020

2121
expect(eventData.measurements).toBeDefined();
2222
expect(eventData.measurements?.fid?.value).toBeDefined();

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fp-fcp/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { SerializedEvent } from '@sentry/types';
2+
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -11,7 +11,7 @@ sentryTest('should capture FP vital.', async ({ browserName, getLocalTestPath, p
1111
}
1212

1313
const url = await getLocalTestPath({ testDir: __dirname });
14-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
14+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
1515

1616
expect(eventData.measurements).toBeDefined();
1717
expect(eventData.measurements?.fp?.value).toBeDefined();
@@ -29,7 +29,7 @@ sentryTest('should capture FCP vital.', async ({ getLocalTestPath, page }) => {
2929
}
3030

3131
const url = await getLocalTestPath({ testDir: __dirname });
32-
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
32+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
3333

3434
expect(eventData.measurements).toBeDefined();
3535
expect(eventData.measurements?.fcp?.value).toBeDefined();

0 commit comments

Comments
 (0)