Skip to content

Commit 5a2c6e9

Browse files
authored
Merge branch 'develop' into lazarnikolov/js-2140-tanstack-start-tunnel-adapter
2 parents 73fbbeb + 5f72df5 commit 5a2c6e9

File tree

50 files changed

+1948
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1948
-114
lines changed

.size-limit.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,28 @@ module.exports = [
3838
path: 'packages/browser/build/npm/esm/prod/index.js',
3939
import: createImport('init', 'browserTracingIntegration'),
4040
gzip: true,
41-
limit: '43 KB',
41+
limit: '44 KB',
42+
},
43+
{
44+
name: '@sentry/browser (incl. Tracing + Span Streaming)',
45+
path: 'packages/browser/build/npm/esm/prod/index.js',
46+
import: createImport('init', 'browserTracingIntegration', 'spanStreamingIntegration'),
47+
gzip: true,
48+
limit: '48 KB',
4249
},
4350
{
4451
name: '@sentry/browser (incl. Tracing, Profiling)',
4552
path: 'packages/browser/build/npm/esm/prod/index.js',
4653
import: createImport('init', 'browserTracingIntegration', 'browserProfilingIntegration'),
4754
gzip: true,
48-
limit: '48 KB',
55+
limit: '49 KB',
4956
},
5057
{
5158
name: '@sentry/browser (incl. Tracing, Replay)',
5259
path: 'packages/browser/build/npm/esm/prod/index.js',
5360
import: createImport('init', 'browserTracingIntegration', 'replayIntegration'),
5461
gzip: true,
55-
limit: '82 KB',
62+
limit: '83 KB',
5663
},
5764
{
5865
name: '@sentry/browser (incl. Tracing, Replay) - with treeshaking flags',
@@ -82,14 +89,14 @@ module.exports = [
8289
path: 'packages/browser/build/npm/esm/prod/index.js',
8390
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'replayCanvasIntegration'),
8491
gzip: true,
85-
limit: '87 KB',
92+
limit: '88 KB',
8693
},
8794
{
8895
name: '@sentry/browser (incl. Tracing, Replay, Feedback)',
8996
path: 'packages/browser/build/npm/esm/prod/index.js',
9097
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'feedbackIntegration'),
9198
gzip: true,
92-
limit: '99 KB',
99+
limit: '100 KB',
93100
},
94101
{
95102
name: '@sentry/browser (incl. Feedback)',
@@ -163,7 +170,7 @@ module.exports = [
163170
path: 'packages/vue/build/esm/index.js',
164171
import: createImport('init', 'browserTracingIntegration'),
165172
gzip: true,
166-
limit: '45 KB',
173+
limit: '46 KB',
167174
},
168175
// Svelte SDK (ESM)
169176
{
@@ -184,7 +191,7 @@ module.exports = [
184191
name: 'CDN Bundle (incl. Tracing)',
185192
path: createCDNPath('bundle.tracing.min.js'),
186193
gzip: true,
187-
limit: '44 KB',
194+
limit: '45 KB',
188195
},
189196
{
190197
name: 'CDN Bundle (incl. Logs, Metrics)',
@@ -196,7 +203,7 @@ module.exports = [
196203
name: 'CDN Bundle (incl. Tracing, Logs, Metrics)',
197204
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
198205
gzip: true,
199-
limit: '45 KB',
206+
limit: '46 KB',
200207
},
201208
{
202209
name: 'CDN Bundle (incl. Replay, Logs, Metrics)',
@@ -208,25 +215,25 @@ module.exports = [
208215
name: 'CDN Bundle (incl. Tracing, Replay)',
209216
path: createCDNPath('bundle.tracing.replay.min.js'),
210217
gzip: true,
211-
limit: '81 KB',
218+
limit: '82 KB',
212219
},
213220
{
214221
name: 'CDN Bundle (incl. Tracing, Replay, Logs, Metrics)',
215222
path: createCDNPath('bundle.tracing.replay.logs.metrics.min.js'),
216223
gzip: true,
217-
limit: '82 KB',
224+
limit: '83 KB',
218225
},
219226
{
220227
name: 'CDN Bundle (incl. Tracing, Replay, Feedback)',
221228
path: createCDNPath('bundle.tracing.replay.feedback.min.js'),
222229
gzip: true,
223-
limit: '87 KB',
230+
limit: '88 KB',
224231
},
225232
{
226233
name: 'CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)',
227234
path: createCDNPath('bundle.tracing.replay.feedback.logs.metrics.min.js'),
228235
gzip: true,
229-
limit: '88 KB',
236+
limit: '89 KB',
230237
},
231238
// browser CDN bundles (non-gzipped)
232239
{
@@ -241,7 +248,7 @@ module.exports = [
241248
path: createCDNPath('bundle.tracing.min.js'),
242249
gzip: false,
243250
brotli: false,
244-
limit: '130 KB',
251+
limit: '134 KB',
245252
},
246253
{
247254
name: 'CDN Bundle (incl. Logs, Metrics) - uncompressed',
@@ -255,7 +262,7 @@ module.exports = [
255262
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
256263
gzip: false,
257264
brotli: false,
258-
limit: '134 KB',
265+
limit: '138 KB',
259266
},
260267
{
261268
name: 'CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed',
@@ -269,14 +276,14 @@ module.exports = [
269276
path: createCDNPath('bundle.tracing.replay.min.js'),
270277
gzip: false,
271278
brotli: false,
272-
limit: '248 KB',
279+
limit: '251 KB',
273280
},
274281
{
275282
name: 'CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed',
276283
path: createCDNPath('bundle.tracing.replay.logs.metrics.min.js'),
277284
gzip: false,
278285
brotli: false,
279-
limit: '251 KB',
286+
limit: '255 KB',
280287
},
281288
{
282289
name: 'CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed',
@@ -290,7 +297,7 @@ module.exports = [
290297
path: createCDNPath('bundle.tracing.replay.feedback.logs.metrics.min.js'),
291298
gzip: false,
292299
brotli: false,
293-
limit: '264 KB',
300+
limit: '268 KB',
294301
},
295302
// Next.js SDK (ESM)
296303
{
@@ -299,7 +306,7 @@ module.exports = [
299306
import: createImport('init'),
300307
ignore: ['next/router', 'next/constants'],
301308
gzip: true,
302-
limit: '48 KB',
309+
limit: '49 KB',
303310
},
304311
// SvelteKit SDK (ESM)
305312
{
@@ -308,7 +315,7 @@ module.exports = [
308315
import: createImport('init'),
309316
ignore: ['$app/stores'],
310317
gzip: true,
311-
limit: '44 KB',
318+
limit: '45 KB',
312319
},
313320
// Node-Core SDK (ESM)
314321
{

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,17 @@ sentryTest('starts a streamed navigation span on page navigation', async ({ getL
6969

7070
expect(navigationSpan).toEqual({
7171
attributes: {
72-
effectiveConnectionType: {
72+
'network.connection.effective_type': {
7373
type: 'string',
7474
value: expect.any(String),
7575
},
76-
hardwareConcurrency: {
77-
type: 'string',
78-
value: expect.any(String),
76+
'device.processor_count': {
77+
type: expect.stringMatching(/^(integer)|(double)$/),
78+
value: expect.any(Number),
79+
},
80+
'network.connection.rtt': {
81+
type: expect.stringMatching(/^(integer)|(double)$/),
82+
value: expect.any(Number),
7983
},
8084
'sentry.idle_span_finish_reason': {
8185
type: 'string',

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,34 @@ sentryTest(
6262

6363
expect(pageloadSpan).toEqual({
6464
attributes: {
65-
effectiveConnectionType: {
65+
// formerly known as 'effectiveConnectionType'
66+
'network.connection.effective_type': {
6667
type: 'string',
6768
value: expect.any(String),
6869
},
69-
hardwareConcurrency: {
70-
type: 'string',
71-
value: expect.any(String),
70+
// formerly known as 'hardwareConcurrency'
71+
'device.processor_count': {
72+
type: expect.stringMatching(/^(integer)|(double)$/),
73+
value: expect.any(Number),
7274
},
73-
'performance.activationStart': {
74-
type: 'integer',
75+
'browser.performance.navigation.activation_start': {
76+
type: expect.stringMatching(/^(integer)|(double)$/),
77+
value: expect.any(Number),
78+
},
79+
'browser.performance.time_origin': {
80+
type: expect.stringMatching(/^(integer)|(double)$/),
81+
value: expect.any(Number),
82+
},
83+
'network.connection.rtt': {
84+
type: expect.stringMatching(/^(integer)|(double)$/),
85+
value: expect.any(Number),
86+
},
87+
'browser.web_vital.ttfb.request_time': {
88+
type: expect.stringMatching(/^(integer)|(double)$/),
7589
value: expect.any(Number),
7690
},
77-
'performance.timeOrigin': {
78-
type: 'double',
91+
'browser.web_vital.ttfb.value': {
92+
type: expect.stringMatching(/^(integer)|(double)$/),
7993
value: expect.any(Number),
8094
},
8195
'sentry.idle_span_finish_reason': {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
window._testBaseTimestamp = performance.timeOrigin / 1000;
5+
6+
Sentry.init({
7+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
8+
integrations: [Sentry.browserTracingIntegration(), Sentry.spanStreamingIntegration()],
9+
traceLifecycle: 'stream',
10+
tracesSampleRate: 1,
11+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { simulateCLS } from '../../../../utils/web-vitals/cls.ts';
2+
3+
// Simulate Layout shift right at the beginning of the page load, depending on the URL hash
4+
// don't run if expected CLS is NaN
5+
const expectedCLS = Number(location.hash.slice(1));
6+
if (expectedCLS && expectedCLS >= 0) {
7+
simulateCLS(expectedCLS).then(() => window.dispatchEvent(new Event('cls-done')));
8+
}
9+
10+
// Simulate layout shift whenever the trigger-cls event is dispatched
11+
// Cannot trigger via a button click because expected layout shift after
12+
// an interaction doesn't contribute to CLS.
13+
window.addEventListener('trigger-cls', () => {
14+
simulateCLS(0.1).then(() => {
15+
window.dispatchEvent(new Event('cls-done'));
16+
});
17+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<div id="content"></div>
8+
<p>Some content</p>
9+
</body>
10+
</html>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import type { Page } from '@playwright/test';
2+
import { expect } from '@playwright/test';
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import { hidePage, shouldSkipTracingTest, testingCdnBundle } from '../../../../utils/helpers';
5+
import { getSpanOp, waitForStreamedSpan } from '../../../../utils/spanUtils';
6+
7+
sentryTest.beforeEach(async ({ browserName, page }) => {
8+
if (shouldSkipTracingTest() || testingCdnBundle() || browserName !== 'chromium') {
9+
sentryTest.skip();
10+
}
11+
12+
await page.setViewportSize({ width: 800, height: 1200 });
13+
});
14+
15+
function waitForLayoutShift(page: Page): Promise<void> {
16+
return page.evaluate(() => {
17+
return new Promise(resolve => {
18+
window.addEventListener('cls-done', () => resolve());
19+
});
20+
});
21+
}
22+
23+
sentryTest('captures CLS as a streamed span with source attributes', async ({ getLocalTestUrl, page }) => {
24+
const url = await getLocalTestUrl({ testDir: __dirname });
25+
26+
const clsSpanPromise = waitForStreamedSpan(page, span => getSpanOp(span) === 'ui.webvital.cls');
27+
const pageloadSpanPromise = waitForStreamedSpan(page, span => getSpanOp(span) === 'pageload');
28+
29+
await page.goto(`${url}#0.15`);
30+
await waitForLayoutShift(page);
31+
await hidePage(page);
32+
33+
const clsSpan = await clsSpanPromise;
34+
const pageloadSpan = await pageloadSpanPromise;
35+
36+
expect(clsSpan.attributes?.['sentry.op']).toEqual({ type: 'string', value: 'ui.webvital.cls' });
37+
expect(clsSpan.attributes?.['sentry.origin']).toEqual({ type: 'string', value: 'auto.http.browser.cls' });
38+
expect(clsSpan.attributes?.['sentry.exclusive_time']).toEqual({ type: 'integer', value: 0 });
39+
expect(clsSpan.attributes?.['user_agent.original']?.value).toEqual(expect.stringContaining('Chrome'));
40+
41+
// Check browser.web_vital.cls.source attributes
42+
expect(clsSpan.attributes?.['browser.web_vital.cls.source.1']?.value).toEqual(
43+
expect.stringContaining('body > div#content > p'),
44+
);
45+
46+
// Check pageload span id is present
47+
expect(clsSpan.attributes?.['sentry.pageload.span_id']?.value).toBe(pageloadSpan.span_id);
48+
49+
// CLS is a point-in-time metric
50+
expect(clsSpan.start_timestamp).toEqual(clsSpan.end_timestamp);
51+
52+
expect(clsSpan.span_id).toMatch(/^[\da-f]{16}$/);
53+
expect(clsSpan.trace_id).toMatch(/^[\da-f]{32}$/);
54+
55+
expect(clsSpan.parent_span_id).toBe(pageloadSpan.span_id);
56+
expect(clsSpan.trace_id).toBe(pageloadSpan.trace_id);
57+
});
58+
59+
sentryTest('CLS streamed span has web vital value attribute', async ({ getLocalTestUrl, page }) => {
60+
const url = await getLocalTestUrl({ testDir: __dirname });
61+
62+
const clsSpanPromise = waitForStreamedSpan(page, span => getSpanOp(span) === 'ui.webvital.cls');
63+
64+
await page.goto(`${url}#0.1`);
65+
await waitForLayoutShift(page);
66+
await hidePage(page);
67+
68+
const clsSpan = await clsSpanPromise;
69+
70+
// The CLS value should be set as a browser.web_vital.cls.value attribute
71+
expect(clsSpan.attributes?.['browser.web_vital.cls.value']?.type).toBe('double');
72+
// Flakey value dependent on timings -> we check for a range
73+
const clsValue = clsSpan.attributes?.['browser.web_vital.cls.value']?.value as number;
74+
expect(clsValue).toBeGreaterThan(0.05);
75+
expect(clsValue).toBeLessThan(0.15);
76+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
window._testBaseTimestamp = performance.timeOrigin / 1000;
5+
6+
Sentry.init({
7+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
8+
integrations: [Sentry.browserTracingIntegration({ idleTimeout: 4000 }), Sentry.spanStreamingIntegration()],
9+
tracesSampleRate: 1,
10+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const blockUI =
2+
(delay = 70) =>
3+
e => {
4+
const startTime = Date.now();
5+
6+
function getElapsed() {
7+
const time = Date.now();
8+
return time - startTime;
9+
}
10+
11+
while (getElapsed() < delay) {
12+
//
13+
}
14+
15+
e.target.classList.add('clicked');
16+
};
17+
18+
document.querySelector('[data-test-id=slow-button]').addEventListener('click', blockUI(450));
19+
document.querySelector('[data-test-id=normal-button]').addEventListener('click', blockUI());
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<button data-test-id="slow-button" data-sentry-element="SlowButton">Slow</button>
8+
<button data-test-id="normal-button" data-sentry-element="NormalButton">Click Me</button>
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)