@coralogix/browser 2.5.0 → 2.6.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 +6 -0
- package/index.esm2.js +604 -604
- package/package.json +1 -1
- package/sessionRecorder.esm.js +666 -582
- package/src/constants.d.ts +1 -1
- package/src/instrumentations/instrumentation.consts.d.ts +4 -0
- package/src/types.d.ts +8 -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;
|
|
@@ -512,15 +495,15 @@ function extractMetadataFromMfeStacktrace() {
|
|
|
512
495
|
});
|
|
513
496
|
});
|
|
514
497
|
}
|
|
515
|
-
var _consoleErrorHandler = function (
|
|
498
|
+
var _consoleErrorHandler = function (errorInstrumentation) {
|
|
516
499
|
return function (original) {
|
|
517
500
|
return function () {
|
|
518
501
|
var args = [];
|
|
519
502
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
520
503
|
args[_i] = arguments[_i];
|
|
521
504
|
}
|
|
522
|
-
|
|
523
|
-
return original.apply(
|
|
505
|
+
errorInstrumentation.report(ErrorSource.CONSOLE, args);
|
|
506
|
+
return original.apply(console, args);
|
|
524
507
|
};
|
|
525
508
|
};
|
|
526
509
|
};
|
|
@@ -1268,6 +1251,10 @@ var DOM_INSTRUMENTATION_NAME = 'dom';
|
|
|
1268
1251
|
var DOM_INSTRUMENTATION_VERSION = '1.0.0';
|
|
1269
1252
|
var CUSTOM_MEASUREMENT_INSTRUMENTATION_NAME = 'custom_measurement';
|
|
1270
1253
|
var CUSTOM_MEASUREMENT_INSTRUMENTATION_VERSION = '1.0.0';
|
|
1254
|
+
var XHR_INSTRUMENTATION_NAME = 'xhr';
|
|
1255
|
+
var FETCH_INSTRUMENTATION_NAME = 'fetch';
|
|
1256
|
+
var CUSTOM_INSTRUMENTATION_NAME = 'custom';
|
|
1257
|
+
var SESSION_RECORDING_INSTRUMENTATION_NAME = 'session_recording';
|
|
1271
1258
|
var ALL_WEB_VITALS_METRICS = {
|
|
1272
1259
|
lcp: true,
|
|
1273
1260
|
fid: true,
|
|
@@ -1329,14 +1316,11 @@ var IMG_EXTENSIONS = [
|
|
|
1329
1316
|
*/
|
|
1330
1317
|
|
|
1331
1318
|
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
|
-
};
|
|
1319
|
+
k = 'function' == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) {
|
|
1320
|
+
a != Array.prototype && a != Object.prototype && (a[b] = c.value);
|
|
1321
|
+
};
|
|
1338
1322
|
function l() {
|
|
1339
|
-
l = function () {};
|
|
1323
|
+
l = function l() {};
|
|
1340
1324
|
h.Symbol || (h.Symbol = m);
|
|
1341
1325
|
}
|
|
1342
1326
|
var n = 0;
|
|
@@ -1347,25 +1331,31 @@ function p() {
|
|
|
1347
1331
|
l();
|
|
1348
1332
|
var a = h.Symbol.iterator;
|
|
1349
1333
|
a || (a = h.Symbol.iterator = h.Symbol('iterator'));
|
|
1350
|
-
'function' != typeof Array.prototype[a] &&
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
p = function () {};
|
|
1334
|
+
'function' != typeof Array.prototype[a] && k(Array.prototype, a, {
|
|
1335
|
+
configurable: true,
|
|
1336
|
+
writable: true,
|
|
1337
|
+
value: function value() {
|
|
1338
|
+
return q(this);
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1341
|
+
p = function p() {};
|
|
1359
1342
|
}
|
|
1360
1343
|
function q(a) {
|
|
1361
1344
|
var b = 0;
|
|
1362
1345
|
return r(function () {
|
|
1363
|
-
return b < a.length ? {
|
|
1346
|
+
return b < a.length ? {
|
|
1347
|
+
done: false,
|
|
1348
|
+
value: a[b++]
|
|
1349
|
+
} : {
|
|
1350
|
+
done: true
|
|
1351
|
+
};
|
|
1364
1352
|
});
|
|
1365
1353
|
}
|
|
1366
1354
|
function r(a) {
|
|
1367
1355
|
p();
|
|
1368
|
-
a = {
|
|
1356
|
+
a = {
|
|
1357
|
+
next: a
|
|
1358
|
+
};
|
|
1369
1359
|
a[h.Symbol.iterator] = function () {
|
|
1370
1360
|
return this;
|
|
1371
1361
|
};
|
|
@@ -1379,7 +1369,7 @@ function t(a) {
|
|
|
1379
1369
|
function u(a) {
|
|
1380
1370
|
if (!(a instanceof Array)) {
|
|
1381
1371
|
a = t(a);
|
|
1382
|
-
for (var b, c = []; !(b = a.next()).done;
|
|
1372
|
+
for (var b, c = []; !(b = a.next()).done;) c.push(b.value);
|
|
1383
1373
|
a = c;
|
|
1384
1374
|
}
|
|
1385
1375
|
return a;
|
|
@@ -1400,50 +1390,37 @@ function w(a, b) {
|
|
|
1400
1390
|
}
|
|
1401
1391
|
function x(a, b) {
|
|
1402
1392
|
var c = fetch;
|
|
1403
|
-
fetch = function (d) {
|
|
1393
|
+
fetch = function fetch(d) {
|
|
1404
1394
|
for (var f = [], e = 0; e < arguments.length; ++e) f[e - 0] = arguments[e];
|
|
1405
1395
|
return new Promise(function (d, e) {
|
|
1406
1396
|
var g = v++;
|
|
1407
1397
|
a(g);
|
|
1408
|
-
c.apply(null, [].concat(u(f))).then(
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
e(a);
|
|
1416
|
-
}
|
|
1417
|
-
);
|
|
1398
|
+
c.apply(null, [].concat(u(f))).then(function (a) {
|
|
1399
|
+
b(g);
|
|
1400
|
+
d(a);
|
|
1401
|
+
}, function (a) {
|
|
1402
|
+
b(a);
|
|
1403
|
+
e(a);
|
|
1404
|
+
});
|
|
1418
1405
|
});
|
|
1419
1406
|
};
|
|
1420
1407
|
}
|
|
1421
1408
|
var y = 'img script iframe link audio video source'.split(' ');
|
|
1422
1409
|
function z(a, b) {
|
|
1423
1410
|
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;
|
|
1411
|
+
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
1412
|
return false;
|
|
1430
1413
|
}
|
|
1431
1414
|
function A(a) {
|
|
1432
1415
|
var b = new MutationObserver(function (c) {
|
|
1433
1416
|
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);
|
|
1417
|
+
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
1418
|
});
|
|
1442
1419
|
b.observe(document, {
|
|
1443
1420
|
attributes: true,
|
|
1444
1421
|
childList: true,
|
|
1445
1422
|
subtree: true,
|
|
1446
|
-
attributeFilter: ['href', 'src']
|
|
1423
|
+
attributeFilter: ['href', 'src']
|
|
1447
1424
|
});
|
|
1448
1425
|
return b;
|
|
1449
1426
|
}
|
|
@@ -1451,29 +1428,33 @@ function B(a, b) {
|
|
|
1451
1428
|
if (2 < a.length) return performance.now();
|
|
1452
1429
|
var c = [];
|
|
1453
1430
|
b = t(b);
|
|
1454
|
-
for (var d = b.next(); !d.done; d = b.next())
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1431
|
+
for (var d = b.next(); !d.done; d = b.next()) d = d.value, c.push({
|
|
1432
|
+
timestamp: d.start,
|
|
1433
|
+
type: 'requestStart'
|
|
1434
|
+
}), c.push({
|
|
1435
|
+
timestamp: d.end,
|
|
1436
|
+
type: 'requestEnd'
|
|
1437
|
+
});
|
|
1458
1438
|
b = t(a);
|
|
1459
|
-
for (d = b.next(); !d.done; d = b.next())
|
|
1460
|
-
|
|
1439
|
+
for (d = b.next(); !d.done; d = b.next()) c.push({
|
|
1440
|
+
timestamp: d.value,
|
|
1441
|
+
type: 'requestStart'
|
|
1442
|
+
});
|
|
1461
1443
|
c.sort(function (a, b) {
|
|
1462
1444
|
return a.timestamp - b.timestamp;
|
|
1463
1445
|
});
|
|
1464
1446
|
a = a.length;
|
|
1465
|
-
for (b = c.length - 1; 0 <= b; b--)
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
}
|
|
1447
|
+
for (b = c.length - 1; 0 <= b; b--) switch (d = c[b], d.type) {
|
|
1448
|
+
case 'requestStart':
|
|
1449
|
+
a--;
|
|
1450
|
+
break;
|
|
1451
|
+
case 'requestEnd':
|
|
1452
|
+
a++;
|
|
1453
|
+
if (2 < a) return d.timestamp;
|
|
1454
|
+
break;
|
|
1455
|
+
default:
|
|
1456
|
+
throw Error('Internal Error: This should never happen');
|
|
1457
|
+
}
|
|
1477
1458
|
return 0;
|
|
1478
1459
|
}
|
|
1479
1460
|
function C(a) {
|
|
@@ -1482,11 +1463,12 @@ function C(a) {
|
|
|
1482
1463
|
this.u = a.minValue || null;
|
|
1483
1464
|
a = CxGlobal.__tti && CxGlobal.__tti.e;
|
|
1484
1465
|
var b = CxGlobal.__tti && CxGlobal.__tti.o;
|
|
1485
|
-
this.a = a
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1466
|
+
this.a = a ? a.map(function (a) {
|
|
1467
|
+
return {
|
|
1468
|
+
start: a.startTime,
|
|
1469
|
+
end: a.startTime + a.duration
|
|
1470
|
+
};
|
|
1471
|
+
}) : [];
|
|
1490
1472
|
b && b.disconnect();
|
|
1491
1473
|
this.b = [];
|
|
1492
1474
|
this.f = new Map();
|
|
@@ -1503,11 +1485,9 @@ C.prototype.getFirstConsistentlyInteractive = function () {
|
|
|
1503
1485
|
var a = this;
|
|
1504
1486
|
return new Promise(function (b) {
|
|
1505
1487
|
a.s = b;
|
|
1506
|
-
'complete' == document.readyState
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
F(a);
|
|
1510
|
-
});
|
|
1488
|
+
'complete' == document.readyState ? F(a) : CxGlobal.addEventListener('load', function () {
|
|
1489
|
+
F(a);
|
|
1490
|
+
});
|
|
1511
1491
|
});
|
|
1512
1492
|
};
|
|
1513
1493
|
function F(a) {
|
|
@@ -1517,55 +1497,37 @@ function F(a) {
|
|
|
1517
1497
|
G(a, Math.max(c + 5e3, b));
|
|
1518
1498
|
}
|
|
1519
1499
|
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));
|
|
1500
|
+
!a.i || a.v > b || (clearTimeout(a.j), a.j = setTimeout(function () {
|
|
1501
|
+
var b = performance.timing.navigationStart,
|
|
1502
|
+
d = B(a.g, a.b),
|
|
1503
|
+
b = (CxGlobal.a && CxGlobal.a.A ? 1e3 * CxGlobal.a.A().C - b : 0) || performance.timing.domContentLoadedEventEnd - b;
|
|
1504
|
+
if (a.u) var f = a.u;else performance.timing.domContentLoadedEventEnd ? (f = performance.timing, f = f.domContentLoadedEventEnd - f.navigationStart) : f = null;
|
|
1505
|
+
var e = performance.now();
|
|
1506
|
+
null === f && G(a, Math.max(d + 5e3, e + 1e3));
|
|
1507
|
+
var g = a.a;
|
|
1508
|
+
5e3 > e - d ? d = null : (d = g.length ? g[g.length - 1].end : b, d = 5e3 > e - d ? null : Math.max(d, f));
|
|
1509
|
+
d && (a.s(d), clearTimeout(a.j), a.i = false, a.c && a.c.disconnect(), a.h && a.h.disconnect());
|
|
1510
|
+
G(a, performance.now() + 1e3);
|
|
1511
|
+
}, b - performance.now()), a.v = b);
|
|
1551
1512
|
}
|
|
1552
1513
|
function D(a) {
|
|
1553
1514
|
a.c = new PerformanceObserver(function (b) {
|
|
1554
1515
|
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
|
-
|
|
1516
|
+
for (var c = b.next(); !c.done; c = b.next()) if (c = c.value, 'resource' === c.entryType && (a.b.push({
|
|
1517
|
+
start: c.fetchStart,
|
|
1518
|
+
end: c.responseEnd
|
|
1519
|
+
}), G(a, B(a.g, a.b) + 5e3)), 'longtask' === c.entryType) {
|
|
1520
|
+
var d = c.startTime + c.duration;
|
|
1521
|
+
a.a.push({
|
|
1522
|
+
start: c.startTime,
|
|
1523
|
+
end: d
|
|
1524
|
+
});
|
|
1525
|
+
G(a, d + 5e3);
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
a.c.observe({
|
|
1529
|
+
entryTypes: ['longtask', 'resource']
|
|
1567
1530
|
});
|
|
1568
|
-
a.c.observe({ entryTypes: ['longtask', 'resource'] });
|
|
1569
1531
|
}
|
|
1570
1532
|
C.prototype.m = function (a) {
|
|
1571
1533
|
this.f.set(a, performance.now());
|
|
@@ -1580,18 +1542,17 @@ h.Object.defineProperties(C.prototype, {
|
|
|
1580
1542
|
g: {
|
|
1581
1543
|
configurable: true,
|
|
1582
1544
|
enumerable: true,
|
|
1583
|
-
get: function () {
|
|
1545
|
+
get: function get() {
|
|
1584
1546
|
return [].concat(u(this.f.values()));
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1587
1549
|
});
|
|
1588
1550
|
var H = {
|
|
1589
|
-
getFirstConsistentlyInteractive: function (
|
|
1551
|
+
getFirstConsistentlyInteractive: function getFirstConsistentlyInteractive() {
|
|
1552
|
+
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
1590
1553
|
a = a ? a : {};
|
|
1591
|
-
return 'PerformanceLongTaskTiming' in CxGlobal
|
|
1592
|
-
|
|
1593
|
-
: Promise.resolve(null);
|
|
1594
|
-
},
|
|
1554
|
+
return 'PerformanceLongTaskTiming' in CxGlobal ? new C(a).getFirstConsistentlyInteractive() : Promise.resolve(null);
|
|
1555
|
+
}
|
|
1595
1556
|
};
|
|
1596
1557
|
|
|
1597
1558
|
function observeIfSupported(observer, entryType) {
|
|
@@ -2097,12 +2058,12 @@ function getTextualContent(element) {
|
|
|
2097
2058
|
return 'innerText' in element ? element.innerText : '';
|
|
2098
2059
|
}
|
|
2099
2060
|
|
|
2100
|
-
var _a$
|
|
2061
|
+
var _a$3;
|
|
2101
2062
|
var USER_INTERACTION_INSTRUMENTATION_NAME = 'user-interaction';
|
|
2102
2063
|
var USER_INTERACTION_INSTRUMENTATION_VERSION = '1';
|
|
2103
|
-
var DEFAULT_INSTRUMENTED_EVENTS = (_a$
|
|
2104
|
-
_a$
|
|
2105
|
-
_a$
|
|
2064
|
+
var DEFAULT_INSTRUMENTED_EVENTS = (_a$3 = {},
|
|
2065
|
+
_a$3["click" /* DOM_EVENT.CLICK */] = true,
|
|
2066
|
+
_a$3);
|
|
2106
2067
|
var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
2107
2068
|
__extends(CoralogixUserInteractionInstrumentation, _super);
|
|
2108
2069
|
function CoralogixUserInteractionInstrumentation(config) {
|
|
@@ -2529,22 +2490,22 @@ var INSTRUMENTATIONS = [
|
|
|
2529
2490
|
},
|
|
2530
2491
|
{
|
|
2531
2492
|
Instrument: CoralogixFetchInstrumentation,
|
|
2532
|
-
confKey:
|
|
2493
|
+
confKey: FETCH_INSTRUMENTATION_NAME,
|
|
2533
2494
|
disable: false,
|
|
2534
2495
|
},
|
|
2535
2496
|
{
|
|
2536
2497
|
Instrument: CoralogixXhrInstrumentation,
|
|
2537
|
-
confKey:
|
|
2498
|
+
confKey: XHR_INSTRUMENTATION_NAME,
|
|
2538
2499
|
disable: false,
|
|
2539
2500
|
},
|
|
2540
2501
|
{
|
|
2541
2502
|
Instrument: CoralogixCustomLogInstrumentation,
|
|
2542
|
-
confKey:
|
|
2503
|
+
confKey: CUSTOM_INSTRUMENTATION_NAME,
|
|
2543
2504
|
disable: false,
|
|
2544
2505
|
},
|
|
2545
2506
|
{
|
|
2546
2507
|
Instrument: CoralogixUserInteractionInstrumentation,
|
|
2547
|
-
confKey:
|
|
2508
|
+
confKey: USER_INTERACTION_INSTRUMENTATION_NAME,
|
|
2548
2509
|
disable: false,
|
|
2549
2510
|
},
|
|
2550
2511
|
{
|
|
@@ -2645,8 +2606,8 @@ function getInternalRumData(key) {
|
|
|
2645
2606
|
return (_a = CxGlobal[RUM_INTERNAL_DATA_KEY]) === null || _a === void 0 ? void 0 : _a[key];
|
|
2646
2607
|
}
|
|
2647
2608
|
|
|
2648
|
-
var _a$
|
|
2649
|
-
var supportedPerformanceTypes = !((_a$
|
|
2609
|
+
var _a$2;
|
|
2610
|
+
var supportedPerformanceTypes = !((_a$2 = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.PerformanceObserver) === null || _a$2 === void 0 ? void 0 : _a$2.supportedEntryTypes)
|
|
2650
2611
|
? new Set()
|
|
2651
2612
|
: new Set(CxGlobal.PerformanceObserver.supportedEntryTypes);
|
|
2652
2613
|
function valueEndWithOrInclude(value, extensions) {
|
|
@@ -2981,7 +2942,7 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
|
2981
2942
|
*/
|
|
2982
2943
|
var SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
|
|
2983
2944
|
function isTracingSuppressed(context) {
|
|
2984
|
-
|
|
2945
|
+
return context.getValue(SUPPRESS_TRACING_KEY) === true;
|
|
2985
2946
|
}
|
|
2986
2947
|
|
|
2987
2948
|
/*
|
|
@@ -3011,57 +2972,66 @@ var BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
|
|
|
3011
2972
|
// Maximum total length of all name-value pairs allowed by w3c spec
|
|
3012
2973
|
var BAGGAGE_MAX_TOTAL_LENGTH = 8192;
|
|
3013
2974
|
|
|
3014
|
-
var __read =
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
2975
|
+
var __read = undefined && undefined.__read || function (o, n) {
|
|
2976
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
2977
|
+
if (!m) return o;
|
|
2978
|
+
var i = m.call(o),
|
|
2979
|
+
r,
|
|
2980
|
+
ar = [],
|
|
2981
|
+
e;
|
|
2982
|
+
try {
|
|
2983
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
2984
|
+
} catch (error) {
|
|
2985
|
+
e = {
|
|
2986
|
+
error: error
|
|
2987
|
+
};
|
|
2988
|
+
} finally {
|
|
3018
2989
|
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; }
|
|
2990
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
2991
|
+
} finally {
|
|
2992
|
+
if (e) throw e.error;
|
|
3027
2993
|
}
|
|
3028
|
-
|
|
2994
|
+
}
|
|
2995
|
+
return ar;
|
|
3029
2996
|
};
|
|
3030
2997
|
function serializeKeyPairs(keyPairs) {
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
2998
|
+
return keyPairs.reduce(function (hValue, current) {
|
|
2999
|
+
var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
|
|
3000
|
+
return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
|
|
3001
|
+
}, '');
|
|
3035
3002
|
}
|
|
3036
3003
|
function getKeyPairs(baggage) {
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
}
|
|
3004
|
+
return baggage.getAllEntries().map(function (_a) {
|
|
3005
|
+
var _b = __read(_a, 2),
|
|
3006
|
+
key = _b[0],
|
|
3007
|
+
value = _b[1];
|
|
3008
|
+
var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
|
|
3009
|
+
// include opaque metadata if provided
|
|
3010
|
+
// NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
|
|
3011
|
+
if (value.metadata !== undefined) {
|
|
3012
|
+
entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
|
|
3013
|
+
}
|
|
3014
|
+
return entry;
|
|
3015
|
+
});
|
|
3047
3016
|
}
|
|
3048
3017
|
function parsePairKeyValue(entry) {
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3018
|
+
var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
|
|
3019
|
+
if (valueProps.length <= 0) return;
|
|
3020
|
+
var keyPairPart = valueProps.shift();
|
|
3021
|
+
if (!keyPairPart) return;
|
|
3022
|
+
var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
|
|
3023
|
+
if (separatorIndex <= 0) return;
|
|
3024
|
+
var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
|
|
3025
|
+
var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
|
|
3026
|
+
var metadata;
|
|
3027
|
+
if (valueProps.length > 0) {
|
|
3028
|
+
metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
|
|
3029
|
+
}
|
|
3030
|
+
return {
|
|
3031
|
+
key: key,
|
|
3032
|
+
value: value,
|
|
3033
|
+
metadata: metadata
|
|
3034
|
+
};
|
|
3065
3035
|
}
|
|
3066
3036
|
|
|
3067
3037
|
/*
|
|
@@ -3085,55 +3055,50 @@ function parsePairKeyValue(entry) {
|
|
|
3085
3055
|
* Based on the Baggage specification:
|
|
3086
3056
|
* https://w3c.github.io/baggage/
|
|
3087
3057
|
*/
|
|
3088
|
-
var W3CBaggagePropagator = /** @class */
|
|
3089
|
-
|
|
3058
|
+
var W3CBaggagePropagator = /** @class */function () {
|
|
3059
|
+
function W3CBaggagePropagator() {}
|
|
3060
|
+
W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
|
|
3061
|
+
var baggage = propagation.getBaggage(context);
|
|
3062
|
+
if (!baggage || isTracingSuppressed(context)) return;
|
|
3063
|
+
var keyPairs = getKeyPairs(baggage).filter(function (pair) {
|
|
3064
|
+
return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
|
|
3065
|
+
}).slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
|
|
3066
|
+
var headerValue = serializeKeyPairs(keyPairs);
|
|
3067
|
+
if (headerValue.length > 0) {
|
|
3068
|
+
setter.set(carrier, BAGGAGE_HEADER, headerValue);
|
|
3090
3069
|
}
|
|
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;
|
|
3070
|
+
};
|
|
3071
|
+
W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
|
|
3072
|
+
var headerValue = getter.get(carrier, BAGGAGE_HEADER);
|
|
3073
|
+
var baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
|
|
3074
|
+
if (!baggageString) return context;
|
|
3075
|
+
var baggage = {};
|
|
3076
|
+
if (baggageString.length === 0) {
|
|
3077
|
+
return context;
|
|
3078
|
+
}
|
|
3079
|
+
var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
|
|
3080
|
+
pairs.forEach(function (entry) {
|
|
3081
|
+
var keyPair = parsePairKeyValue(entry);
|
|
3082
|
+
if (keyPair) {
|
|
3083
|
+
var baggageEntry = {
|
|
3084
|
+
value: keyPair.value
|
|
3085
|
+
};
|
|
3086
|
+
if (keyPair.metadata) {
|
|
3087
|
+
baggageEntry.metadata = keyPair.metadata;
|
|
3129
3088
|
}
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3089
|
+
baggage[keyPair.key] = baggageEntry;
|
|
3090
|
+
}
|
|
3091
|
+
});
|
|
3092
|
+
if (Object.entries(baggage).length === 0) {
|
|
3093
|
+
return context;
|
|
3094
|
+
}
|
|
3095
|
+
return propagation.setBaggage(context, propagation.createBaggage(baggage));
|
|
3096
|
+
};
|
|
3097
|
+
W3CBaggagePropagator.prototype.fields = function () {
|
|
3098
|
+
return [BAGGAGE_HEADER];
|
|
3099
|
+
};
|
|
3100
|
+
return W3CBaggagePropagator;
|
|
3101
|
+
}();
|
|
3137
3102
|
|
|
3138
3103
|
/*
|
|
3139
3104
|
* Copyright The OpenTelemetry Authors
|
|
@@ -3152,8 +3117,8 @@ var W3CBaggagePropagator = /** @class */ (function () {
|
|
|
3152
3117
|
*/
|
|
3153
3118
|
var ExportResultCode;
|
|
3154
3119
|
(function (ExportResultCode) {
|
|
3155
|
-
|
|
3156
|
-
|
|
3120
|
+
ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
|
|
3121
|
+
ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
|
|
3157
3122
|
})(ExportResultCode || (ExportResultCode = {}));
|
|
3158
3123
|
|
|
3159
3124
|
/*
|
|
@@ -3171,89 +3136,100 @@ var ExportResultCode;
|
|
|
3171
3136
|
* See the License for the specific language governing permissions and
|
|
3172
3137
|
* limitations under the License.
|
|
3173
3138
|
*/
|
|
3174
|
-
var __values =
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3139
|
+
var __values = undefined && undefined.__values || function (o) {
|
|
3140
|
+
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
3141
|
+
m = s && o[s],
|
|
3142
|
+
i = 0;
|
|
3143
|
+
if (m) return m.call(o);
|
|
3144
|
+
if (o && typeof o.length === "number") return {
|
|
3145
|
+
next: function next() {
|
|
3146
|
+
if (o && i >= o.length) o = void 0;
|
|
3147
|
+
return {
|
|
3148
|
+
value: o && o[i++],
|
|
3149
|
+
done: !o
|
|
3150
|
+
};
|
|
3151
|
+
}
|
|
3152
|
+
};
|
|
3153
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
3184
3154
|
};
|
|
3185
3155
|
/** 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); }, [])));
|
|
3156
|
+
var CompositePropagator = /** @class */function () {
|
|
3157
|
+
/**
|
|
3158
|
+
* Construct a composite propagator from a list of propagators.
|
|
3159
|
+
*
|
|
3160
|
+
* @param [config] Configuration object for composite propagator
|
|
3161
|
+
*/
|
|
3162
|
+
function CompositePropagator(config) {
|
|
3163
|
+
if (config === void 0) {
|
|
3164
|
+
config = {};
|
|
3200
3165
|
}
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3166
|
+
var _a;
|
|
3167
|
+
this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
|
|
3168
|
+
this._fields = Array.from(new Set(this._propagators
|
|
3169
|
+
// older propagators may not have fields function, null check to be sure
|
|
3170
|
+
.map(function (p) {
|
|
3171
|
+
return typeof p.fields === 'function' ? p.fields() : [];
|
|
3172
|
+
}).reduce(function (x, y) {
|
|
3173
|
+
return x.concat(y);
|
|
3174
|
+
}, [])));
|
|
3175
|
+
}
|
|
3176
|
+
/**
|
|
3177
|
+
* Run each of the configured propagators with the given context and carrier.
|
|
3178
|
+
* Propagators are run in the order they are configured, so if multiple
|
|
3179
|
+
* propagators write the same carrier key, the propagator later in the list
|
|
3180
|
+
* will "win".
|
|
3181
|
+
*
|
|
3182
|
+
* @param context Context to inject
|
|
3183
|
+
* @param carrier Carrier into which context will be injected
|
|
3184
|
+
*/
|
|
3185
|
+
CompositePropagator.prototype.inject = function (context, carrier, setter) {
|
|
3186
|
+
var e_1, _a;
|
|
3187
|
+
try {
|
|
3188
|
+
for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3189
|
+
var propagator = _c.value;
|
|
3212
3190
|
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
|
-
}
|
|
3191
|
+
propagator.inject(context, carrier, setter);
|
|
3192
|
+
} catch (err) {
|
|
3193
|
+
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3222
3194
|
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
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
|
-
|
|
3195
|
+
}
|
|
3196
|
+
} catch (e_1_1) {
|
|
3197
|
+
e_1 = {
|
|
3198
|
+
error: e_1_1
|
|
3199
|
+
};
|
|
3200
|
+
} finally {
|
|
3201
|
+
try {
|
|
3202
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3203
|
+
} finally {
|
|
3204
|
+
if (e_1) throw e_1.error;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
/**
|
|
3209
|
+
* Run each of the configured propagators with the given context and carrier.
|
|
3210
|
+
* Propagators are run in the order they are configured, so if multiple
|
|
3211
|
+
* propagators write the same context key, the propagator later in the list
|
|
3212
|
+
* will "win".
|
|
3213
|
+
*
|
|
3214
|
+
* @param context Context to add values to
|
|
3215
|
+
* @param carrier Carrier from which to extract context
|
|
3216
|
+
*/
|
|
3217
|
+
CompositePropagator.prototype.extract = function (context, carrier, getter) {
|
|
3218
|
+
return this._propagators.reduce(function (ctx, propagator) {
|
|
3219
|
+
try {
|
|
3220
|
+
return propagator.extract(ctx, carrier, getter);
|
|
3221
|
+
} catch (err) {
|
|
3222
|
+
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3223
|
+
}
|
|
3224
|
+
return ctx;
|
|
3225
|
+
}, context);
|
|
3226
|
+
};
|
|
3227
|
+
CompositePropagator.prototype.fields = function () {
|
|
3228
|
+
// return a new array so our fields cannot be modified
|
|
3229
|
+
return this._fields.slice();
|
|
3230
|
+
};
|
|
3231
|
+
return CompositePropagator;
|
|
3232
|
+
}();
|
|
3257
3233
|
|
|
3258
3234
|
/*
|
|
3259
3235
|
* Copyright The OpenTelemetry Authors
|
|
@@ -3285,15 +3261,14 @@ var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
|
|
|
3285
3261
|
* see https://www.w3.org/TR/trace-context/#key
|
|
3286
3262
|
*/
|
|
3287
3263
|
function validateKey(key) {
|
|
3288
|
-
|
|
3264
|
+
return VALID_KEY_REGEX.test(key);
|
|
3289
3265
|
}
|
|
3290
3266
|
/**
|
|
3291
3267
|
* Value is opaque string up to 256 characters printable ASCII RFC0020
|
|
3292
3268
|
* characters (i.e., the range 0x20 to 0x7E) except comma , and =.
|
|
3293
3269
|
*/
|
|
3294
3270
|
function validateValue(value) {
|
|
3295
|
-
|
|
3296
|
-
!INVALID_VALUE_COMMA_EQUAL_REGEX.test(value));
|
|
3271
|
+
return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value);
|
|
3297
3272
|
}
|
|
3298
3273
|
|
|
3299
3274
|
/*
|
|
@@ -3324,74 +3299,67 @@ var LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
|
|
|
3324
3299
|
* - The value of any key can be updated. Modified keys MUST be moved to the
|
|
3325
3300
|
* beginning of the list.
|
|
3326
3301
|
*/
|
|
3327
|
-
var TraceState = /** @class */
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3302
|
+
var TraceState = /** @class */function () {
|
|
3303
|
+
function TraceState(rawTraceState) {
|
|
3304
|
+
this._internalState = new Map();
|
|
3305
|
+
if (rawTraceState) this._parse(rawTraceState);
|
|
3306
|
+
}
|
|
3307
|
+
TraceState.prototype.set = function (key, value) {
|
|
3308
|
+
// TODO: Benchmark the different approaches(map vs list) and
|
|
3309
|
+
// use the faster one.
|
|
3310
|
+
var traceState = this._clone();
|
|
3311
|
+
if (traceState._internalState.has(key)) {
|
|
3312
|
+
traceState._internalState.delete(key);
|
|
3332
3313
|
}
|
|
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));
|
|
3314
|
+
traceState._internalState.set(key, value);
|
|
3315
|
+
return traceState;
|
|
3316
|
+
};
|
|
3317
|
+
TraceState.prototype.unset = function (key) {
|
|
3318
|
+
var traceState = this._clone();
|
|
3319
|
+
traceState._internalState.delete(key);
|
|
3320
|
+
return traceState;
|
|
3321
|
+
};
|
|
3322
|
+
TraceState.prototype.get = function (key) {
|
|
3323
|
+
return this._internalState.get(key);
|
|
3324
|
+
};
|
|
3325
|
+
TraceState.prototype.serialize = function () {
|
|
3326
|
+
var _this = this;
|
|
3327
|
+
return this._keys().reduce(function (agg, key) {
|
|
3328
|
+
agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
|
|
3329
|
+
return agg;
|
|
3330
|
+
}, []).join(LIST_MEMBERS_SEPARATOR);
|
|
3331
|
+
};
|
|
3332
|
+
TraceState.prototype._parse = function (rawTraceState) {
|
|
3333
|
+
if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
|
|
3334
|
+
this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
|
|
3335
|
+
.reduce(function (agg, part) {
|
|
3336
|
+
var listMember = part.trim(); // Optional Whitespace (OWS) handling
|
|
3337
|
+
var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
|
|
3338
|
+
if (i !== -1) {
|
|
3339
|
+
var key = listMember.slice(0, i);
|
|
3340
|
+
var value = listMember.slice(i + 1, part.length);
|
|
3341
|
+
if (validateKey(key) && validateValue(value)) {
|
|
3342
|
+
agg.set(key, value);
|
|
3383
3343
|
}
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3344
|
+
}
|
|
3345
|
+
return agg;
|
|
3346
|
+
}, new Map());
|
|
3347
|
+
// Because of the reverse() requirement, trunc must be done after map is created
|
|
3348
|
+
if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
|
|
3349
|
+
this._internalState = new Map(Array.from(this._internalState.entries()).reverse() // Use reverse same as original tracestate parse chain
|
|
3350
|
+
.slice(0, MAX_TRACE_STATE_ITEMS));
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
TraceState.prototype._keys = function () {
|
|
3354
|
+
return Array.from(this._internalState.keys()).reverse();
|
|
3355
|
+
};
|
|
3356
|
+
TraceState.prototype._clone = function () {
|
|
3357
|
+
var traceState = new TraceState();
|
|
3358
|
+
traceState._internalState = new Map(this._internalState);
|
|
3359
|
+
return traceState;
|
|
3360
|
+
};
|
|
3361
|
+
return TraceState;
|
|
3362
|
+
}();
|
|
3395
3363
|
|
|
3396
3364
|
/*
|
|
3397
3365
|
* Copyright The OpenTelemetry Authors
|
|
@@ -3427,19 +3395,17 @@ var TRACE_PARENT_REGEX = new RegExp("^\\s?(" + VERSION_PART + ")-(" + TRACE_ID_P
|
|
|
3427
3395
|
* For more information see {@link https://www.w3.org/TR/trace-context/}
|
|
3428
3396
|
*/
|
|
3429
3397
|
function parseTraceParent(traceParent) {
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
traceFlags: parseInt(match[4], 16),
|
|
3442
|
-
};
|
|
3398
|
+
var match = TRACE_PARENT_REGEX.exec(traceParent);
|
|
3399
|
+
if (!match) return null;
|
|
3400
|
+
// According to the specification the implementation should be compatible
|
|
3401
|
+
// with future versions. If there are more parts, we only reject it if it's using version 00
|
|
3402
|
+
// See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
|
|
3403
|
+
if (match[1] === '00' && match[5]) return null;
|
|
3404
|
+
return {
|
|
3405
|
+
traceId: match[2],
|
|
3406
|
+
spanId: match[3],
|
|
3407
|
+
traceFlags: parseInt(match[4], 16)
|
|
3408
|
+
};
|
|
3443
3409
|
}
|
|
3444
3410
|
/**
|
|
3445
3411
|
* Propagates {@link SpanContext} through Trace Context format propagation.
|
|
@@ -3447,61 +3413,50 @@ function parseTraceParent(traceParent) {
|
|
|
3447
3413
|
* Based on the Trace Context specification:
|
|
3448
3414
|
* https://www.w3.org/TR/trace-context/
|
|
3449
3415
|
*/
|
|
3450
|
-
var W3CTraceContextPropagator = /** @class */
|
|
3451
|
-
|
|
3416
|
+
var W3CTraceContextPropagator = /** @class */function () {
|
|
3417
|
+
function W3CTraceContextPropagator() {}
|
|
3418
|
+
W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
|
|
3419
|
+
var spanContext = trace.getSpanContext(context);
|
|
3420
|
+
if (!spanContext || isTracingSuppressed(context) || !isSpanContextValid(spanContext)) return;
|
|
3421
|
+
var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
|
|
3422
|
+
setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
|
|
3423
|
+
if (spanContext.traceState) {
|
|
3424
|
+
setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
|
|
3452
3425
|
}
|
|
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
|
-
}());
|
|
3426
|
+
};
|
|
3427
|
+
W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
|
|
3428
|
+
var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
|
|
3429
|
+
if (!traceParentHeader) return context;
|
|
3430
|
+
var traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
|
|
3431
|
+
if (typeof traceParent !== 'string') return context;
|
|
3432
|
+
var spanContext = parseTraceParent(traceParent);
|
|
3433
|
+
if (!spanContext) return context;
|
|
3434
|
+
spanContext.isRemote = true;
|
|
3435
|
+
var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
|
|
3436
|
+
if (traceStateHeader) {
|
|
3437
|
+
// If more than one `tracestate` header is found, we merge them into a
|
|
3438
|
+
// single header.
|
|
3439
|
+
var state = Array.isArray(traceStateHeader) ? traceStateHeader.join(',') : traceStateHeader;
|
|
3440
|
+
spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
|
|
3441
|
+
}
|
|
3442
|
+
return trace.setSpanContext(context, spanContext);
|
|
3443
|
+
};
|
|
3444
|
+
W3CTraceContextPropagator.prototype.fields = function () {
|
|
3445
|
+
return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
|
|
3446
|
+
};
|
|
3447
|
+
return W3CTraceContextPropagator;
|
|
3448
|
+
}();
|
|
3494
3449
|
|
|
3495
|
-
var _a;
|
|
3450
|
+
var _a$1;
|
|
3496
3451
|
var MAX_RUM_EVENTS_PER_REQUEST = 500;
|
|
3497
3452
|
var MAX_RUM_EVENTS = 20000;
|
|
3498
3453
|
var MAX_MS_RECORD_TIME = 60000;
|
|
3499
3454
|
var DEFAULT_RUM_EVENTS = 5000;
|
|
3500
3455
|
var DEFAULT_MS_RECORD_TIME = 10000;
|
|
3501
3456
|
({
|
|
3502
|
-
instrumentationsToSend: (_a = {},
|
|
3503
|
-
_a[CoralogixEventType.WEB_VITALS] = true,
|
|
3504
|
-
_a),
|
|
3457
|
+
instrumentationsToSend: (_a$1 = {},
|
|
3458
|
+
_a$1[CoralogixEventType.WEB_VITALS] = true,
|
|
3459
|
+
_a$1),
|
|
3505
3460
|
});
|
|
3506
3461
|
|
|
3507
3462
|
var Request = /** @class */ (function () {
|
|
@@ -3774,6 +3729,38 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3774
3729
|
return SessionIdle;
|
|
3775
3730
|
}());
|
|
3776
3731
|
|
|
3732
|
+
var _a;
|
|
3733
|
+
var instrumentationsCompatibility = (_a = {},
|
|
3734
|
+
_a[XHR_INSTRUMENTATION_NAME] = {
|
|
3735
|
+
browsers: [
|
|
3736
|
+
{ name: 'Chrome', minVersion: 43 }
|
|
3737
|
+
],
|
|
3738
|
+
warningText: 'XHR',
|
|
3739
|
+
},
|
|
3740
|
+
_a[SESSION_RECORDING_INSTRUMENTATION_NAME] = {
|
|
3741
|
+
browsers: [
|
|
3742
|
+
{ name: 'Chrome', minVersion: 45 },
|
|
3743
|
+
],
|
|
3744
|
+
warningText: 'Session Recording',
|
|
3745
|
+
},
|
|
3746
|
+
_a);
|
|
3747
|
+
function isInstrumentationCompatible(confKey) {
|
|
3748
|
+
var _a = parseUserAgent(navigator.userAgent), browserVersion = _a.browserVersion, browser = _a.browser;
|
|
3749
|
+
var majorVersion = parseInt(browserVersion.split('.')[0]);
|
|
3750
|
+
var compatibility = instrumentationsCompatibility[confKey];
|
|
3751
|
+
if (!compatibility)
|
|
3752
|
+
return true;
|
|
3753
|
+
var matchedBrowser = compatibility.browsers.find(function (compatibleBrowser) { return compatibleBrowser.name === browser; });
|
|
3754
|
+
if (!matchedBrowser) {
|
|
3755
|
+
return true;
|
|
3756
|
+
}
|
|
3757
|
+
if (!isNaN(majorVersion) && majorVersion < matchedBrowser.minVersion) {
|
|
3758
|
+
console.debug("Coralogix Browser SDK - ".concat(compatibility.warningText, " is not supported on this browser"));
|
|
3759
|
+
return false;
|
|
3760
|
+
}
|
|
3761
|
+
return true;
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3777
3764
|
var SessionManager = /** @class */ (function (_super) {
|
|
3778
3765
|
__extends(SessionManager, _super);
|
|
3779
3766
|
function SessionManager(recordConfig) {
|
|
@@ -3926,7 +3913,7 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3926
3913
|
};
|
|
3927
3914
|
SessionManager.prototype.initializeSession = function (recordConfig) {
|
|
3928
3915
|
return __awaiter(this, void 0, void 0, function () {
|
|
3929
|
-
var recordingSamplingEnabled, SessionRecorder_1;
|
|
3916
|
+
var recordingSamplingEnabled, isSessionRecordingCompatible, SessionRecorder_1;
|
|
3930
3917
|
return __generator(this, function (_a) {
|
|
3931
3918
|
switch (_a.label) {
|
|
3932
3919
|
case 0:
|
|
@@ -3934,7 +3921,8 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3934
3921
|
this.sessionRecorderConfig = recordConfig;
|
|
3935
3922
|
if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
|
|
3936
3923
|
recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
|
|
3937
|
-
|
|
3924
|
+
isSessionRecordingCompatible = isInstrumentationCompatible(SESSION_RECORDING_INSTRUMENTATION_NAME);
|
|
3925
|
+
if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3 /*break*/, 2];
|
|
3938
3926
|
return [4 /*yield*/, import('./sessionRecorder.esm.js')];
|
|
3939
3927
|
case 1:
|
|
3940
3928
|
SessionRecorder_1 = (_a.sent()).SessionRecorder;
|
|
@@ -4146,7 +4134,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4146
4134
|
return resolvedUrlBlueprinters;
|
|
4147
4135
|
}
|
|
4148
4136
|
|
|
4149
|
-
var SDK_VERSION = '2.
|
|
4137
|
+
var SDK_VERSION = '2.6.0';
|
|
4150
4138
|
|
|
4151
4139
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4152
4140
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4662,139 +4650,151 @@ var CoralogixRum = {
|
|
|
4662
4650
|
},
|
|
4663
4651
|
init: function (options) {
|
|
4664
4652
|
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
|
-
var
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
errorsInstrumentation =
|
|
4708
|
-
instrumentation;
|
|
4709
|
-
break;
|
|
4710
|
-
}
|
|
4711
|
-
case 'fetch':
|
|
4712
|
-
case 'xhr': {
|
|
4713
|
-
instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls, traceParentInHeader: traceParentInHeader }));
|
|
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) {
|
|
4653
|
+
try {
|
|
4654
|
+
// Check if CoralogixRum already inited.
|
|
4655
|
+
if (isInited) {
|
|
4656
|
+
console.warn('CoralogixRum already inited.');
|
|
4657
|
+
return;
|
|
4658
|
+
}
|
|
4659
|
+
// Abort if not in browser environment.
|
|
4660
|
+
if (!CxGlobal.sessionStorage) {
|
|
4661
|
+
console.warn('CoralogixRum: Non-browser environment detected, aborting');
|
|
4662
|
+
return;
|
|
4663
|
+
}
|
|
4664
|
+
// Abort if running in a not supported browser.
|
|
4665
|
+
if (typeof Symbol !== 'function') {
|
|
4666
|
+
console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
|
|
4667
|
+
return;
|
|
4668
|
+
}
|
|
4669
|
+
var resolvedOptions_1 = validateAndResolveInitConfig(options);
|
|
4670
|
+
if (!resolvedOptions_1) {
|
|
4671
|
+
return;
|
|
4672
|
+
}
|
|
4673
|
+
CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
|
|
4674
|
+
var sampler = getResolvedSampler(resolvedOptions_1);
|
|
4675
|
+
// Check if not in debug mode & no auth token.
|
|
4676
|
+
if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
|
|
4677
|
+
console.warn('rumAuth will be required in the future');
|
|
4678
|
+
}
|
|
4679
|
+
timeMeasurementTracker = new TimeMeasurementTracker();
|
|
4680
|
+
new SessionManager(resolvedOptions_1.sessionRecordingConfig).start();
|
|
4681
|
+
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;
|
|
4682
|
+
tracerProvider = new CoralogixWebTracerProvider({
|
|
4683
|
+
sampler: sampler,
|
|
4684
|
+
});
|
|
4685
|
+
var pluginDefaults_1 = {};
|
|
4686
|
+
// Resolve instrumentations.
|
|
4687
|
+
var instrumentations = INSTRUMENTATIONS.map(function (_a) {
|
|
4688
|
+
var _b, _c;
|
|
4689
|
+
var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
|
|
4690
|
+
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);
|
|
4691
|
+
if (pluginConf) {
|
|
4692
|
+
var instrumentation = void 0;
|
|
4693
|
+
switch (confKey) {
|
|
4694
|
+
case ERROR_INSTRUMENTATION_NAME: {
|
|
4723
4695
|
instrumentation = new Instrument(pluginConf);
|
|
4724
|
-
|
|
4696
|
+
errorsInstrumentation =
|
|
4725
4697
|
instrumentation;
|
|
4698
|
+
break;
|
|
4726
4699
|
}
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4700
|
+
case FETCH_INSTRUMENTATION_NAME:
|
|
4701
|
+
case XHR_INSTRUMENTATION_NAME: {
|
|
4702
|
+
if (confKey === XHR_INSTRUMENTATION_NAME) {
|
|
4703
|
+
var isXhrCompatible = isInstrumentationCompatible(XHR_INSTRUMENTATION_NAME);
|
|
4704
|
+
if (!isXhrCompatible) {
|
|
4705
|
+
return;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
instrumentation = new Instrument(__assign(__assign({}, pluginConf), { ignoreUrls: ignoreUrls_1, traceParentInHeader: traceParentInHeader_1 }));
|
|
4709
|
+
break;
|
|
4710
|
+
}
|
|
4711
|
+
case INTERNAL_INSTRUMENTATION_NAME: {
|
|
4732
4712
|
instrumentation = new Instrument(pluginConf);
|
|
4733
|
-
|
|
4734
|
-
|
|
4713
|
+
saveInternalRumData(INTERNAL_INSTRUMENTATION_NAME, instrumentation);
|
|
4714
|
+
break;
|
|
4735
4715
|
}
|
|
4736
|
-
|
|
4716
|
+
case SCREENSHOT_INSTRUMENTATION_NAME: {
|
|
4717
|
+
if ((_c = resolvedOptions_1.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
4718
|
+
instrumentation = new Instrument(pluginConf);
|
|
4719
|
+
screenshotInstrumentation =
|
|
4720
|
+
instrumentation;
|
|
4721
|
+
}
|
|
4722
|
+
break;
|
|
4723
|
+
}
|
|
4724
|
+
case MEMORY_USAGE_INSTRUMENTATION_NAME: {
|
|
4725
|
+
if (resolvedOptions_1.memoryUsageConfig.enabled &&
|
|
4726
|
+
isMeasureUserAgentSpecificMemoryAllowed()) {
|
|
4727
|
+
instrumentation = new Instrument(pluginConf);
|
|
4728
|
+
memoryUsageInstrumentation =
|
|
4729
|
+
instrumentation;
|
|
4730
|
+
}
|
|
4731
|
+
break;
|
|
4732
|
+
}
|
|
4733
|
+
default:
|
|
4734
|
+
instrumentation = new Instrument(pluginConf);
|
|
4737
4735
|
}
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4736
|
+
if (instrumentation instanceof CoralogixCustomLogInstrumentation) {
|
|
4737
|
+
_customInstrumentation = instrumentation;
|
|
4738
|
+
}
|
|
4739
|
+
if (instrumentation instanceof
|
|
4740
|
+
CoralogixCustomMeasurementInstrumentation) {
|
|
4741
|
+
customMeasurementInstrumentation = instrumentation;
|
|
4742
|
+
}
|
|
4743
|
+
return instrumentation;
|
|
4746
4744
|
}
|
|
4747
|
-
return
|
|
4745
|
+
return null;
|
|
4746
|
+
}).filter(function (instrument) {
|
|
4747
|
+
return Boolean(instrument);
|
|
4748
|
+
});
|
|
4749
|
+
var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
|
|
4750
|
+
// Init Span Attributes Processor.
|
|
4751
|
+
attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
|
|
4752
|
+
application: application,
|
|
4753
|
+
version: version,
|
|
4754
|
+
}), _a[CoralogixAttributes.USER_CONTEXT] = JSON.stringify(mergedUserContext), _a), (environment
|
|
4755
|
+
? (_b = {}, _b[CoralogixAttributes.ENVIRONMENT] = environment, _b) : {})));
|
|
4756
|
+
if (labels) {
|
|
4757
|
+
attributesProcessor.setCustomLabels(labels);
|
|
4748
4758
|
}
|
|
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');
|
|
4759
|
+
setAttrProcessor(attributesProcessor);
|
|
4760
|
+
// The order of processors is important.
|
|
4761
|
+
tracerProvider.addSpanProcessor(attributesProcessor);
|
|
4762
|
+
// Add Navigation Processor
|
|
4763
|
+
navigationProcessor = new CoralogixNavigationProcessor();
|
|
4764
|
+
tracerProvider.addSpanProcessor(navigationProcessor);
|
|
4765
|
+
// Add Span Mapping Processor
|
|
4766
|
+
spanMapProcessor = new CoralogixSpanMapProcessor();
|
|
4767
|
+
tracerProvider.addSpanProcessor(spanMapProcessor);
|
|
4768
|
+
// Add snapshot processor
|
|
4769
|
+
new SnapshotManager();
|
|
4770
|
+
snapshotProcessor = new CoralogixSnapshotSpanProcessor();
|
|
4771
|
+
tracerProvider.addSpanProcessor(snapshotProcessor);
|
|
4772
|
+
// Add Batch Span Processor and Exporter
|
|
4773
|
+
tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
|
|
4774
|
+
maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
|
|
4775
|
+
scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
|
|
4776
|
+
}));
|
|
4777
|
+
handlePropagators(options, tracerProvider);
|
|
4778
|
+
// Register Instrumentations
|
|
4779
|
+
_deregisterInstrumentations = registerInstrumentations({
|
|
4780
|
+
tracerProvider: tracerProvider,
|
|
4781
|
+
instrumentations: instrumentations,
|
|
4782
|
+
});
|
|
4783
|
+
var _c = __read$1(partition(resolvedOptions_1.labelProviders || [], function (_a) {
|
|
4784
|
+
var urlType = _a.urlType;
|
|
4785
|
+
return urlType === UrlType.PAGE || !urlType;
|
|
4786
|
+
}), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
|
|
4787
|
+
saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
|
|
4788
|
+
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
4789
|
+
isInited = true;
|
|
4790
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4791
|
+
console.info('Coralogix Browser SDK - initialization has completed');
|
|
4792
|
+
}
|
|
4793
|
+
reportInternalEvent('init');
|
|
4794
|
+
}
|
|
4795
|
+
catch (err) {
|
|
4796
|
+
console.warn('Coralogix Browser SDK - initialization failed: ', err);
|
|
4797
|
+
}
|
|
4798
4798
|
},
|
|
4799
4799
|
getCustomTracer: function (ignoredList) {
|
|
4800
4800
|
var _a, _b;
|