Skip to content

Commit 0c398ab

Browse files
authored
Merge branch 'develop' into sig/nitro-parametrized-routes
2 parents 5362333 + 868d01a commit 0c398ab

File tree

40 files changed

+1083
-368
lines changed

40 files changed

+1083
-368
lines changed

.github/workflows/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- name: Get auth token
1717
id: token
18-
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
18+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
1919
with:
2020
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
2121
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Get auth token
2121
id: token
22-
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
22+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
2323
with:
2424
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
2525
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
Work in this release was contributed by @Spice-King. Thank you for your contribution!
8+
79
## 9.35.0
810

911
- feat(browser): Add ElementTiming instrumentation and spans ([#16589](https://github.com/getsentry/sentry-javascript/pull/16589))
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
window.Replay = Sentry.replayIntegration({
5+
flushMinDelay: 200,
6+
flushMaxDelay: 200,
7+
minReplayDuration: 0,
8+
useCompression: false,
9+
_experiments: {
10+
ignoreMutations: ['.moving'],
11+
},
12+
});
13+
14+
Sentry.init({
15+
dsn: 'https://[email protected]/1337',
16+
sampleRate: 0,
17+
replaysSessionSampleRate: 1.0,
18+
replaysOnErrorSampleRate: 0.0,
19+
20+
integrations: [window.Replay],
21+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function moveElement(el, remaining) {
2+
if (!remaining) {
3+
el.classList.remove('moving');
4+
5+
setTimeout(() => {
6+
el.style.transform = `translate(${remaining}0px, 0)`;
7+
el.classList.add('moved');
8+
});
9+
return;
10+
}
11+
12+
el.style.transform = `translate(${remaining}0px, 0)`;
13+
14+
setTimeout(() => {
15+
moveElement(el, remaining - 1);
16+
}, 10);
17+
}
18+
19+
const el = document.querySelector('#mutation-target');
20+
const btn = document.querySelector('#button-move');
21+
22+
btn.addEventListener('click', event => {
23+
el.classList.add('moving');
24+
event.preventDefault();
25+
moveElement(el, 20);
26+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<div id="mutation-target" style="position: relative">This is moved around!</div>
8+
9+
<button id="button-move" type="button">Move</button>
10+
</body>
11+
</html>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { expect } from '@playwright/test';
2+
import type { mutationData } from '@sentry-internal/rrweb-types';
3+
import { sentryTest } from '../../../utils/fixtures';
4+
import type { RecordingSnapshot } from '../../../utils/replayHelpers';
5+
import { collectReplayRequests, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers';
6+
7+
sentryTest('allows to ignore mutations via `ignoreMutations` option', async ({ getLocalTestUrl, page }) => {
8+
if (shouldSkipReplayTest()) {
9+
sentryTest.skip();
10+
}
11+
12+
const url = await getLocalTestUrl({ testDir: __dirname });
13+
14+
const reqPromise0 = waitForReplayRequest(page, 0);
15+
16+
await page.goto(url);
17+
await reqPromise0;
18+
19+
const requestsPromise = collectReplayRequests(page, recordingEvents => {
20+
const events = recordingEvents as (RecordingSnapshot & { data: mutationData })[];
21+
return events.some(event => event.data.attributes?.some(attr => attr.attributes['class'] === 'moved'));
22+
});
23+
24+
page.locator('#button-move').click();
25+
26+
const requests = await requestsPromise;
27+
28+
// All transform mutatinos are ignored and not captured
29+
const transformMutations = requests.replayRecordingSnapshots.filter(
30+
item =>
31+
(item.data as mutationData)?.attributes?.some(
32+
attr => attr.attributes['style'] && attr.attributes['class'] !== 'moved',
33+
),
34+
);
35+
36+
// Should capture the final class mutation
37+
const classMutations = requests.replayRecordingSnapshots.filter(
38+
item => (item.data as mutationData)?.attributes?.some(attr => attr.attributes['class']),
39+
);
40+
41+
expect(transformMutations).toEqual([]);
42+
expect(classMutations).toEqual([
43+
{
44+
data: {
45+
adds: [],
46+
attributes: [
47+
{
48+
attributes: {
49+
class: 'moved',
50+
style: {
51+
transform: 'translate(0px, 0px)',
52+
},
53+
},
54+
id: expect.any(Number),
55+
},
56+
],
57+
removes: [],
58+
source: expect.any(Number),
59+
texts: [],
60+
},
61+
timestamp: 0,
62+
type: 3,
63+
},
64+
]);
65+
});

packages/astro/src/index.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export {
1212
addEventProcessor,
1313
addIntegration,
1414
amqplibIntegration,
15+
// eslint-disable-next-line deprecation/deprecation
1516
anrIntegration,
17+
// eslint-disable-next-line deprecation/deprecation
1618
disableAnrDetectionForCallback,
1719
captureCheckIn,
1820
captureConsoleIntegration,

packages/aws-serverless/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export {
4242
close,
4343
getSentryRelease,
4444
createGetModuleFromFilename,
45+
// eslint-disable-next-line deprecation/deprecation
4546
anrIntegration,
47+
// eslint-disable-next-line deprecation/deprecation
4648
disableAnrDetectionForCallback,
4749
consoleIntegration,
4850
httpIntegration,

packages/browser/src/tracing/request.ts

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Client, HandlerDataXhr, SentryWrappedXMLHttpRequest, Span, WebFetc
22
import {
33
addFetchEndInstrumentationHandler,
44
addFetchInstrumentationHandler,
5-
browserPerformanceTimeOrigin,
65
getActiveSpan,
76
getClient,
87
getLocationHref,
@@ -23,10 +22,10 @@ import type { XhrHint } from '@sentry-internal/browser-utils';
2322
import {
2423
addPerformanceInstrumentationHandler,
2524
addXhrInstrumentationHandler,
26-
extractNetworkProtocol,
2725
SENTRY_XHR_DATA_KEY,
2826
} from '@sentry-internal/browser-utils';
2927
import { WINDOW } from '../helpers';
28+
import { resourceTimingToSpanAttributes } from './resource-timing';
3029

3130
/** Options for Request Instrumentation */
3231
export interface RequestInstrumentationOptions {
@@ -238,8 +237,8 @@ function addHTTPTimings(span: Span): void {
238237
const cleanup = addPerformanceInstrumentationHandler('resource', ({ entries }) => {
239238
entries.forEach(entry => {
240239
if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) {
241-
const spanData = resourceTimingEntryToSpanData(entry);
242-
spanData.forEach(data => span.setAttribute(...data));
240+
const spanAttributes = resourceTimingToSpanAttributes(entry);
241+
spanAttributes.forEach(attributeArray => span.setAttribute(...attributeArray));
243242
// In the next tick, clean this handler up
244243
// We have to wait here because otherwise this cleans itself up before it is fully done
245244
setTimeout(cleanup);
@@ -248,35 +247,6 @@ function addHTTPTimings(span: Span): void {
248247
});
249248
}
250249

251-
function getAbsoluteTime(time: number = 0): number {
252-
return ((browserPerformanceTimeOrigin() || performance.timeOrigin) + time) / 1000;
253-
}
254-
255-
function resourceTimingEntryToSpanData(resourceTiming: PerformanceResourceTiming): [string, string | number][] {
256-
const { name, version } = extractNetworkProtocol(resourceTiming.nextHopProtocol);
257-
258-
const timingSpanData: [string, string | number][] = [];
259-
260-
timingSpanData.push(['network.protocol.version', version], ['network.protocol.name', name]);
261-
262-
if (!browserPerformanceTimeOrigin()) {
263-
return timingSpanData;
264-
}
265-
return [
266-
...timingSpanData,
267-
['http.request.redirect_start', getAbsoluteTime(resourceTiming.redirectStart)],
268-
['http.request.fetch_start', getAbsoluteTime(resourceTiming.fetchStart)],
269-
['http.request.domain_lookup_start', getAbsoluteTime(resourceTiming.domainLookupStart)],
270-
['http.request.domain_lookup_end', getAbsoluteTime(resourceTiming.domainLookupEnd)],
271-
['http.request.connect_start', getAbsoluteTime(resourceTiming.connectStart)],
272-
['http.request.secure_connection_start', getAbsoluteTime(resourceTiming.secureConnectionStart)],
273-
['http.request.connection_end', getAbsoluteTime(resourceTiming.connectEnd)],
274-
['http.request.request_start', getAbsoluteTime(resourceTiming.requestStart)],
275-
['http.request.response_start', getAbsoluteTime(resourceTiming.responseStart)],
276-
['http.request.response_end', getAbsoluteTime(resourceTiming.responseEnd)],
277-
];
278-
}
279-
280250
/**
281251
* A function that determines whether to attach tracing headers to a request.
282252
* We only export this function for testing purposes.

0 commit comments

Comments
 (0)