Skip to content

Commit 4a6acd7

Browse files
author
Luca Forstner
committed
Merge remote-tracking branch 'origin/master' into lforst-refactor-proxy-loader
2 parents 14469f6 + 012ff34 commit 4a6acd7

File tree

11 files changed

+60
-56
lines changed

11 files changed

+60
-56
lines changed

packages/node/test/manual/webpack-domain/yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,9 @@ json-schema-traverse@^0.4.1:
13911391
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
13921392

13931393
json5@^1.0.1:
1394-
version "1.0.1"
1395-
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
1396-
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
1394+
version "1.0.2"
1395+
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
1396+
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
13971397
dependencies:
13981398
minimist "^1.2.0"
13991399

@@ -1577,9 +1577,9 @@ minimatch@^3.0.4:
15771577
brace-expansion "^1.1.7"
15781578

15791579
minimist@^1.2.0, minimist@^1.2.5:
1580-
version "1.2.5"
1581-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
1582-
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
1580+
version "1.2.7"
1581+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
1582+
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
15831583

15841584
mississippi@^3.0.0:
15851585
version "3.0.0"

packages/replay/demo/yarn.lock

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,13 +1493,13 @@
14931493
"@sentry/utils" "7.1.1"
14941494
tslib "^1.9.3"
14951495

1496-
"@sentry/core@7.24.0":
1497-
version "7.24.0"
1498-
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.24.0.tgz#e856a071c702279854d6e5221957d61cd48036cc"
1499-
integrity sha512-QVRtmnaWEI0/MHIfBozgsMfh+7WU6OfpvUd72x1Dpk3Zk6Zs7Hqq0YfxfeBd7ApjNjGogPl1beaHcHAHlr3IyA==
1496+
"@sentry/core@7.28.1":
1497+
version "7.28.1"
1498+
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.28.1.tgz#c712ce17469b18b01606108817be24a99ed2116e"
1499+
integrity sha512-7wvnuvn/mrAfcugWoCG/3pqDIrUgH5t+HisMJMGw0h9Tc33KqrmqMDCQVvjlrr2pWrw/vuUCFdm8CbUHJ832oQ==
15001500
dependencies:
1501-
"@sentry/types" "7.24.0"
1502-
"@sentry/utils" "7.24.0"
1501+
"@sentry/types" "7.28.1"
1502+
"@sentry/utils" "7.28.1"
15031503
tslib "^1.9.3"
15041504

15051505
"@sentry/hub@7.1.1":
@@ -1512,12 +1512,11 @@
15121512
tslib "^1.9.3"
15131513

15141514
"@sentry/replay@file:..":
1515-
version "7.24.0"
1515+
version "7.28.1"
15161516
dependencies:
1517-
"@sentry/core" "7.24.0"
1518-
"@sentry/types" "7.24.0"
1519-
"@sentry/utils" "7.24.0"
1520-
lodash.debounce "^4.0.8"
1517+
"@sentry/core" "7.28.1"
1518+
"@sentry/types" "7.28.1"
1519+
"@sentry/utils" "7.28.1"
15211520

15221521
"@sentry/tracing@^7.1.1":
15231522
version "7.1.1"
@@ -1534,10 +1533,10 @@
15341533
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.1.1.tgz#63aa68e7be36d63cc305d01af9119a4cdb186ae3"
15351534
integrity sha512-5N1UMd2SqvUXprcIUMyDEju3H9lJY2oWfWQBGo0lG6Amn/lGAPAYlchg+4vQCLutDQMyd8K9zPwcbKn4u6gHdw==
15361535

1537-
"@sentry/types@7.24.0":
1538-
version "7.24.0"
1539-
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.24.0.tgz#1acc841efe7bd56fc3eb647a613dba92631e8413"
1540-
integrity sha512-Xs4r9esBPieJUA6cGmMqfSQiinILdlhScjM+NqDSzxOo8+LRCJzckTLhUttBGVlaAoa4hjCEsfkHA1tVV1DycA==
1536+
"@sentry/types@7.28.1":
1537+
version "7.28.1"
1538+
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.28.1.tgz#9018b4c152b475de9bedd267237393d3c9b1253d"
1539+
integrity sha512-DvSplMVrVEmOzR2M161V5+B8Up3vR71xMqJOpWTzE9TqtFJRGPtqT/5OBsNJJw1+/j2ssMcnKwbEo9Q2EGeS6g==
15411540

