@sentry/replay 0.6.11 → 0.6.13-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/config/types/jest.config.d.ts +3 -0
- package/dist/config/types/jest.setup.d.ts +32 -0
- package/dist/config/types/src/blockAllMedia.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/getBreadcrumbHandler.d.ts +3 -0
- package/dist/config/types/src/coreHandlers/getSpanHandler.d.ts +5 -0
- package/dist/config/types/src/coreHandlers/handleDom.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleFetch.d.ts +19 -0
- package/dist/config/types/src/coreHandlers/handleFetch.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleHistory.d.ts +7 -0
- package/dist/config/types/src/coreHandlers/handleScope-unit.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleScope.d.ts +2 -0
- package/dist/config/types/src/coreHandlers/handleScope.test.d.ts +1 -0
- package/dist/config/types/src/coreHandlers/handleXhr.d.ts +21 -0
- package/dist/config/types/src/createPerformanceEntry.d.ts +43 -0
- package/dist/config/types/src/createPerformanceEntry.test.d.ts +1 -0
- package/dist/config/types/src/eventBuffer.d.ts +45 -0
- package/dist/config/types/src/eventBuffer.test.d.ts +1 -0
- package/dist/config/types/src/flags.d.ts +2 -0
- package/dist/config/types/src/flush.test.d.ts +1 -0
- package/dist/config/types/src/index-errorSampleRate.test.d.ts +1 -0
- package/dist/config/types/src/index-noSticky.test.d.ts +1 -0
- package/dist/config/types/src/index-sampling.test.d.ts +1 -0
- package/dist/config/types/src/index.d.ts +293 -0
- package/dist/config/types/src/index.test.d.ts +1 -0
- package/dist/config/types/src/multiple-instances.test.d.ts +1 -0
- package/dist/config/types/src/session/Session.d.ts +62 -0
- package/dist/config/types/src/session/Session.test.d.ts +1 -0
- package/dist/config/types/src/session/constants.d.ts +11 -0
- package/dist/config/types/src/session/createSession.d.ts +8 -0
- package/dist/config/types/src/session/createSession.test.d.ts +1 -0
- package/dist/config/types/src/session/deleteSession.d.ts +4 -0
- package/dist/config/types/src/session/deleteSession.test.d.ts +1 -0
- package/dist/config/types/src/session/fetchSession.d.ts +6 -0
- package/dist/config/types/src/session/fetchSession.test.d.ts +1 -0
- package/dist/config/types/src/session/getSession.d.ts +20 -0
- package/dist/config/types/src/session/getSession.test.d.ts +1 -0
- package/dist/config/types/src/session/index.d.ts +1 -0
- package/dist/config/types/src/session/saveSession.d.ts +2 -0
- package/dist/config/types/src/session/saveSession.test.d.ts +1 -0
- package/dist/config/types/src/stop.test.d.ts +1 -0
- package/dist/config/types/src/types.d.ts +131 -0
- package/dist/config/types/src/util/addInternalBreadcrumb.d.ts +5 -0
- package/dist/config/types/src/util/captureInternalException.d.ts +4 -0
- package/dist/config/types/src/util/createBreadcrumb.d.ts +4 -0
- package/dist/config/types/src/util/createPayload.d.ts +5 -0
- package/dist/config/types/src/util/dedupePerformanceEntries.d.ts +10 -0
- package/dist/config/types/src/util/dedupePerformanceEntries.test.d.ts +1 -0
- package/dist/config/types/src/util/isExpired.d.ts +5 -0
- package/dist/config/types/src/util/isExpired.test.d.ts +1 -0
- package/dist/config/types/src/util/isIngestHost.d.ts +4 -0
- package/dist/config/types/src/util/isInternal.d.ts +5 -0
- package/dist/config/types/src/util/isSampled.d.ts +7 -0
- package/dist/config/types/src/util/isSampled.test.d.ts +1 -0
- package/dist/config/types/src/util/isSessionExpired.d.ts +5 -0
- package/dist/config/types/src/util/isSessionExpired.test.d.ts +1 -0
- package/dist/config/types/src/util/logger.d.ts +12 -0
- package/dist/config/types/test/fixtures/performanceEntry/lcp.d.ts +1 -0
- package/dist/config/types/test/fixtures/performanceEntry/navigation.d.ts +1 -0
- package/dist/config/types/test/fixtures/performanceEntry/resource.d.ts +1 -0
- package/dist/config/types/test/index.d.ts +3 -0
- package/dist/config/types/test/mocks/mockRrweb.d.ts +15 -0
- package/dist/config/types/test/mocks/mockSdk.d.ts +10 -0
- package/dist/index.es.js +20 -15
- package/dist/index.js +20 -15
- package/dist/index.js.map +1 -1
- package/dist/types/src/session/Session.d.ts +5 -4
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SessionOptions } from '../types';
|
|
2
|
+
import { Session } from './Session';
|
|
3
|
+
interface GetSessionParams extends SessionOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The length of time (in ms) which we will consider the session to be expired.
|
|
6
|
+
*/
|
|
7
|
+
expiry: number;
|
|
8
|
+
/**
|
|
9
|
+
* The current session (e.g. if stickySession is off)
|
|
10
|
+
*/
|
|
11
|
+
currentSession?: Session;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get or create a session
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSession({ expiry, currentSession, stickySession, sessionSampleRate, errorSampleRate, }: GetSessionParams): {
|
|
17
|
+
type: string;
|
|
18
|
+
session: Session;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createSession';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { eventWithTime, recordOptions } from 'rrweb/typings/types';
|
|
2
|
+
export declare type RecordingEvent = eventWithTime;
|
|
3
|
+
export declare type RecordingOptions = recordOptions<eventWithTime>;
|
|
4
|
+
export declare type RecordedEvents = Uint8Array | string;
|
|
5
|
+
export declare type AllPerformanceEntry = PerformancePaintTiming | PerformanceResourceTiming | PerformanceNavigationTiming;
|
|
6
|
+
export interface SendReplayRequest {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
events: RecordedEvents;
|
|
9
|
+
replayId: string;
|
|
10
|
+
segmentId: number;
|
|
11
|
+
includeReplayStartTimestamp: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare type InstrumentationTypeBreadcrumb = 'dom' | 'scope';
|
|
14
|
+
export declare type InstrumentationTypeSpan = 'fetch' | 'xhr' | 'history';
|
|
15
|
+
export declare type InstrumentationType = InstrumentationTypeBreadcrumb | InstrumentationTypeSpan | 'console' | 'error' | 'unhandledrejection';
|
|
16
|
+
/**
|
|
17
|
+
* The request payload to worker
|
|
18
|
+
*/
|
|
19
|
+
export interface WorkerRequest {
|
|
20
|
+
id: number;
|
|
21
|
+
method: string;
|
|
22
|
+
args: any[];
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
const __SENTRY_REPLAY_VERSION__: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The response from the worker
|
|
29
|
+
*/
|
|
30
|
+
export interface WorkerResponse {
|
|
31
|
+
id: number;
|
|
32
|
+
method: string;
|
|
33
|
+
success: boolean;
|
|
34
|
+
response: string | Uint8Array;
|
|
35
|
+
}
|
|
36
|
+
export interface SampleRates {
|
|
37
|
+
/**
|
|
38
|
+
* The sample rate for session-long replays. 1.0 will record all sessions and
|
|
39
|
+
* 0 will record none.
|
|
40
|
+
*/
|
|
41
|
+
sessionSampleRate: number;
|
|
42
|
+
/**
|
|
43
|
+
* The sample rate for sessions that has had an error occur. This is
|
|
44
|
+
* independent of `sessionSampleRate`.
|
|
45
|
+
*/
|
|
46
|
+
errorSampleRate: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Session options that are configurable by the integration configuration
|
|
50
|
+
*/
|
|
51
|
+
export interface SessionOptions extends SampleRates {
|
|
52
|
+
/**
|
|
53
|
+
* If false, will create a new session per pageload. Otherwise, saves session
|
|
54
|
+
* to Session Storage.
|
|
55
|
+
*/
|
|
56
|
+
stickySession: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface ReplayPluginOptions extends SessionOptions {
|
|
59
|
+
/**
|
|
60
|
+
* The amount of time to wait before sending a replay
|
|
61
|
+
*/
|
|
62
|
+
flushMinDelay: number;
|
|
63
|
+
/**
|
|
64
|
+
* The max amount of time to wait before sending a replay
|
|
65
|
+
*/
|
|
66
|
+
flushMaxDelay: number;
|
|
67
|
+
/**
|
|
68
|
+
* The amount of time to buffer the initial snapshot
|
|
69
|
+
*/
|
|
70
|
+
initialFlushDelay: number;
|
|
71
|
+
/**
|
|
72
|
+
* Attempt to use compression when web workers are available
|
|
73
|
+
*
|
|
74
|
+
* (default is true)
|
|
75
|
+
*/
|
|
76
|
+
useCompression: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Only capture replays when an error happens
|
|
79
|
+
*
|
|
80
|
+
* @deprecated
|
|
81
|
+
* @see errorSampleRate
|
|
82
|
+
*/
|
|
83
|
+
captureOnlyOnError?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The sample rate for replays. 1.0 will record all replays, 0 will record none.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated
|
|
88
|
+
* @see sessionSampleRate
|
|
89
|
+
*/
|
|
90
|
+
replaysSamplingRate?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Mask all text in recordings. All text will be replaced with asterisks by default.
|
|
93
|
+
*/
|
|
94
|
+
maskAllText: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Block all media (e.g. images, svg, video) in recordings.
|
|
97
|
+
*/
|
|
98
|
+
blockAllMedia: boolean;
|
|
99
|
+
}
|
|
100
|
+
declare type OptionalReplayPluginOptions = Partial<ReplayPluginOptions>;
|
|
101
|
+
export interface ReplayConfiguration extends OptionalReplayPluginOptions, RecordingOptions {
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Some initial state captured before creating a root replay event
|
|
105
|
+
*/
|
|
106
|
+
export interface InitialState {
|
|
107
|
+
timestamp: number;
|
|
108
|
+
url: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Additional context that will be sent w/ `replay_event`
|
|
112
|
+
*/
|
|
113
|
+
export interface ReplayEventContext {
|
|
114
|
+
/**
|
|
115
|
+
* Set of Sentry error ids that have occurred during a replay segment
|
|
116
|
+
*/
|
|
117
|
+
errorIds: Set<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Set of Sentry trace ids that have occurred during a replay segment
|
|
120
|
+
*/
|
|
121
|
+
traceIds: Set<string>;
|
|
122
|
+
/**
|
|
123
|
+
* Ordered list of URLs that have been visited during a replay segment
|
|
124
|
+
*/
|
|
125
|
+
urls: string[];
|
|
126
|
+
/**
|
|
127
|
+
* The timestamp of the earliest event that has been added to event buffer. This can happen due to the Performance Observer which buffers events.
|
|
128
|
+
*/
|
|
129
|
+
earliestEvent: number | null;
|
|
130
|
+
}
|
|
131
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Breadcrumb } from '@sentry/types';
|
|
2
|
+
declare type RequiredProperties = 'category' | 'message';
|
|
3
|
+
export declare function createBreadcrumb(breadcrumb: Pick<Breadcrumb, RequiredProperties> & Partial<Omit<Breadcrumb, RequiredProperties>>): Breadcrumb;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* There are some difficulties diagnosing why there are duplicate navigation
|
|
3
|
+
* entries. We've witnessed several intermittent results:
|
|
4
|
+
* - duplicate entries have duration = 0
|
|
5
|
+
* - duplicate entries are the same object reference
|
|
6
|
+
* - none of the above
|
|
7
|
+
*
|
|
8
|
+
* Compare the values of several keys to determine if the entries are duplicates or not.
|
|
9
|
+
*/
|
|
10
|
+
export declare function dedupePerformanceEntries(currentList: PerformanceEntryList, newList: PerformanceEntryList): PerformancePaintTiming[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const logger: {
|
|
2
|
+
error: (...args: any[]) => any;
|
|
3
|
+
warn: (...args: any[]) => any;
|
|
4
|
+
log: (...args: any[]) => any;
|
|
5
|
+
disable(): void;
|
|
6
|
+
enable(): void;
|
|
7
|
+
info: (...args: unknown[]) => void;
|
|
8
|
+
debug: (...args: unknown[]) => void;
|
|
9
|
+
assert: (...args: unknown[]) => void;
|
|
10
|
+
trace: (...args: unknown[]) => void;
|
|
11
|
+
};
|
|
12
|
+
export { logger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceEntryLcp(obj?: Partial<PerformancePaintTiming>): PerformancePaintTiming;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceEntryNavigation(obj?: Partial<PerformanceNavigationTiming>): PerformanceNavigationTiming;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceEntryResource(obj?: Partial<PerformanceResourceTiming>): PerformanceResourceTiming;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { RecordingEvent } from '../../src/types';
|
|
3
|
+
declare type RecordAdditionalProperties = {
|
|
4
|
+
takeFullSnapshot: jest.Mock;
|
|
5
|
+
addCustomEvent: () => void;
|
|
6
|
+
freezePage: () => void;
|
|
7
|
+
mirror: unknown;
|
|
8
|
+
_emitter: (event: RecordingEvent, ...args: any[]) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare type RecordMock = jest.MockedFunction<typeof rrweb.record> & RecordAdditionalProperties;
|
|
11
|
+
import * as rrweb from 'rrweb';
|
|
12
|
+
export declare function mockRrweb(): {
|
|
13
|
+
record: RecordMock;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BrowserOptions } from '@sentry/browser';
|
|
2
|
+
import { ReplayConfiguration } from '../../src/types';
|
|
3
|
+
interface MockSdkParams {
|
|
4
|
+
replayOptions?: ReplayConfiguration;
|
|
5
|
+
sentryOptions?: BrowserOptions;
|
|
6
|
+
}
|
|
7
|
+
export declare function mockSdk({ replayOptions, sentryOptions, }?: MockSdkParams): Promise<{
|
|
8
|
+
replay: import("../../src").Replay;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
package/dist/index.es.js
CHANGED
|
@@ -353,7 +353,11 @@ var Session = /** @class */ (function () {
|
|
|
353
353
|
this._lastActivity = (_c = session.lastActivity) !== null && _c !== void 0 ? _c : now;
|
|
354
354
|
this._segmentId = (_d = session.segmentId) !== null && _d !== void 0 ? _d : 0;
|
|
355
355
|
this._sampled =
|
|
356
|
-
(_e = session.sampled) !== null && _e !== void 0 ? _e : (isSampled(sessionSampleRate)
|
|
356
|
+
(_e = session.sampled) !== null && _e !== void 0 ? _e : (isSampled(sessionSampleRate)
|
|
357
|
+
? 'session'
|
|
358
|
+
: isSampled(errorSampleRate)
|
|
359
|
+
? 'error'
|
|
360
|
+
: false);
|
|
357
361
|
this.options = {
|
|
358
362
|
stickySession: stickySession,
|
|
359
363
|
};
|
|
@@ -464,7 +468,6 @@ function fetchSession(_a) {
|
|
|
464
468
|
}
|
|
465
469
|
try {
|
|
466
470
|
var sessionObj = JSON.parse(sessionStringFromStorage);
|
|
467
|
-
// TODO: It's unexpected, but people seem to encounter `sessionObj.segmentId === 0`
|
|
468
471
|
return new Session(sessionObj,
|
|
469
472
|
// We are assuming that if there is a saved item, then the session is sticky,
|
|
470
473
|
// however this could break down if we used a different storage mechanism (e.g. localstorage)
|
|
@@ -1252,14 +1255,6 @@ var Replay = /** @class */ (function () {
|
|
|
1252
1255
|
maskAllText: maskAllText,
|
|
1253
1256
|
blockAllMedia: blockAllMedia,
|
|
1254
1257
|
};
|
|
1255
|
-
// Modify recording options to checkoutEveryNthSecond if this is defined, as we
|
|
1256
|
-
// don't know when an error will occur, so we need to keep a buffer of replay events.
|
|
1257
|
-
if (this.options.errorSampleRate > 0 &&
|
|
1258
|
-
this.options.sessionSampleRate < 1.0) {
|
|
1259
|
-
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
|
|
1260
|
-
this.recordingOptions.checkoutEveryNms = 60000;
|
|
1261
|
-
this.waitForError = true;
|
|
1262
|
-
}
|
|
1263
1258
|
// TODO(deprecated): Maintain backwards compatibility for alpha users
|
|
1264
1259
|
if (usingDeprecatedCaptureOnlyOnError) {
|
|
1265
1260
|
console.warn('[@sentry/replay]: The `captureOnlyOnError` option is deprecated! Please configure `errorSampleRate` instead.');
|
|
@@ -1316,6 +1311,7 @@ var Replay = /** @class */ (function () {
|
|
|
1316
1311
|
if (!isBrowser) {
|
|
1317
1312
|
return;
|
|
1318
1313
|
}
|
|
1314
|
+
this.setInitialState();
|
|
1319
1315
|
this.loadSession({ expiry: SESSION_IDLE_DURATION });
|
|
1320
1316
|
// If there is no session, then something bad has happened - can't continue
|
|
1321
1317
|
if (!this.session) {
|
|
@@ -1326,6 +1322,15 @@ var Replay = /** @class */ (function () {
|
|
|
1326
1322
|
// If session was not sampled, then we do not initialize the integration at all.
|
|
1327
1323
|
return;
|
|
1328
1324
|
}
|
|
1325
|
+
// Modify recording options to checkoutEveryNthSecond if
|
|
1326
|
+
// sampling for error replay. This is because we don't know
|
|
1327
|
+
// when an error will occur, so we need to keep a buffer of
|
|
1328
|
+
// replay events.
|
|
1329
|
+
if (this.session.sampled === 'error') {
|
|
1330
|
+
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
|
|
1331
|
+
this.recordingOptions.checkoutEveryNms = 60000;
|
|
1332
|
+
this.waitForError = true;
|
|
1333
|
+
}
|
|
1329
1334
|
// setup() is generally called on page load or manually - in both cases we
|
|
1330
1335
|
// should treat it as an activity
|
|
1331
1336
|
this.updateSessionActivity();
|
|
@@ -1333,9 +1338,6 @@ var Replay = /** @class */ (function () {
|
|
|
1333
1338
|
useCompression: Boolean(this.options.useCompression),
|
|
1334
1339
|
});
|
|
1335
1340
|
this.addListeners();
|
|
1336
|
-
// Tag all (non replay) events that get sent to Sentry with the current
|
|
1337
|
-
// replay ID so that we can reference them later in the UI
|
|
1338
|
-
addGlobalEventProcessor(this.handleGlobalEvent);
|
|
1339
1341
|
this.startRecording();
|
|
1340
1342
|
this.isEnabled = true;
|
|
1341
1343
|
};
|
|
@@ -1445,6 +1447,9 @@ var Replay = /** @class */ (function () {
|
|
|
1445
1447
|
addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
|
|
1446
1448
|
addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
|
|
1447
1449
|
addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
|
|
1450
|
+
// Tag all (non replay) events that get sent to Sentry with the current
|
|
1451
|
+
// replay ID so that we can reference them later in the UI
|
|
1452
|
+
addGlobalEventProcessor(this.handleGlobalEvent);
|
|
1448
1453
|
this.hasInitializedCoreListeners = true;
|
|
1449
1454
|
}
|
|
1450
1455
|
// PerformanceObserver //
|
|
@@ -1859,7 +1864,7 @@ var Replay = /** @class */ (function () {
|
|
|
1859
1864
|
timestamp = new Date().getTime();
|
|
1860
1865
|
sdkInfo = {
|
|
1861
1866
|
name: 'sentry.javascript.integration.replay',
|
|
1862
|
-
version: "0.6.
|
|
1867
|
+
version: "0.6.13-0",
|
|
1863
1868
|
};
|
|
1864
1869
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1865
1870
|
var _a;
|
|
@@ -1968,7 +1973,7 @@ var Replay = /** @class */ (function () {
|
|
|
1968
1973
|
setContext('Replays', {
|
|
1969
1974
|
retryCount: this.retryCount,
|
|
1970
1975
|
});
|
|
1971
|
-
captureInternalException(
|
|
1976
|
+
captureInternalException(ex_1);
|
|
1972
1977
|
// If an error happened here, it's likely that uploading the attachment
|
|
1973
1978
|
// failed, we'll can retry with the same events payload
|
|
1974
1979
|
if (this.retryCount >= MAX_RETRY_COUNT) {
|
package/dist/index.js
CHANGED
|
@@ -361,7 +361,11 @@ var Session = /** @class */ (function () {
|
|
|
361
361
|
this._lastActivity = (_c = session.lastActivity) !== null && _c !== void 0 ? _c : now;
|
|
362
362
|
this._segmentId = (_d = session.segmentId) !== null && _d !== void 0 ? _d : 0;
|
|
363
363
|
this._sampled =
|
|
364
|
-
(_e = session.sampled) !== null && _e !== void 0 ? _e : (isSampled(sessionSampleRate)
|
|
364
|
+
(_e = session.sampled) !== null && _e !== void 0 ? _e : (isSampled(sessionSampleRate)
|
|
365
|
+
? 'session'
|
|
366
|
+
: isSampled(errorSampleRate)
|
|
367
|
+
? 'error'
|
|
368
|
+
: false);
|
|
365
369
|
this.options = {
|
|
366
370
|
stickySession: stickySession,
|
|
367
371
|
};
|
|
@@ -472,7 +476,6 @@ function fetchSession(_a) {
|
|
|
472
476
|
}
|
|
473
477
|
try {
|
|
474
478
|
var sessionObj = JSON.parse(sessionStringFromStorage);
|
|
475
|
-
// TODO: It's unexpected, but people seem to encounter `sessionObj.segmentId === 0`
|
|
476
479
|
return new Session(sessionObj,
|
|
477
480
|
// We are assuming that if there is a saved item, then the session is sticky,
|
|
478
481
|
// however this could break down if we used a different storage mechanism (e.g. localstorage)
|
|
@@ -1260,14 +1263,6 @@ var Replay = /** @class */ (function () {
|
|
|
1260
1263
|
maskAllText: maskAllText,
|
|
1261
1264
|
blockAllMedia: blockAllMedia,
|
|
1262
1265
|
};
|
|
1263
|
-
// Modify recording options to checkoutEveryNthSecond if this is defined, as we
|
|
1264
|
-
// don't know when an error will occur, so we need to keep a buffer of replay events.
|
|
1265
|
-
if (this.options.errorSampleRate > 0 &&
|
|
1266
|
-
this.options.sessionSampleRate < 1.0) {
|
|
1267
|
-
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
|
|
1268
|
-
this.recordingOptions.checkoutEveryNms = 60000;
|
|
1269
|
-
this.waitForError = true;
|
|
1270
|
-
}
|
|
1271
1266
|
// TODO(deprecated): Maintain backwards compatibility for alpha users
|
|
1272
1267
|
if (usingDeprecatedCaptureOnlyOnError) {
|
|
1273
1268
|
console.warn('[@sentry/replay]: The `captureOnlyOnError` option is deprecated! Please configure `errorSampleRate` instead.');
|
|
@@ -1324,6 +1319,7 @@ var Replay = /** @class */ (function () {
|
|
|
1324
1319
|
if (!isBrowser) {
|
|
1325
1320
|
return;
|
|
1326
1321
|
}
|
|
1322
|
+
this.setInitialState();
|
|
1327
1323
|
this.loadSession({ expiry: SESSION_IDLE_DURATION });
|
|
1328
1324
|
// If there is no session, then something bad has happened - can't continue
|
|
1329
1325
|
if (!this.session) {
|
|
@@ -1334,6 +1330,15 @@ var Replay = /** @class */ (function () {
|
|
|
1334
1330
|
// If session was not sampled, then we do not initialize the integration at all.
|
|
1335
1331
|
return;
|
|
1336
1332
|
}
|
|
1333
|
+
// Modify recording options to checkoutEveryNthSecond if
|
|
1334
|
+
// sampling for error replay. This is because we don't know
|
|
1335
|
+
// when an error will occur, so we need to keep a buffer of
|
|
1336
|
+
// replay events.
|
|
1337
|
+
if (this.session.sampled === 'error') {
|
|
1338
|
+
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
|
|
1339
|
+
this.recordingOptions.checkoutEveryNms = 60000;
|
|
1340
|
+
this.waitForError = true;
|
|
1341
|
+
}
|
|
1337
1342
|
// setup() is generally called on page load or manually - in both cases we
|
|
1338
1343
|
// should treat it as an activity
|
|
1339
1344
|
this.updateSessionActivity();
|
|
@@ -1341,9 +1346,6 @@ var Replay = /** @class */ (function () {
|
|
|
1341
1346
|
useCompression: Boolean(this.options.useCompression),
|
|
1342
1347
|
});
|
|
1343
1348
|
this.addListeners();
|
|
1344
|
-
// Tag all (non replay) events that get sent to Sentry with the current
|
|
1345
|
-
// replay ID so that we can reference them later in the UI
|
|
1346
|
-
core.addGlobalEventProcessor(this.handleGlobalEvent);
|
|
1347
1349
|
this.startRecording();
|
|
1348
1350
|
this.isEnabled = true;
|
|
1349
1351
|
};
|
|
@@ -1453,6 +1455,9 @@ var Replay = /** @class */ (function () {
|
|
|
1453
1455
|
utils.addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
|
|
1454
1456
|
utils.addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
|
|
1455
1457
|
utils.addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
|
|
1458
|
+
// Tag all (non replay) events that get sent to Sentry with the current
|
|
1459
|
+
// replay ID so that we can reference them later in the UI
|
|
1460
|
+
core.addGlobalEventProcessor(this.handleGlobalEvent);
|
|
1456
1461
|
this.hasInitializedCoreListeners = true;
|
|
1457
1462
|
}
|
|
1458
1463
|
// PerformanceObserver //
|
|
@@ -1867,7 +1872,7 @@ var Replay = /** @class */ (function () {
|
|
|
1867
1872
|
timestamp = new Date().getTime();
|
|
1868
1873
|
sdkInfo = {
|
|
1869
1874
|
name: 'sentry.javascript.integration.replay',
|
|
1870
|
-
version: "0.6.
|
|
1875
|
+
version: "0.6.13-0",
|
|
1871
1876
|
};
|
|
1872
1877
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1873
1878
|
var _a;
|
|
@@ -1976,7 +1981,7 @@ var Replay = /** @class */ (function () {
|
|
|
1976
1981
|
core.setContext('Replays', {
|
|
1977
1982
|
retryCount: this.retryCount,
|
|
1978
1983
|
});
|
|
1979
|
-
captureInternalException(
|
|
1984
|
+
captureInternalException(ex_1);
|
|
1980
1985
|
// If an error happened here, it's likely that uploading the attachment
|
|
1981
1986
|
// failed, we'll can retry with the same events payload
|
|
1982
1987
|
if (this.retryCount >= MAX_RETRY_COUNT) {
|