@coralogix/browser 2.5.0 → 2.7.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/README.md +47 -0
- package/index.esm2.js +690 -605
- package/package.json +1 -1
- package/sessionRecorder.esm.js +666 -582
- package/src/constants.d.ts +6 -1
- package/src/coralogix-rum.d.ts +4 -0
- package/src/instrumentations/CoralogixErrorInstrumentation.d.ts +2 -1
- package/src/instrumentations/instrumentation.consts.d.ts +6 -0
- package/src/instrumentations/web-worker/CoralogixWorkerInstrumentation.d.ts +14 -0
- package/src/instrumentations/web-worker/web-worker.consts.d.ts +12 -0
- package/src/types.d.ts +10 -0
- package/src/utils/compatibility.d.ts +1 -0
- package/src/version.d.ts +1 -1
package/index.esm2.js
CHANGED
|
@@ -48,8 +48,8 @@ function generateUUID(placeholder) {
|
|
|
48
48
|
: "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g, generateUUID);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
function isFunction
|
|
52
|
-
return typeof funktion === 'function'
|
|
51
|
+
function isFunction(funktion) {
|
|
52
|
+
return typeof funktion === 'function';
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// Default to complaining loudly when things don't go according to plan.
|
|
@@ -57,7 +57,7 @@ var logger = console.error.bind(console);
|
|
|
57
57
|
|
|
58
58
|
// Sets a property on an object, preserving its enumerability.
|
|
59
59
|
// This function assumes that the property is already writable.
|
|
60
|
-
function defineProperty
|
|
60
|
+
function defineProperty(obj, name, value) {
|
|
61
61
|
var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);
|
|
62
62
|
Object.defineProperty(obj, name, {
|
|
63
63
|
configurable: true,
|
|
@@ -68,104 +68,87 @@ function defineProperty (obj, name, value) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// Keep initialization idempotent.
|
|
71
|
-
function shimmer
|
|
71
|
+
function shimmer(options) {
|
|
72
72
|
if (options && options.logger) {
|
|
73
|
-
if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");
|
|
74
|
-
else logger = options.logger;
|
|
73
|
+
if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");else logger = options.logger;
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
function wrap (nodule, name, wrapper) {
|
|
76
|
+
function wrap(nodule, name, wrapper) {
|
|
79
77
|
if (!nodule || !nodule[name]) {
|
|
80
78
|
logger('no original function ' + name + ' to wrap');
|
|
81
|
-
return
|
|
79
|
+
return;
|
|
82
80
|
}
|
|
83
|
-
|
|
84
81
|
if (!wrapper) {
|
|
85
82
|
logger('no wrapper function');
|
|
86
|
-
logger(
|
|
87
|
-
return
|
|
83
|
+
logger(new Error().stack);
|
|
84
|
+
return;
|
|
88
85
|
}
|
|
89
|
-
|
|
90
86
|
if (!isFunction(nodule[name]) || !isFunction(wrapper)) {
|
|
91
87
|
logger('original object and wrapper must be functions');
|
|
92
|
-
return
|
|
88
|
+
return;
|
|
93
89
|
}
|
|
94
|
-
|
|
95
90
|
var original = nodule[name];
|
|
96
91
|
var wrapped = wrapper(original, name);
|
|
97
|
-
|
|
98
92
|
defineProperty(wrapped, '__original', original);
|
|
99
93
|
defineProperty(wrapped, '__unwrap', function () {
|
|
100
94
|
if (nodule[name] === wrapped) defineProperty(nodule, name, original);
|
|
101
95
|
});
|
|
102
96
|
defineProperty(wrapped, '__wrapped', true);
|
|
103
|
-
|
|
104
97
|
defineProperty(nodule, name, wrapped);
|
|
105
|
-
return wrapped
|
|
98
|
+
return wrapped;
|
|
106
99
|
}
|
|
107
|
-
|
|
108
|
-
function massWrap (nodules, names, wrapper) {
|
|
100
|
+
function massWrap(nodules, names, wrapper) {
|
|
109
101
|
if (!nodules) {
|
|
110
102
|
logger('must provide one or more modules to patch');
|
|
111
|
-
logger(
|
|
112
|
-
return
|
|
103
|
+
logger(new Error().stack);
|
|
104
|
+
return;
|
|
113
105
|
} else if (!Array.isArray(nodules)) {
|
|
114
106
|
nodules = [nodules];
|
|
115
107
|
}
|
|
116
|
-
|
|
117
108
|
if (!(names && Array.isArray(names))) {
|
|
118
109
|
logger('must provide one or more functions to wrap on modules');
|
|
119
|
-
return
|
|
110
|
+
return;
|
|
120
111
|
}
|
|
121
|
-
|
|
122
112
|
nodules.forEach(function (nodule) {
|
|
123
113
|
names.forEach(function (name) {
|
|
124
114
|
wrap(nodule, name, wrapper);
|
|
125
115
|
});
|
|
126
116
|
});
|
|
127
117
|
}
|
|
128
|
-
|
|
129
|
-
function unwrap (nodule, name) {
|
|
118
|
+
function unwrap(nodule, name) {
|
|
130
119
|
if (!nodule || !nodule[name]) {
|
|
131
120
|
logger('no function to unwrap.');
|
|
132
|
-
logger(
|
|
133
|
-
return
|
|
121
|
+
logger(new Error().stack);
|
|
122
|
+
return;
|
|
134
123
|
}
|
|
135
|
-
|
|
136
124
|
if (!nodule[name].__unwrap) {
|
|
137
125
|
logger('no original to unwrap to -- has ' + name + ' already been unwrapped?');
|
|
138
126
|
} else {
|
|
139
|
-
return nodule[name].__unwrap()
|
|
127
|
+
return nodule[name].__unwrap();
|
|
140
128
|
}
|
|
141
129
|
}
|
|
142
|
-
|
|
143
|
-
function massUnwrap (nodules, names) {
|
|
130
|
+
function massUnwrap(nodules, names) {
|
|
144
131
|
if (!nodules) {
|
|
145
132
|
logger('must provide one or more modules to patch');
|
|
146
|
-
logger(
|
|
147
|
-
return
|
|
133
|
+
logger(new Error().stack);
|
|
134
|
+
return;
|
|
148
135
|
} else if (!Array.isArray(nodules)) {
|
|
149
136
|
nodules = [nodules];
|
|
150
137
|
}
|
|
151
|
-
|
|
152
138
|
if (!(names && Array.isArray(names))) {
|
|
153
139
|
logger('must provide one or more functions to unwrap on modules');
|
|
154
|
-
return
|
|
140
|
+
return;
|
|
155
141
|
}
|
|
156
|
-
|
|
157
142
|
nodules.forEach(function (nodule) {
|
|
158
143
|
names.forEach(function (name) {
|
|
159
144
|
unwrap(nodule, name);
|
|
160
145
|
});
|
|
161
146
|
});
|
|
162
147
|
}
|
|
163
|
-
|
|
164
148
|
shimmer.wrap = wrap;
|
|
165
149
|
shimmer.massWrap = massWrap;
|
|
166
150
|
shimmer.unwrap = unwrap;
|
|
167
151
|
shimmer.massUnwrap = massUnwrap;
|
|
168
|
-
|
|
169
152
|
var shimmer_1 = shimmer;
|
|
170
153
|
|
|
171
154
|
var CoralogixEventType;
|
|
@@ -398,6 +381,7 @@ var ErrorSource;
|
|
|
398
381
|
ErrorSource["UNHANDLED_REJECTION"] = "unhandledrejection";
|
|
399
382
|
ErrorSource["DOCUMENT"] = "document";
|
|
400
383
|
ErrorSource["CAPTURED"] = "captured";
|
|
384
|
+
ErrorSource["WEB_WORKER"] = "web_worker";
|
|
401
385
|
})(ErrorSource || (ErrorSource = {}));
|
|
402
386
|
function buildStacktrace(span, err) {
|
|
403
387
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -512,15 +496,15 @@ function extractMetadataFromMfeStacktrace() {
|
|
|
512
496
|
});
|
|
513
497
|
});
|
|
514
498
|
}
|
|
515
|
-
var _consoleErrorHandler = function (
|
|
499
|
+
var _consoleErrorHandler = function (errorInstrumentation) {
|
|
516
500
|
return function (original) {
|
|
517
501
|
return function () {
|
|
518
502
|
var args = [];
|
|
519
503
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
520
504
|
args[_i] = arguments[_i];
|
|
521
505
|
}
|
|
522
|
-
|
|
523
|
-
return original.apply(
|
|
506
|
+
errorInstrumentation.report(ErrorSource.CONSOLE, args);
|
|
507
|
+
return original.apply(console, args);
|
|
524
508
|
};
|
|
525
509
|
};
|
|
526
510
|
};
|
|
@@ -1268,6 +1252,12 @@ var DOM_INSTRUMENTATION_NAME = 'dom';
|
|
|
1268
1252
|
var DOM_INSTRUMENTATION_VERSION = '1.0.0';
|
|
1269
1253
|
var CUSTOM_MEASUREMENT_INSTRUMENTATION_NAME = 'custom_measurement';
|
|
1270
1254
|
var CUSTOM_MEASUREMENT_INSTRUMENTATION_VERSION = '1.0.0';
|
|
1255
|
+
var WORKER_INSTRUMENTATION = 'web_worker';
|
|
1256
|
+
var WORKER_INSTRUMENTATION_VERSION = '1.0.0';
|
|
1257
|
+
var XHR_INSTRUMENTATION_NAME = 'xhr';
|
|
1258
|
+
var FETCH_INSTRUMENTATION_NAME = 'fetch';
|
|
1259
|
+
var CUSTOM_INSTRUMENTATION_NAME = 'custom';
|
|
1260
|
+
var SESSION_RECORDING_INSTRUMENTATION_NAME = 'session_recording';
|
|
1271
1261
|
var ALL_WEB_VITALS_METRICS = {
|
|
1272
1262
|
lcp: true,
|
|
1273
1263
|
fid: true,
|
|
@@ -1329,14 +1319,11 @@ var IMG_EXTENSIONS = [
|
|
|
1329
1319
|
*/
|
|
1330
1320
|
|
|
1331
1321
|
var h = 'undefined' != typeof CxGlobal ? CxGlobal : {},
|
|
1332
|
-
k =
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
: function (a, b, c) {
|
|
1336
|
-
a != Array.prototype && a != Object.prototype && (a[b] = c.value);
|
|
1337
|
-
};
|
|
1322
|
+
k = 'function' == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) {
|
|
1323
|
+
a != Array.prototype && a != Object.prototype && (a[b] = c.value);
|
|
1324
|
+
};
|
|
1338
1325
|
function l() {
|
|
1339
|
-
l = function () {};
|
|
1326
|
+
l = function l() {};
|
|
1340
1327
|
h.Symbol || (h.Symbol = m);
|
|
1341
1328
|
}
|
|
1342
1329
|
var n = 0;
|
|
@@ -1347,25 +1334,31 @@ function p() {
|
|
|
1347
1334
|
l();
|
|
1348
1335
|
var a = h.Symbol.iterator;
|
|
1349
1336
|
a || (a = h.Symbol.iterator = h.Symbol('iterator'));
|
|
1350
|
-
'function' != typeof Array.prototype[a] &&
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
p = function () {};
|
|
1337
|
+
'function' != typeof Array.prototype[a] && k(Array.prototype, a, {
|
|
1338
|
+
configurable: true,
|
|
1339
|
+
writable: true,
|
|
1340
|
+
value: function value() {
|
|
1341
|
+
return q(this);
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
p = function p() {};
|
|
1359
1345
|
}
|
|
1360
1346
|
function q(a) {
|
|
1361
1347
|
var b = 0;
|
|
1362
1348
|
return r(function () {
|
|
1363
|
-
return b < a.length ? {
|
|
1349
|
+
return b < a.length ? {
|
|
1350
|
+
done: false,
|
|
1351
|
+
value: a[b++]
|
|
1352
|
+
} : {
|
|
1353
|
+
done: true
|
|
1354
|
+
};
|
|
1364
1355
|
});
|
|
1365
1356
|
}
|
|
1366
1357
|
function r(a) {
|
|
1367
1358
|
p();
|
|
1368
|
-
a = {
|
|
1359
|
+
a = {
|
|
1360
|
+
next: a
|
|
1361
|
+
};
|
|
1369
1362
|
a[h.Symbol.iterator] = function () {
|
|
1370
1363
|
return this;
|
|
1371
1364
|
};
|
|
@@ -1379,7 +1372,7 @@ function t(a) {
|
|
|
1379
1372
|
function u(a) {
|
|
1380
1373
|
if (!(a instanceof Array)) {
|
|
1381
1374
|
a = t(a);
|
|
1382
|
-
for (var b, c = []; !(b = a.next()).done;
|
|
1375
|
+
for (var b, c = []; !(b = a.next()).done;) c.push(b.value);
|
|
1383
1376
|
a = c;
|
|
1384
1377
|
}
|
|
1385
1378
|
return a;
|
|
@@ -1400,50 +1393,37 @@ function w(a, b) {
|
|
|
1400
1393
|
}
|
|
1401
1394
|
function x(a, b) {
|
|
1402
1395
|
var c = fetch;
|
|
1403
|
-
fetch = function (d) {
|
|
1396
|
+
fetch = function fetch(d) {
|
|
1404
1397
|
for (var f = [], e = 0; e < arguments.length; ++e) f[e - 0] = arguments[e];
|
|
1405
1398
|
return new Promise(function (d, e) {
|
|
1406
1399
|
var g = v++;
|
|
1407
1400
|
a(g);
|
|
1408
|
-
c.apply(null, [].concat(u(f))).then(
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
e(a);
|
|
1416
|
-
}
|
|
1417
|
-
);
|
|
1401
|
+
c.apply(null, [].concat(u(f))).then(function (a) {
|
|
1402
|
+
b(g);
|
|
1403
|
+
d(a);
|
|
1404
|
+
}, function (a) {
|
|
1405
|
+
b(a);
|
|
1406
|
+
e(a);
|
|
1407
|
+
});
|
|
1418
1408
|
});
|
|
1419
1409
|
};
|
|
1420
1410
|
}
|
|
1421
1411
|
var y = 'img script iframe link audio video source'.split(' ');
|
|
1422
1412
|
function z(a, b) {
|
|
1423
1413
|
a = t(a);
|
|
1424
|
-
for (var c = a.next(); !c.done; c = a.next())
|
|
1425
|
-
if (
|
|
1426
|
-
((c = c.value), b.includes(c.nodeName.toLowerCase()) || z(c.children, b))
|
|
1427
|
-
)
|
|
1428
|
-
return true;
|
|
1414
|
+
for (var c = a.next(); !c.done; c = a.next()) if (c = c.value, b.includes(c.nodeName.toLowerCase()) || z(c.children, b)) return true;
|
|
1429
1415
|
return false;
|
|
1430
1416
|
}
|
|
1431
1417
|
function A(a) {
|
|
1432
1418
|
var b = new MutationObserver(function (c) {
|
|
1433
1419
|
c = t(c);
|
|
1434
|
-
for (var b = c.next(); !b.done; b = c.next())
|
|
1435
|
-
(b = b.value),
|
|
1436
|
-
'childList' == b.type && z(b.addedNodes, y)
|
|
1437
|
-
? a(b)
|
|
1438
|
-
: 'attributes' == b.type &&
|
|
1439
|
-
y.includes(b.target.tagName.toLowerCase()) &&
|
|
1440
|
-
a(b);
|
|
1420
|
+
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);
|
|
1441
1421
|
});
|
|
1442
1422
|
b.observe(document, {
|
|
1443
1423
|
attributes: true,
|
|
1444
1424
|
childList: true,
|
|
1445
1425
|
subtree: true,
|
|
1446
|
-
attributeFilter: ['href', 'src']
|
|
1426
|
+
attributeFilter: ['href', 'src']
|
|
1447
1427
|
});
|
|
1448
1428
|
return b;
|
|
1449
1429
|
}
|
|
@@ -1451,29 +1431,33 @@ function B(a, b) {
|
|
|
1451
1431
|
if (2 < a.length) return performance.now();
|
|
1452
1432
|
var c = [];
|
|
1453
1433
|
b = t(b);
|
|
1454
|
-
for (var d = b.next(); !d.done; d = b.next())
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1434
|
+
for (var d = b.next(); !d.done; d = b.next()) d = d.value, c.push({
|
|
1435
|
+
timestamp: d.start,
|
|
1436
|
+
type: 'requestStart'
|
|
1437
|
+
}), c.push({
|
|
1438
|
+
timestamp: d.end,
|
|
1439
|
+
type: 'requestEnd'
|
|
1440
|
+
});
|
|
1458
1441
|
b = t(a);
|
|
1459
|
-
for (d = b.next(); !d.done; d = b.next())
|
|
1460
|
-
|
|
1442
|
+
for (d = b.next(); !d.done; d = b.next()) c.push({
|
|
1443
|
+
timestamp: d.value,
|
|
1444
|
+
type: 'requestStart'
|
|
1445
|
+
});
|
|
1461
1446
|
c.sort(function (a, b) {
|
|
1462
1447
|
return a.timestamp - b.timestamp;
|
|
1463
1448
|
});
|
|
1464
1449
|
a = a.length;
|
|
1465
|
-
for (b = c.length - 1; 0 <= b; b--)
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
}
|
|
1450
|
+
for (b = c.length - 1; 0 <= b; b--) switch (d = c[b], d.type) {
|
|
1451
|
+
case 'requestStart':
|
|
1452
|
+
a--;
|
|
1453
|
+
break;
|
|
1454
|
+
case 'requestEnd':
|
|
1455
|
+
a++;
|
|
1456
|
+
if (2 < a) return d.timestamp;
|
|
1457
|
+
break;
|
|
1458
|
+
default:
|
|
1459
|
+
throw Error('Internal Error: This should never happen');
|
|
1460
|
+
}
|
|
1477
1461
|
return 0;
|
|
1478
1462
|
}
|
|
1479
1463
|
function C(a) {
|
|
@@ -1482,11 +1466,12 @@ function C(a) {
|
|
|
1482
1466
|
this.u = a.minValue || null;
|
|
1483
1467
|
a = CxGlobal.__tti && CxGlobal.__tti.e;
|
|
1484
1468
|
var b = CxGlobal.__tti && CxGlobal.__tti.o;
|
|
1485
|
-
this.a = a
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1469
|
+
this.a = a ? a.map(function (a) {
|
|
1470
|
+
return {
|
|
1471
|
+
start: a.startTime,
|
|
1472
|
+
end: a.startTime + a.duration
|
|
1473
|
+
};
|
|
1474
|
+
}) : [];
|
|
1490
1475
|
b && b.disconnect();
|
|
1491
1476
|
this.b = [];
|
|
1492
1477
|
this.f = new Map();
|
|
@@ -1503,11 +1488,9 @@ C.prototype.getFirstConsistentlyInteractive = function () {
|
|
|
1503
1488
|
var a = this;
|
|
1504
1489
|
return new Promise(function (b) {
|
|
1505
1490
|
a.s = b;
|
|
1506
|
-
'complete' == document.readyState
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
F(a);
|
|
1510
|
-
});
|
|
1491
|
+
'complete' == document.readyState ? F(a) : CxGlobal.addEventListener('load', function () {
|
|
1492
|
+
F(a);
|
|
1493
|
+
});
|
|
1511
1494
|
});
|
|
1512
1495
|
};
|
|
1513
1496
|
function F(a) {
|
|
@@ -1517,55 +1500,37 @@ function F(a) {
|
|
|
1517
1500
|
G(a, Math.max(c + 5e3, b));
|
|
1518
1501
|
}
|
|
1519
1502
|
function G(a, b) {
|
|
1520
|
-
!a.i ||
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
? ((f = performance.timing),
|
|
1533
|
-
(f = f.domContentLoadedEventEnd - f.navigationStart))
|
|
1534
|
-
: (f = null);
|
|
1535
|
-
var e = performance.now();
|
|
1536
|
-
null === f && G(a, Math.max(d + 5e3, e + 1e3));
|
|
1537
|
-
var g = a.a;
|
|
1538
|
-
5e3 > e - d
|
|
1539
|
-
? (d = null)
|
|
1540
|
-
: ((d = g.length ? g[g.length - 1].end : b),
|
|
1541
|
-
(d = 5e3 > e - d ? null : Math.max(d, f)));
|
|
1542
|
-
d &&
|
|
1543
|
-
(a.s(d),
|
|
1544
|
-
clearTimeout(a.j),
|
|
1545
|
-
(a.i = false),
|
|
1546
|
-
a.c && a.c.disconnect(),
|
|
1547
|
-
a.h && a.h.disconnect());
|
|
1548
|
-
G(a, performance.now() + 1e3);
|
|
1549
|
-
}, b - performance.now())),
|
|
1550
|
-
(a.v = b));
|
|
1503
|
+
!a.i || a.v > b || (clearTimeout(a.j), a.j = setTimeout(function () {
|
|
1504
|
+
var b = performance.timing.navigationStart,
|
|
1505
|
+
d = B(a.g, a.b),
|
|
1506
|
+
b = (CxGlobal.a && CxGlobal.a.A ? 1e3 * CxGlobal.a.A().C - b : 0) || performance.timing.domContentLoadedEventEnd - b;
|
|
1507
|
+
if (a.u) var f = a.u;else performance.timing.domContentLoadedEventEnd ? (f = performance.timing, f = f.domContentLoadedEventEnd - f.navigationStart) : f = null;
|
|
1508
|
+
var e = performance.now();
|
|
1509
|
+
null === f && G(a, Math.max(d + 5e3, e + 1e3));
|
|
1510
|
+
var g = a.a;
|
|
1511
|
+
5e3 > e - d ? d = null : (d = g.length ? g[g.length - 1].end : b, d = 5e3 > e - d ? null : Math.max(d, f));
|
|
1512
|
+
d && (a.s(d), clearTimeout(a.j), a.i = false, a.c && a.c.disconnect(), a.h && a.h.disconnect());
|
|
1513
|
+
G(a, performance.now() + 1e3);
|
|
1514
|
+
}, b - performance.now()), a.v = b);
|
|
1551
1515
|
}
|
|
1552
1516
|
function D(a) {
|
|
1553
1517
|
a.c = new PerformanceObserver(function (b) {
|
|
1554
1518
|
b = t(b.getEntries());
|
|
1555
|
-
for (var c = b.next(); !c.done; c = b.next())
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1519
|
+
for (var c = b.next(); !c.done; c = b.next()) if (c = c.value, 'resource' === c.entryType && (a.b.push({
|
|
1520
|
+
start: c.fetchStart,
|
|
1521
|
+
end: c.responseEnd
|
|
1522
|
+
}), G(a, B(a.g, a.b) + 5e3)), 'longtask' === c.entryType) {
|
|
1523
|
+
var d = c.startTime + c.duration;
|
|
1524
|
+
a.a.push({
|
|
1525
|
+
start: c.startTime,
|
|
1526
|
+
end: d
|
|
1527
|
+
});
|
|
1528
|
+
G(a, d + 5e3);
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
a.c.observe({
|
|
1532
|
+
entryTypes: ['longtask', 'resource']
|
|
1567
1533
|
});
|
|
1568
|
-
a.c.observe({ entryTypes: ['longtask', 'resource'] });
|
|
1569
1534
|
}
|
|
1570
1535
|
C.prototype.m = function (a) {
|
|
1571
1536
|
this.f.set(a, performance.now());
|
|
@@ -1580,18 +1545,17 @@ h.Object.defineProperties(C.prototype, {
|
|
|
1580
1545
|
g: {
|
|
1581
1546
|
configurable: true,
|
|
1582
1547
|
enumerable: true,
|
|
1583
|
-
get: function () {
|
|
1548
|
+
get: function get() {
|
|
1584
1549
|
return [].concat(u(this.f.values()));
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1587
1552
|
});
|
|
1588
1553
|
var H = {
|
|
1589
|
-
getFirstConsistentlyInteractive: function (
|
|
1554
|
+
getFirstConsistentlyInteractive: function getFirstConsistentlyInteractive() {
|
|
1555
|
+
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
1590
1556
|
a = a ? a : {};
|
|
1591
|
-
return 'PerformanceLongTaskTiming' in CxGlobal
|
|
1592
|
-
|
|
1593
|
-
: Promise.resolve(null);
|
|
1594
|
-
},
|
|
1557
|
+
return 'PerformanceLongTaskTiming' in CxGlobal ? new C(a).getFirstConsistentlyInteractive() : Promise.resolve(null);
|
|
1558
|
+
}
|
|
1595
1559
|
};
|
|
1596
1560
|
|
|
1597
1561
|
function observeIfSupported(observer, entryType) {
|
|
@@ -2097,12 +2061,12 @@ function getTextualContent(element) {
|
|
|
2097
2061
|
return 'innerText' in element ? element.innerText : '';
|
|
2098
2062
|
}
|
|
2099
2063
|
|
|
2100
|
-
var _a$
|
|
2064
|
+
var _a$3;
|
|
2101
2065
|
var USER_INTERACTION_INSTRUMENTATION_NAME = 'user-interaction';
|
|
2102
2066
|
var USER_INTERACTION_INSTRUMENTATION_VERSION = '1';
|
|
2103
|
-
var DEFAULT_INSTRUMENTED_EVENTS = (_a$
|
|
2104
|
-
_a$
|
|
2105
|
-
_a$
|
|
2067
|
+
var DEFAULT_INSTRUMENTED_EVENTS = (_a$3 = {},
|
|
2068
|
+
_a$3["click" /* DOM_EVENT.CLICK */] = true,
|
|
2069
|
+
_a$3);
|
|
2106
2070
|
var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
2107
2071
|
__extends(CoralogixUserInteractionInstrumentation, _super);
|
|
2108
2072
|
function CoralogixUserInteractionInstrumentation(config) {
|
|
@@ -2468,6 +2432,76 @@ var CoralogixDOMInstrumentation = /** @class */ (function (_super) {
|
|
|
2468
2432
|
return CoralogixDOMInstrumentation;
|
|
2469
2433
|
}(InstrumentationBase));
|
|
2470
2434
|
|
|
2435
|
+
var ERROR_TYPES = {
|
|
2436
|
+
RUNTIME: 'web-worker-runtime-error',
|
|
2437
|
+
MESSAGE_ERROR: 'web-worker-messageerror',
|
|
2438
|
+
};
|
|
2439
|
+
var ERROR_MESSAGES = {
|
|
2440
|
+
UNKNOWN_RUNTIME: 'Unknown worker runtime error',
|
|
2441
|
+
DESERIALIZATION_FAILED: 'Failed to deserialize message from worker',
|
|
2442
|
+
};
|
|
2443
|
+
var WORKER_EVENTS = {
|
|
2444
|
+
ERROR: 'error',
|
|
2445
|
+
MESSAGE_ERROR: 'messageerror',
|
|
2446
|
+
};
|
|
2447
|
+
|
|
2448
|
+
var CoralogixWorkerInstrumentation = /** @class */ (function (_super) {
|
|
2449
|
+
__extends(CoralogixWorkerInstrumentation, _super);
|
|
2450
|
+
function CoralogixWorkerInstrumentation(config, errorInstrumentation, coralogixRum) {
|
|
2451
|
+
var _this = _super.call(this, WORKER_INSTRUMENTATION, WORKER_INSTRUMENTATION_VERSION, config) || this;
|
|
2452
|
+
_this.errorInstrumentation = errorInstrumentation;
|
|
2453
|
+
_this.coralogixRum = coralogixRum;
|
|
2454
|
+
_this.init();
|
|
2455
|
+
return _this;
|
|
2456
|
+
}
|
|
2457
|
+
CoralogixWorkerInstrumentation.prototype.disable = function () { };
|
|
2458
|
+
CoralogixWorkerInstrumentation.prototype.enable = function () { };
|
|
2459
|
+
CoralogixWorkerInstrumentation.prototype.init = function () {
|
|
2460
|
+
var globalObj = CxGlobal;
|
|
2461
|
+
var OriginalWorker = globalObj.Worker;
|
|
2462
|
+
globalObj.Worker = this.createCxWorker(OriginalWorker);
|
|
2463
|
+
};
|
|
2464
|
+
CoralogixWorkerInstrumentation.prototype.createCxWorker = function (OriginalWorker) {
|
|
2465
|
+
var self = this;
|
|
2466
|
+
var CxWorker = /** @class */ (function (_super) {
|
|
2467
|
+
__extends(CxWorker, _super);
|
|
2468
|
+
function CxWorker(scriptURL, options) {
|
|
2469
|
+
var _this = _super.call(this, scriptURL, options) || this;
|
|
2470
|
+
_this.CoralogixRum = self.coralogixRum;
|
|
2471
|
+
self.attachWorkerErrorHandlers(_this, scriptURL);
|
|
2472
|
+
return _this;
|
|
2473
|
+
}
|
|
2474
|
+
return CxWorker;
|
|
2475
|
+
}(OriginalWorker));
|
|
2476
|
+
return CxWorker;
|
|
2477
|
+
};
|
|
2478
|
+
CoralogixWorkerInstrumentation.prototype.attachWorkerErrorHandlers = function (worker, scriptURL) {
|
|
2479
|
+
var _this = this;
|
|
2480
|
+
var source = scriptURL.toString();
|
|
2481
|
+
worker.addEventListener(WORKER_EVENTS.ERROR, function (event) {
|
|
2482
|
+
var message = event.message || ERROR_MESSAGES.UNKNOWN_RUNTIME;
|
|
2483
|
+
_this.reportWorkerError(message, {
|
|
2484
|
+
scriptURL: source,
|
|
2485
|
+
filename: event.filename,
|
|
2486
|
+
lineno: event.lineno,
|
|
2487
|
+
colno: event.colno,
|
|
2488
|
+
originalError: event.error || null,
|
|
2489
|
+
}, { type: ERROR_TYPES.RUNTIME });
|
|
2490
|
+
});
|
|
2491
|
+
worker.addEventListener(WORKER_EVENTS.MESSAGE_ERROR, function (event) {
|
|
2492
|
+
_this.reportWorkerError(ERROR_MESSAGES.DESERIALIZATION_FAILED, {
|
|
2493
|
+
scriptURL: source,
|
|
2494
|
+
event: event,
|
|
2495
|
+
}, { type: ERROR_TYPES.MESSAGE_ERROR });
|
|
2496
|
+
});
|
|
2497
|
+
};
|
|
2498
|
+
CoralogixWorkerInstrumentation.prototype.reportWorkerError = function (message, customData, labels) {
|
|
2499
|
+
var _a;
|
|
2500
|
+
(_a = this.errorInstrumentation) === null || _a === void 0 ? void 0 : _a.reportError(ErrorSource.WEB_WORKER, new Error(message), customData, labels);
|
|
2501
|
+
};
|
|
2502
|
+
return CoralogixWorkerInstrumentation;
|
|
2503
|
+
}(InstrumentationBase));
|
|
2504
|
+
|
|
2471
2505
|
var CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
|
|
2472
2506
|
var CORALOGIX_RECORDING_URL_SUFFIX = '/sessionrecording';
|
|
2473
2507
|
var MAX_EXPORT_BATCH_SIZE = 50;
|
|
@@ -2529,22 +2563,22 @@ var INSTRUMENTATIONS = [
|
|
|
2529
2563
|
},
|
|
2530
2564
|
{
|
|
2531
2565
|
Instrument: CoralogixFetchInstrumentation,
|
|
2532
|
-
confKey:
|
|
2566
|
+
confKey: FETCH_INSTRUMENTATION_NAME,
|
|
2533
2567
|
disable: false,
|
|
2534
2568
|
},
|
|
2535
2569
|
{
|
|
2536
2570
|
Instrument: CoralogixXhrInstrumentation,
|
|
2537
|
-
confKey:
|
|
2571
|
+
confKey: XHR_INSTRUMENTATION_NAME,
|
|
2538
2572
|
disable: false,
|
|
2539
2573
|
},
|
|
2540
2574
|
{
|
|
2541
2575
|
Instrument: CoralogixCustomLogInstrumentation,
|
|
2542
|
-
confKey:
|
|
2576
|
+
confKey: CUSTOM_INSTRUMENTATION_NAME,
|
|
2543
2577
|
disable: false,
|
|
2544
2578
|
},
|
|
2545
2579
|
{
|
|
2546
2580
|
Instrument: CoralogixUserInteractionInstrumentation,
|
|
2547
|
-
confKey:
|
|
2581
|
+
confKey: USER_INTERACTION_INSTRUMENTATION_NAME,
|
|
2548
2582
|
disable: false,
|
|
2549
2583
|
},
|
|
2550
2584
|
{
|
|
@@ -2587,6 +2621,11 @@ var INSTRUMENTATIONS = [
|
|
|
2587
2621
|
confKey: SCREENSHOT_INSTRUMENTATION_NAME,
|
|
2588
2622
|
disable: false,
|
|
2589
2623
|
},
|
|
2624
|
+
{
|
|
2625
|
+
Instrument: CoralogixWorkerInstrumentation,
|
|
2626
|
+
confKey: WORKER_INSTRUMENTATION,
|
|
2627
|
+
disable: false,
|
|
2628
|
+
},
|
|
2590
2629
|
];
|
|
2591
2630
|
var CoralogixAttributes = {
|
|
2592
2631
|
USER_AGENT: 'user_agent',
|
|
@@ -2645,8 +2684,8 @@ function getInternalRumData(key) {
|
|
|
2645
2684
|
return (_a = CxGlobal[RUM_INTERNAL_DATA_KEY]) === null || _a === void 0 ? void 0 : _a[key];
|
|
2646
2685
|
}
|
|
2647
2686
|
|
|
2648
|
-
var _a$
|
|
2649
|
-
var supportedPerformanceTypes = !((_a$
|
|
2687
|
+
var _a$2;
|
|
2688
|
+
var supportedPerformanceTypes = !((_a$2 = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.PerformanceObserver) === null || _a$2 === void 0 ? void 0 : _a$2.supportedEntryTypes)
|
|
2650
2689
|
? new Set()
|
|
2651
2690
|
: new Set(CxGlobal.PerformanceObserver.supportedEntryTypes);
|
|
2652
2691
|
function valueEndWithOrInclude(value, extensions) {
|
|
@@ -2981,7 +3020,7 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
|
2981
3020
|
*/
|
|
2982
3021
|
var SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
|
|
2983
3022
|
function isTracingSuppressed(context) {
|
|
2984
|
-
|
|
3023
|
+
return context.getValue(SUPPRESS_TRACING_KEY) === true;
|
|
2985
3024
|
}
|
|
2986
3025
|
|
|
2987
3026
|
/*
|
|
@@ -3011,57 +3050,66 @@ var BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
|
|
|
3011
3050
|
// Maximum total length of all name-value pairs allowed by w3c spec
|
|
3012
3051
|
var BAGGAGE_MAX_TOTAL_LENGTH = 8192;
|
|
3013
3052
|
|
|
3014
|
-
var __read =
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3053
|
+
var __read = undefined && undefined.__read || function (o, n) {
|
|
3054
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3055
|
+
if (!m) return o;
|
|
3056
|
+
var i = m.call(o),
|
|
3057
|
+
r,
|
|
3058
|
+
ar = [],
|
|
3059
|
+
e;
|
|
3060
|
+
try {
|
|
3061
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
3062
|
+
} catch (error) {
|
|
3063
|
+
e = {
|
|
3064
|
+
error: error
|
|
3065
|
+
};
|
|
3066
|
+
} finally {
|
|
3018
3067
|
try {
|
|
3019
|
-
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
finally {
|
|
3023
|
-
try {
|
|
3024
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
3025
|
-
}
|
|
3026
|
-
finally { if (e) throw e.error; }
|
|
3068
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
3069
|
+
} finally {
|
|
3070
|
+
if (e) throw e.error;
|
|
3027
3071
|
}
|
|
3028
|
-
|
|
3072
|
+
}
|
|
3073
|
+
return ar;
|
|
3029
3074
|
};
|
|
3030
3075
|
function serializeKeyPairs(keyPairs) {
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3076
|
+
return keyPairs.reduce(function (hValue, current) {
|
|
3077
|
+
var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
|
|
3078
|
+
return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
|
|
3079
|
+
}, '');
|
|
3035
3080
|
}
|
|
3036
3081
|
function getKeyPairs(baggage) {
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
}
|
|
3082
|
+
return baggage.getAllEntries().map(function (_a) {
|
|
3083
|
+
var _b = __read(_a, 2),
|
|
3084
|
+
key = _b[0],
|
|
3085
|
+
value = _b[1];
|
|
3086
|
+
var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
|
|
3087
|
+
// include opaque metadata if provided
|
|
3088
|
+
// NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
|
|
3089
|
+
if (value.metadata !== undefined) {
|
|
3090
|
+
entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
|
|
3091
|
+
}
|
|
3092
|
+
return entry;
|
|
3093
|
+
});
|
|
3047
3094
|
}
|
|
3048
3095
|
function parsePairKeyValue(entry) {
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3096
|
+
var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
|
|
3097
|
+
if (valueProps.length <= 0) return;
|
|
3098
|
+
var keyPairPart = valueProps.shift();
|
|
3099
|
+
if (!keyPairPart) return;
|
|
3100
|
+
var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
|
|
3101
|
+
if (separatorIndex <= 0) return;
|
|
3102
|
+
var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
|
|
3103
|
+
var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
|
|
3104
|
+
var metadata;
|
|
3105
|
+
if (valueProps.length > 0) {
|
|
3106
|
+
metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
|
|
3107
|
+
}
|
|
3108
|
+
return {
|
|
3109
|
+
key: key,
|
|
3110
|
+
value: value,
|
|
3111
|
+
metadata: metadata
|
|
3112
|
+
};
|
|
3065
3113
|
}
|
|
3066
3114
|
|
|
3067
3115
|
/*
|
|
@@ -3085,55 +3133,50 @@ function parsePairKeyValue(entry) {
|
|
|
3085
3133
|
* Based on the Baggage specification:
|
|
3086
3134
|
* https://w3c.github.io/baggage/
|
|
3087
3135
|
*/
|
|
3088
|
-
var W3CBaggagePropagator = /** @class */
|
|
3089
|
-
|
|
3136
|
+
var W3CBaggagePropagator = /** @class */function () {
|
|
3137
|
+
function W3CBaggagePropagator() {}
|
|
3138
|
+
W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
|
|
3139
|
+
var baggage = propagation.getBaggage(context);
|
|
3140
|
+
if (!baggage || isTracingSuppressed(context)) return;
|
|
3141
|
+
var keyPairs = getKeyPairs(baggage).filter(function (pair) {
|
|
3142
|
+
return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
|
|
3143
|
+
}).slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
|
|
3144
|
+
var headerValue = serializeKeyPairs(keyPairs);
|
|
3145
|
+
if (headerValue.length > 0) {
|
|
3146
|
+
setter.set(carrier, BAGGAGE_HEADER, headerValue);
|
|
3090
3147
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
: headerValue;
|
|
3110
|
-
if (!baggageString)
|
|
3111
|
-
return context;
|
|
3112
|
-
var baggage = {};
|
|
3113
|
-
if (baggageString.length === 0) {
|
|
3114
|
-
return context;
|
|
3115
|
-
}
|
|
3116
|
-
var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
|
|
3117
|
-
pairs.forEach(function (entry) {
|
|
3118
|
-
var keyPair = parsePairKeyValue(entry);
|
|
3119
|
-
if (keyPair) {
|
|
3120
|
-
var baggageEntry = { value: keyPair.value };
|
|
3121
|
-
if (keyPair.metadata) {
|
|
3122
|
-
baggageEntry.metadata = keyPair.metadata;
|
|
3123
|
-
}
|
|
3124
|
-
baggage[keyPair.key] = baggageEntry;
|
|
3125
|
-
}
|
|
3126
|
-
});
|
|
3127
|
-
if (Object.entries(baggage).length === 0) {
|
|
3128
|
-
return context;
|
|
3148
|
+
};
|
|
3149
|
+
W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
|
|
3150
|
+
var headerValue = getter.get(carrier, BAGGAGE_HEADER);
|
|
3151
|
+
var baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
|
|
3152
|
+
if (!baggageString) return context;
|
|
3153
|
+
var baggage = {};
|
|
3154
|
+
if (baggageString.length === 0) {
|
|
3155
|
+
return context;
|
|
3156
|
+
}
|
|
3157
|
+
var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
|
|
3158
|
+
pairs.forEach(function (entry) {
|
|
3159
|
+
var keyPair = parsePairKeyValue(entry);
|
|
3160
|
+
if (keyPair) {
|
|
3161
|
+
var baggageEntry = {
|
|
3162
|
+
value: keyPair.value
|
|
3163
|
+
};
|
|
3164
|
+
if (keyPair.metadata) {
|
|
3165
|
+
baggageEntry.metadata = keyPair.metadata;
|
|
3129
3166
|
}
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3167
|
+
baggage[keyPair.key] = baggageEntry;
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
if (Object.entries(baggage).length === 0) {
|
|
3171
|
+
return context;
|
|
3172
|
+
}
|
|
3173
|
+
return propagation.setBaggage(context, propagation.createBaggage(baggage));
|
|
3174
|
+
};
|
|
3175
|
+
W3CBaggagePropagator.prototype.fields = function () {
|
|
3176
|
+
return [BAGGAGE_HEADER];
|
|
3177
|
+
};
|
|
3178
|
+
return W3CBaggagePropagator;
|
|
3179
|
+
}();
|
|
3137
3180
|
|
|
3138
3181
|
/*
|
|
3139
3182
|
* Copyright The OpenTelemetry Authors
|
|
@@ -3152,8 +3195,8 @@ var W3CBaggagePropagator = /** @class */ (function () {
|
|
|
3152
3195
|
*/
|
|
3153
3196
|
var ExportResultCode;
|
|
3154
3197
|
(function (ExportResultCode) {
|
|
3155
|
-
|
|
3156
|
-
|
|
3198
|
+
ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
|
|
3199
|
+
ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
|
|
3157
3200
|
})(ExportResultCode || (ExportResultCode = {}));
|
|
3158
3201
|
|
|
3159
3202
|
/*
|
|
@@ -3171,89 +3214,100 @@ var ExportResultCode;
|
|
|
3171
3214
|
* See the License for the specific language governing permissions and
|
|
3172
3215
|
* limitations under the License.
|
|
3173
3216
|
*/
|
|
3174
|
-
var __values =
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3217
|
+
var __values = undefined && undefined.__values || function (o) {
|
|
3218
|
+
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
3219
|
+
m = s && o[s],
|
|
3220
|
+
i = 0;
|
|
3221
|
+
if (m) return m.call(o);
|
|
3222
|
+
if (o && typeof o.length === "number") return {
|
|
3223
|
+
next: function next() {
|
|
3224
|
+
if (o && i >= o.length) o = void 0;
|
|
3225
|
+
return {
|
|
3226
|
+
value: o && o[i++],
|
|
3227
|
+
done: !o
|
|
3228
|
+
};
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
3184
3232
|
};
|
|
3185
3233
|
/** Combines multiple propagators into a single propagator. */
|
|
3186
|
-
var CompositePropagator = /** @class */
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
|
|
3196
|
-
this._fields = Array.from(new Set(this._propagators
|
|
3197
|
-
// older propagators may not have fields function, null check to be sure
|
|
3198
|
-
.map(function (p) { return (typeof p.fields === 'function' ? p.fields() : []); })
|
|
3199
|
-
.reduce(function (x, y) { return x.concat(y); }, [])));
|
|
3234
|
+
var CompositePropagator = /** @class */function () {
|
|
3235
|
+
/**
|
|
3236
|
+
* Construct a composite propagator from a list of propagators.
|
|
3237
|
+
*
|
|
3238
|
+
* @param [config] Configuration object for composite propagator
|
|
3239
|
+
*/
|
|
3240
|
+
function CompositePropagator(config) {
|
|
3241
|
+
if (config === void 0) {
|
|
3242
|
+
config = {};
|
|
3200
3243
|
}
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3244
|
+
var _a;
|
|
3245
|
+
this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
|
|
3246
|
+
this._fields = Array.from(new Set(this._propagators
|
|
3247
|
+
// older propagators may not have fields function, null check to be sure
|
|
3248
|
+
.map(function (p) {
|
|
3249
|
+
return typeof p.fields === 'function' ? p.fields() : [];
|
|
3250
|
+
}).reduce(function (x, y) {
|
|
3251
|
+
return x.concat(y);
|
|
3252
|
+
}, [])));
|
|
3253
|
+
}
|
|
3254
|
+
/**
|
|
3255
|
+
* Run each of the configured propagators with the given context and carrier.
|
|
3256
|
+
* Propagators are run in the order they are configured, so if multiple
|
|
3257
|
+
* propagators write the same carrier key, the propagator later in the list
|
|
3258
|
+
* will "win".
|
|
3259
|
+
*
|
|
3260
|
+
* @param context Context to inject
|
|
3261
|
+
* @param carrier Carrier into which context will be injected
|
|
3262
|
+
*/
|
|
3263
|
+
CompositePropagator.prototype.inject = function (context, carrier, setter) {
|
|
3264
|
+
var e_1, _a;
|
|
3265
|
+
try {
|
|
3266
|
+
for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3267
|
+
var propagator = _c.value;
|
|
3212
3268
|
try {
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
propagator.inject(context, carrier, setter);
|
|
3217
|
-
}
|
|
3218
|
-
catch (err) {
|
|
3219
|
-
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3220
|
-
}
|
|
3221
|
-
}
|
|
3222
|
-
}
|
|
3223
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3224
|
-
finally {
|
|
3225
|
-
try {
|
|
3226
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3227
|
-
}
|
|
3228
|
-
finally { if (e_1) throw e_1.error; }
|
|
3269
|
+
propagator.inject(context, carrier, setter);
|
|
3270
|
+
} catch (err) {
|
|
3271
|
+
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3229
3272
|
}
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
}()
|
|
3273
|
+
}
|
|
3274
|
+
} catch (e_1_1) {
|
|
3275
|
+
e_1 = {
|
|
3276
|
+
error: e_1_1
|
|
3277
|
+
};
|
|
3278
|
+
} finally {
|
|
3279
|
+
try {
|
|
3280
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3281
|
+
} finally {
|
|
3282
|
+
if (e_1) throw e_1.error;
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
};
|
|
3286
|
+
/**
|
|
3287
|
+
* Run each of the configured propagators with the given context and carrier.
|
|
3288
|
+
* Propagators are run in the order they are configured, so if multiple
|
|
3289
|
+
* propagators write the same context key, the propagator later in the list
|
|
3290
|
+
* will "win".
|
|
3291
|
+
*
|
|
3292
|
+
* @param context Context to add values to
|
|
3293
|
+
* @param carrier Carrier from which to extract context
|
|
3294
|
+
*/
|
|
3295
|
+
CompositePropagator.prototype.extract = function (context, carrier, getter) {
|
|
3296
|
+
return this._propagators.reduce(function (ctx, propagator) {
|
|
3297
|
+
try {
|
|
3298
|
+
return propagator.extract(ctx, carrier, getter);
|
|
3299
|
+
} catch (err) {
|
|
3300
|
+
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3301
|
+
}
|
|
3302
|
+
return ctx;
|
|
3303
|
+
}, context);
|
|
3304
|
+
};
|
|
3305
|
+
CompositePropagator.prototype.fields = function () {
|
|
3306
|
+
// return a new array so our fields cannot be modified
|
|
3307
|
+
return this._fields.slice();
|
|
3308
|
+
};
|
|
3309
|
+
return CompositePropagator;
|
|
3310
|
+
}();
|
|
3257
3311
|
|
|
3258
3312
|
/*
|
|
3259
3313
|
* Copyright The OpenTelemetry Authors
|
|
@@ -3285,15 +3339,14 @@ var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
|
|
|
3285
3339
|
* see https://www.w3.org/TR/trace-context/#key
|
|
3286
3340
|
*/
|
|
3287
3341
|
function validateKey(key) {
|
|
3288
|
-
|
|
3342
|
+
return VALID_KEY_REGEX.test(key);
|
|
3289
3343
|
}
|
|
3290
3344
|
/**
|
|
3291
3345
|
* Value is opaque string up to 256 characters printable ASCII RFC0020
|
|
3292
3346
|
* characters (i.e., the range 0x20 to 0x7E) except comma , and =.
|
|
3293
3347
|
*/
|
|
3294
3348
|
function validateValue(value) {
|
|
3295
|
-
|
|
3296
|
-
!INVALID_VALUE_COMMA_EQUAL_REGEX.test(value));
|
|
3349
|
+
return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value);
|
|
3297
3350
|
}
|
|
3298
3351
|
|
|
3299
3352
|
/*
|
|
@@ -3324,74 +3377,67 @@ var LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
|
|
|
3324
3377
|
* - The value of any key can be updated. Modified keys MUST be moved to the
|
|
3325
3378
|
* beginning of the list.
|
|
3326
3379
|
*/
|
|
3327
|
-
var TraceState = /** @class */
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3380
|
+
var TraceState = /** @class */function () {
|
|
3381
|
+
function TraceState(rawTraceState) {
|
|
3382
|
+
this._internalState = new Map();
|
|
3383
|
+
if (rawTraceState) this._parse(rawTraceState);
|
|
3384
|
+
}
|
|
3385
|
+
TraceState.prototype.set = function (key, value) {
|
|
3386
|
+
// TODO: Benchmark the different approaches(map vs list) and
|
|
3387
|
+
// use the faster one.
|
|
3388
|
+
var traceState = this._clone();
|
|
3389
|
+
if (traceState._internalState.has(key)) {
|
|
3390
|
+
traceState._internalState.delete(key);
|
|
3332
3391
|
}
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
return;
|
|
3363
|
-
this._internalState = rawTraceState
|
|
3364
|
-
.split(LIST_MEMBERS_SEPARATOR)
|
|
3365
|
-
.reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
|
|
3366
|
-
.reduce(function (agg, part) {
|
|
3367
|
-
var listMember = part.trim(); // Optional Whitespace (OWS) handling
|
|
3368
|
-
var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
|
|
3369
|
-
if (i !== -1) {
|
|
3370
|
-
var key = listMember.slice(0, i);
|
|
3371
|
-
var value = listMember.slice(i + 1, part.length);
|
|
3372
|
-
if (validateKey(key) && validateValue(value)) {
|
|
3373
|
-
agg.set(key, value);
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
return agg;
|
|
3377
|
-
}, new Map());
|
|
3378
|
-
// Because of the reverse() requirement, trunc must be done after map is created
|
|
3379
|
-
if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
|
|
3380
|
-
this._internalState = new Map(Array.from(this._internalState.entries())
|
|
3381
|
-
.reverse() // Use reverse same as original tracestate parse chain
|
|
3382
|
-
.slice(0, MAX_TRACE_STATE_ITEMS));
|
|
3392
|
+
traceState._internalState.set(key, value);
|
|
3393
|
+
return traceState;
|
|
3394
|
+
};
|
|
3395
|
+
TraceState.prototype.unset = function (key) {
|
|
3396
|
+
var traceState = this._clone();
|
|
3397
|
+
traceState._internalState.delete(key);
|
|
3398
|
+
return traceState;
|
|
3399
|
+
};
|
|
3400
|
+
TraceState.prototype.get = function (key) {
|
|
3401
|
+
return this._internalState.get(key);
|
|
3402
|
+
};
|
|
3403
|
+
TraceState.prototype.serialize = function () {
|
|
3404
|
+
var _this = this;
|
|
3405
|
+
return this._keys().reduce(function (agg, key) {
|
|
3406
|
+
agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
|
|
3407
|
+
return agg;
|
|
3408
|
+
}, []).join(LIST_MEMBERS_SEPARATOR);
|
|
3409
|
+
};
|
|
3410
|
+
TraceState.prototype._parse = function (rawTraceState) {
|
|
3411
|
+
if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
|
|
3412
|
+
this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
|
|
3413
|
+
.reduce(function (agg, part) {
|
|
3414
|
+
var listMember = part.trim(); // Optional Whitespace (OWS) handling
|
|
3415
|
+
var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
|
|
3416
|
+
if (i !== -1) {
|
|
3417
|
+
var key = listMember.slice(0, i);
|
|
3418
|
+
var value = listMember.slice(i + 1, part.length);
|
|
3419
|
+
if (validateKey(key) && validateValue(value)) {
|
|
3420
|
+
agg.set(key, value);
|
|
3383
3421
|
}
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3422
|
+
}
|
|
3423
|
+
return agg;
|
|
3424
|
+
}, new Map());
|
|
3425
|
+
// Because of the reverse() requirement, trunc must be done after map is created
|
|
3426
|
+
if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
|
|
3427
|
+
this._internalState = new Map(Array.from(this._internalState.entries()).reverse() // Use reverse same as original tracestate parse chain
|
|
3428
|
+
.slice(0, MAX_TRACE_STATE_ITEMS));
|
|
3429
|
+
}
|
|
3430
|
+
};
|
|
3431
|
+
TraceState.prototype._keys = function () {
|
|
3432
|
+
return Array.from(this._internalState.keys()).reverse();
|
|
3433
|
+
};
|
|
3434
|
+
TraceState.prototype._clone = function () {
|
|
3435
|
+
var traceState = new TraceState();
|
|
3436
|
+
traceState._internalState = new Map(this._internalState);
|
|
3437
|
+
return traceState;
|
|
3438
|
+
};
|
|
3439
|
+
return TraceState;
|
|
3440
|
+
}();
|
|
3395
3441
|
|
|
3396
3442
|
/*
|
|
3397
3443
|
* Copyright The OpenTelemetry Authors
|
|
@@ -3427,19 +3473,17 @@ var TRACE_PARENT_REGEX = new RegExp("^\\s?(" + VERSION_PART + ")-(" + TRACE_ID_P
|
|
|
3427
3473
|
* For more information see {@link https://www.w3.org/TR/trace-context/}
|
|
3428
3474
|
*/
|
|
3429
3475
|
function parseTraceParent(traceParent) {
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
traceFlags: parseInt(match[4], 16),
|
|
3442
|
-
};
|
|
3476
|
+
var match = TRACE_PARENT_REGEX.exec(traceParent);
|
|
3477
|
+
if (!match) return null;
|
|
3478
|
+
// According to the specification the implementation should be compatible
|
|
3479
|
+
// with future versions. If there are more parts, we only reject it if it's using version 00
|
|
3480
|
+
// See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
|
|
3481
|
+
if (match[1] === '00' && match[5]) return null;
|
|
3482
|
+
return {
|
|
3483
|
+
traceId: match[2],
|
|
3484
|
+
spanId: match[3],
|
|
3485
|
+
traceFlags: parseInt(match[4], 16)
|
|
3486
|
+
};
|
|
3443
3487
|
}
|
|
3444
3488
|
/**
|
|
3445
3489
|
* Propagates {@link SpanContext} through Trace Context format propagation.
|
|
@@ -3447,61 +3491,50 @@ function parseTraceParent(traceParent) {
|
|
|
3447
3491
|
* Based on the Trace Context specification:
|
|
3448
3492
|
* https://www.w3.org/TR/trace-context/
|
|
3449
3493
|
*/
|
|
3450
|
-
var W3CTraceContextPropagator = /** @class */
|
|
3451
|
-
|
|
3494
|
+
var W3CTraceContextPropagator = /** @class */function () {
|
|
3495
|
+
function W3CTraceContextPropagator() {}
|
|
3496
|
+
W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
|
|
3497
|
+
var spanContext = trace.getSpanContext(context);
|
|
3498
|
+
if (!spanContext || isTracingSuppressed(context) || !isSpanContextValid(spanContext)) return;
|
|
3499
|
+
var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
|
|
3500
|
+
setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
|
|
3501
|
+
if (spanContext.traceState) {
|
|
3502
|
+
setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
|
|
3452
3503
|
}
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
return context;
|
|
3477
|
-
spanContext.isRemote = true;
|
|
3478
|
-
var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
|
|
3479
|
-
if (traceStateHeader) {
|
|
3480
|
-
// If more than one `tracestate` header is found, we merge them into a
|
|
3481
|
-
// single header.
|
|
3482
|
-
var state = Array.isArray(traceStateHeader)
|
|
3483
|
-
? traceStateHeader.join(',')
|
|
3484
|
-
: traceStateHeader;
|
|
3485
|
-
spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
|
|
3486
|
-
}
|
|
3487
|
-
return trace.setSpanContext(context, spanContext);
|
|
3488
|
-
};
|
|
3489
|
-
W3CTraceContextPropagator.prototype.fields = function () {
|
|
3490
|
-
return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
|
|
3491
|
-
};
|
|
3492
|
-
return W3CTraceContextPropagator;
|
|
3493
|
-
}());
|
|
3504
|
+
};
|
|
3505
|
+
W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
|
|
3506
|
+
var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
|
|
3507
|
+
if (!traceParentHeader) return context;
|
|
3508
|
+
var traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
|
|
3509
|
+
if (typeof traceParent !== 'string') return context;
|
|
3510
|
+
var spanContext = parseTraceParent(traceParent);
|
|
3511
|
+
if (!spanContext) return context;
|
|
3512
|
+
spanContext.isRemote = true;
|
|
3513
|
+
var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
|
|
3514
|
+
if (traceStateHeader) {
|
|
3515
|
+
// If more than one `tracestate` header is found, we merge them into a
|
|
3516
|
+
// single header.
|
|
3517
|
+
var state = Array.isArray(traceStateHeader) ? traceStateHeader.join(',') : traceStateHeader;
|
|
3518
|
+
spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
|
|
3519
|
+
}
|
|
3520
|
+
return trace.setSpanContext(context, spanContext);
|
|
3521
|
+
};
|
|
3522
|
+
W3CTraceContextPropagator.prototype.fields = function () {
|
|
3523
|
+
return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
|
|
3524
|
+
};
|
|
3525
|
+
return W3CTraceContextPropagator;
|
|
3526
|
+
}();
|
|
3494
3527
|
|
|
3495
|
-
var _a;
|
|
3528
|
+
var _a$1;
|
|
3496
3529
|
var MAX_RUM_EVENTS_PER_REQUEST = 500;
|
|
3497
3530
|
var MAX_RUM_EVENTS = 20000;
|
|
3498
3531
|
var MAX_MS_RECORD_TIME = 60000;
|
|
3499
3532
|
var DEFAULT_RUM_EVENTS = 5000;
|
|
3500
3533
|
var DEFAULT_MS_RECORD_TIME = 10000;
|
|
3501
3534
|
({
|
|
3502
|
-
instrumentationsToSend: (_a = {},
|
|
3503
|
-
_a[CoralogixEventType.WEB_VITALS] = true,
|
|
3504
|
-
_a),
|
|
3535
|
+
instrumentationsToSend: (_a$1 = {},
|
|
3536
|
+
_a$1[CoralogixEventType.WEB_VITALS] = true,
|
|
3537
|
+
_a$1),
|
|
3505
3538
|
});
|
|
3506
3539
|
|
|
3507
3540
|
var Request = /** @class */ (function () {
|
|
@@ -3774,6 +3807,38 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3774
3807
|
return SessionIdle;
|
|
3775
3808
|
}());
|
|
3776
3809
|
|
|
3810
|
+
var _a;
|
|
3811
|
+
var instrumentationsCompatibility = (_a = {},
|
|
3812
|
+
_a[XHR_INSTRUMENTATION_NAME] = {
|
|
3813
|
+
browsers: [
|
|
3814
|
+
{ name: 'Chrome', minVersion: 43 }
|
|
3815
|
+
],
|
|
3816
|
+
warningText: 'XHR',
|
|
3817
|
+
},
|
|
3818
|
+
_a[SESSION_RECORDING_INSTRUMENTATION_NAME] = {
|
|
3819
|
+
browsers: [
|
|
3820
|
+
{ name: 'Chrome', minVersion: 45 },
|
|
3821
|
+
],
|
|
3822
|
+
warningText: 'Session Recording',
|
|
3823
|
+
},
|
|
3824
|
+
_a);
|
|
3825
|
+
function isInstrumentationCompatible(confKey) {
|
|
3826
|
+
var _a = parseUserAgent(navigator.userAgent), browserVersion = _a.browserVersion, browser = _a.browser;
|
|
3827
|
+
var majorVersion = parseInt(browserVersion.split('.')[0]);
|
|
3828
|
+
var compatibility = instrumentationsCompatibility[confKey];
|
|
3829
|
+
if (!compatibility)
|
|
3830
|
+
return true;
|
|
3831
|
+
var matchedBrowser = compatibility.browsers.find(function (compatibleBrowser) { return compatibleBrowser.name === browser; });
|
|
3832
|
+
if (!matchedBrowser) {
|
|
3833
|
+
return true;
|
|
3834
|
+
}
|
|
3835
|
+
if (!isNaN(majorVersion) && majorVersion < matchedBrowser.minVersion) {
|
|
3836
|
+
console.debug("Coralogix Browser SDK - ".concat(compatibility.warningText, " is not supported on this browser"));
|
|
3837
|
+
return false;
|
|
3838
|
+
}
|
|
3839
|
+
return true;
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3777
3842
|
var SessionManager = /** @class */ (function (_super) {
|
|
3778
3843
|
__extends(SessionManager, _super);
|
|
3779
3844
|
function SessionManager(recordConfig) {
|
|
@@ -3926,7 +3991,7 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3926
3991
|
};
|
|
3927
3992
|
SessionManager.prototype.initializeSession = function (recordConfig) {
|
|
3928
3993
|
return __awaiter(this, void 0, void 0, function () {
|
|
3929
|
-
var recordingSamplingEnabled, SessionRecorder_1;
|
|
3994
|
+
var recordingSamplingEnabled, isSessionRecordingCompatible, SessionRecorder_1;
|
|
3930
3995
|
return __generator(this, function (_a) {
|
|
3931
3996
|
switch (_a.label) {
|
|
3932
3997
|
case 0:
|
|
@@ -3934,7 +3999,8 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3934
3999
|
this.sessionRecorderConfig = recordConfig;
|
|
3935
4000
|
if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
|
|
3936
4001
|
recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
|
|
3937
|
-
|
|
4002
|
+
isSessionRecordingCompatible = isInstrumentationCompatible(SESSION_RECORDING_INSTRUMENTATION_NAME);
|
|
4003
|
+
if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3 /*break*/, 2];
|
|
3938
4004
|
return [4 /*yield*/, import('./sessionRecorder.esm.js')];
|
|
3939
4005
|
case 1:
|
|
3940
4006
|
SessionRecorder_1 = (_a.sent()).SessionRecorder;
|
|
@@ -4146,7 +4212,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4146
4212
|
return resolvedUrlBlueprinters;
|
|
4147
4213
|
}
|
|
4148
4214
|
|
|
4149
|
-
var SDK_VERSION = '2.
|
|
4215
|
+
var SDK_VERSION = '2.7.0';
|
|
4150
4216
|
|
|
4151
4217
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4152
4218
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4633,7 +4699,7 @@ function getTiming(duration) {
|
|
|
4633
4699
|
return getNowTime() - getSessionManager().currentPageTimestamp;
|
|
4634
4700
|
}
|
|
4635
4701
|
|
|
4636
|
-
if (supportedPerformanceTypes.has(PerformanceTypes.LongTask)) {
|
|
4702
|
+
if (supportedPerformanceTypes === null || supportedPerformanceTypes === void 0 ? void 0 : supportedPerformanceTypes.has(PerformanceTypes.LongTask)) {
|
|
4637
4703
|
var ttiHandler_1 = (CxGlobal.__tti = {
|
|
4638
4704
|
e: [],
|
|
4639
4705
|
});
|
|
@@ -4662,139 +4728,158 @@ var CoralogixRum = {
|
|
|
4662
4728
|
},
|
|
4663
4729
|
init: function (options) {
|
|
4664
4730
|
var _a, _b;
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
var
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
var
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
break;
|
|
4715
|
-
}
|
|
4716
|
-
case INTERNAL_INSTRUMENTATION_NAME: {
|
|
4717
|
-
instrumentation = new Instrument(pluginConf);
|
|
4718
|
-
saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
|
|
4719
|
-
break;
|
|
4720
|
-
}
|
|
4721
|
-
case SCREENSHOT_INSTRUMENTATION_NAME: {
|
|
4722
|
-
if ((_c = resolvedOptions.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
4731
|
+
var _this = this;
|
|
4732
|
+
try {
|
|
4733
|
+
// Check if CoralogixRum already inited.
|
|
4734
|
+
if (isInited) {
|
|
4735
|
+
console.warn('CoralogixRum already inited.');
|
|
4736
|
+
return;
|
|
4737
|
+
}
|
|
4738
|
+
// Abort if not in browser environment.
|
|
4739
|
+
if (!CxGlobal.sessionStorage) {
|
|
4740
|
+
console.warn('CoralogixRum: Non-browser environment detected, aborting');
|
|
4741
|
+
return;
|
|
4742
|
+
}
|
|
4743
|
+
// Abort if running in a not supported browser.
|
|
4744
|
+
if (typeof Symbol !== 'function') {
|
|
4745
|
+
console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
|
|
4746
|
+
return;
|
|
4747
|
+
}
|
|
4748
|
+
var resolvedOptions_1 = validateAndResolveInitConfig(options);
|
|
4749
|
+
if (!resolvedOptions_1) {
|
|
4750
|
+
return;
|
|
4751
|
+
}
|
|
4752
|
+
CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
|
|
4753
|
+
var sampler = getResolvedSampler(resolvedOptions_1);
|
|
4754
|
+
// Check if not in debug mode & no auth token.
|
|
4755
|
+
if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
|
|
4756
|
+
console.warn('rumAuth will be required in the future');
|
|
4757
|
+
}
|
|
4758
|
+
timeMeasurementTracker = new TimeMeasurementTracker();
|
|
4759
|
+
new SessionManager(resolvedOptions_1.sessionRecordingConfig).start();
|
|
4760
|
+
var ignoreUrls_1 = resolvedOptions_1.ignoreUrls, labels = resolvedOptions_1.labels, user_context = resolvedOptions_1.user_context, application = resolvedOptions_1.application, version = resolvedOptions_1.version, traceParentInHeader_1 = resolvedOptions_1.traceParentInHeader, environment = resolvedOptions_1.environment;
|
|
4761
|
+
tracerProvider = new CoralogixWebTracerProvider({
|
|
4762
|
+
sampler: sampler,
|
|
4763
|
+
});
|
|
4764
|
+
var pluginDefaults_1 = {};
|
|
4765
|
+
// Resolve instrumentations.
|
|
4766
|
+
var instrumentations = INSTRUMENTATIONS.map(function (_a) {
|
|
4767
|
+
var _b, _c;
|
|
4768
|
+
var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
|
|
4769
|
+
var pluginConf = getInstrumentationConfig((_b = resolvedOptions_1 === null || resolvedOptions_1 === void 0 ? void 0 : resolvedOptions_1.instrumentations) === null || _b === void 0 ? void 0 : _b[confKey], pluginDefaults_1, disable);
|
|
4770
|
+
if (pluginConf) {
|
|
4771
|
+
var instrumentation = void 0;
|
|
4772
|
+
switch (confKey) {
|
|
4773
|
+
case WORKER_INSTRUMENTATION: {
|
|
4774
|
+
if (resolvedOptions_1.workerSupport) {
|
|
4775
|
+
instrumentation = new Instrument(pluginConf, errorsInstrumentation, _this);
|
|
4776
|
+
}
|
|
4777
|
+
break;
|
|
4778
|
+
}
|
|
4779
|
+
case ERROR_INSTRUMENTATION_NAME: {
|
|
4723
4780
|
instrumentation = new Instrument(pluginConf);
|
|
4724
|
-
|
|
4781
|
+
errorsInstrumentation =
|
|
4725
4782
|
instrumentation;
|
|
4783
|
+
break;
|
|
4726
4784
|
}
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4785
|
+
case FETCH_INSTRUMENTATION_NAME:
|
|
4786
|
+
case XHR_INSTRUMENTATION_NAME: {
|
|
4787
|
+
if (confKey === XHR_INSTRUMENTATION_NAME) {
|
|
4788
|
+
var isXhrCompatible = isInstrumentationCompatible(XHR_INSTRUMENTATION_NAME);
|
|
4789
|
+
if (!isXhrCompatible) {
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4793
|
+
instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls_1, traceParentInHeader: traceParentInHeader_1 }));
|
|
4794
|
+
break;
|
|
4795
|
+
}
|
|
4796
|
+
case INTERNAL_INSTRUMENTATION_NAME: {
|
|
4732
4797
|
instrumentation = new Instrument(pluginConf);
|
|
4733
|
-
|
|
4734
|
-
|
|
4798
|
+
saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
|
|
4799
|
+
break;
|
|
4800
|
+
}
|
|
4801
|
+
case SCREENSHOT_INSTRUMENTATION_NAME: {
|
|
4802
|
+
if ((_c = resolvedOptions_1.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
4803
|
+
instrumentation = new Instrument(pluginConf);
|
|
4804
|
+
screenshotInstrumentation =
|
|
4805
|
+
instrumentation;
|
|
4806
|
+
}
|
|
4807
|
+
break;
|
|
4735
4808
|
}
|
|
4736
|
-
|
|
4809
|
+
case MEMORY_USAGE_INSTRUMENTATION_NAME: {
|
|
4810
|
+
if (resolvedOptions_1.memoryUsageConfig.enabled &&
|
|
4811
|
+
isMeasureUserAgentSpecificMemoryAllowed()) {
|
|
4812
|
+
instrumentation = new Instrument(pluginConf);
|
|
4813
|
+
memoryUsageInstrumentation =
|
|
4814
|
+
instrumentation;
|
|
4815
|
+
}
|
|
4816
|
+
break;
|
|
4817
|
+
}
|
|
4818
|
+
default:
|
|
4819
|
+
instrumentation = new Instrument(pluginConf);
|
|
4737
4820
|
}
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4821
|
+
if (instrumentation instanceof CoralogixCustomLogInstrumentation) {
|
|
4822
|
+
_customInstrumentation = instrumentation;
|
|
4823
|
+
}
|
|
4824
|
+
if (instrumentation instanceof
|
|
4825
|
+
CoralogixCustomMeasurementInstrumentation) {
|
|
4826
|
+
customMeasurementInstrumentation = instrumentation;
|
|
4827
|
+
}
|
|
4828
|
+
return instrumentation;
|
|
4746
4829
|
}
|
|
4747
|
-
return
|
|
4830
|
+
return null;
|
|
4831
|
+
}).filter(function (instrument) {
|
|
4832
|
+
return Boolean(instrument);
|
|
4833
|
+
});
|
|
4834
|
+
var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
|
|
4835
|
+
// Init Span Attributes Processor.
|
|
4836
|
+
attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
|
|
4837
|
+
application: application,
|
|
4838
|
+
version: version,
|
|
4839
|
+
}), _a[CoralogixAttributes.USER_CONTEXT] = JSON.stringify(mergedUserContext), _a), (environment
|
|
4840
|
+
? (_b = {}, _b[CoralogixAttributes.ENVIRONMENT] = environment, _b) : {})));
|
|
4841
|
+
if (labels) {
|
|
4842
|
+
attributesProcessor.setCustomLabels(labels);
|
|
4748
4843
|
}
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
var urlType = _a.urlType;
|
|
4789
|
-
return urlType === UrlType.PAGE || !urlType;
|
|
4790
|
-
}), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
|
|
4791
|
-
saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
|
|
4792
|
-
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
4793
|
-
isInited = true;
|
|
4794
|
-
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4795
|
-
console.info('CoralogixRum.init() complete');
|
|
4796
|
-
}
|
|
4797
|
-
reportInternalEvent('init');
|
|
4844
|
+
setAttrProcessor(attributesProcessor);
|
|
4845
|
+
// The order of processors is important.
|
|
4846
|
+
tracerProvider.addSpanProcessor(attributesProcessor);
|
|
4847
|
+
// Add Navigation Processor
|
|
4848
|
+
navigationProcessor = new CoralogixNavigationProcessor();
|
|
4849
|
+
tracerProvider.addSpanProcessor(navigationProcessor);
|
|
4850
|
+
// Add Span Mapping Processor
|
|
4851
|
+
spanMapProcessor = new CoralogixSpanMapProcessor();
|
|
4852
|
+
tracerProvider.addSpanProcessor(spanMapProcessor);
|
|
4853
|
+
// Add snapshot processor
|
|
4854
|
+
new SnapshotManager();
|
|
4855
|
+
snapshotProcessor = new CoralogixSnapshotSpanProcessor();
|
|
4856
|
+
tracerProvider.addSpanProcessor(snapshotProcessor);
|
|
4857
|
+
// Add Batch Span Processor and Exporter
|
|
4858
|
+
tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
|
|
4859
|
+
maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
|
|
4860
|
+
scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
|
|
4861
|
+
}));
|
|
4862
|
+
handlePropagators(options, tracerProvider);
|
|
4863
|
+
// Register Instrumentations
|
|
4864
|
+
_deregisterInstrumentations = registerInstrumentations({
|
|
4865
|
+
tracerProvider: tracerProvider,
|
|
4866
|
+
instrumentations: instrumentations,
|
|
4867
|
+
});
|
|
4868
|
+
var _c = __read$1(partition(resolvedOptions_1.labelProviders || [], function (_a) {
|
|
4869
|
+
var urlType = _a.urlType;
|
|
4870
|
+
return urlType === UrlType.PAGE || !urlType;
|
|
4871
|
+
}), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
|
|
4872
|
+
saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
|
|
4873
|
+
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
4874
|
+
isInited = true;
|
|
4875
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4876
|
+
console.info('Coralogix Browser SDK - initialization has completed');
|
|
4877
|
+
}
|
|
4878
|
+
reportInternalEvent('init');
|
|
4879
|
+
}
|
|
4880
|
+
catch (err) {
|
|
4881
|
+
console.warn('Coralogix Browser SDK - initialization failed: ', err);
|
|
4882
|
+
}
|
|
4798
4883
|
},
|
|
4799
4884
|
getCustomTracer: function (ignoredList) {
|
|
4800
4885
|
var _a, _b;
|