@coralogix/browser 3.0.1 → 3.1.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/CHANGELOG.md +11 -0
- package/index.esm2.js +3 -3
- package/package.json +1 -1
- package/sessionRecorder.esm.js +19 -31
- package/src/session/session.consts.d.ts +1 -1
- package/src/session/sessionRecorder.d.ts +2 -4
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 3.1.0 (2026-01-25)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
- Add optimized mutation handling in session recorder
|
|
5
|
+
|
|
6
|
+
## 3.0.2 (2026-01-20)
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- Revert mutation counter limit that could cause incomplete session recordings
|
|
11
|
+
|
|
1
12
|
## 3.0.1 (2026-01-18)
|
|
2
13
|
|
|
3
14
|
### 🩹 Fixes
|
package/index.esm2.js
CHANGED
|
@@ -212,7 +212,7 @@ var BATCH_TIME_DELAY = 1000;
|
|
|
212
212
|
var SESSION_RECORDING_POSTFIX_URL = '/browser/alpha/sessionrecording';
|
|
213
213
|
var SESSION_KEY = 'rum_session';
|
|
214
214
|
var PREV_SESSION_KEY = 'rum_prev_session';
|
|
215
|
-
var
|
|
215
|
+
var MUTATION_LIMIT = 10000;
|
|
216
216
|
var DEFAULT_SESSION_CONFIG = {
|
|
217
217
|
sessionSampleRate: 100,
|
|
218
218
|
onlyWithErrorConfig: {
|
|
@@ -4138,7 +4138,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4138
4138
|
return resolvedUrlBlueprinters;
|
|
4139
4139
|
}
|
|
4140
4140
|
|
|
4141
|
-
var SDK_VERSION = '3.0
|
|
4141
|
+
var SDK_VERSION = '3.1.0';
|
|
4142
4142
|
|
|
4143
4143
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4144
4144
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -5089,4 +5089,4 @@ var SessionRecordingEventType;
|
|
|
5089
5089
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
5090
5090
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
5091
5091
|
|
|
5092
|
-
export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, getNowTime as a, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as b, SESSION_RECORDING_DEFAULT_HEADERS as c, SESSION_RECORDING_POSTFIX_URL as d, SESSION_RECORDER_KEY as e,
|
|
5092
|
+
export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, getNowTime as a, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as b, SESSION_RECORDING_DEFAULT_HEADERS as c, SESSION_RECORDING_POSTFIX_URL as d, SESSION_RECORDER_KEY as e, MUTATION_LIMIT as f, getSdkConfig as g, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as h, CoralogixRum as i, CoralogixLogSeverity as j, SessionRecordingEventType as k, CoralogixEventType as l, UrlType as m, reportInternalEvent as r };
|
package/package.json
CHANGED
package/sessionRecorder.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
-
import { C as CxGlobal,
|
|
2
|
+
import { C as CxGlobal, g as getSdkConfig, S as SESSION_RECORDER_SEGMENTS_MAP, a as getNowTime, b as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, M as MAX_BATCH_TIME_MS, R as Request, c as SESSION_RECORDING_DEFAULT_HEADERS, d as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, r as reportInternalEvent, e as SESSION_RECORDER_KEY, f as MUTATION_LIMIT, h as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE } from './index.esm2.js';
|
|
3
3
|
import { record } from 'rrweb';
|
|
4
4
|
import { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
|
@@ -1484,7 +1484,15 @@ var SessionRecorder = (function () {
|
|
|
1484
1484
|
this.isErrorOccurred = false;
|
|
1485
1485
|
this.debugMode = !!((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.debug);
|
|
1486
1486
|
this._recordingStopDueToTimeout = false;
|
|
1487
|
-
this.
|
|
1487
|
+
this.onMutation = function (mutations) {
|
|
1488
|
+
var mutationsCount = _this.getMutationCount(mutations);
|
|
1489
|
+
if (mutationsCount > _this.maxMutations) {
|
|
1490
|
+
var message = "Recording stopped: mutation-limit exceeded - mutations: ".concat(mutationsCount, ", limit: ").concat(_this.maxMutations);
|
|
1491
|
+
console.warn("Coralogix Browser SDK - ".concat(message));
|
|
1492
|
+
reportInternalEvent('recording-stop', message);
|
|
1493
|
+
_this.stopRecording();
|
|
1494
|
+
}
|
|
1495
|
+
};
|
|
1488
1496
|
this.handleRecordEvent = function (event, isCheckout) {
|
|
1489
1497
|
if (!_this.recordingStopped) {
|
|
1490
1498
|
if (_this.onlySessionWithErrorMode) {
|
|
@@ -1555,7 +1563,7 @@ var SessionRecorder = (function () {
|
|
|
1555
1563
|
this.onlySessionWithErrorMode = onlySessionWithErrorMode;
|
|
1556
1564
|
this.maxRecordTimeForSessionWithError = maxRecordTimeForSessionWithError;
|
|
1557
1565
|
this.isAutoStartRecording = autoStartSessionRecording;
|
|
1558
|
-
this.maxMutations = maxMutations !== null && maxMutations !== void 0 ? maxMutations :
|
|
1566
|
+
this.maxMutations = maxMutations !== null && maxMutations !== void 0 ? maxMutations : MUTATION_LIMIT;
|
|
1559
1567
|
this.recordConfig = this.prepareRecordConfig(recordConfig);
|
|
1560
1568
|
if (CxGlobal.Worker) {
|
|
1561
1569
|
this.workerManager = new WorkerManager();
|
|
@@ -1607,8 +1615,6 @@ var SessionRecorder = (function () {
|
|
|
1607
1615
|
if (this.debugMode) {
|
|
1608
1616
|
console.debug('Coralogix Browser SDK - Session recording started');
|
|
1609
1617
|
}
|
|
1610
|
-
this.mutationCallbackCount = 0;
|
|
1611
|
-
this.startMutationObserver();
|
|
1612
1618
|
this.resetBatching();
|
|
1613
1619
|
this.recordingStopped = false;
|
|
1614
1620
|
this.isErrorOccurred = false;
|
|
@@ -1647,32 +1653,12 @@ var SessionRecorder = (function () {
|
|
|
1647
1653
|
this.hasRecording = false;
|
|
1648
1654
|
this.prepareRecordEventsBeforeSend();
|
|
1649
1655
|
this.clearIntervals();
|
|
1650
|
-
this.stopMutationObserver();
|
|
1651
|
-
};
|
|
1652
|
-
SessionRecorder.prototype.stopMutationObserver = function () {
|
|
1653
|
-
var _a;
|
|
1654
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1655
1656
|
};
|
|
1656
|
-
SessionRecorder.prototype.
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
if (_this.mutationCallbackCount > _this.maxMutations) {
|
|
1662
|
-
var message = "Coralogix Browser SDK - Recording stopped due to too many mutations ".concat(_this.mutationCallbackCount);
|
|
1663
|
-
console.warn(message);
|
|
1664
|
-
reportInternalEvent('recording-stop', message);
|
|
1665
|
-
_this.stopRecording();
|
|
1666
|
-
}
|
|
1667
|
-
});
|
|
1668
|
-
this.mutationObserver.observe(document, {
|
|
1669
|
-
attributes: false,
|
|
1670
|
-
attributeOldValue: false,
|
|
1671
|
-
characterData: false,
|
|
1672
|
-
characterDataOldValue: false,
|
|
1673
|
-
childList: true,
|
|
1674
|
-
subtree: true,
|
|
1675
|
-
});
|
|
1657
|
+
SessionRecorder.prototype.getMutationCount = function (mutations) {
|
|
1658
|
+
return (mutations.adds.length +
|
|
1659
|
+
mutations.removes.length +
|
|
1660
|
+
mutations.attributes.length +
|
|
1661
|
+
mutations.texts.length);
|
|
1676
1662
|
};
|
|
1677
1663
|
SessionRecorder.prototype.clearIntervals = function () {
|
|
1678
1664
|
if (this.batchingTimeInterval) {
|
|
@@ -1682,7 +1668,9 @@ var SessionRecorder = (function () {
|
|
|
1682
1668
|
SessionRecorder.prototype.prepareRecordConfig = function (recordConfig) {
|
|
1683
1669
|
var _a;
|
|
1684
1670
|
var _b = recordConfig || {}, excludeDOMOptions = _b.excludeDOMOptions, recordConsoleEvents = _b.recordConsoleEvents;
|
|
1685
|
-
this.recordConfig = __assign(__assign({}, recordConfig), { emit: this.handleRecordEvent,
|
|
1671
|
+
this.recordConfig = __assign(__assign({}, recordConfig), { emit: this.handleRecordEvent, hooks: {
|
|
1672
|
+
mutation: this.onMutation,
|
|
1673
|
+
}, checkoutEveryNms: this.onlySessionWithErrorMode
|
|
1686
1674
|
? this.maxRecordTimeForSessionWithError
|
|
1687
1675
|
: undefined, slimDOMOptions: __assign(__assign({}, excludeDOMOptions), { script: (_a = excludeDOMOptions === null || excludeDOMOptions === void 0 ? void 0 : excludeDOMOptions.script) !== null && _a !== void 0 ? _a : true }), plugins: recordConsoleEvents ? [getRecordConsolePlugin()] : [] });
|
|
1688
1676
|
return this.recordConfig;
|
|
@@ -7,7 +7,7 @@ export declare const BATCH_TIME_DELAY: number;
|
|
|
7
7
|
export declare const SESSION_RECORDING_POSTFIX_URL = "/browser/alpha/sessionrecording";
|
|
8
8
|
export declare const SESSION_KEY: string;
|
|
9
9
|
export declare const PREV_SESSION_KEY: string;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const MUTATION_LIMIT: number;
|
|
11
11
|
export declare const DEFAULT_SESSION_CONFIG: SessionConfig;
|
|
12
12
|
export declare const SESSION_IDLE_TIME: number;
|
|
13
13
|
export declare const SESSION_EXPIRATION_TIME: number;
|
|
@@ -21,11 +21,9 @@ export declare class SessionRecorder {
|
|
|
21
21
|
private isErrorOccurred;
|
|
22
22
|
private debugMode;
|
|
23
23
|
private _recordingStopDueToTimeout;
|
|
24
|
-
private mutationObserver;
|
|
25
24
|
private request;
|
|
26
25
|
private workerManager;
|
|
27
26
|
private isWorkerReady;
|
|
28
|
-
private mutationCallbackCount;
|
|
29
27
|
constructor(sessionManager: SessionManager, recordConfig: SessionRecordingConfig);
|
|
30
28
|
getSessionHasScreenshot(): boolean;
|
|
31
29
|
getSessionHasRecording(): boolean;
|
|
@@ -36,8 +34,8 @@ export declare class SessionRecorder {
|
|
|
36
34
|
startRecording(): Promise<void>;
|
|
37
35
|
screenshot(id: string): void;
|
|
38
36
|
stopRecording(): void;
|
|
39
|
-
private
|
|
40
|
-
private
|
|
37
|
+
private onMutation;
|
|
38
|
+
private getMutationCount;
|
|
41
39
|
private clearIntervals;
|
|
42
40
|
private prepareRecordConfig;
|
|
43
41
|
private handleRecordEvent;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.0
|
|
1
|
+
export declare const SDK_VERSION = "3.1.0";
|