15421541
"@sentry/utils@7.1.1":
15431542
version "7.1.1"
@@ -1547,12 +1546,12 @@
15471546
"@sentry/types" "7.1.1"
15481547
tslib "^1.9.3"
15491548

1550-
"@sentry/utils@7.24.0":
1551-
version "7.24.0"
1552-
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.24.0.tgz#73f100dc8942e73353473eaf3168e5052e2f45be"
1553-
integrity sha512-baaRDhHWHTyhmR6V8YKSo0NvN+D17pIKRDmb2vpWHVpTjobKCivNBLRoy3VhnIMS/24XyZnL028QLwkUNLg1Ug==
1549+
"@sentry/utils@7.28.1":
1550+
version "7.28.1"
1551+
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.28.1.tgz#0a7b6aa4b09e91e4d1aded2a8c8dbaf818cee96e"
1552+
integrity sha512-75/jzLUO9HH09iC9TslNimGbxOP3jgn89P+q7uR+rp2fJfRExHVeKJZQdK0Ij4/SmE7TJ3Uh2r154N0INZEx1g==
15541553
dependencies:
1555-
"@sentry/types" "7.24.0"
1554+
"@sentry/types" "7.28.1"
15561555
tslib "^1.9.3"
15571556

15581557
"@sinonjs/commons@^1.7.0":
@@ -5548,9 +5547,9 @@ json-stable-stringify-without-jsonify@^1.0.1:
55485547
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
55495548

55505549
json5@^1.0.1:
5551-
version "1.0.1"
5552-
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
5553-
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
5550+
version "1.0.2"
5551+
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
5552+
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
55545553
dependencies:
55555554
minimist "^1.2.0"
55565555

@@ -5879,12 +5878,7 @@ minimatch@^5.0.1:
58795878
dependencies:
58805879
brace-expansion "^2.0.1"
58815880

5882-
minimist@^1.1.1, minimist@^1.2.5:
5883-
version "1.2.6"
5884-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
5885-
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
5886-
5887-
minimist@^1.2.0:
5881+
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
58885882
version "1.2.7"
58895883
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
58905884
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==

packages/replay/src/replay.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable max-lines */ // TODO: We might want to split this file up
22
import { addGlobalEventProcessor, captureException, getCurrentHub, setContext } from '@sentry/core';
3-
import { Breadcrumb, ReplayEvent, TransportMakeRequestResponse } from '@sentry/types';
3+
import type { Breadcrumb, ReplayEvent, ReplayRecordingMode, TransportMakeRequestResponse } from '@sentry/types';
44
import { addInstrumentationHandler, logger } from '@sentry/utils';
55
import { EventType, record } from 'rrweb';
66

