Skip to content

Commit b461588

Browse files
committed
feat(replay): Share performance instrumentation with tracing
1 parent df08e8f commit b461588

File tree

30 files changed

+351
-330
lines changed

30 files changed

+351
-330
lines changed

packages/browser-integration-tests/suites/replay/eventBufferError/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { envelopeRequestParser } from '../../../utils/helpers';
55
import {
66
getDecompressedRecordingEvents,
77
getReplaySnapshot,
8+
isCustomSnapshot,
89
isReplayEvent,
910
REPLAY_DEFAULT_FLUSH_MAX_DELAY,
1011
shouldSkipReplayTest,
@@ -41,8 +42,8 @@ sentryTest(
4142
// We only want to count replays here
4243
if (event && isReplayEvent(event)) {
4344
const events = getDecompressedRecordingEvents(route.request());
44-
// this makes sure we ignore e.g. mouse move events which can otherwise lead to flakes
45-
if (events.length > 0) {
45+
// Make sure to not count mouse moves or performance spans
46+
if (events.filter(event => !isCustomSnapshot(event) || event.data.tag !== 'performanceSpan').length > 0) {
4647
called++;
4748
}
4849
}

packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/template.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<button id="button-add">Add items</button>
8-
<button id="button-modify">Modify items</button>
9-
<button id="button-remove">Remove items</button>
7+
<button id="noop" type="button">Noop</button>
8+
<button id="button-add" type="button">Add items</button>
9+
<button id="button-modify" type="button">Modify items</button>
10+
<button id="button-remove" type="button">Remove items</button>
1011
<ul class="list"></ul>
1112

1213
<script>

packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ sentryTest(
2121
const url = await getLocalTestPath({ testDir: __dirname });
2222

2323
const [res0] = await Promise.all([waitForReplayRequest(page, 0), page.goto(url)]);
24+
// Ensure LCP is captured
25+
await Promise.all([waitForReplayRequest(page), page.click('#noop')]);
2426
await forceFlushReplay();
2527

2628
const [res1] = await Promise.all([waitForReplayRequest(page), page.click('#button-add')]);

packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/template.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<button id="button-add">Add items</button>
8-
<button id="button-modify">Modify items</button>
9-
<button id="button-remove">Remove items</button>
7+
<button id="noop" type="button">Noop</button>
8+
<button id="button-add" type="button">Add items</button>
9+
<button id="button-modify" type="button">Modify items</button>
10+
<button id="button-remove" type="button">Remove items</button>
1011
<ul class="list"></ul>
1112

1213
<script>

packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ sentryTest(
2323
});
2424
});
2525

26-
const reqPromise0 = waitForReplayRequest(page, 0);
27-
2826
const url = await getLocalTestPath({ testDir: __dirname });
2927

30-
const [res0] = await Promise.all([reqPromise0, page.goto(url)]);
28+
const [res0] = await Promise.all([waitForReplayRequest(page, 0), page.goto(url)]);
29+
// Ensure LCP is captured
30+
await Promise.all([waitForReplayRequest(page), page.click('#noop')]);
3131
await forceFlushReplay();
3232

33-
const reqPromise1 = waitForReplayRequest(page);
34-
35-
const [res1] = await Promise.all([reqPromise1, page.click('#button-add')]);
33+
const [res1] = await Promise.all([waitForReplayRequest(page), page.click('#button-add')]);
3634
await forceFlushReplay();
3735

3836
// replay should be stopped due to mutation limit

packages/browser-integration-tests/suites/replay/multiple-pages/test.ts-snapshots/seg-1-snap-incremental-chromium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": 1,
77
"id": 9,
88
"x": 41.810001373291016,
9-
"y": 18.479999542236328
9+
"y": 18.75
1010
},
1111
"timestamp": [timestamp]
1212
},
@@ -26,7 +26,7 @@
2626
"type": 0,
2727
"id": 9,
2828
"x": 41.810001373291016,
29-
"y": 18.479999542236328
29+
"y": 18.75
3030
},
3131
"timestamp": [timestamp]
3232
},

packages/browser-integration-tests/suites/replay/multiple-pages/test.ts-snapshots/seg-3-snap-incremental-chromium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": 1,
77
"id": 9,
88
"x": 41.810001373291016,
9-
"y": 18.479999542236328
9+
"y": 18.75
1010
},
1111
"timestamp": [timestamp]
1212
},
@@ -26,7 +26,7 @@
2626
"type": 0,
2727
"id": 9,
2828
"x": 41.810001373291016,
29-
"y": 18.479999542236328
29+
"y": 18.75
3030
},
3131
"timestamp": [timestamp]
3232
},

packages/browser-integration-tests/suites/replay/multiple-pages/test.ts-snapshots/seg-5-snap-incremental-chromium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": 1,
77
"id": 12,
88
"x": 41.810001373291016,
9-
"y": 90.37000274658203
9+
"y": 90.62000274658203
1010
},
1111
"timestamp": [timestamp]
1212
},
@@ -26,7 +26,7 @@
2626
"type": 0,
2727
"id": 12,
2828
"x": 41.810001373291016,
29-
"y": 90.37000274658203
29+
"y": 90.62000274658203
3030
},
3131
"timestamp": [timestamp]
3232
},

packages/browser-integration-tests/suites/replay/multiple-pages/test.ts-snapshots/seg-6-snap-incremental-chromium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": 1,
77
"id": 15,
88
"x": 157.13999938964844,
9-
"y": 90.37000274658203
9+
"y": 90.62000274658203
1010
},
1111
"timestamp": [timestamp]
1212
},
@@ -35,7 +35,7 @@
3535
"type": 0,
3636
"id": 15,
3737
"x": 157.13999938964844,
38-
"y": 90.37000274658203
38+
"y": 90.62000274658203
3939
},
4040
"timestamp": [timestamp]
4141
},

packages/browser-integration-tests/suites/replay/multiple-pages/test.ts-snapshots/seg-7-snap-incremental-chromium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": 1,
77
"id": 12,
88
"x": 41.810001373291016,
9-
"y": 90.37000274658203
9+
"y": 90.62000274658203
1010
},
1111
"timestamp": [timestamp]
1212
},
@@ -35,7 +35,7 @@
3535
"type": 0,
3636
"id": 12,
3737
"x": 41.810001373291016,
38-
"y": 90.37000274658203
38+
"y": 90.62000274658203
3939
},
4040
"timestamp": [timestamp]
4141
},

0 commit comments

Comments
 (0)