@coralogix/browser 3.4.1 → 3.5.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 +12 -0
- package/README.md +54 -35
- package/index.esm.js +1 -1
- package/index.esm2.js +126 -56
- package/package.json +1 -3
- package/sessionRecorder.esm.js +5535 -1314
- package/src/constants.d.ts +1 -2
- package/src/cx-rrweb/rrweb/index.d.ts +4 -0
- package/src/cx-rrweb/rrweb/record/cross-origin-iframe-mirror.d.ts +14 -0
- package/src/cx-rrweb/rrweb/record/error-handler.d.ts +6 -0
- package/src/cx-rrweb/rrweb/record/iframe-manager.d.ts +34 -0
- package/src/cx-rrweb/rrweb/record/index.d.ts +10 -0
- package/src/cx-rrweb/rrweb/record/mutation.d.ts +50 -0
- package/src/cx-rrweb/rrweb/record/observer.d.ts +9 -0
- package/src/cx-rrweb/rrweb/record/observers/canvas/2d.d.ts +2 -0
- package/src/cx-rrweb/rrweb/record/observers/canvas/canvas-manager.d.ts +37 -0
- package/src/cx-rrweb/rrweb/record/observers/canvas/canvas.d.ts +2 -0
- package/src/cx-rrweb/rrweb/record/observers/canvas/serialize-args.d.ts +6 -0
- package/src/cx-rrweb/rrweb/record/observers/canvas/webgl.d.ts +2 -0
- package/src/cx-rrweb/rrweb/record/processed-node-manager.d.ts +8 -0
- package/src/cx-rrweb/rrweb/record/shadow-dom-manager.d.ts +26 -0
- package/src/cx-rrweb/rrweb/record/stylesheet-manager.d.ts +17 -0
- package/src/cx-rrweb/rrweb/record/workers/image-bitmap-data-url-worker.d.ts +6 -0
- package/src/cx-rrweb/rrweb/types.d.ts +102 -0
- package/src/cx-rrweb/rrweb/utils/base64.d.ts +1 -0
- package/src/cx-rrweb/rrweb/utils.d.ts +66 -0
- package/src/cx-rrweb/rrweb-plugin-console-record/error-stack-parser.d.ts +37 -0
- package/src/cx-rrweb/rrweb-plugin-console-record/index.d.ts +42 -0
- package/src/cx-rrweb/rrweb-plugin-console-record/stringify.d.ts +2 -0
- package/src/cx-rrweb/rrweb-snapshot/index.d.ts +4 -0
- package/src/cx-rrweb/rrweb-snapshot/snapshot.d.ts +76 -0
- package/src/cx-rrweb/rrweb-snapshot/types.d.ts +50 -0
- package/src/cx-rrweb/rrweb-snapshot/utils.d.ts +51 -0
- package/src/cx-rrweb/rrweb-types/index.d.ts +558 -0
- package/src/cx-rrweb/rrweb-utils/index.d.ts +43 -0
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +4 -1
- package/src/otel/rum-span-attributes.types.d.ts +1 -0
- package/src/session/session-idle.d.ts +2 -0
- package/src/session/session.model.d.ts +3 -3
- package/src/session/sessionRecorder.d.ts +0 -3
- package/src/tools/cx-timers.d.ts +25 -0
- package/src/tools/global-keys.d.ts +2 -0
- package/src/types.d.ts +3 -1
- package/src/version.d.ts +1 -1
- package/src/tools/getZoneJsOriginalDom.d.ts +0 -1
- package/src/utils/zone-patch.d.ts +0 -10
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
- [Recording Manually](#recording-manually)
|
|
20
20
|
- [Privacy & Security](#privacy--security)
|
|
21
|
-
- [Performance](#performance)
|
|
22
21
|
- [Worker URL](#worker-url)
|
|
23
22
|
- [Screenshots](#screenshots)
|
|
24
23
|
|
|
@@ -26,32 +25,34 @@
|
|
|
26
25
|
11. [Multi Page Application](#multi-page-application)
|
|
27
26
|
12. [Ignore Errors](#ignore-errors)
|
|
28
27
|
13. [Ignore URLs](#ignore-urls)
|
|
29
|
-
14. [
|
|
30
|
-
15. [
|
|
31
|
-
16. [
|
|
32
|
-
17. [
|
|
28
|
+
14. [Stack Trace Limit](#stack-trace-limit)
|
|
29
|
+
15. [Mask Elements](#mask-elements)
|
|
30
|
+
16. [Label Providers](#label-providers)
|
|
31
|
+
17. [URL Blueprinters](#url-blueprinters)
|
|
32
|
+
18. [Traces](#traces)
|
|
33
33
|
|
|
34
34
|
- [Propagate Trace Header for CORS URLs](#propagatetraceheadercorsurls)
|
|
35
35
|
- [Allowed Tracing URLs](#allowedtracingurls)
|
|
36
36
|
- [Extra Propagators (B3 / AWS X-Ray)](#b3--aws-x-ray-propagation)
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
19. [Before Send](#before-send)
|
|
39
|
+
20. [Proxy URL](#proxy-url)
|
|
40
|
+
21. [Collect IP Data](#collect-ip-data)
|
|
41
|
+
22. [Custom Measurement](#custom-measurement)
|
|
42
|
+
23. [Add Timing](#add-timing)
|
|
43
|
+
24. [Custom Time Measurement](#custom-time-measurement)
|
|
44
|
+
25. [Microfrontend Support](#microfrontend-support)
|
|
45
45
|
|
|
46
46
|
- [Pre Requisites](#pre-requisites)
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
26. [Custom Spans](#custom-spans)
|
|
49
49
|
|
|
50
50
|
- [Ignored Instruments](#ignored-instruments)
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
27. [Soft Navigations (Experimental)](#soft-navigations--experimental)
|
|
53
|
+
28. [Memory Usage (Experimental)](#memory-usage---experimental)
|
|
54
|
+
29. [Angular Zone.js Configuration](#angular-zonejs-configuration)
|
|
55
|
+
30. [CDN](#cdn)
|
|
55
56
|
|
|
56
57
|
- [Specific Version](#specific-version-recommended)
|
|
57
58
|
- [Add the CDN Script to Your Application](#add-the-cdn-script-to-your-application)
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
- [Via JS File](#via-js-file)
|
|
60
61
|
- [Via TS File](#via-ts-file)
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
31. [Flutter Web](#flutter-web)
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
@@ -352,22 +353,6 @@ CoralogixRum.init({
|
|
|
352
353
|
});
|
|
353
354
|
```
|
|
354
355
|
|
|
355
|
-
#### Performance
|
|
356
|
-
|
|
357
|
-
Session Recording works by recording incremental DOM changes that occur in your web application.
|
|
358
|
-
To avoid performance issues, Session Recording will stop recording if it detects a large number of mutations (Default: 5,000).
|
|
359
|
-
|
|
360
|
-
```javascript
|
|
361
|
-
CoralogixRum.init({
|
|
362
|
-
// ...
|
|
363
|
-
sessionRecordingConfig: {
|
|
364
|
-
// ...
|
|
365
|
-
// According to MutationObserver API, A large number of DOM mutations can negatively impact performance
|
|
366
|
-
maxMutations: 5000,
|
|
367
|
-
},
|
|
368
|
-
});
|
|
369
|
-
```
|
|
370
|
-
|
|
371
356
|
#### Worker Url
|
|
372
357
|
|
|
373
358
|
By default, Session recording uses an inline web worker script to compress data before transmission. For added flexibility, you can host a custom worker script on your own domain. Simply host the following file on your server: [worker.min.js](https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/worker.min.js)
|
|
@@ -511,6 +496,21 @@ CoralogixRum.init({
|
|
|
511
496
|
});
|
|
512
497
|
```
|
|
513
498
|
|
|
499
|
+
### Stack Trace Limit
|
|
500
|
+
|
|
501
|
+
Browsers typically capture 10 stack frames by default. If your error stack traces are being truncated and you need to see deeper into the call stack, you can increase this limit using the `stackTraceLimit` option.
|
|
502
|
+
|
|
503
|
+
```javascript
|
|
504
|
+
import { CoralogixRum } from '@coralogix/browser';
|
|
505
|
+
|
|
506
|
+
CoralogixRum.init({
|
|
507
|
+
// ...
|
|
508
|
+
stackTraceLimit: 50,
|
|
509
|
+
});
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
> **Note:** Higher values may have a performance impact, as the browser needs to capture more frames each time an error is created.
|
|
513
|
+
|
|
514
514
|
### Mask elements
|
|
515
515
|
|
|
516
516
|
User interactions capture text from clickable elements only (button, label, link, input, option).
|
|
@@ -872,8 +872,7 @@ This feature allows you to track multiple applications on the same page.<br>
|
|
|
872
872
|
|
|
873
873
|
#### Pre Requisites
|
|
874
874
|
|
|
875
|
-
To support microfrontend, you need to install one of these plugins: [webpack](https://www.npmjs.com/package/@coralogix/webpack-plugin), [esbuild](https://www.npmjs.com/package/@coralogix/esbuild-plugin) and include them in your build process
|
|
876
|
-
Plugins for other bundlers are coming soon.
|
|
875
|
+
To support microfrontend, you need to install one of these plugins: [webpack](https://www.npmjs.com/package/@coralogix/webpack-plugin), [esbuild](https://www.npmjs.com/package/@coralogix/esbuild-plugin), [vite](https://www.npmjs.com/package/@coralogix/vite-plugin) and include them in your build process.
|
|
877
876
|
|
|
878
877
|
When an error occurs, the SDK will find the correlated microfrontend and will add a label with the microfrontend app/version to the error event.
|
|
879
878
|
|
|
@@ -1028,6 +1027,26 @@ self.onmessage = (message) => {
|
|
|
1028
1027
|
|
|
1029
1028
|
---
|
|
1030
1029
|
|
|
1030
|
+
## Angular Zone.js Configuration
|
|
1031
|
+
|
|
1032
|
+
By default, the SDK runs its internal timers outside Angular's Zone.js to prevent unnecessary change detection cycles. This improves performance by avoiding redundant UI updates triggered by the SDK's background operations.
|
|
1033
|
+
|
|
1034
|
+
```javascript
|
|
1035
|
+
CoralogixRum.init({
|
|
1036
|
+
// ...
|
|
1037
|
+
runOutsideAngularZone: true, // Defaults to true
|
|
1038
|
+
});
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
| Value | Behavior |
|
|
1042
|
+
| ------- | ------------------------------------------------------------------------ |
|
|
1043
|
+
| `true` | SDK timers run outside Zone.js, preventing change detection triggers. |
|
|
1044
|
+
| `false` | SDK timers run inside Zone.js, which may trigger change detection. |
|
|
1045
|
+
|
|
1046
|
+
> **Note:** In most cases, you should keep the default value (`true`) for optimal performance. Only set to `false` if you have a specific reason to include SDK operations in Angular's change detection.
|
|
1047
|
+
|
|
1048
|
+
---
|
|
1049
|
+
|
|
1031
1050
|
## CDN
|
|
1032
1051
|
|
|
1033
1052
|
Coralogix Browser SDK is also provided via CDN.<br>
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { s as CoralogixEventType, q as CoralogixLogSeverity, p as CoralogixRum, O as OtelNetworkAttrs, P as PerformanceTypes, r as SessionRecordingEventType, U as UrlBasedLabelProvider, t as UrlType } from './index.esm2.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import '@opentelemetry/sdk-trace-web';
|
package/index.esm2.js
CHANGED
|
@@ -195,6 +195,9 @@ var CoralogixLogSeverity;
|
|
|
195
195
|
CoralogixLogSeverity[CoralogixLogSeverity["Critical"] = 6] = "Critical";
|
|
196
196
|
})(CoralogixLogSeverity || (CoralogixLogSeverity = {}));
|
|
197
197
|
|
|
198
|
+
var SDK_CONFIG_KEY = 'sdkConfig';
|
|
199
|
+
var USER_AGENT_KEY = 'userAgent';
|
|
200
|
+
|
|
198
201
|
var millisecondsPerSecond = 1000;
|
|
199
202
|
var millisecondsPerMinute = millisecondsPerSecond * 60;
|
|
200
203
|
var MILLISECONDS_PER_HOUR = millisecondsPerMinute * 60;
|
|
@@ -212,7 +215,6 @@ var BATCH_TIME_DELAY = 1000;
|
|
|
212
215
|
var SESSION_RECORDING_POSTFIX_URL = '/browser/alpha/sessionrecording';
|
|
213
216
|
var SESSION_KEY = 'rum_session';
|
|
214
217
|
var PREV_SESSION_KEY = 'rum_prev_session';
|
|
215
|
-
var MUTATION_LIMIT = 10000;
|
|
216
218
|
var DEFAULT_SESSION_CONFIG = {
|
|
217
219
|
sessionSampleRate: 100,
|
|
218
220
|
onlyWithErrorConfig: {
|
|
@@ -367,7 +369,8 @@ function getCustomMergedLabels(labels) {
|
|
|
367
369
|
|
|
368
370
|
var CACHED_METADATA_KEY = '__cx_metadata__';
|
|
369
371
|
var ERROR_INSTRUMENTATION_VERSION = '1';
|
|
370
|
-
var
|
|
372
|
+
var STACK_FRAME_LIMIT = 50;
|
|
373
|
+
var STACK_LINE_LIMIT = 1024;
|
|
371
374
|
var MESSAGE_LIMIT = 1024;
|
|
372
375
|
var MFE_PATH_PATTERN = /https?:\/\/.*\//;
|
|
373
376
|
function extractMfePath(fileName) {
|
|
@@ -391,29 +394,42 @@ var ErrorSource;
|
|
|
391
394
|
ErrorSource["CAPTURED"] = "captured";
|
|
392
395
|
ErrorSource["WEB_WORKER"] = "web_worker";
|
|
393
396
|
})(ErrorSource || (ErrorSource = {}));
|
|
397
|
+
function parseStackFrames(err) {
|
|
398
|
+
var stack = err.stack, message = err.message, name = err.name;
|
|
399
|
+
if (!stack) {
|
|
400
|
+
return [];
|
|
401
|
+
}
|
|
402
|
+
var sanitizedStack = stack
|
|
403
|
+
.split('\n')
|
|
404
|
+
.map(function (line) { return line.slice(0, STACK_LINE_LIMIT); })
|
|
405
|
+
.join('\n');
|
|
406
|
+
return ErrorStackParser.parse({
|
|
407
|
+
stack: sanitizedStack,
|
|
408
|
+
message: message,
|
|
409
|
+
name: name,
|
|
410
|
+
})
|
|
411
|
+
.slice(0, STACK_FRAME_LIMIT)
|
|
412
|
+
.map(function (_a) {
|
|
413
|
+
var fileName = _a.fileName, columnNumber = _a.columnNumber, lineNumber = _a.lineNumber, functionName = _a.functionName;
|
|
414
|
+
return ({
|
|
415
|
+
fileName: fileName,
|
|
416
|
+
columnNumber: columnNumber,
|
|
417
|
+
lineNumber: lineNumber,
|
|
418
|
+
functionName: functionName,
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
}
|
|
394
422
|
function buildStacktrace(span, err) {
|
|
395
423
|
return __awaiter(this, void 0, void 0, function () {
|
|
396
|
-
var
|
|
424
|
+
var stackFrames, supportMfe;
|
|
397
425
|
return __generator(this, function (_a) {
|
|
398
426
|
switch (_a.label) {
|
|
399
427
|
case 0:
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
428
|
+
stackFrames = parseStackFrames(err);
|
|
429
|
+
if (stackFrames.length === 0) {
|
|
430
|
+
return [2];
|
|
431
|
+
}
|
|
403
432
|
supportMfe = getSdkConfig().supportMfe;
|
|
404
|
-
stackFrames = ErrorStackParser.parse({
|
|
405
|
-
stack: stack.substring(0, STACK_LIMIT),
|
|
406
|
-
message: message,
|
|
407
|
-
name: name,
|
|
408
|
-
}).map(function (_a) {
|
|
409
|
-
var fileName = _a.fileName, columnNumber = _a.columnNumber, lineNumber = _a.lineNumber, functionName = _a.functionName;
|
|
410
|
-
return ({
|
|
411
|
-
fileName: fileName,
|
|
412
|
-
columnNumber: columnNumber,
|
|
413
|
-
lineNumber: lineNumber,
|
|
414
|
-
functionName: functionName,
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
433
|
if (!supportMfe) return [3, 2];
|
|
418
434
|
return [4, handleMFE(stackFrames, span)];
|
|
419
435
|
case 1:
|
|
@@ -421,8 +437,7 @@ function buildStacktrace(span, err) {
|
|
|
421
437
|
_a.label = 2;
|
|
422
438
|
case 2:
|
|
423
439
|
span[ErrorAttributes.STACK] = stackFrames;
|
|
424
|
-
|
|
425
|
-
case 3: return [2];
|
|
440
|
+
return [2];
|
|
426
441
|
}
|
|
427
442
|
});
|
|
428
443
|
});
|
|
@@ -549,6 +564,10 @@ var CoralogixErrorInstrumentation = (function (_super) {
|
|
|
549
564
|
}
|
|
550
565
|
CoralogixErrorInstrumentation.prototype.init = function () { };
|
|
551
566
|
CoralogixErrorInstrumentation.prototype.enable = function () {
|
|
567
|
+
var stackTraceLimit = getSdkConfig().stackTraceLimit;
|
|
568
|
+
if (stackTraceLimit) {
|
|
569
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
570
|
+
}
|
|
552
571
|
shimmer_1.wrap(console, 'error', _consoleErrorHandler(this));
|
|
553
572
|
CxGlobal.addEventListener('error', _errorListener(this));
|
|
554
573
|
CxGlobal.addEventListener('unhandledrejection', _unhandledRejectionListener(this));
|
|
@@ -1303,6 +1322,64 @@ var IMG_EXTENSIONS = [
|
|
|
1303
1322
|
'.webp',
|
|
1304
1323
|
];
|
|
1305
1324
|
|
|
1325
|
+
function getBrowserWindow() {
|
|
1326
|
+
return CxGlobal;
|
|
1327
|
+
}
|
|
1328
|
+
function shouldRunOutsideZone() {
|
|
1329
|
+
var _a;
|
|
1330
|
+
return ((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.runOutsideAngularZone) !== false;
|
|
1331
|
+
}
|
|
1332
|
+
function getZoneJsOriginalDom(target, name) {
|
|
1333
|
+
if (!shouldRunOutsideZone()) {
|
|
1334
|
+
return target[name];
|
|
1335
|
+
}
|
|
1336
|
+
var browserWindow = getBrowserWindow();
|
|
1337
|
+
var original;
|
|
1338
|
+
if (browserWindow.Zone &&
|
|
1339
|
+
typeof browserWindow.Zone.__symbol__ === 'function') {
|
|
1340
|
+
original = target[browserWindow.Zone.__symbol__(name)];
|
|
1341
|
+
}
|
|
1342
|
+
if (!original) {
|
|
1343
|
+
original = target[name];
|
|
1344
|
+
}
|
|
1345
|
+
return original;
|
|
1346
|
+
}
|
|
1347
|
+
function cxSetTimeout(callback, delay) {
|
|
1348
|
+
var browserWindow = getBrowserWindow();
|
|
1349
|
+
var originalSetTimeout = getZoneJsOriginalDom(browserWindow, 'setTimeout');
|
|
1350
|
+
return originalSetTimeout.call(browserWindow, callback, delay);
|
|
1351
|
+
}
|
|
1352
|
+
function cxSetInterval(callback, delay) {
|
|
1353
|
+
var browserWindow = getBrowserWindow();
|
|
1354
|
+
var originalSetInterval = getZoneJsOriginalDom(browserWindow, 'setInterval');
|
|
1355
|
+
return originalSetInterval.call(browserWindow, callback, delay);
|
|
1356
|
+
}
|
|
1357
|
+
function cxClearTimeout(id) {
|
|
1358
|
+
var browserWindow = getBrowserWindow();
|
|
1359
|
+
var originalClearTimeout = getZoneJsOriginalDom(browserWindow, 'clearTimeout');
|
|
1360
|
+
originalClearTimeout.call(browserWindow, id);
|
|
1361
|
+
}
|
|
1362
|
+
function cxClearInterval(id) {
|
|
1363
|
+
var browserWindow = getBrowserWindow();
|
|
1364
|
+
var originalClearInterval = getZoneJsOriginalDom(browserWindow, 'clearInterval');
|
|
1365
|
+
originalClearInterval.call(browserWindow, id);
|
|
1366
|
+
}
|
|
1367
|
+
function cxRequestAnimationFrame(callback) {
|
|
1368
|
+
var browserWindow = getBrowserWindow();
|
|
1369
|
+
var originalRaf = getZoneJsOriginalDom(browserWindow, 'requestAnimationFrame');
|
|
1370
|
+
return originalRaf.call(browserWindow, callback);
|
|
1371
|
+
}
|
|
1372
|
+
function cxCancelAnimationFrame(id) {
|
|
1373
|
+
var browserWindow = getBrowserWindow();
|
|
1374
|
+
var originalCaf = getZoneJsOriginalDom(browserWindow, 'cancelAnimationFrame');
|
|
1375
|
+
originalCaf.call(browserWindow, id);
|
|
1376
|
+
}
|
|
1377
|
+
function createCxMutationObserver(callback) {
|
|
1378
|
+
var browserWindow = getBrowserWindow();
|
|
1379
|
+
var OriginalMutationObserver = getZoneJsOriginalDom(browserWindow, 'MutationObserver');
|
|
1380
|
+
return new OriginalMutationObserver(callback);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1306
1383
|
/** Original source: https://www.npmjs.com/package/tti-polyfill?activeTab=code
|
|
1307
1384
|
* @license Apache-2.0
|
|
1308
1385
|
* @version 0.2.2
|
|
@@ -1409,7 +1486,7 @@ function z(a, b) {
|
|
|
1409
1486
|
return false;
|
|
1410
1487
|
}
|
|
1411
1488
|
function A(a) {
|
|
1412
|
-
var b =
|
|
1489
|
+
var b = createCxMutationObserver(function (c) {
|
|
1413
1490
|
c = t(c);
|
|
1414
1491
|
for (var b = c.next(); !b.done; b = c.next()) b = b.value, 'childList' == b.type && z(b.addedNodes, y) ? a(b) : 'attributes' == b.type && y.includes(b.target.tagName.toLowerCase()) && a(b);
|
|
1415
1492
|
});
|
|
@@ -1494,7 +1571,7 @@ function F(a) {
|
|
|
1494
1571
|
G(a, Math.max(c + 5e3, b));
|
|
1495
1572
|
}
|
|
1496
1573
|
function G(a, b) {
|
|
1497
|
-
!a.i || a.v > b || (
|
|
1574
|
+
!a.i || a.v > b || (cxClearTimeout(a.j), a.j = cxSetTimeout(function () {
|
|
1498
1575
|
var b = performance.timing.navigationStart,
|
|
1499
1576
|
d = B(a.g, a.b),
|
|
1500
1577
|
b = (CxGlobal.a && CxGlobal.a.A ? 1e3 * CxGlobal.a.A().C - b : 0) || performance.timing.domContentLoadedEventEnd - b;
|
|
@@ -1503,7 +1580,7 @@ function G(a, b) {
|
|
|
1503
1580
|
null === f && G(a, Math.max(d + 5e3, e + 1e3));
|
|
1504
1581
|
var g = a.a;
|
|
1505
1582
|
5e3 > e - d ? d = null : (d = g.length ? g[g.length - 1].end : b, d = 5e3 > e - d ? null : Math.max(d, f));
|
|
1506
|
-
d && (a.s(d),
|
|
1583
|
+
d && (a.s(d), cxClearTimeout(a.j), a.i = false, a.c && a.c.disconnect(), a.h && a.h.disconnect());
|
|
1507
1584
|
G(a, performance.now() + 1e3);
|
|
1508
1585
|
}, b - performance.now()), a.v = b);
|
|
1509
1586
|
}
|
|
@@ -1909,19 +1986,6 @@ var CoralogixResourcesInstrumentation = (function (_super) {
|
|
|
1909
1986
|
return CoralogixResourcesInstrumentation;
|
|
1910
1987
|
}(InstrumentationBase));
|
|
1911
1988
|
|
|
1912
|
-
function getZoneJsOriginalDom(target, name) {
|
|
1913
|
-
var browserWindow = getCxGlobal();
|
|
1914
|
-
var original;
|
|
1915
|
-
if (browserWindow.Zone &&
|
|
1916
|
-
typeof browserWindow.Zone.__symbol__ === 'function') {
|
|
1917
|
-
original = target[browserWindow.Zone.__symbol__(name)];
|
|
1918
|
-
}
|
|
1919
|
-
if (!original) {
|
|
1920
|
-
original = target[name];
|
|
1921
|
-
}
|
|
1922
|
-
return original;
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
1989
|
function addEventListeners(eventTarget, eventNames, listener, _a) {
|
|
1926
1990
|
var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;
|
|
1927
1991
|
var resolvedListener = once
|
|
@@ -2199,7 +2263,7 @@ var CoralogixMemoryUsageInstrumentation = (function (_super) {
|
|
|
2199
2263
|
};
|
|
2200
2264
|
CoralogixMemoryUsageInstrumentation.prototype.runMemoryMeasurements = function () {
|
|
2201
2265
|
var _this = this;
|
|
2202
|
-
this.timeoutId =
|
|
2266
|
+
this.timeoutId = cxSetTimeout(function () { return _this.measureMemoryUsage(); }, this.memoryUsageInterval);
|
|
2203
2267
|
};
|
|
2204
2268
|
CoralogixMemoryUsageInstrumentation.prototype.measureMemoryUsage = function () {
|
|
2205
2269
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2216,7 +2280,7 @@ var CoralogixMemoryUsageInstrumentation = (function (_super) {
|
|
|
2216
2280
|
};
|
|
2217
2281
|
CoralogixMemoryUsageInstrumentation.prototype.clearMeasurementsInterval = function () {
|
|
2218
2282
|
if (this.timeoutId) {
|
|
2219
|
-
|
|
2283
|
+
cxClearTimeout(this.timeoutId);
|
|
2220
2284
|
}
|
|
2221
2285
|
};
|
|
2222
2286
|
return CoralogixMemoryUsageInstrumentation;
|
|
@@ -2373,10 +2437,12 @@ var CoralogixDOMInstrumentation = (function (_super) {
|
|
|
2373
2437
|
return _this;
|
|
2374
2438
|
}
|
|
2375
2439
|
CoralogixDOMInstrumentation.prototype.registerToDOMEvents = function () {
|
|
2376
|
-
document
|
|
2440
|
+
var originalAddEventListener = getZoneJsOriginalDom(document, 'addEventListener');
|
|
2441
|
+
originalAddEventListener.call(document, 'visibilitychange', this.visibilityChangeHandler);
|
|
2377
2442
|
};
|
|
2378
2443
|
CoralogixDOMInstrumentation.prototype.unregisterFromDOMEvents = function () {
|
|
2379
|
-
document
|
|
2444
|
+
var originalRemoveEventListener = getZoneJsOriginalDom(document, 'removeEventListener');
|
|
2445
|
+
originalRemoveEventListener.call(document, 'visibilitychange', this.visibilityChangeHandler);
|
|
2380
2446
|
};
|
|
2381
2447
|
CoralogixDOMInstrumentation.prototype.init = function () { };
|
|
2382
2448
|
CoralogixDOMInstrumentation.prototype.disable = function () {
|
|
@@ -2384,7 +2450,7 @@ var CoralogixDOMInstrumentation = (function (_super) {
|
|
|
2384
2450
|
};
|
|
2385
2451
|
CoralogixDOMInstrumentation.prototype.enable = function () {
|
|
2386
2452
|
var _this = this;
|
|
2387
|
-
|
|
2453
|
+
cxSetTimeout(function () {
|
|
2388
2454
|
_this.registerToDOMEvents();
|
|
2389
2455
|
});
|
|
2390
2456
|
};
|
|
@@ -2470,8 +2536,6 @@ var REQUIRED_CONFIG_KEYS = [
|
|
|
2470
2536
|
'version',
|
|
2471
2537
|
'coralogixDomain',
|
|
2472
2538
|
];
|
|
2473
|
-
var SDK_CONFIG_KEY = 'sdkConfig';
|
|
2474
|
-
var USER_AGENT_KEY = 'userAgent';
|
|
2475
2539
|
var ID_MASK_KEY = '{id}';
|
|
2476
2540
|
var UUID_REGEX = /[0-9a-fA-F-]{36}/g;
|
|
2477
2541
|
var NANOID_REGEX = /^[a-zA-Z0-9-_]{21}$/;
|
|
@@ -3630,7 +3694,7 @@ var CoralogixExporter = (function () {
|
|
|
3630
3694
|
chunks.push(cachedLogs.slice(i, i + MAX_RUM_EVENTS_PER_REQUEST));
|
|
3631
3695
|
}
|
|
3632
3696
|
chunks.forEach(function (chunk) {
|
|
3633
|
-
|
|
3697
|
+
cxSetTimeout(function () { return _this.invokeLogRequest(chunk, true); }, _this.batchTimeDelay);
|
|
3634
3698
|
_this.batchTimeDelay += BATCH_TIME_DELAY;
|
|
3635
3699
|
});
|
|
3636
3700
|
this.clearCachedDataForSessionWithError();
|
|
@@ -3673,22 +3737,28 @@ var SessionIdle = (function () {
|
|
|
3673
3737
|
var _this = this;
|
|
3674
3738
|
this.idleConfig = idleConfig;
|
|
3675
3739
|
this._isIdleActive = false;
|
|
3740
|
+
this.lastResetTime = 0;
|
|
3741
|
+
this.THROTTLE_MS = 1000;
|
|
3676
3742
|
this.stopCallbacks = {};
|
|
3677
3743
|
this.resetTimeout = function () {
|
|
3678
3744
|
var _a, _b;
|
|
3679
3745
|
(_b = (_a = _this.stopCallbacks).clearTimeout) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3680
|
-
var id =
|
|
3746
|
+
var id = cxSetTimeout(function () {
|
|
3681
3747
|
_this._isIdleActive = true;
|
|
3682
3748
|
_this.idleConfig.onIdle();
|
|
3683
3749
|
}, _this.idleConfig.timeoutDelay);
|
|
3684
|
-
_this.stopCallbacks.clearTimeout = function () { return
|
|
3750
|
+
_this.stopCallbacks.clearTimeout = function () { return cxClearTimeout(id); };
|
|
3685
3751
|
};
|
|
3686
3752
|
this.idlenessEventsHandler = function () {
|
|
3687
3753
|
if (_this._isIdleActive) {
|
|
3688
3754
|
_this._isIdleActive = false;
|
|
3689
3755
|
_this.idleConfig.onActive();
|
|
3690
3756
|
}
|
|
3691
|
-
|
|
3757
|
+
var now = Date.now();
|
|
3758
|
+
if (now - _this.lastResetTime >= _this.THROTTLE_MS) {
|
|
3759
|
+
_this.lastResetTime = now;
|
|
3760
|
+
_this.resetTimeout();
|
|
3761
|
+
}
|
|
3692
3762
|
};
|
|
3693
3763
|
}
|
|
3694
3764
|
Object.defineProperty(SessionIdle.prototype, "isIdleActive", {
|
|
@@ -4110,7 +4180,7 @@ function isInitialConfigValid(initConfig) {
|
|
|
4110
4180
|
return true;
|
|
4111
4181
|
}
|
|
4112
4182
|
function validateAndResolveInitConfig(config) {
|
|
4113
|
-
var _a, _b, _c;
|
|
4183
|
+
var _a, _b, _c, _d;
|
|
4114
4184
|
if (!isInitialConfigValid(config)) {
|
|
4115
4185
|
return;
|
|
4116
4186
|
}
|
|
@@ -4120,7 +4190,7 @@ function validateAndResolveInitConfig(config) {
|
|
|
4120
4190
|
if (proxyUrl)
|
|
4121
4191
|
resolvedIgnoreUrls.push(new RegExp(proxyUrl));
|
|
4122
4192
|
OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(OPTIONS_DEFAULTS.ignoreUrls), false));
|
|
4123
|
-
return __assign(__assign(__assign({}, OPTIONS_DEFAULTS), config), { maskInputTypes: (_a = config.maskInputTypes) !== null && _a !== void 0 ? _a : MASK_INPUT_TYPES_DEFAULT, maskClass: (_b = config.maskClass) !== null && _b !== void 0 ? _b : MASK_CLASS_DEFAULT, ignoreUrls: resolvedIgnoreUrls, urlBlueprinters: resolveUrlBlueprinters(urlBlueprinters), sessionSampleRate: (_c = config.sessionSampleRate) !== null && _c !== void 0 ? _c : 100, sessionConfig: resolveSessionConfig(config.sessionConfig), sessionRecordingConfig: resolveSessionRecordingConfig(config.sessionRecordingConfig), memoryUsageConfig: resolveMemoryUsageConfig(config.memoryUsageConfig), trackSoftNavigations: !!config.trackSoftNavigations, supportMfe: !!config.supportMfe });
|
|
4193
|
+
return __assign(__assign(__assign({}, OPTIONS_DEFAULTS), config), { maskInputTypes: (_a = config.maskInputTypes) !== null && _a !== void 0 ? _a : MASK_INPUT_TYPES_DEFAULT, maskClass: (_b = config.maskClass) !== null && _b !== void 0 ? _b : MASK_CLASS_DEFAULT, ignoreUrls: resolvedIgnoreUrls, urlBlueprinters: resolveUrlBlueprinters(urlBlueprinters), sessionSampleRate: (_c = config.sessionSampleRate) !== null && _c !== void 0 ? _c : 100, sessionConfig: resolveSessionConfig(config.sessionConfig), sessionRecordingConfig: resolveSessionRecordingConfig(config.sessionRecordingConfig), memoryUsageConfig: resolveMemoryUsageConfig(config.memoryUsageConfig), trackSoftNavigations: !!config.trackSoftNavigations, supportMfe: !!config.supportMfe, runOutsideAngularZone: (_d = config.runOutsideAngularZone) !== null && _d !== void 0 ? _d : true });
|
|
4124
4194
|
}
|
|
4125
4195
|
function resolveMemoryUsageConfig(memoryUsageConfig) {
|
|
4126
4196
|
var _a;
|
|
@@ -4154,7 +4224,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4154
4224
|
return resolvedUrlBlueprinters;
|
|
4155
4225
|
}
|
|
4156
4226
|
|
|
4157
|
-
var SDK_VERSION = '3.
|
|
4227
|
+
var SDK_VERSION = '3.5.1';
|
|
4158
4228
|
|
|
4159
4229
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4160
4230
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4265,7 +4335,7 @@ function flattenToAttributes(obj, prefix) {
|
|
|
4265
4335
|
function buildRumContextAttributes(cxRumEvent, resolvedLabels) {
|
|
4266
4336
|
var session_context = cxRumEvent.session_context, page_context = cxRumEvent.page_context, event_context = cxRumEvent.event_context, error_context = cxRumEvent.error_context, network_request_context = cxRumEvent.network_request_context;
|
|
4267
4337
|
var prefixedLabels = flattenToAttributes(resolvedLabels, 'cx_rum.labels.');
|
|
4268
|
-
return buildCxRumSpanAttributes(__assign(__assign({ 'cx_rum.browser_sdk.version': cxRumEvent.browser_sdk.version, 'cx_rum.platform': cxRumEvent.platform, 'cx_rum.environment': cxRumEvent.environment, 'cx_rum.version_metadata.app_name': cxRumEvent.version_metadata.app_name, 'cx_rum.version_metadata.app_version': cxRumEvent.version_metadata.app_version }, prefixedLabels), { 'cx_rum.session_context.os': session_context === null || session_context === void 0 ? void 0 : session_context.os, 'cx_rum.session_context.osVersion': session_context === null || session_context === void 0 ? void 0 : session_context.osVersion, 'cx_rum.session_context.browser': session_context === null || session_context === void 0 ? void 0 : session_context.browser, 'cx_rum.session_context.browserVersion': session_context === null || session_context === void 0 ? void 0 : session_context.browserVersion, 'cx_rum.session_context.device': session_context === null || session_context === void 0 ? void 0 : session_context.device, 'cx_rum.session_context.user_agent': session_context === null || session_context === void 0 ? void 0 : session_context.user_agent, 'cx_rum.session_context.user_email': session_context === null || session_context === void 0 ? void 0 : session_context.user_email, 'cx_rum.session_context.user_id': session_context === null || session_context === void 0 ? void 0 : session_context.user_id, 'cx_rum.session_context.user_name': session_context === null || session_context === void 0 ? void 0 : session_context.user_name, 'cx_rum.page_context.page_fragments': page_context === null || page_context === void 0 ? void 0 : page_context.page_fragments, 'cx_rum.page_context.page_url_blueprint': page_context === null || page_context === void 0 ? void 0 : page_context.page_url_blueprint, 'cx_rum.event_context.type': event_context === null || event_context === void 0 ? void 0 : event_context.type, 'cx_rum.event_context.severity': event_context === null || event_context === void 0 ? void 0 : event_context.severity, 'cx_rum.error_context.error_type': error_context === null || error_context === void 0 ? void 0 : error_context.error_type, 'cx_rum.error_context.error_message': error_context === null || error_context === void 0 ? void 0 : error_context.error_message, 'cx_rum.network_request_context.fragments': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.fragments, 'cx_rum.network_request_context.url': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.url, 'cx_rum.network_request_context.status_code': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.status_code, 'cx_rum.network_request_context.method': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.method }));
|
|
4338
|
+
return buildCxRumSpanAttributes(__assign(__assign({ 'cx_rum.browser_sdk.version': cxRumEvent.browser_sdk.version, 'cx_rum.platform': cxRumEvent.platform, 'cx_rum.environment': cxRumEvent.environment, 'cx_rum.version_metadata.app_name': cxRumEvent.version_metadata.app_name, 'cx_rum.version_metadata.app_version': cxRumEvent.version_metadata.app_version }, prefixedLabels), { 'cx_rum.session_context.session_id': session_context === null || session_context === void 0 ? void 0 : session_context.session_id, 'cx_rum.session_context.os': session_context === null || session_context === void 0 ? void 0 : session_context.os, 'cx_rum.session_context.osVersion': session_context === null || session_context === void 0 ? void 0 : session_context.osVersion, 'cx_rum.session_context.browser': session_context === null || session_context === void 0 ? void 0 : session_context.browser, 'cx_rum.session_context.browserVersion': session_context === null || session_context === void 0 ? void 0 : session_context.browserVersion, 'cx_rum.session_context.device': session_context === null || session_context === void 0 ? void 0 : session_context.device, 'cx_rum.session_context.user_agent': session_context === null || session_context === void 0 ? void 0 : session_context.user_agent, 'cx_rum.session_context.user_email': session_context === null || session_context === void 0 ? void 0 : session_context.user_email, 'cx_rum.session_context.user_id': session_context === null || session_context === void 0 ? void 0 : session_context.user_id, 'cx_rum.session_context.user_name': session_context === null || session_context === void 0 ? void 0 : session_context.user_name, 'cx_rum.page_context.page_fragments': page_context === null || page_context === void 0 ? void 0 : page_context.page_fragments, 'cx_rum.page_context.page_url_blueprint': page_context === null || page_context === void 0 ? void 0 : page_context.page_url_blueprint, 'cx_rum.event_context.type': event_context === null || event_context === void 0 ? void 0 : event_context.type, 'cx_rum.event_context.severity': event_context === null || event_context === void 0 ? void 0 : event_context.severity, 'cx_rum.error_context.error_type': error_context === null || error_context === void 0 ? void 0 : error_context.error_type, 'cx_rum.error_context.error_message': error_context === null || error_context === void 0 ? void 0 : error_context.error_message, 'cx_rum.network_request_context.fragments': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.fragments, 'cx_rum.network_request_context.url': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.url, 'cx_rum.network_request_context.status_code': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.status_code, 'cx_rum.network_request_context.method': network_request_context === null || network_request_context === void 0 ? void 0 : network_request_context.method }));
|
|
4269
4339
|
}
|
|
4270
4340
|
|
|
4271
4341
|
var CoralogixSpanMapProcessor = (function () {
|
|
@@ -5031,13 +5101,13 @@ var CoralogixRum = {
|
|
|
5031
5101
|
getSessionRecorder().startRecording();
|
|
5032
5102
|
return;
|
|
5033
5103
|
}
|
|
5034
|
-
var intervalId =
|
|
5104
|
+
var intervalId = cxSetInterval(function () {
|
|
5035
5105
|
if (getSessionRecorder()) {
|
|
5036
|
-
|
|
5106
|
+
cxClearInterval(intervalId);
|
|
5037
5107
|
getSessionRecorder().startRecording();
|
|
5038
5108
|
}
|
|
5039
5109
|
}, 300);
|
|
5040
|
-
|
|
5110
|
+
cxSetTimeout(function () { return cxClearInterval(intervalId); }, 3000);
|
|
5041
5111
|
},
|
|
5042
5112
|
screenshot: function (description) {
|
|
5043
5113
|
var _a;
|
|
@@ -5167,4 +5237,4 @@ var SessionRecordingEventType;
|
|
|
5167
5237
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
5168
5238
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
5169
5239
|
|
|
5170
|
-
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,
|
|
5240
|
+
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, cxClearTimeout as a, createCxMutationObserver as b, cxSetTimeout as c, cxRequestAnimationFrame as d, cxCancelAnimationFrame as e, cxClearInterval as f, getZoneJsOriginalDom as g, getSdkConfig as h, getNowTime as i, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as j, cxSetInterval as k, SESSION_RECORDING_DEFAULT_HEADERS as l, SESSION_RECORDING_POSTFIX_URL as m, SESSION_RECORDER_KEY as n, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as o, CoralogixRum as p, CoralogixLogSeverity as q, SessionRecordingEventType as r, CoralogixEventType as s, UrlType as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coralogix/browser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Official Coralogix SDK for browsers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Coralogix",
|
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
"@opentelemetry/propagator-b3": "1.25.1",
|
|
28
28
|
"@opentelemetry/sdk-trace-base": "1.25.1",
|
|
29
29
|
"@opentelemetry/sdk-trace-web": "1.25.1",
|
|
30
|
-
"@rrweb/rrweb-plugin-console-record": "2.0.0-alpha.15",
|
|
31
30
|
"error-stack-parser": "2.1.4",
|
|
32
|
-
"rrweb": "2.0.0-alpha.15",
|
|
33
31
|
"tslib": "2.6.3",
|
|
34
32
|
"web-vitals": "4.2.3-soft-navs"
|
|
35
33
|
},
|