@@ -34,7 +34,6 @@ import type {
3434
RecordingOptions,
3535
ReplayContainer as ReplayContainerInterface,
3636
ReplayPluginOptions,
37-
ReplayRecordingMode,
3837
SendReplay,
3938
Session,
4039
} from './types';
@@ -922,7 +921,7 @@ export class ReplayContainer implements ReplayContainerInterface {
922921
const transport = client && client.getTransport();
923922
const dsn = client?.getDsn();
924923

925-
if (!client || !scope || !transport || !dsn) {
924+
if (!client || !scope || !transport || !dsn || !this.session || !this.session.sampled) {
926925
return;
927926
}
928927

@@ -936,9 +935,10 @@ export class ReplayContainer implements ReplayContainerInterface {
936935
urls,
937936
replay_id: replayId,
938937
segment_id,
938+
replay_type: this.session.sampled,
939939
};
940940

941-
const replayEvent = await getReplayEvent({ scope, client, event: baseEvent });
941+
const replayEvent = await getReplayEvent({ scope, client, replayId, event: baseEvent });
942942

943943
if (!replayEvent) {
944944
// Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
@@ -951,7 +951,6 @@ export class ReplayContainer implements ReplayContainerInterface {
951951
...replayEvent.tags,
952952
sessionSampleRate: this._options.sessionSampleRate,
953953
errorSampleRate: this._options.errorSampleRate,
954-
replayType: this.session?.sampled,
955954
};
956955

957956
/*
@@ -970,8 +969,9 @@ export class ReplayContainer implements ReplayContainerInterface {
970969
],
971970
"replay_id": "eventId",
972971
"segment_id": 3,
972+
"replay_type": "error",
973973
"platform": "javascript",
974-
"event_id": "generated-uuid",
974+
"event_id": "eventId",
975975
"environment": "production",
976976
"sdk": {
977977
"integrations": [
@@ -985,7 +985,6 @@ export class ReplayContainer implements ReplayContainerInterface {
985985
"tags": {
986986
"sessionSampleRate": 1,
987987
"errorSampleRate": 0,
988-
"replayType": "error"
989988
}
990989
}
991990
*/

packages/replay/src/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReplayRecordingData } from '@sentry/types';
1+
import type { ReplayRecordingData, ReplayRecordingMode } from '@sentry/types';
22

33
import type { eventWithTime, recordOptions } from './types/rrweb';
44

@@ -9,8 +9,6 @@ export type RecordedEvents = Uint8Array | string;
99

1010
export type AllPerformanceEntry = PerformancePaintTiming | PerformanceResourceTiming | PerformanceNavigationTiming;
1111

12-
export type ReplayRecordingMode = 'session' | 'error';
13-
1412
export interface SendReplay {
1513
events: RecordedEvents;
1614
replayId: string;

packages/replay/src/util/getReplayEvent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { Client, ReplayEvent } from '@sentry/types';
44
export async function getReplayEvent({
55
client,
66
scope,
7+
replayId: event_id,
78
event,
89
}: {
910
client: Client;
1011
scope: Scope;
12+
replayId: string;
1113
event: ReplayEvent;
1214
}): Promise<ReplayEvent | null> {
13-
const preparedEvent = (await prepareEvent(client.getOptions(), event, {}, scope)) as ReplayEvent | null;
15+
const preparedEvent = (await prepareEvent(client.getOptions(), event, { event_id }, scope)) as ReplayEvent | null;
1416

1517
// If e.g. a global event processor returned null
1618
if (!preparedEvent) {

packages/replay/test/unit/index-errorSampleRate.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ describe('Replay (errorSampleRate)', () => {
6060
expect(replay).toHaveSentReplay({
6161
recordingPayloadHeader: { segment_id: 0 },
6262
replayEventPayload: expect.objectContaining({
63+
replay_type: 'error',
6364
tags: expect.objectContaining({
6465
errorSampleRate: 1,
65-
replayType: 'error',
6666
sessionSampleRate: 0,
6767
}),
6868
}),
@@ -90,9 +90,9 @@ describe('Replay (errorSampleRate)', () => {
9090
expect(replay).toHaveLastSentReplay({
9191
recordingPayloadHeader: { segment_id: 1 },
9292
replayEventPayload: expect.objectContaining({
93+
replay_type: 'error',
9394
tags: expect.objectContaining({
9495
errorSampleRate: 1,
95-
replayType: 'error',
9696
sessionSampleRate: 0,
9797
}),
9898
}),

packages/replay/test/unit/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,9 @@ describe('Replay', () => {
789789
replayEventPayload: expect.objectContaining({
790790
replay_start_timestamp: (BASE_TIMESTAMP - 10000) / 1000,
791791
urls: ['http://localhost/'], // this doesn't truly test if we are capturing the right URL as we don't change URLs, but good enough
792+
replay_type: 'session',
792793
tags: expect.objectContaining({
793794
errorSampleRate: 0,
794-
replayType: 'session',
795795
sessionSampleRate: 1,
796796
}),
797797
}),

packages/replay/test/unit/util/createReplayEnvelope.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ describe('createReplayEnvelope', () => {
2323
name: 'sentry.javascript.browser',
2424
version: '7.25.0',
2525
},
26+
replay_type: 'error',
2627
tags: {
2728
sessionSampleRate: 1,
2829
errorSampleRate: 0,
29-
replayType: 'error',
3030
},
3131
};
3232

@@ -59,9 +59,10 @@ describe('createReplayEnvelope', () => {
5959
event_id: REPLAY_ID,
6060
platform: 'javascript',
6161
replay_id: REPLAY_ID,
62+
replay_type: 'error',
6263
sdk: { integrations: ['BrowserTracing', 'Replay'], name: 'sentry.javascript.browser', version: '7.25.0' },
6364
segment_id: 3,
64-
tags: { errorSampleRate: 0, replayType: 'error', sessionSampleRate: 1 },
65+
tags: { errorSampleRate: 0, sessionSampleRate: 1 },
6566
timestamp: 1670837008.634,
6667
trace_ids: ['traceId'],
6768
type: 'replay_event',
@@ -94,7 +95,8 @@ describe('createReplayEnvelope', () => {
9495
replay_id: REPLAY_ID,
9596
sdk: { integrations: ['BrowserTracing', 'Replay'], name: 'sentry.javascript.browser', version: '7.25.0' },
9697
segment_id: 3,
97-
tags: { errorSampleRate: 0, replayType: 'error', sessionSampleRate: 1 },
98+
replay_type: 'error',
99+
tags: { errorSampleRate: 0, sessionSampleRate: 1 },
98100
timestamp: 1670837008.634,
99101
trace_ids: ['traceId'],
100102
type: 'replay_event',

packages/replay/test/unit/util/getReplayEvent.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ describe('getReplayEvent', () => {
3333
trace_ids: ['trace-ID'],
3434
urls: ['https://sentry.io/'],
3535
replay_id: replayId,
36+
event_id: replayId,
37+
replay_type: 'session',
3638
segment_id: 3,
3739
};
3840

39-
const replayEvent = await getReplayEvent({ scope, client, event });
41+
const replayEvent = await getReplayEvent({ scope, client, replayId, event });
4042

4143
expect(replayEvent).toEqual({
4244
type: 'replay_event',
@@ -45,10 +47,10 @@ describe('getReplayEvent', () => {
4547
trace_ids: ['trace-ID'],
4648
urls: ['https://sentry.io/'],
4749
replay_id: 'replay-ID',
50+
replay_type: 'session',
4851
segment_id: 3,
4952
platform: 'javascript',
50-
// generated uuid with 32 chars
51-
event_id: expect.stringMatching(/^\w{32}$/),
53+
event_id: 'replay-ID',
5254
environment: 'production',
5355
sdk: {
5456
name: 'sentry.javascript.browser',

packages/types/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export type { ExtractedNodeRequestData, HttpHeaderValue, Primitive, WorkerLocati
4040
export type { ClientOptions, Options } from './options';
4141
export type { Package } from './package';
4242
export type { PolymorphicEvent, PolymorphicRequest } from './polymorphics';
43-
export type { ReplayEvent, ReplayRecordingData } from './replay';
43+
export type { ReplayEvent, ReplayRecordingData, ReplayRecordingMode } from './replay';
4444
export type { QueryParams, Request } from './request';
4545
export type { Runtime } from './runtime';
4646
export type { CaptureContext, Scope, ScopeContext } from './scope';

packages/types/src/replay.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ export interface ReplayEvent extends Event {
1010
trace_ids: string[];
1111
replay_id: string;
1212
segment_id: number;
13+
replay_type: ReplayRecordingMode;
1314
}
1415

1516
/**
1617
* NOTE: These types are still considered Beta and subject to change.
1718
* @hidden
1819
*/
1920
export type ReplayRecordingData = string | Uint8Array;
21+
22+
/**
23+
* NOTE: These types are still considered Beta and subject to change.
24+
* @hidden
25+
*/
26+
export type ReplayRecordingMode = 'session' | 'error';

0 commit comments

Comments
 (0)