@coralogix/browser 3.0.2 → 3.1.1
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 +16 -9
- package/package.json +1 -1
- package/sessionRecorder.esm.js +19 -28
- package/src/session/session.consts.d.ts +1 -1
- package/src/session/sessionRecorder.d.ts +2 -3
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
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: {
|
|
@@ -621,20 +621,27 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
621
621
|
};
|
|
622
622
|
CoralogixErrorInstrumentation.prototype.reportString = function (source, message, stackError) {
|
|
623
623
|
return __awaiter(this, void 0, void 0, function () {
|
|
624
|
-
var span;
|
|
625
|
-
return __generator(this, function (
|
|
626
|
-
switch (
|
|
624
|
+
var span, supportMfe;
|
|
625
|
+
return __generator(this, function (_b) {
|
|
626
|
+
switch (_b.label) {
|
|
627
627
|
case 0:
|
|
628
628
|
span = this.createSpan(source);
|
|
629
629
|
addErrorDefaultAttributes(span);
|
|
630
630
|
span.setAttribute(CoralogixAttributes.SOURCE, source);
|
|
631
631
|
span.setAttribute(ErrorAttributes.MESSAGE, message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT));
|
|
632
|
-
|
|
632
|
+
supportMfe = getSdkConfig().supportMfe;
|
|
633
|
+
if (!stackError) return [3, 4];
|
|
634
|
+
if (!supportMfe) return [3, 2];
|
|
633
635
|
return [4, buildStacktrace(span, stackError)];
|
|
634
636
|
case 1:
|
|
635
|
-
|
|
636
|
-
|
|
637
|
+
_b.sent();
|
|
638
|
+
return [3, 3];
|
|
637
639
|
case 2:
|
|
640
|
+
void buildStacktrace(span, stackError);
|
|
641
|
+
_b.label = 3;
|
|
642
|
+
case 3:
|
|
643
|
+
_b.label = 4;
|
|
644
|
+
case 4:
|
|
638
645
|
span.end();
|
|
639
646
|
return [2];
|
|
640
647
|
}
|
|
@@ -4138,7 +4145,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4138
4145
|
return resolvedUrlBlueprinters;
|
|
4139
4146
|
}
|
|
4140
4147
|
|
|
4141
|
-
var SDK_VERSION = '3.
|
|
4148
|
+
var SDK_VERSION = '3.1.1';
|
|
4142
4149
|
|
|
4143
4150
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4144
4151
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -5089,4 +5096,4 @@ var SessionRecordingEventType;
|
|
|
5089
5096
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
5090
5097
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
5091
5098
|
|
|
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,
|
|
5099
|
+
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,6 +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.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
|
+
};
|
|
1487
1496
|
this.handleRecordEvent = function (event, isCheckout) {
|
|
1488
1497
|
if (!_this.recordingStopped) {
|
|
1489
1498
|
if (_this.onlySessionWithErrorMode) {
|
|
@@ -1554,7 +1563,7 @@ var SessionRecorder = (function () {
|
|
|
1554
1563
|
this.onlySessionWithErrorMode = onlySessionWithErrorMode;
|
|
1555
1564
|
this.maxRecordTimeForSessionWithError = maxRecordTimeForSessionWithError;
|
|
1556
1565
|
this.isAutoStartRecording = autoStartSessionRecording;
|
|
1557
|
-
this.maxMutations = maxMutations !== null && maxMutations !== void 0 ? maxMutations :
|
|
1566
|
+
this.maxMutations = maxMutations !== null && maxMutations !== void 0 ? maxMutations : MUTATION_LIMIT;
|
|
1558
1567
|
this.recordConfig = this.prepareRecordConfig(recordConfig);
|
|
1559
1568
|
if (CxGlobal.Worker) {
|
|
1560
1569
|
this.workerManager = new WorkerManager();
|
|
@@ -1606,7 +1615,6 @@ var SessionRecorder = (function () {
|
|
|
1606
1615
|
if (this.debugMode) {
|
|
1607
1616
|
console.debug('Coralogix Browser SDK - Session recording started');
|
|
1608
1617
|
}
|
|
1609
|
-
this.startMutationObserver();
|
|
1610
1618
|
this.resetBatching();
|
|
1611
1619
|
this.recordingStopped = false;
|
|
1612
1620
|
this.isErrorOccurred = false;
|
|
@@ -1645,31 +1653,12 @@ var SessionRecorder = (function () {
|
|
|
1645
1653
|
this.hasRecording = false;
|
|
1646
1654
|
this.prepareRecordEventsBeforeSend();
|
|
1647
1655
|
this.clearIntervals();
|
|
1648
|
-
this.stopMutationObserver();
|
|
1649
|
-
};
|
|
1650
|
-
SessionRecorder.prototype.stopMutationObserver = function () {
|
|
1651
|
-
var _a;
|
|
1652
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1653
1656
|
};
|
|
1654
|
-
SessionRecorder.prototype.
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
var message = "Coralogix Browser SDK - Recording stopped due to too many mutations ".concat(mutations.length);
|
|
1660
|
-
console.warn(message);
|
|
1661
|
-
reportInternalEvent('recording-stop', message);
|
|
1662
|
-
_this.stopRecording();
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
|
-
this.mutationObserver.observe(document, {
|
|
1666
|
-
attributes: false,
|
|
1667
|
-
attributeOldValue: false,
|
|
1668
|
-
characterData: false,
|
|
1669
|
-
characterDataOldValue: false,
|
|
1670
|
-
childList: true,
|
|
1671
|
-
subtree: true,
|
|
1672
|
-
});
|
|
1657
|
+
SessionRecorder.prototype.getMutationCount = function (mutations) {
|
|
1658
|
+
return (mutations.adds.length +
|
|
1659
|
+
mutations.removes.length +
|
|
1660
|
+
mutations.attributes.length +
|
|
1661
|
+
mutations.texts.length);
|
|
1673
1662
|
};
|
|
1674
1663
|
SessionRecorder.prototype.clearIntervals = function () {
|
|
1675
1664
|
if (this.batchingTimeInterval) {
|
|
@@ -1679,7 +1668,9 @@ var SessionRecorder = (function () {
|
|
|
1679
1668
|
SessionRecorder.prototype.prepareRecordConfig = function (recordConfig) {
|
|
1680
1669
|
var _a;
|
|
1681
1670
|
var _b = recordConfig || {}, excludeDOMOptions = _b.excludeDOMOptions, recordConsoleEvents = _b.recordConsoleEvents;
|
|
1682
|
-
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
|
|
1683
1674
|
? this.maxRecordTimeForSessionWithError
|
|
1684
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()] : [] });
|
|
1685
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,7 +21,6 @@ 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;
|
|
@@ -35,8 +34,8 @@ export declare class SessionRecorder {
|
|
|
35
34
|
startRecording(): Promise<void>;
|
|
36
35
|
screenshot(id: string): void;
|
|
37
36
|
stopRecording(): void;
|
|
38
|
-
private
|
|
39
|
-
private
|
|
37
|
+
private onMutation;
|
|
38
|
+
private getMutationCount;
|
|
40
39
|
private clearIntervals;
|
|
41
40
|
private prepareRecordConfig;
|
|
42
41
|
private handleRecordEvent;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.
|
|
1
|
+
export declare const SDK_VERSION = "3.1.1";
|