@coralogix/browser 2.8.5 → 2.8.6
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 +7 -0
- package/index.esm.js +2 -3
- package/index.esm2.js +588 -790
- package/package.json +1 -1
- package/sessionRecorder.esm.js +28 -1291
- package/src/constants.d.ts +0 -4
- package/src/otel/otel.consts.d.ts +0 -10
- package/src/session/session.model.d.ts +0 -40
- package/src/tools/addEventListener.d.ts +0 -7
- package/src/tools/getZoneJsOriginalDom.d.ts +0 -3
- package/src/types.d.ts +0 -87
- package/src/utils/array.d.ts +0 -9
- package/src/utils/general.d.ts +0 -6
- package/src/utils/object.d.ts +0 -26
- package/src/utils/string.d.ts +0 -4
- package/src/version.d.ts +1 -1
package/index.esm2.js
CHANGED
|
@@ -1,15 +1,150 @@
|
|
|
1
|
-
import { __assign, __extends, __awaiter, __generator, __read as __read$1, __spreadArray, __rest, __values as __values$1 } from 'tslib';
|
|
2
1
|
import { SamplingDecision, AlwaysOnSampler, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
3
2
|
import { getElementXPath, WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
|
4
3
|
import { InstrumentationBase, registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
5
|
-
import ErrorStackParser from 'error-stack-parser';
|
|
6
4
|
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
|
|
7
5
|
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
|
|
8
6
|
import { onFID, onCLS, onLCP, onFCP, onINP, onTTFB } from 'web-vitals/attribution';
|
|
9
|
-
import {
|
|
7
|
+
import { ExportResultCode, W3CBaggagePropagator, W3CTraceContextPropagator, CompositePropagator } from '@opentelemetry/core';
|
|
8
|
+
import { trace, context } from '@opentelemetry/api';
|
|
10
9
|
import { B3Propagator, B3InjectEncoding } from '@opentelemetry/propagator-b3';
|
|
11
10
|
import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray';
|
|
12
11
|
|
|
12
|
+
/******************************************************************************
|
|
13
|
+
Copyright (c) Microsoft Corporation.
|
|
14
|
+
|
|
15
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
+
purpose with or without fee is hereby granted.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
27
|
+
|
|
28
|
+
var extendStatics = function(d, b) {
|
|
29
|
+
extendStatics = Object.setPrototypeOf ||
|
|
30
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
32
|
+
return extendStatics(d, b);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function __extends(d, b) {
|
|
36
|
+
if (typeof b !== "function" && b !== null)
|
|
37
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
38
|
+
extendStatics(d, b);
|
|
39
|
+
function __() { this.constructor = d; }
|
|
40
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var __assign = function() {
|
|
44
|
+
__assign = Object.assign || function __assign(t) {
|
|
45
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
46
|
+
s = arguments[i];
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
};
|
|
51
|
+
return __assign.apply(this, arguments);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
function __rest(s, e) {
|
|
55
|
+
var t = {};
|
|
56
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
57
|
+
t[p] = s[p];
|
|
58
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
59
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
60
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
61
|
+
t[p[i]] = s[p[i]];
|
|
62
|
+
}
|
|
63
|
+
return t;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
67
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
68
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
69
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
70
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
71
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
72
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function __generator(thisArg, body) {
|
|
77
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
78
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
79
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
80
|
+
function step(op) {
|
|
81
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
82
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
83
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
84
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
85
|
+
switch (op[0]) {
|
|
86
|
+
case 0: case 1: t = op; break;
|
|
87
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
88
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
89
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
90
|
+
default:
|
|
91
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
92
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
93
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
94
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
95
|
+
if (t[2]) _.ops.pop();
|
|
96
|
+
_.trys.pop(); continue;
|
|
97
|
+
}
|
|
98
|
+
op = body.call(thisArg, _);
|
|
99
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
100
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function __values(o) {
|
|
105
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
106
|
+
if (m) return m.call(o);
|
|
107
|
+
if (o && typeof o.length === "number") return {
|
|
108
|
+
next: function () {
|
|
109
|
+
if (o && i >= o.length) o = void 0;
|
|
110
|
+
return { value: o && o[i++], done: !o };
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function __read(o, n) {
|
|
117
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
118
|
+
if (!m) return o;
|
|
119
|
+
var i = m.call(o), r, ar = [], e;
|
|
120
|
+
try {
|
|
121
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
122
|
+
}
|
|
123
|
+
catch (error) { e = { error: error }; }
|
|
124
|
+
finally {
|
|
125
|
+
try {
|
|
126
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
127
|
+
}
|
|
128
|
+
finally { if (e) throw e.error; }
|
|
129
|
+
}
|
|
130
|
+
return ar;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function __spreadArray(to, from, pack) {
|
|
134
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
135
|
+
if (ar || !(i in from)) {
|
|
136
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
137
|
+
ar[i] = from[i];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
144
|
+
var e = new Error(message);
|
|
145
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
146
|
+
};
|
|
147
|
+
|
|
13
148
|
function isString(value) {
|
|
14
149
|
return typeof value === 'string';
|
|
15
150
|
}
|
|
@@ -38,10 +173,6 @@ function stringMatchesSomePattern(testString, patterns, requireExactStringMatch)
|
|
|
38
173
|
return isMatchingPattern(testString, pattern, requireExactStringMatch);
|
|
39
174
|
});
|
|
40
175
|
}
|
|
41
|
-
/**
|
|
42
|
-
* UUID v4
|
|
43
|
-
* https://gist.github.com/jed/982883
|
|
44
|
-
*/
|
|
45
176
|
function generateUUID(placeholder) {
|
|
46
177
|
return placeholder
|
|
47
178
|
? (+placeholder ^ ((Math.random() * 16) >> (+placeholder / 4))).toString(16)
|
|
@@ -88,15 +219,16 @@ var UrlType;
|
|
|
88
219
|
UrlType["NETWORK_REQUEST"] = "network_request";
|
|
89
220
|
})(UrlType || (UrlType = {}));
|
|
90
221
|
|
|
222
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
223
|
+
|
|
224
|
+
function getDefaultExportFromCjs (x) {
|
|
225
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
226
|
+
}
|
|
227
|
+
|
|
91
228
|
function isFunction(funktion) {
|
|
92
229
|
return typeof funktion === 'function';
|
|
93
230
|
}
|
|
94
|
-
|
|
95
|
-
// Default to complaining loudly when things don't go according to plan.
|
|
96
231
|
var logger = console.error.bind(console);
|
|
97
|
-
|
|
98
|
-
// Sets a property on an object, preserving its enumerability.
|
|
99
|
-
// This function assumes that the property is already writable.
|
|
100
232
|
function defineProperty(obj, name, value) {
|
|
101
233
|
var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);
|
|
102
234
|
Object.defineProperty(obj, name, {
|
|
@@ -106,8 +238,6 @@ function defineProperty(obj, name, value) {
|
|
|
106
238
|
value: value
|
|
107
239
|
});
|
|
108
240
|
}
|
|
109
|
-
|
|
110
|
-
// Keep initialization idempotent.
|
|
111
241
|
function shimmer(options) {
|
|
112
242
|
if (options && options.logger) {
|
|
113
243
|
if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");else logger = options.logger;
|
|
@@ -190,6 +320,7 @@ shimmer.massWrap = massWrap;
|
|
|
190
320
|
shimmer.unwrap = unwrap;
|
|
191
321
|
shimmer.massUnwrap = massUnwrap;
|
|
192
322
|
var shimmer_1 = shimmer;
|
|
323
|
+
getDefaultExportFromCjs(shimmer_1);
|
|
193
324
|
|
|
194
325
|
var CoralogixLogSeverity;
|
|
195
326
|
(function (CoralogixLogSeverity) {
|
|
@@ -201,6 +332,290 @@ var CoralogixLogSeverity;
|
|
|
201
332
|
CoralogixLogSeverity[CoralogixLogSeverity["Critical"] = 6] = "Critical";
|
|
202
333
|
})(CoralogixLogSeverity || (CoralogixLogSeverity = {}));
|
|
203
334
|
|
|
335
|
+
var errorStackParser = {exports: {}};
|
|
336
|
+
|
|
337
|
+
var stackframe = {exports: {}};
|
|
338
|
+
|
|
339
|
+
var hasRequiredStackframe;
|
|
340
|
+
function requireStackframe() {
|
|
341
|
+
if (hasRequiredStackframe) return stackframe.exports;
|
|
342
|
+
hasRequiredStackframe = 1;
|
|
343
|
+
(function (module, exports) {
|
|
344
|
+
(function (root, factory) {
|
|
345
|
+
{
|
|
346
|
+
module.exports = factory();
|
|
347
|
+
}
|
|
348
|
+
})(commonjsGlobal, function () {
|
|
349
|
+
|
|
350
|
+
function _isNumber(n) {
|
|
351
|
+
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
352
|
+
}
|
|
353
|
+
function _capitalize(str) {
|
|
354
|
+
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
355
|
+
}
|
|
356
|
+
function _getter(p) {
|
|
357
|
+
return function () {
|
|
358
|
+
return this[p];
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];
|
|
362
|
+
var numericProps = ['columnNumber', 'lineNumber'];
|
|
363
|
+
var stringProps = ['fileName', 'functionName', 'source'];
|
|
364
|
+
var arrayProps = ['args'];
|
|
365
|
+
var objectProps = ['evalOrigin'];
|
|
366
|
+
var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);
|
|
367
|
+
function StackFrame(obj) {
|
|
368
|
+
if (!obj) return;
|
|
369
|
+
for (var i = 0; i < props.length; i++) {
|
|
370
|
+
if (obj[props[i]] !== undefined) {
|
|
371
|
+
this['set' + _capitalize(props[i])](obj[props[i]]);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
StackFrame.prototype = {
|
|
376
|
+
getArgs: function getArgs() {
|
|
377
|
+
return this.args;
|
|
378
|
+
},
|
|
379
|
+
setArgs: function setArgs(v) {
|
|
380
|
+
if (Object.prototype.toString.call(v) !== '[object Array]') {
|
|
381
|
+
throw new TypeError('Args must be an Array');
|
|
382
|
+
}
|
|
383
|
+
this.args = v;
|
|
384
|
+
},
|
|
385
|
+
getEvalOrigin: function getEvalOrigin() {
|
|
386
|
+
return this.evalOrigin;
|
|
387
|
+
},
|
|
388
|
+
setEvalOrigin: function setEvalOrigin(v) {
|
|
389
|
+
if (v instanceof StackFrame) {
|
|
390
|
+
this.evalOrigin = v;
|
|
391
|
+
} else if (v instanceof Object) {
|
|
392
|
+
this.evalOrigin = new StackFrame(v);
|
|
393
|
+
} else {
|
|
394
|
+
throw new TypeError('Eval Origin must be an Object or StackFrame');
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
toString: function toString() {
|
|
398
|
+
var fileName = this.getFileName() || '';
|
|
399
|
+
var lineNumber = this.getLineNumber() || '';
|
|
400
|
+
var columnNumber = this.getColumnNumber() || '';
|
|
401
|
+
var functionName = this.getFunctionName() || '';
|
|
402
|
+
if (this.getIsEval()) {
|
|
403
|
+
if (fileName) {
|
|
404
|
+
return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
|
|
405
|
+
}
|
|
406
|
+
return '[eval]:' + lineNumber + ':' + columnNumber;
|
|
407
|
+
}
|
|
408
|
+
if (functionName) {
|
|
409
|
+
return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
|
|
410
|
+
}
|
|
411
|
+
return fileName + ':' + lineNumber + ':' + columnNumber;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
StackFrame.fromString = function StackFrame$$fromString(str) {
|
|
415
|
+
var argsStartIndex = str.indexOf('(');
|
|
416
|
+
var argsEndIndex = str.lastIndexOf(')');
|
|
417
|
+
var functionName = str.substring(0, argsStartIndex);
|
|
418
|
+
var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');
|
|
419
|
+
var locationString = str.substring(argsEndIndex + 1);
|
|
420
|
+
if (locationString.indexOf('@') === 0) {
|
|
421
|
+
var parts = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(locationString, '');
|
|
422
|
+
var fileName = parts[1];
|
|
423
|
+
var lineNumber = parts[2];
|
|
424
|
+
var columnNumber = parts[3];
|
|
425
|
+
}
|
|
426
|
+
return new StackFrame({
|
|
427
|
+
functionName: functionName,
|
|
428
|
+
args: args || undefined,
|
|
429
|
+
fileName: fileName,
|
|
430
|
+
lineNumber: lineNumber || undefined,
|
|
431
|
+
columnNumber: columnNumber || undefined
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
for (var i = 0; i < booleanProps.length; i++) {
|
|
435
|
+
StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);
|
|
436
|
+
StackFrame.prototype['set' + _capitalize(booleanProps[i])] = function (p) {
|
|
437
|
+
return function (v) {
|
|
438
|
+
this[p] = Boolean(v);
|
|
439
|
+
};
|
|
440
|
+
}(booleanProps[i]);
|
|
441
|
+
}
|
|
442
|
+
for (var j = 0; j < numericProps.length; j++) {
|
|
443
|
+
StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);
|
|
444
|
+
StackFrame.prototype['set' + _capitalize(numericProps[j])] = function (p) {
|
|
445
|
+
return function (v) {
|
|
446
|
+
if (!_isNumber(v)) {
|
|
447
|
+
throw new TypeError(p + ' must be a Number');
|
|
448
|
+
}
|
|
449
|
+
this[p] = Number(v);
|
|
450
|
+
};
|
|
451
|
+
}(numericProps[j]);
|
|
452
|
+
}
|
|
453
|
+
for (var k = 0; k < stringProps.length; k++) {
|
|
454
|
+
StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);
|
|
455
|
+
StackFrame.prototype['set' + _capitalize(stringProps[k])] = function (p) {
|
|
456
|
+
return function (v) {
|
|
457
|
+
this[p] = String(v);
|
|
458
|
+
};
|
|
459
|
+
}(stringProps[k]);
|
|
460
|
+
}
|
|
461
|
+
return StackFrame;
|
|
462
|
+
});
|
|
463
|
+
})(stackframe);
|
|
464
|
+
return stackframe.exports;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
(function (module, exports) {
|
|
468
|
+
(function (root, factory) {
|
|
469
|
+
{
|
|
470
|
+
module.exports = factory(requireStackframe());
|
|
471
|
+
}
|
|
472
|
+
})(commonjsGlobal, function ErrorStackParser(StackFrame) {
|
|
473
|
+
|
|
474
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
475
|
+
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
476
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
477
|
+
return {
|
|
478
|
+
parse: function ErrorStackParser$$parse(error) {
|
|
479
|
+
if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
|
|
480
|
+
return this.parseOpera(error);
|
|
481
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
482
|
+
return this.parseV8OrIE(error);
|
|
483
|
+
} else if (error.stack) {
|
|
484
|
+
return this.parseFFOrSafari(error);
|
|
485
|
+
} else {
|
|
486
|
+
throw new Error('Cannot parse given Error object');
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
extractLocation: function ErrorStackParser$$extractLocation(urlLike) {
|
|
490
|
+
if (urlLike.indexOf(':') === -1) {
|
|
491
|
+
return [urlLike];
|
|
492
|
+
}
|
|
493
|
+
var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
494
|
+
var parts = regExp.exec(urlLike.replace(/[()]/g, ''));
|
|
495
|
+
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
496
|
+
},
|
|
497
|
+
parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
|
|
498
|
+
var filtered = error.stack.split('\n').filter(function (line) {
|
|
499
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
500
|
+
}, this);
|
|
501
|
+
return filtered.map(function (line) {
|
|
502
|
+
if (line.indexOf('(eval ') > -1) {
|
|
503
|
+
line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, '');
|
|
504
|
+
}
|
|
505
|
+
var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, '');
|
|
506
|
+
var location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
507
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
|
|
508
|
+
var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);
|
|
509
|
+
var functionName = location && sanitizedLine || undefined;
|
|
510
|
+
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
|
|
511
|
+
return new StackFrame({
|
|
512
|
+
functionName: functionName,
|
|
513
|
+
fileName: fileName,
|
|
514
|
+
lineNumber: locationParts[1],
|
|
515
|
+
columnNumber: locationParts[2],
|
|
516
|
+
source: line
|
|
517
|
+
});
|
|
518
|
+
}, this);
|
|
519
|
+
},
|
|
520
|
+
parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
|
|
521
|
+
var filtered = error.stack.split('\n').filter(function (line) {
|
|
522
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
523
|
+
}, this);
|
|
524
|
+
return filtered.map(function (line) {
|
|
525
|
+
if (line.indexOf(' > eval') > -1) {
|
|
526
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
527
|
+
}
|
|
528
|
+
if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
|
|
529
|
+
return new StackFrame({
|
|
530
|
+
functionName: line
|
|
531
|
+
});
|
|
532
|
+
} else {
|
|
533
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
534
|
+
var matches = line.match(functionNameRegex);
|
|
535
|
+
var functionName = matches && matches[1] ? matches[1] : undefined;
|
|
536
|
+
var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
|
|
537
|
+
return new StackFrame({
|
|
538
|
+
functionName: functionName,
|
|
539
|
+
fileName: locationParts[0],
|
|
540
|
+
lineNumber: locationParts[1],
|
|
541
|
+
columnNumber: locationParts[2],
|
|
542
|
+
source: line
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}, this);
|
|
546
|
+
},
|
|
547
|
+
parseOpera: function ErrorStackParser$$parseOpera(e) {
|
|
548
|
+
if (!e.stacktrace || e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) {
|
|
549
|
+
return this.parseOpera9(e);
|
|
550
|
+
} else if (!e.stack) {
|
|
551
|
+
return this.parseOpera10(e);
|
|
552
|
+
} else {
|
|
553
|
+
return this.parseOpera11(e);
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
parseOpera9: function ErrorStackParser$$parseOpera9(e) {
|
|
557
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
558
|
+
var lines = e.message.split('\n');
|
|
559
|
+
var result = [];
|
|
560
|
+
for (var i = 2, len = lines.length; i < len; i += 2) {
|
|
561
|
+
var match = lineRE.exec(lines[i]);
|
|
562
|
+
if (match) {
|
|
563
|
+
result.push(new StackFrame({
|
|
564
|
+
fileName: match[2],
|
|
565
|
+
lineNumber: match[1],
|
|
566
|
+
source: lines[i]
|
|
567
|
+
}));
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return result;
|
|
571
|
+
},
|
|
572
|
+
parseOpera10: function ErrorStackParser$$parseOpera10(e) {
|
|
573
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
574
|
+
var lines = e.stacktrace.split('\n');
|
|
575
|
+
var result = [];
|
|
576
|
+
for (var i = 0, len = lines.length; i < len; i += 2) {
|
|
577
|
+
var match = lineRE.exec(lines[i]);
|
|
578
|
+
if (match) {
|
|
579
|
+
result.push(new StackFrame({
|
|
580
|
+
functionName: match[3] || undefined,
|
|
581
|
+
fileName: match[2],
|
|
582
|
+
lineNumber: match[1],
|
|
583
|
+
source: lines[i]
|
|
584
|
+
}));
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return result;
|
|
588
|
+
},
|
|
589
|
+
parseOpera11: function ErrorStackParser$$parseOpera11(error) {
|
|
590
|
+
var filtered = error.stack.split('\n').filter(function (line) {
|
|
591
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
592
|
+
}, this);
|
|
593
|
+
return filtered.map(function (line) {
|
|
594
|
+
var tokens = line.split('@');
|
|
595
|
+
var locationParts = this.extractLocation(tokens.pop());
|
|
596
|
+
var functionCall = tokens.shift() || '';
|
|
597
|
+
var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, '$2').replace(/\([^)]*\)/g, '') || undefined;
|
|
598
|
+
var argsRaw;
|
|
599
|
+
if (functionCall.match(/\(([^)]*)\)/)) {
|
|
600
|
+
argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1');
|
|
601
|
+
}
|
|
602
|
+
var args = argsRaw === undefined || argsRaw === '[arguments not available]' ? undefined : argsRaw.split(',');
|
|
603
|
+
return new StackFrame({
|
|
604
|
+
functionName: functionName,
|
|
605
|
+
args: args,
|
|
606
|
+
fileName: locationParts[0],
|
|
607
|
+
lineNumber: locationParts[1],
|
|
608
|
+
columnNumber: locationParts[2],
|
|
609
|
+
source: line
|
|
610
|
+
});
|
|
611
|
+
}, this);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
});
|
|
615
|
+
})(errorStackParser);
|
|
616
|
+
var errorStackParserExports = errorStackParser.exports;
|
|
617
|
+
var ErrorStackParser = getDefaultExportFromCjs(errorStackParserExports);
|
|
618
|
+
|
|
204
619
|
var millisecondsPerSecond = 1000;
|
|
205
620
|
var millisecondsPerMinute = millisecondsPerSecond * 60;
|
|
206
621
|
var MILLISECONDS_PER_HOUR = millisecondsPerMinute * 60;
|
|
@@ -208,7 +623,7 @@ function getNowTime() {
|
|
|
208
623
|
return new Date().getTime();
|
|
209
624
|
}
|
|
210
625
|
|
|
211
|
-
var MAX_BATCH_TIME_MS = 10000;
|
|
626
|
+
var MAX_BATCH_TIME_MS = 10000;
|
|
212
627
|
var SESSION_RECORDING_DEFAULT_HEADERS = {
|
|
213
628
|
'Content-Encoding': 'gzip',
|
|
214
629
|
};
|
|
@@ -323,18 +738,8 @@ var MAIN_TRACER_KEY = '@';
|
|
|
323
738
|
var ATTR_PROCESSOR_KEY = 'attrProcessor';
|
|
324
739
|
var SpanStatusCode;
|
|
325
740
|
(function (SpanStatusCode) {
|
|
326
|
-
/**
|
|
327
|
-
* The default status.
|
|
328
|
-
*/
|
|
329
741
|
SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
|
|
330
|
-
/**
|
|
331
|
-
* The operation has been validated by an Application developer or
|
|
332
|
-
* Operator to have completed successfully.
|
|
333
|
-
*/
|
|
334
742
|
SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
|
|
335
|
-
/**
|
|
336
|
-
* The operation contains an error.
|
|
337
|
-
*/
|
|
338
743
|
SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
|
|
339
744
|
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
340
745
|
|
|
@@ -390,7 +795,7 @@ function buildStacktrace(span, err) {
|
|
|
390
795
|
case 0:
|
|
391
796
|
stack = err.stack, message = err.message, name = err.name;
|
|
392
797
|
hasStack = !!(stack === null || stack === void 0 ? void 0 : stack.includes('at '));
|
|
393
|
-
if (!(err && hasStack)) return [3
|
|
798
|
+
if (!(err && hasStack)) return [3, 3];
|
|
394
799
|
supportMfe = getSdkConfig().supportMfe;
|
|
395
800
|
stackFrames = ErrorStackParser.parse({
|
|
396
801
|
stack: stack.substring(0, STACK_LIMIT),
|
|
@@ -405,15 +810,15 @@ function buildStacktrace(span, err) {
|
|
|
405
810
|
functionName: functionName,
|
|
406
811
|
});
|
|
407
812
|
});
|
|
408
|
-
if (!supportMfe) return [3
|
|
409
|
-
return [4
|
|
813
|
+
if (!supportMfe) return [3, 2];
|
|
814
|
+
return [4, handleMFE(stackFrames, span)];
|
|
410
815
|
case 1:
|
|
411
816
|
_a.sent();
|
|
412
817
|
_a.label = 2;
|
|
413
818
|
case 2:
|
|
414
819
|
span[ErrorAttributes.STACK] = stackFrames;
|
|
415
820
|
_a.label = 3;
|
|
416
|
-
case 3: return [2
|
|
821
|
+
case 3: return [2];
|
|
417
822
|
}
|
|
418
823
|
});
|
|
419
824
|
});
|
|
@@ -427,26 +832,25 @@ function handleMFE(stackFrames, span) {
|
|
|
427
832
|
i = 0;
|
|
428
833
|
_b.label = 1;
|
|
429
834
|
case 1:
|
|
430
|
-
if (!(i < stackFrames.length)) return [3
|
|
431
|
-
return [4
|
|
835
|
+
if (!(i < stackFrames.length)) return [3, 4];
|
|
836
|
+
return [4, extractMetadataFromMfeStacktrace(stackFrames[i].fileName)];
|
|
432
837
|
case 2:
|
|
433
838
|
metadata = _b.sent();
|
|
434
839
|
stackFrames[i] = __assign(__assign({}, stackFrames[i]), (metadata || { isShell: true }));
|
|
435
840
|
_b.label = 3;
|
|
436
841
|
case 3:
|
|
437
842
|
i++;
|
|
438
|
-
return [3
|
|
843
|
+
return [3, 1];
|
|
439
844
|
case 4:
|
|
440
|
-
_a = __read
|
|
845
|
+
_a = __read(stackFrames, 1), lastFrame = _a[0];
|
|
441
846
|
addLabelForMFE(span, lastFrame);
|
|
442
|
-
return [2
|
|
847
|
+
return [2];
|
|
443
848
|
}
|
|
444
849
|
});
|
|
445
850
|
});
|
|
446
851
|
}
|
|
447
852
|
function addLabelForMFE(span, lastFrame) {
|
|
448
853
|
var app = lastFrame.app, version = lastFrame.version, isShell = lastFrame.isShell;
|
|
449
|
-
// Do not add label if its shell
|
|
450
854
|
if (!isShell) {
|
|
451
855
|
setCustomLabelsForSpan(span, { mfeApp: app, mfeVersion: version });
|
|
452
856
|
}
|
|
@@ -460,37 +864,36 @@ function extractMetadataFromMfeStacktrace() {
|
|
|
460
864
|
case 0:
|
|
461
865
|
cachedMetadata = CxGlobal[CACHED_METADATA_KEY];
|
|
462
866
|
MFE_METADATA_KEY = 'cx-metadata.json';
|
|
463
|
-
_a = __read
|
|
464
|
-
if (!mfePath) return [3
|
|
867
|
+
_a = __read(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
|
|
868
|
+
if (!mfePath) return [3, 7];
|
|
465
869
|
response = void 0;
|
|
466
|
-
if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3
|
|
870
|
+
if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3, 6];
|
|
467
871
|
_c.label = 1;
|
|
468
872
|
case 1:
|
|
469
873
|
_c.trys.push([1, 4, , 5]);
|
|
470
|
-
return [4
|
|
471
|
-
//this is a browser cache control
|
|
874
|
+
return [4, fetch("".concat(mfePath).concat(MFE_METADATA_KEY), {
|
|
472
875
|
cache: 'no-cache',
|
|
473
876
|
})];
|
|
474
877
|
case 2:
|
|
475
878
|
response = _c.sent();
|
|
476
879
|
_b = [{}];
|
|
477
|
-
return [4
|
|
880
|
+
return [4, response.json()];
|
|
478
881
|
case 3:
|
|
479
882
|
metadata = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), { mfePath: mfePath }]);
|
|
480
|
-
return [3
|
|
883
|
+
return [3, 5];
|
|
481
884
|
case 4:
|
|
482
885
|
e_1 = _c.sent();
|
|
483
886
|
if (getSdkConfig().debug) {
|
|
484
887
|
console.warn('Coralogix Browser SDK - Error fetching metadata', e_1);
|
|
485
888
|
}
|
|
486
|
-
return [3
|
|
889
|
+
return [3, 5];
|
|
487
890
|
case 5:
|
|
488
891
|
CxGlobal[CACHED_METADATA_KEY] = cachedMetadata.set(mfePath, metadata);
|
|
489
|
-
return [3
|
|
892
|
+
return [3, 7];
|
|
490
893
|
case 6:
|
|
491
894
|
metadata = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
|
|
492
895
|
_c.label = 7;
|
|
493
|
-
case 7: return [2
|
|
896
|
+
case 7: return [2, metadata];
|
|
494
897
|
}
|
|
495
898
|
});
|
|
496
899
|
});
|
|
@@ -526,7 +929,7 @@ function addErrorDefaultAttributes(span) {
|
|
|
526
929
|
span.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.ERROR);
|
|
527
930
|
span.setAttribute(CoralogixAttributes.SEVERITY, CoralogixLogSeverity.Error);
|
|
528
931
|
}
|
|
529
|
-
var CoralogixErrorInstrumentation =
|
|
932
|
+
var CoralogixErrorInstrumentation = (function (_super) {
|
|
530
933
|
__extends(CoralogixErrorInstrumentation, _super);
|
|
531
934
|
function CoralogixErrorInstrumentation(config) {
|
|
532
935
|
var _this = _super.call(this, ERROR_INSTRUMENTATION_NAME, ERROR_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -575,7 +978,6 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
575
978
|
this.reportString(source, arg);
|
|
576
979
|
break;
|
|
577
980
|
case arg instanceof Array: {
|
|
578
|
-
// if any arguments are Errors then add the stack trace even though the message is handled differently
|
|
579
981
|
var firstError = arg.find(function (x) { return x instanceof Error; });
|
|
580
982
|
var message = arg
|
|
581
983
|
.map(function (msg) {
|
|
@@ -608,11 +1010,11 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
608
1010
|
if (labels) {
|
|
609
1011
|
setCustomLabelsForSpan(span, labels);
|
|
610
1012
|
}
|
|
611
|
-
return [4
|
|
1013
|
+
return [4, buildStacktrace(span, err)];
|
|
612
1014
|
case 1:
|
|
613
1015
|
_a.sent();
|
|
614
1016
|
span.end();
|
|
615
|
-
return [2
|
|
1017
|
+
return [2];
|
|
616
1018
|
}
|
|
617
1019
|
});
|
|
618
1020
|
});
|
|
@@ -627,14 +1029,14 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
627
1029
|
addErrorDefaultAttributes(span);
|
|
628
1030
|
span.setAttribute(CoralogixAttributes.SOURCE, source);
|
|
629
1031
|
span.setAttribute(ErrorAttributes.MESSAGE, message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT));
|
|
630
|
-
if (!firstError) return [3
|
|
631
|
-
return [4
|
|
1032
|
+
if (!firstError) return [3, 2];
|
|
1033
|
+
return [4, buildStacktrace(span, firstError)];
|
|
632
1034
|
case 1:
|
|
633
1035
|
_a.sent();
|
|
634
1036
|
_a.label = 2;
|
|
635
1037
|
case 2:
|
|
636
1038
|
span.end();
|
|
637
|
-
return [2
|
|
1039
|
+
return [2];
|
|
638
1040
|
}
|
|
639
1041
|
});
|
|
640
1042
|
});
|
|
@@ -673,7 +1075,6 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
673
1075
|
if (message && typeof message === 'string') {
|
|
674
1076
|
return message;
|
|
675
1077
|
}
|
|
676
|
-
// GrpcStatusEvent
|
|
677
1078
|
if (statusMessage && typeof statusMessage === 'string') {
|
|
678
1079
|
return statusMessage;
|
|
679
1080
|
}
|
|
@@ -691,7 +1092,7 @@ var propagateTraceHeaderCorsUrls = function (config) {
|
|
|
691
1092
|
}
|
|
692
1093
|
};
|
|
693
1094
|
|
|
694
|
-
var NetworkDataManager =
|
|
1095
|
+
var NetworkDataManager = (function () {
|
|
695
1096
|
function NetworkDataManager() {
|
|
696
1097
|
var _this = this;
|
|
697
1098
|
this.responseBodyParsers = new Map([
|
|
@@ -699,68 +1100,68 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
699
1100
|
switch (_c.label) {
|
|
700
1101
|
case 0:
|
|
701
1102
|
_b = (_a = JSON).stringify;
|
|
702
|
-
return [4
|
|
703
|
-
case 1: return [2
|
|
1103
|
+
return [4, body.json()];
|
|
1104
|
+
case 1: return [2, _b.apply(_a, [_c.sent()])];
|
|
704
1105
|
}
|
|
705
1106
|
}); }); }],
|
|
706
1107
|
[MimeType.TextPlain, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
707
1108
|
switch (_a.label) {
|
|
708
|
-
case 0: return [4
|
|
709
|
-
case 1: return [2
|
|
1109
|
+
case 0: return [4, body.text()];
|
|
1110
|
+
case 1: return [2, _a.sent()];
|
|
710
1111
|
}
|
|
711
1112
|
}); }); }],
|
|
712
1113
|
[MimeType.TextHtml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
713
1114
|
switch (_a.label) {
|
|
714
|
-
case 0: return [4
|
|
715
|
-
case 1: return [2
|
|
1115
|
+
case 0: return [4, body.text()];
|
|
1116
|
+
case 1: return [2, _a.sent()];
|
|
716
1117
|
}
|
|
717
1118
|
}); }); }],
|
|
718
1119
|
[MimeType.TextCss, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
719
1120
|
switch (_a.label) {
|
|
720
|
-
case 0: return [4
|
|
721
|
-
case 1: return [2
|
|
1121
|
+
case 0: return [4, body.text()];
|
|
1122
|
+
case 1: return [2, _a.sent()];
|
|
722
1123
|
}
|
|
723
1124
|
}); }); }],
|
|
724
1125
|
[MimeType.TextJavascript, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
725
1126
|
switch (_a.label) {
|
|
726
|
-
case 0: return [4
|
|
727
|
-
case 1: return [2
|
|
1127
|
+
case 0: return [4, body.text()];
|
|
1128
|
+
case 1: return [2, _a.sent()];
|
|
728
1129
|
}
|
|
729
1130
|
}); }); }],
|
|
730
1131
|
[MimeType.Xml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
731
1132
|
switch (_a.label) {
|
|
732
|
-
case 0: return [4
|
|
733
|
-
case 1: return [2
|
|
1133
|
+
case 0: return [4, body.text()];
|
|
1134
|
+
case 1: return [2, _a.sent()];
|
|
734
1135
|
}
|
|
735
1136
|
}); }); }],
|
|
736
1137
|
[MimeType.FormData, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
737
1138
|
switch (_a.label) {
|
|
738
|
-
case 0: return [4
|
|
739
|
-
case 1: return [2
|
|
1139
|
+
case 0: return [4, body.text()];
|
|
1140
|
+
case 1: return [2, _a.sent()];
|
|
740
1141
|
}
|
|
741
1142
|
}); }); }],
|
|
742
1143
|
]);
|
|
743
1144
|
this.requestBodySerializers = new Map([
|
|
744
1145
|
[BodyType.String, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
745
|
-
return [2
|
|
1146
|
+
return [2, body];
|
|
746
1147
|
}); }); }],
|
|
747
1148
|
[BodyType.Blob, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
748
|
-
return [2
|
|
1149
|
+
return [2, body.text()];
|
|
749
1150
|
}); }); }],
|
|
750
1151
|
[
|
|
751
1152
|
BodyType.FormData,
|
|
752
1153
|
function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
753
|
-
return [2
|
|
1154
|
+
return [2, this.serializeFormData(body)];
|
|
754
1155
|
}); }); },
|
|
755
1156
|
],
|
|
756
1157
|
[
|
|
757
1158
|
BodyType.URLSearchParams,
|
|
758
1159
|
function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
759
|
-
return [2
|
|
1160
|
+
return [2, body.toString()];
|
|
760
1161
|
}); }); },
|
|
761
1162
|
],
|
|
762
1163
|
[BodyType.JsonObject, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
763
|
-
return [2
|
|
1164
|
+
return [2, JSON.stringify(body)];
|
|
764
1165
|
}); }); }],
|
|
765
1166
|
]);
|
|
766
1167
|
}
|
|
@@ -779,11 +1180,11 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
779
1180
|
switch (_a.label) {
|
|
780
1181
|
case 0:
|
|
781
1182
|
if (!(request === null || request === void 0 ? void 0 : request.body))
|
|
782
|
-
return [2
|
|
783
|
-
return [4
|
|
1183
|
+
return [2, ''];
|
|
1184
|
+
return [4, this.serializeRequestBody(request.body)];
|
|
784
1185
|
case 1:
|
|
785
1186
|
bodyContent = _a.sent();
|
|
786
|
-
return [2
|
|
1187
|
+
return [2, this.truncateIfExceedsLimit(bodyContent)];
|
|
787
1188
|
}
|
|
788
1189
|
});
|
|
789
1190
|
});
|
|
@@ -798,11 +1199,11 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
798
1199
|
mimeType = contentType.split(';')[0].trim();
|
|
799
1200
|
parser = this.responseBodyParsers.get(mimeType);
|
|
800
1201
|
if (!parser)
|
|
801
|
-
return [2
|
|
802
|
-
return [4
|
|
1202
|
+
return [2, ''];
|
|
1203
|
+
return [4, parser(response)];
|
|
803
1204
|
case 1:
|
|
804
1205
|
parsedContent = _a.sent();
|
|
805
|
-
return [2
|
|
1206
|
+
return [2, this.truncateIfExceedsLimit(parsedContent)];
|
|
806
1207
|
}
|
|
807
1208
|
});
|
|
808
1209
|
});
|
|
@@ -817,15 +1218,15 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
817
1218
|
switch (_b.label) {
|
|
818
1219
|
case 0:
|
|
819
1220
|
handler = this.requestBodySerializers.get(body.constructor.name);
|
|
820
|
-
if (!handler) return [3
|
|
821
|
-
return [4
|
|
1221
|
+
if (!handler) return [3, 2];
|
|
1222
|
+
return [4, handler(body)];
|
|
822
1223
|
case 1:
|
|
823
1224
|
_a = _b.sent();
|
|
824
|
-
return [3
|
|
1225
|
+
return [3, 3];
|
|
825
1226
|
case 2:
|
|
826
1227
|
_a = '';
|
|
827
1228
|
_b.label = 3;
|
|
828
|
-
case 3: return [2
|
|
1229
|
+
case 3: return [2, _a];
|
|
829
1230
|
}
|
|
830
1231
|
});
|
|
831
1232
|
});
|
|
@@ -859,7 +1260,7 @@ var BodyType;
|
|
|
859
1260
|
BodyType["Unknown"] = "Unknown";
|
|
860
1261
|
})(BodyType || (BodyType = {}));
|
|
861
1262
|
|
|
862
|
-
var HeadersManager =
|
|
1263
|
+
var HeadersManager = (function () {
|
|
863
1264
|
function HeadersManager() {
|
|
864
1265
|
}
|
|
865
1266
|
HeadersManager.prototype.filterHeaders = function (headersInit, allowedKeys) {
|
|
@@ -895,7 +1296,7 @@ var HeadersManager = /** @class */ (function () {
|
|
|
895
1296
|
}
|
|
896
1297
|
var lines = headersString.trim().split(/\r\n/);
|
|
897
1298
|
lines.forEach(function (line) {
|
|
898
|
-
var _a = __read
|
|
1299
|
+
var _a = __read(line.split(': ', 2), 2), key = _a[0], value = _a[1];
|
|
899
1300
|
if (key && value) {
|
|
900
1301
|
headerMap.set(key.trim().toLowerCase(), value.trim());
|
|
901
1302
|
}
|
|
@@ -925,7 +1326,7 @@ var FetchSource;
|
|
|
925
1326
|
(function (FetchSource) {
|
|
926
1327
|
FetchSource["FETCH"] = "fetch";
|
|
927
1328
|
})(FetchSource || (FetchSource = {}));
|
|
928
|
-
var CoralogixFetchInstrumentation =
|
|
1329
|
+
var CoralogixFetchInstrumentation = (function (_super) {
|
|
929
1330
|
__extends(CoralogixFetchInstrumentation, _super);
|
|
930
1331
|
function CoralogixFetchInstrumentation(config) {
|
|
931
1332
|
var _this = this;
|
|
@@ -952,11 +1353,11 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
952
1353
|
url = span.attributes['http.url'] ||
|
|
953
1354
|
'';
|
|
954
1355
|
resolvedConfig = this.networkDataManager.resolveConfigForUrl(url, networkExtraConfig);
|
|
955
|
-
if (!resolvedConfig) return [3
|
|
956
|
-
return [4
|
|
1356
|
+
if (!resolvedConfig) return [3, 3];
|
|
1357
|
+
return [4, this.setRequestAttributes(span, request, resolvedConfig)];
|
|
957
1358
|
case 1:
|
|
958
1359
|
_b.sent();
|
|
959
|
-
return [4
|
|
1360
|
+
return [4, this.setResponseAttributes(span, response, resolvedConfig)];
|
|
960
1361
|
case 2:
|
|
961
1362
|
_b.sent();
|
|
962
1363
|
_b.label = 3;
|
|
@@ -968,7 +1369,7 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
968
1369
|
_a[CoralogixAttributes.EVENT_TYPE] = CoralogixEventType.NETWORK_REQUEST,
|
|
969
1370
|
_a[CoralogixAttributes.SOURCE] = FetchSource.FETCH,
|
|
970
1371
|
_a));
|
|
971
|
-
return [2
|
|
1372
|
+
return [2];
|
|
972
1373
|
}
|
|
973
1374
|
});
|
|
974
1375
|
});
|
|
@@ -983,11 +1384,11 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
983
1384
|
_b.label = 1;
|
|
984
1385
|
case 1:
|
|
985
1386
|
_b.trys.push([1, 5, , 6]);
|
|
986
|
-
if (!collectReqPayload) return [3
|
|
987
|
-
return [4
|
|
1387
|
+
if (!collectReqPayload) return [3, 3];
|
|
1388
|
+
return [4, this.networkDataManager.stringifyRequestBody(request)];
|
|
988
1389
|
case 2:
|
|
989
1390
|
_a = _b.sent();
|
|
990
|
-
return [3
|
|
1391
|
+
return [3, 4];
|
|
991
1392
|
case 3:
|
|
992
1393
|
_a = undefined;
|
|
993
1394
|
_b.label = 4;
|
|
@@ -1002,14 +1403,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
1002
1403
|
span[NetworkInstrumentationAttributes.REQUEST_HEADERS] =
|
|
1003
1404
|
Object.fromEntries(sanitizedHeaders);
|
|
1004
1405
|
}
|
|
1005
|
-
return [3
|
|
1406
|
+
return [3, 6];
|
|
1006
1407
|
case 5:
|
|
1007
1408
|
error_1 = _b.sent();
|
|
1008
1409
|
if (getSdkConfig().debug) {
|
|
1009
1410
|
console.debug('Error setting request attributes on span:', error_1);
|
|
1010
1411
|
}
|
|
1011
|
-
return [3
|
|
1012
|
-
case 6: return [2
|
|
1412
|
+
return [3, 6];
|
|
1413
|
+
case 6: return [2];
|
|
1013
1414
|
}
|
|
1014
1415
|
});
|
|
1015
1416
|
});
|
|
@@ -1021,15 +1422,15 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
1021
1422
|
switch (_b.label) {
|
|
1022
1423
|
case 0:
|
|
1023
1424
|
resHeaders = networkExtraConfig.resHeaders, collectResPayload = networkExtraConfig.collectResPayload;
|
|
1024
|
-
if (!(result instanceof Response)) return [3
|
|
1425
|
+
if (!(result instanceof Response)) return [3, 6];
|
|
1025
1426
|
_b.label = 1;
|
|
1026
1427
|
case 1:
|
|
1027
1428
|
_b.trys.push([1, 5, , 6]);
|
|
1028
|
-
if (!collectResPayload) return [3
|
|
1029
|
-
return [4
|
|
1429
|
+
if (!collectResPayload) return [3, 3];
|
|
1430
|
+
return [4, this.networkDataManager.stringifyResponseBody(result)];
|
|
1030
1431
|
case 2:
|
|
1031
1432
|
_a = _b.sent();
|
|
1032
|
-
return [3
|
|
1433
|
+
return [3, 4];
|
|
1033
1434
|
case 3:
|
|
1034
1435
|
_a = undefined;
|
|
1035
1436
|
_b.label = 4;
|
|
@@ -1046,14 +1447,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
1046
1447
|
span[NetworkInstrumentationAttributes.RESPONSE_HEADERS] =
|
|
1047
1448
|
Object.fromEntries(sanitizedHeaders);
|
|
1048
1449
|
}
|
|
1049
|
-
return [3
|
|
1450
|
+
return [3, 6];
|
|
1050
1451
|
case 5:
|
|
1051
1452
|
error_2 = _b.sent();
|
|
1052
1453
|
if (getSdkConfig().debug) {
|
|
1053
1454
|
console.debug('Error setting request attributes on span:', error_2);
|
|
1054
1455
|
}
|
|
1055
|
-
return [3
|
|
1056
|
-
case 6: return [2
|
|
1456
|
+
return [3, 6];
|
|
1457
|
+
case 6: return [2];
|
|
1057
1458
|
}
|
|
1058
1459
|
});
|
|
1059
1460
|
});
|
|
@@ -1065,7 +1466,7 @@ var XHRSource;
|
|
|
1065
1466
|
(function (XHRSource) {
|
|
1066
1467
|
XHRSource["XHR"] = "xhr";
|
|
1067
1468
|
})(XHRSource || (XHRSource = {}));
|
|
1068
|
-
var CoralogixXhrInstrumentation =
|
|
1469
|
+
var CoralogixXhrInstrumentation = (function (_super) {
|
|
1069
1470
|
__extends(CoralogixXhrInstrumentation, _super);
|
|
1070
1471
|
function CoralogixXhrInstrumentation(config) {
|
|
1071
1472
|
var _this = this;
|
|
@@ -1120,7 +1521,7 @@ var LogSource;
|
|
|
1120
1521
|
(function (LogSource) {
|
|
1121
1522
|
LogSource["CODE"] = "code";
|
|
1122
1523
|
})(LogSource || (LogSource = {}));
|
|
1123
|
-
var CoralogixCustomLogInstrumentation =
|
|
1524
|
+
var CoralogixCustomLogInstrumentation = (function (_super) {
|
|
1124
1525
|
__extends(CoralogixCustomLogInstrumentation, _super);
|
|
1125
1526
|
function CoralogixCustomLogInstrumentation(config) {
|
|
1126
1527
|
var _a;
|
|
@@ -1152,43 +1553,21 @@ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
|
|
|
1152
1553
|
return CoralogixCustomLogInstrumentation;
|
|
1153
1554
|
}(InstrumentationBase));
|
|
1154
1555
|
|
|
1155
|
-
/**
|
|
1156
|
-
* Checks if value is null or undefined.
|
|
1157
|
-
*
|
|
1158
|
-
* @param value The value to check.
|
|
1159
|
-
* @returns Returns true if value is null or undefined, else false.
|
|
1160
|
-
*/
|
|
1161
1556
|
function isNil(value) {
|
|
1162
1557
|
return value == null;
|
|
1163
1558
|
}
|
|
1164
1559
|
|
|
1165
|
-
/**
|
|
1166
|
-
* Ensures a given value is converted into an array of elements.
|
|
1167
|
-
*
|
|
1168
|
-
* @template T - The type of the input value and the elements in the resulting array.
|
|
1169
|
-
*
|
|
1170
|
-
* @param value - The input value, which can be a single instance of type `T`, an array of instances of type `T`, or a Set of instances of type `T`.
|
|
1171
|
-
*
|
|
1172
|
-
* @returns An array of elements of type `T`. If the input is `null` or `undefined`, returns an empty array.
|
|
1173
|
-
*/
|
|
1174
1560
|
function coerceArray(value) {
|
|
1175
1561
|
if (isNil(value))
|
|
1176
1562
|
return [];
|
|
1177
1563
|
if (value instanceof Set)
|
|
1178
|
-
return __spreadArray([], __read
|
|
1564
|
+
return __spreadArray([], __read(value), false);
|
|
1179
1565
|
return Array.isArray(value) ? value : [value];
|
|
1180
1566
|
}
|
|
1181
1567
|
|
|
1182
1568
|
function isObject(value) {
|
|
1183
1569
|
return typeof value === 'object';
|
|
1184
1570
|
}
|
|
1185
|
-
/**
|
|
1186
|
-
* Creates an object composed of the properties of the input object, excluding the specified paths.
|
|
1187
|
-
*
|
|
1188
|
-
* @param object The source object from which to omit properties.
|
|
1189
|
-
* @param paths An array or a single path (including nested paths) to omit from the source object.
|
|
1190
|
-
* @returns Returns a new object with the specified paths omitted.
|
|
1191
|
-
*/
|
|
1192
1571
|
function omit(object) {
|
|
1193
1572
|
if (object === void 0) { object = {}; }
|
|
1194
1573
|
var paths = [];
|
|
@@ -1199,7 +1578,7 @@ function omit(object) {
|
|
|
1199
1578
|
return {};
|
|
1200
1579
|
var omitter = function (source, pathArray) {
|
|
1201
1580
|
var _a;
|
|
1202
|
-
var _b = __read
|
|
1581
|
+
var _b = __read(pathArray), firstKey = _b[0], remainingKeys = _b.slice(1);
|
|
1203
1582
|
if (!source.hasOwnProperty(firstKey))
|
|
1204
1583
|
return source;
|
|
1205
1584
|
if (!remainingKeys.length) {
|
|
@@ -1208,15 +1587,8 @@ function omit(object) {
|
|
|
1208
1587
|
}
|
|
1209
1588
|
return __assign(__assign({}, source), (_a = {}, _a[firstKey] = omitter(source[firstKey], remainingKeys), _a));
|
|
1210
1589
|
};
|
|
1211
|
-
//@ts-ignore
|
|
1212
1590
|
return coerceArray(paths).reduce(function (result, path) { return omitter(result, path.split('.')); }, object);
|
|
1213
1591
|
}
|
|
1214
|
-
/**
|
|
1215
|
-
* Checks if a Set, Array, Map, or Object is empty.
|
|
1216
|
-
*
|
|
1217
|
-
* @param value - The value to check.
|
|
1218
|
-
* @returns Returns true if the value is an empty Set, Map, Array, String or Object, else false.
|
|
1219
|
-
*/
|
|
1220
1592
|
function isEmpty(value) {
|
|
1221
1593
|
if (isNil(value))
|
|
1222
1594
|
return true;
|
|
@@ -1231,12 +1603,6 @@ function isEmpty(value) {
|
|
|
1231
1603
|
}
|
|
1232
1604
|
return false;
|
|
1233
1605
|
}
|
|
1234
|
-
/**
|
|
1235
|
-
* Checks if a Set, Array, Map, or Object is not empty.
|
|
1236
|
-
*
|
|
1237
|
-
* @param value - The value to check.
|
|
1238
|
-
* @returns Returns false if the value is an empty Set, Map, Array, String or Object, else true.
|
|
1239
|
-
*/
|
|
1240
1606
|
function isNotEmpty(value) {
|
|
1241
1607
|
return !isEmpty(value);
|
|
1242
1608
|
}
|
|
@@ -1577,23 +1943,19 @@ function isPerformanceObserverSupported() {
|
|
|
1577
1943
|
return true;
|
|
1578
1944
|
}
|
|
1579
1945
|
|
|
1580
|
-
var CoralogixWebVitalsInstrumentation =
|
|
1946
|
+
var CoralogixWebVitalsInstrumentation = (function (_super) {
|
|
1581
1947
|
__extends(CoralogixWebVitalsInstrumentation, _super);
|
|
1582
1948
|
function CoralogixWebVitalsInstrumentation(config) {
|
|
1583
1949
|
var _this = _super.call(this, WEB_VITALS_INSTRUMENTATION_NAME, WEB_VITALS_INSTRUMENTATION_VERSION, config) || this;
|
|
1584
1950
|
_this.observers = [];
|
|
1585
1951
|
_this.isSoftNavsEnabled = getSdkConfig().trackSoftNavigations;
|
|
1586
|
-
// function that creates a span for each web vital and reports the data
|
|
1587
|
-
// as attributes
|
|
1588
1952
|
_this.onReport = function (metric) {
|
|
1589
1953
|
if (!metric) {
|
|
1590
1954
|
return;
|
|
1591
1955
|
}
|
|
1592
|
-
// calculate TBT when FCP is reported because TBT is calculated between FCP and TTI
|
|
1593
1956
|
if (metric.name === 'FCP') {
|
|
1594
1957
|
_this.registerToTBTMetric();
|
|
1595
1958
|
}
|
|
1596
|
-
// start the span
|
|
1597
1959
|
var webVitalsSpan = _this.tracer.startSpan(CoralogixEventType.WEB_VITALS);
|
|
1598
1960
|
var metricData = metric.entries ? omit(metric, 'entries') : metric;
|
|
1599
1961
|
metricData = omit(metricData, 'attribution.navigationEntry');
|
|
@@ -1601,9 +1963,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
|
|
|
1601
1963
|
metricData = omit(metricData, 'attribution');
|
|
1602
1964
|
}
|
|
1603
1965
|
webVitalsSpan.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.WEB_VITALS);
|
|
1604
|
-
// add core web vital attributes
|
|
1605
1966
|
webVitalsSpan.setAttribute(WEB_VITALS_INSTRUMENTATION_NAME, JSON.stringify(metricData, getCircularReplacer()));
|
|
1606
|
-
// end the span
|
|
1607
1967
|
webVitalsSpan.end();
|
|
1608
1968
|
};
|
|
1609
1969
|
_this.metrics = isEmpty(config.metrics)
|
|
@@ -1622,27 +1982,21 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
|
|
|
1622
1982
|
CoralogixWebVitalsInstrumentation.prototype.registerToCoreWebVitalMetrics = function () {
|
|
1623
1983
|
var shouldReportSoftNavs = this.isSoftNavsEnabled &&
|
|
1624
1984
|
supportedPerformanceTypes.has(PerformanceTypes.SoftNavigation);
|
|
1625
|
-
// Capture First Input Delay
|
|
1626
1985
|
if (this.metrics.fid) {
|
|
1627
1986
|
onFID(this.onReport);
|
|
1628
1987
|
}
|
|
1629
|
-
// Capture Cumulative Layout Shift
|
|
1630
1988
|
if (this.metrics.cls) {
|
|
1631
1989
|
onCLS(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
|
|
1632
1990
|
}
|
|
1633
|
-
// Capture Largest Contentful Paint
|
|
1634
1991
|
if (this.metrics.lcp) {
|
|
1635
1992
|
onLCP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
|
|
1636
1993
|
}
|
|
1637
|
-
// Capture First Contentful Paint
|
|
1638
1994
|
if (this.metrics.fcp) {
|
|
1639
1995
|
onFCP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
|
|
1640
1996
|
}
|
|
1641
|
-
// Capture Interaction to Next Paint
|
|
1642
1997
|
if (this.metrics.inp) {
|
|
1643
1998
|
onINP(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
|
|
1644
1999
|
}
|
|
1645
|
-
// Capture Time to First Byte
|
|
1646
2000
|
if (this.metrics.ttfb) {
|
|
1647
2001
|
onTTFB(this.onReport, { reportSoftNavs: shouldReportSoftNavs });
|
|
1648
2002
|
}
|
|
@@ -1745,7 +2099,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
|
|
|
1745
2099
|
return CoralogixWebVitalsInstrumentation;
|
|
1746
2100
|
}(InstrumentationBase));
|
|
1747
2101
|
|
|
1748
|
-
var CoralogixLongTaskInstrumentation =
|
|
2102
|
+
var CoralogixLongTaskInstrumentation = (function (_super) {
|
|
1749
2103
|
__extends(CoralogixLongTaskInstrumentation, _super);
|
|
1750
2104
|
function CoralogixLongTaskInstrumentation(config) {
|
|
1751
2105
|
var _this = _super.call(this, LONG_TASKS_INSTRUMENTATION_NAME, LONG_TASK_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -1828,7 +2182,7 @@ function isPatternMatch(str, arr, warnKey) {
|
|
|
1828
2182
|
});
|
|
1829
2183
|
}
|
|
1830
2184
|
|
|
1831
|
-
var CoralogixResourcesInstrumentation =
|
|
2185
|
+
var CoralogixResourcesInstrumentation = (function (_super) {
|
|
1832
2186
|
__extends(CoralogixResourcesInstrumentation, _super);
|
|
1833
2187
|
function CoralogixResourcesInstrumentation(config) {
|
|
1834
2188
|
var _a;
|
|
@@ -1926,9 +2280,6 @@ var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
|
|
|
1926
2280
|
return CoralogixResourcesInstrumentation;
|
|
1927
2281
|
}(InstrumentationBase));
|
|
1928
2282
|
|
|
1929
|
-
/**
|
|
1930
|
-
* Gets the original value for a DOM API that was potentially patched by Zone.js.
|
|
1931
|
-
*/
|
|
1932
2283
|
function getZoneJsOriginalDom(target, name) {
|
|
1933
2284
|
var browserWindow = getCxGlobal();
|
|
1934
2285
|
var original;
|
|
@@ -1942,9 +2293,6 @@ function getZoneJsOriginalDom(target, name) {
|
|
|
1942
2293
|
return original;
|
|
1943
2294
|
}
|
|
1944
2295
|
|
|
1945
|
-
/**
|
|
1946
|
-
* Add event listeners to an event target object.
|
|
1947
|
-
*/
|
|
1948
2296
|
function addEventListeners(eventTarget, eventNames, listener, _a) {
|
|
1949
2297
|
var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;
|
|
1950
2298
|
var resolvedListener = once
|
|
@@ -2048,9 +2396,9 @@ var _a$3;
|
|
|
2048
2396
|
var USER_INTERACTION_INSTRUMENTATION_NAME = 'interactions';
|
|
2049
2397
|
var USER_INTERACTION_INSTRUMENTATION_VERSION = '1';
|
|
2050
2398
|
var DEFAULT_INSTRUMENTED_EVENTS = (_a$3 = {},
|
|
2051
|
-
_a$3["click"
|
|
2399
|
+
_a$3["click"] = true,
|
|
2052
2400
|
_a$3);
|
|
2053
|
-
var CoralogixUserInteractionInstrumentation =
|
|
2401
|
+
var CoralogixUserInteractionInstrumentation = (function (_super) {
|
|
2054
2402
|
__extends(CoralogixUserInteractionInstrumentation, _super);
|
|
2055
2403
|
function CoralogixUserInteractionInstrumentation(config) {
|
|
2056
2404
|
var _this = _super.call(this, USER_INTERACTION_INSTRUMENTATION_NAME, USER_INTERACTION_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2086,7 +2434,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
|
2086
2434
|
],
|
|
2087
2435
|
[CoralogixAttributes.TARGET_ELEMENT, nodeName],
|
|
2088
2436
|
].forEach(function (_a) {
|
|
2089
|
-
var _b = __read
|
|
2437
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
2090
2438
|
span.setAttribute(key, value);
|
|
2091
2439
|
});
|
|
2092
2440
|
}
|
|
@@ -2095,11 +2443,11 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
|
2095
2443
|
var eventsMap = __assign(__assign({}, DEFAULT_INSTRUMENTED_EVENTS), (_a = this._config) === null || _a === void 0 ? void 0 : _a['events']);
|
|
2096
2444
|
var eventNames = Object.entries(eventsMap)
|
|
2097
2445
|
.filter(function (_a) {
|
|
2098
|
-
var _b = __read
|
|
2446
|
+
var _b = __read(_a, 2); _b[0]; var enabled = _b[1];
|
|
2099
2447
|
return enabled;
|
|
2100
2448
|
})
|
|
2101
2449
|
.map(function (_a) {
|
|
2102
|
-
var _b = __read
|
|
2450
|
+
var _b = __read(_a, 1), eventName = _b[0];
|
|
2103
2451
|
return eventName;
|
|
2104
2452
|
});
|
|
2105
2453
|
this.stop = addEventListeners(document, eventNames, this.handler, {
|
|
@@ -2116,7 +2464,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
|
2116
2464
|
|
|
2117
2465
|
var MEMORY_USAGE_INSTRUMENTATION_NAME = 'memory_usage';
|
|
2118
2466
|
var MEMORY_USAGE_INSTRUMENTATION_VERSION = '1.0.0';
|
|
2119
|
-
var MEMORY_USAGE_DEFAULT_INTERVAL = 300000;
|
|
2467
|
+
var MEMORY_USAGE_DEFAULT_INTERVAL = 300000;
|
|
2120
2468
|
|
|
2121
2469
|
function isMeasureUserAgentSpecificMemoryAllowed() {
|
|
2122
2470
|
if (!CxGlobal.crossOriginIsolated) {
|
|
@@ -2139,7 +2487,7 @@ function mapMemoryUsageEntries(memoryUsage) {
|
|
|
2139
2487
|
};
|
|
2140
2488
|
var breakdownEntries = [];
|
|
2141
2489
|
try {
|
|
2142
|
-
for (var _b = __values
|
|
2490
|
+
for (var _b = __values(memoryUsage.breakdown), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2143
2491
|
var entry = _c.value;
|
|
2144
2492
|
if (entry.bytes > 0) {
|
|
2145
2493
|
breakdownEntries.push({
|
|
@@ -2158,10 +2506,10 @@ function mapMemoryUsageEntries(memoryUsage) {
|
|
|
2158
2506
|
}
|
|
2159
2507
|
finally { if (e_1) throw e_1.error; }
|
|
2160
2508
|
}
|
|
2161
|
-
return __spreadArray([parentEntry], __read
|
|
2509
|
+
return __spreadArray([parentEntry], __read(breakdownEntries), false);
|
|
2162
2510
|
}
|
|
2163
2511
|
|
|
2164
|
-
var CoralogixMemoryUsageInstrumentation =
|
|
2512
|
+
var CoralogixMemoryUsageInstrumentation = (function (_super) {
|
|
2165
2513
|
__extends(CoralogixMemoryUsageInstrumentation, _super);
|
|
2166
2514
|
function CoralogixMemoryUsageInstrumentation(config) {
|
|
2167
2515
|
var _this = _super.call(this, MEMORY_USAGE_INSTRUMENTATION_NAME, MEMORY_USAGE_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2188,12 +2536,12 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
|
|
|
2188
2536
|
switch (_b.label) {
|
|
2189
2537
|
case 0:
|
|
2190
2538
|
_b.trys.push([0, 2, , 3]);
|
|
2191
|
-
return [4
|
|
2539
|
+
return [4, performance.measureUserAgentSpecificMemory()];
|
|
2192
2540
|
case 1:
|
|
2193
2541
|
memoryUsage = _b.sent();
|
|
2194
2542
|
memoryUsageEntries = mapMemoryUsageEntries(memoryUsage);
|
|
2195
2543
|
try {
|
|
2196
|
-
for (memoryUsageEntries_1 = __values
|
|
2544
|
+
for (memoryUsageEntries_1 = __values(memoryUsageEntries), memoryUsageEntries_1_1 = memoryUsageEntries_1.next(); !memoryUsageEntries_1_1.done; memoryUsageEntries_1_1 = memoryUsageEntries_1.next()) {
|
|
2197
2545
|
entry = memoryUsageEntries_1_1.value;
|
|
2198
2546
|
memoryUsageSpan = this.tracer.startSpan(MEMORY_USAGE_INSTRUMENTATION_NAME);
|
|
2199
2547
|
memoryUsageSpan[CoralogixAttributes.EVENT_TYPE] =
|
|
@@ -2209,13 +2557,13 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
|
|
|
2209
2557
|
}
|
|
2210
2558
|
finally { if (e_1) throw e_1.error; }
|
|
2211
2559
|
}
|
|
2212
|
-
return [3
|
|
2560
|
+
return [3, 3];
|
|
2213
2561
|
case 2:
|
|
2214
2562
|
error_1 = _b.sent();
|
|
2215
2563
|
console.warn('Memory usage measurement failed', error_1);
|
|
2216
2564
|
this.clearMeasurementsInterval();
|
|
2217
|
-
return [3
|
|
2218
|
-
case 3: return [2
|
|
2565
|
+
return [3, 3];
|
|
2566
|
+
case 3: return [2];
|
|
2219
2567
|
}
|
|
2220
2568
|
});
|
|
2221
2569
|
});
|
|
@@ -2228,11 +2576,11 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
|
|
|
2228
2576
|
return __awaiter(this, void 0, void 0, function () {
|
|
2229
2577
|
return __generator(this, function (_a) {
|
|
2230
2578
|
switch (_a.label) {
|
|
2231
|
-
case 0: return [4
|
|
2579
|
+
case 0: return [4, this.createMemorySample()];
|
|
2232
2580
|
case 1:
|
|
2233
2581
|
_a.sent();
|
|
2234
2582
|
this.runMemoryMeasurements();
|
|
2235
|
-
return [2
|
|
2583
|
+
return [2];
|
|
2236
2584
|
}
|
|
2237
2585
|
});
|
|
2238
2586
|
});
|
|
@@ -2248,7 +2596,7 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
|
|
|
2248
2596
|
var SCREENSHOT_INSTRUMENTATION_NAME = 'screenshot';
|
|
2249
2597
|
var SCREENSHOT_INSTRUMENTATION_VERSION = '1.0.0';
|
|
2250
2598
|
|
|
2251
|
-
var CoralogixScreenshotInstrumentation =
|
|
2599
|
+
var CoralogixScreenshotInstrumentation = (function (_super) {
|
|
2252
2600
|
__extends(CoralogixScreenshotInstrumentation, _super);
|
|
2253
2601
|
function CoralogixScreenshotInstrumentation(config) {
|
|
2254
2602
|
return _super.call(this, SCREENSHOT_INSTRUMENTATION_NAME, SCREENSHOT_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2272,7 +2620,7 @@ var CoralogixScreenshotInstrumentation = /** @class */ (function (_super) {
|
|
|
2272
2620
|
return CoralogixScreenshotInstrumentation;
|
|
2273
2621
|
}(InstrumentationBase));
|
|
2274
2622
|
|
|
2275
|
-
var TimeMeasurementTracker =
|
|
2623
|
+
var TimeMeasurementTracker = (function () {
|
|
2276
2624
|
function TimeMeasurementTracker() {
|
|
2277
2625
|
this.measurements = new Map();
|
|
2278
2626
|
}
|
|
@@ -2310,7 +2658,7 @@ var TimeMeasurementTracker = /** @class */ (function () {
|
|
|
2310
2658
|
return TimeMeasurementTracker;
|
|
2311
2659
|
}());
|
|
2312
2660
|
|
|
2313
|
-
var CoralogixCustomMeasurementInstrumentation =
|
|
2661
|
+
var CoralogixCustomMeasurementInstrumentation = (function (_super) {
|
|
2314
2662
|
__extends(CoralogixCustomMeasurementInstrumentation, _super);
|
|
2315
2663
|
function CoralogixCustomMeasurementInstrumentation(config) {
|
|
2316
2664
|
return _super.call(this, CUSTOM_MEASUREMENT_INSTRUMENTATION_NAME, CUSTOM_MEASUREMENT_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2335,7 +2683,7 @@ var CoralogixCustomMeasurementInstrumentation = /** @class */ (function (_super)
|
|
|
2335
2683
|
}(InstrumentationBase));
|
|
2336
2684
|
|
|
2337
2685
|
var INTERNAL_INSTRUMENTATION_VERSION = '1';
|
|
2338
|
-
var CoralogixInternalInstrumentation =
|
|
2686
|
+
var CoralogixInternalInstrumentation = (function (_super) {
|
|
2339
2687
|
__extends(CoralogixInternalInstrumentation, _super);
|
|
2340
2688
|
function CoralogixInternalInstrumentation(config) {
|
|
2341
2689
|
return _super.call(this, CoralogixEventType.INTERNAL, INTERNAL_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2382,8 +2730,7 @@ var CoralogixInternalInstrumentation = /** @class */ (function (_super) {
|
|
|
2382
2730
|
return CoralogixInternalInstrumentation;
|
|
2383
2731
|
}(InstrumentationBase));
|
|
2384
2732
|
|
|
2385
|
-
|
|
2386
|
-
var CoralogixDOMInstrumentation = /** @class */ (function (_super) {
|
|
2733
|
+
var CoralogixDOMInstrumentation = (function (_super) {
|
|
2387
2734
|
__extends(CoralogixDOMInstrumentation, _super);
|
|
2388
2735
|
function CoralogixDOMInstrumentation(config) {
|
|
2389
2736
|
var _this = _super.call(this, DOM_INSTRUMENTATION_NAME, DOM_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2428,7 +2775,7 @@ var WORKER_EVENTS = {
|
|
|
2428
2775
|
MESSAGE_ERROR: 'messageerror',
|
|
2429
2776
|
};
|
|
2430
2777
|
|
|
2431
|
-
var CoralogixWorkerInstrumentation =
|
|
2778
|
+
var CoralogixWorkerInstrumentation = (function (_super) {
|
|
2432
2779
|
__extends(CoralogixWorkerInstrumentation, _super);
|
|
2433
2780
|
function CoralogixWorkerInstrumentation(config, errorInstrumentation, coralogixRum) {
|
|
2434
2781
|
var _this = _super.call(this, WORKER_INSTRUMENTATION, WORKER_INSTRUMENTATION_VERSION, config) || this;
|
|
@@ -2446,7 +2793,7 @@ var CoralogixWorkerInstrumentation = /** @class */ (function (_super) {
|
|
|
2446
2793
|
};
|
|
2447
2794
|
CoralogixWorkerInstrumentation.prototype.createCxWorker = function (OriginalWorker) {
|
|
2448
2795
|
var self = this;
|
|
2449
|
-
var CxWorker =
|
|
2796
|
+
var CxWorker = (function (_super) {
|
|
2450
2797
|
__extends(CxWorker, _super);
|
|
2451
2798
|
function CxWorker(scriptURL, options) {
|
|
2452
2799
|
var _this = _super.call(this, scriptURL, options) || this;
|
|
@@ -2539,10 +2886,6 @@ var OPTIONS_DEFAULTS = {
|
|
|
2539
2886
|
urlBlueprinters: defaultUrlBlueprinters,
|
|
2540
2887
|
collectIPData: true,
|
|
2541
2888
|
};
|
|
2542
|
-
/**
|
|
2543
|
-
* Note: For any instrumentation added to CoralogixOtelWebOptionsInstrumentations,
|
|
2544
|
-
* The `confKey` must match one of its keys.
|
|
2545
|
-
*/
|
|
2546
2889
|
var INSTRUMENTATIONS = [
|
|
2547
2890
|
{
|
|
2548
2891
|
Instrument: CoralogixErrorInstrumentation,
|
|
@@ -2640,13 +2983,13 @@ var CoralogixAttributes = {
|
|
|
2640
2983
|
SCREENSHOT_CONTEXT: 'screenshot_context',
|
|
2641
2984
|
};
|
|
2642
2985
|
var CoralogixDomainsApiUrlMap = {
|
|
2643
|
-
EU1: 'https://ingress.eu1.rum-ingress-coralogix.com',
|
|
2644
|
-
EU2: 'https://ingress.eu2.rum-ingress-coralogix.com',
|
|
2645
|
-
US1: 'https://ingress.us1.rum-ingress-coralogix.com',
|
|
2646
|
-
US2: 'https://ingress.us2.rum-ingress-coralogix.com',
|
|
2647
|
-
AP1: 'https://ingress.ap1.rum-ingress-coralogix.com',
|
|
2648
|
-
AP2: 'https://ingress.ap2.rum-ingress-coralogix.com',
|
|
2649
|
-
AP3: 'https://ingress.ap3.rum-ingress-coralogix.com',
|
|
2986
|
+
EU1: 'https://ingress.eu1.rum-ingress-coralogix.com',
|
|
2987
|
+
EU2: 'https://ingress.eu2.rum-ingress-coralogix.com',
|
|
2988
|
+
US1: 'https://ingress.us1.rum-ingress-coralogix.com',
|
|
2989
|
+
US2: 'https://ingress.us2.rum-ingress-coralogix.com',
|
|
2990
|
+
AP1: 'https://ingress.ap1.rum-ingress-coralogix.com',
|
|
2991
|
+
AP2: 'https://ingress.ap2.rum-ingress-coralogix.com',
|
|
2992
|
+
AP3: 'https://ingress.ap3.rum-ingress-coralogix.com',
|
|
2650
2993
|
STAGING: 'https://ingress.staging.rum-ingress-coralogix.com',
|
|
2651
2994
|
};
|
|
2652
2995
|
var PROXY_CX_FORWARD_PARAMETER = 'cxforward';
|
|
@@ -2687,7 +3030,7 @@ function getInstrumentationConfig(value, defaults, defaultDisable) {
|
|
|
2687
3030
|
return Object.assign({}, defaults, value);
|
|
2688
3031
|
}
|
|
2689
3032
|
var hrTimeToMilliseconds = function (_a) {
|
|
2690
|
-
var _b = __read
|
|
3033
|
+
var _b = __read(_a, 2), seconds = _b[0], nanoseconds = _b[1];
|
|
2691
3034
|
return seconds * 1000 + Math.round(nanoseconds / 1e6);
|
|
2692
3035
|
};
|
|
2693
3036
|
var isNetworkError = function (status) {
|
|
@@ -2756,8 +3099,8 @@ function parseUserAgent(userAgent) {
|
|
|
2756
3099
|
var osVersion = 'Unknown';
|
|
2757
3100
|
var device = 'Desktop';
|
|
2758
3101
|
try {
|
|
2759
|
-
for (var _g = __values
|
|
2760
|
-
var _j = __read
|
|
3102
|
+
for (var _g = __values(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
3103
|
+
var _j = __read(_h.value, 2), name_1 = _j[0], regex = _j[1];
|
|
2761
3104
|
var match = userAgent.match(regex);
|
|
2762
3105
|
if (match) {
|
|
2763
3106
|
browser = name_1;
|
|
@@ -2774,8 +3117,8 @@ function parseUserAgent(userAgent) {
|
|
|
2774
3117
|
finally { if (e_1) throw e_1.error; }
|
|
2775
3118
|
}
|
|
2776
3119
|
try {
|
|
2777
|
-
for (var _k = __values
|
|
2778
|
-
var _m = __read
|
|
3120
|
+
for (var _k = __values(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
3121
|
+
var _m = __read(_l.value, 2), name_2 = _m[0], regex = _m[1];
|
|
2779
3122
|
var match = userAgent.match(regex);
|
|
2780
3123
|
if (match) {
|
|
2781
3124
|
os = name_2;
|
|
@@ -2792,8 +3135,8 @@ function parseUserAgent(userAgent) {
|
|
|
2792
3135
|
finally { if (e_2) throw e_2.error; }
|
|
2793
3136
|
}
|
|
2794
3137
|
try {
|
|
2795
|
-
for (var _o = __values
|
|
2796
|
-
var _q = __read
|
|
3138
|
+
for (var _o = __values(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
3139
|
+
var _q = __read(_p.value, 2), name_3 = _q[0], regex = _q[1];
|
|
2797
3140
|
var match = userAgent.match(regex);
|
|
2798
3141
|
if (match) {
|
|
2799
3142
|
device = name_3;
|
|
@@ -2819,8 +3162,7 @@ function calculateTotalBlockingTime(list) {
|
|
|
2819
3162
|
function generateWebVitalUniqueID() {
|
|
2820
3163
|
return "v3-".concat(getNowTime(), "-").concat(Math.floor(Math.random() * (9e12 - 1)) + 1e12);
|
|
2821
3164
|
}
|
|
2822
|
-
function rateForTBTMetricValue(value
|
|
2823
|
-
) {
|
|
3165
|
+
function rateForTBTMetricValue(value) {
|
|
2824
3166
|
switch (true) {
|
|
2825
3167
|
case value > 600:
|
|
2826
3168
|
return 'poor';
|
|
@@ -2835,8 +3177,8 @@ function flattenAttributes(attributes) {
|
|
|
2835
3177
|
var customLabels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
|
|
2836
3178
|
var flatAttributes = omit(attributes, CoralogixAttributes.CUSTOM_LABELS);
|
|
2837
3179
|
try {
|
|
2838
|
-
for (var _b = __values
|
|
2839
|
-
var _d = __read
|
|
3180
|
+
for (var _b = __values(Object.entries(customLabels)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3181
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
2840
3182
|
flatAttributes[key] =
|
|
2841
3183
|
typeof value !== 'string' ? JSON.stringify(value) : value;
|
|
2842
3184
|
}
|
|
@@ -2867,7 +3209,7 @@ function replacePatternsInUrl(_a) {
|
|
|
2867
3209
|
var patterns = _a.patterns, url = _a.url;
|
|
2868
3210
|
var modifiedUrl = url;
|
|
2869
3211
|
try {
|
|
2870
|
-
for (var patterns_1 = __values
|
|
3212
|
+
for (var patterns_1 = __values(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {
|
|
2871
3213
|
var _c = patterns_1_1.value, pattern = _c.pattern, replacement = _c.replacement;
|
|
2872
3214
|
modifiedUrl = modifiedUrl.replace(pattern, replacement);
|
|
2873
3215
|
}
|
|
@@ -2909,7 +3251,7 @@ function partition(array, predicate) {
|
|
|
2909
3251
|
var truthyValues = [];
|
|
2910
3252
|
var falsyValues = [];
|
|
2911
3253
|
try {
|
|
2912
|
-
for (var array_1 = __values
|
|
3254
|
+
for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
|
|
2913
3255
|
var element = array_1_1.value;
|
|
2914
3256
|
if (predicate(element)) {
|
|
2915
3257
|
truthyValues.push(element);
|
|
@@ -2929,7 +3271,7 @@ function partition(array, predicate) {
|
|
|
2929
3271
|
return [truthyValues, falsyValues];
|
|
2930
3272
|
}
|
|
2931
3273
|
|
|
2932
|
-
var CoralogixSpanAttributesProcessor =
|
|
3274
|
+
var CoralogixSpanAttributesProcessor = (function () {
|
|
2933
3275
|
function CoralogixSpanAttributesProcessor(labels) {
|
|
2934
3276
|
var _a;
|
|
2935
3277
|
this.labels = (_a = {},
|
|
@@ -2985,528 +3327,6 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
|
2985
3327
|
return CoralogixSpanAttributesProcessor;
|
|
2986
3328
|
}());
|
|
2987
3329
|
|
|
2988
|
-
/*
|
|
2989
|
-
* Copyright The OpenTelemetry Authors
|
|
2990
|
-
*
|
|
2991
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2992
|
-
* you may not use this file except in compliance with the License.
|
|
2993
|
-
* You may obtain a copy of the License at
|
|
2994
|
-
*
|
|
2995
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
2996
|
-
*
|
|
2997
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2998
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2999
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3000
|
-
* See the License for the specific language governing permissions and
|
|
3001
|
-
* limitations under the License.
|
|
3002
|
-
*/
|
|
3003
|
-
var SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
|
|
3004
|
-
function isTracingSuppressed(context) {
|
|
3005
|
-
return context.getValue(SUPPRESS_TRACING_KEY) === true;
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
|
-
/*
|
|
3009
|
-
* Copyright The OpenTelemetry Authors
|
|
3010
|
-
*
|
|
3011
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3012
|
-
* you may not use this file except in compliance with the License.
|
|
3013
|
-
* You may obtain a copy of the License at
|
|
3014
|
-
*
|
|
3015
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3016
|
-
*
|
|
3017
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3018
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3019
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3020
|
-
* See the License for the specific language governing permissions and
|
|
3021
|
-
* limitations under the License.
|
|
3022
|
-
*/
|
|
3023
|
-
var BAGGAGE_KEY_PAIR_SEPARATOR = '=';
|
|
3024
|
-
var BAGGAGE_PROPERTIES_SEPARATOR = ';';
|
|
3025
|
-
var BAGGAGE_ITEMS_SEPARATOR = ',';
|
|
3026
|
-
// Name of the http header used to propagate the baggage
|
|
3027
|
-
var BAGGAGE_HEADER = 'baggage';
|
|
3028
|
-
// Maximum number of name-value pairs allowed by w3c spec
|
|
3029
|
-
var BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;
|
|
3030
|
-
// Maximum number of bytes per a single name-value pair allowed by w3c spec
|
|
3031
|
-
var BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
|
|
3032
|
-
// Maximum total length of all name-value pairs allowed by w3c spec
|
|
3033
|
-
var BAGGAGE_MAX_TOTAL_LENGTH = 8192;
|
|
3034
|
-
|
|
3035
|
-
var __read = undefined && undefined.__read || function (o, n) {
|
|
3036
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3037
|
-
if (!m) return o;
|
|
3038
|
-
var i = m.call(o),
|
|
3039
|
-
r,
|
|
3040
|
-
ar = [],
|
|
3041
|
-
e;
|
|
3042
|
-
try {
|
|
3043
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
3044
|
-
} catch (error) {
|
|
3045
|
-
e = {
|
|
3046
|
-
error: error
|
|
3047
|
-
};
|
|
3048
|
-
} finally {
|
|
3049
|
-
try {
|
|
3050
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
3051
|
-
} finally {
|
|
3052
|
-
if (e) throw e.error;
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
return ar;
|
|
3056
|
-
};
|
|
3057
|
-
function serializeKeyPairs(keyPairs) {
|
|
3058
|
-
return keyPairs.reduce(function (hValue, current) {
|
|
3059
|
-
var value = "" + hValue + (hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : '') + current;
|
|
3060
|
-
return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;
|
|
3061
|
-
}, '');
|
|
3062
|
-
}
|
|
3063
|
-
function getKeyPairs(baggage) {
|
|
3064
|
-
return baggage.getAllEntries().map(function (_a) {
|
|
3065
|
-
var _b = __read(_a, 2),
|
|
3066
|
-
key = _b[0],
|
|
3067
|
-
value = _b[1];
|
|
3068
|
-
var entry = encodeURIComponent(key) + "=" + encodeURIComponent(value.value);
|
|
3069
|
-
// include opaque metadata if provided
|
|
3070
|
-
// NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation
|
|
3071
|
-
if (value.metadata !== undefined) {
|
|
3072
|
-
entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();
|
|
3073
|
-
}
|
|
3074
|
-
return entry;
|
|
3075
|
-
});
|
|
3076
|
-
}
|
|
3077
|
-
function parsePairKeyValue(entry) {
|
|
3078
|
-
var valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);
|
|
3079
|
-
if (valueProps.length <= 0) return;
|
|
3080
|
-
var keyPairPart = valueProps.shift();
|
|
3081
|
-
if (!keyPairPart) return;
|
|
3082
|
-
var separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);
|
|
3083
|
-
if (separatorIndex <= 0) return;
|
|
3084
|
-
var key = decodeURIComponent(keyPairPart.substring(0, separatorIndex).trim());
|
|
3085
|
-
var value = decodeURIComponent(keyPairPart.substring(separatorIndex + 1).trim());
|
|
3086
|
-
var metadata;
|
|
3087
|
-
if (valueProps.length > 0) {
|
|
3088
|
-
metadata = baggageEntryMetadataFromString(valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR));
|
|
3089
|
-
}
|
|
3090
|
-
return {
|
|
3091
|
-
key: key,
|
|
3092
|
-
value: value,
|
|
3093
|
-
metadata: metadata
|
|
3094
|
-
};
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
|
-
/*
|
|
3098
|
-
* Copyright The OpenTelemetry Authors
|
|
3099
|
-
*
|
|
3100
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3101
|
-
* you may not use this file except in compliance with the License.
|
|
3102
|
-
* You may obtain a copy of the License at
|
|
3103
|
-
*
|
|
3104
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3105
|
-
*
|
|
3106
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3107
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3108
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3109
|
-
* See the License for the specific language governing permissions and
|
|
3110
|
-
* limitations under the License.
|
|
3111
|
-
*/
|
|
3112
|
-
/**
|
|
3113
|
-
* Propagates {@link Baggage} through Context format propagation.
|
|
3114
|
-
*
|
|
3115
|
-
* Based on the Baggage specification:
|
|
3116
|
-
* https://w3c.github.io/baggage/
|
|
3117
|
-
*/
|
|
3118
|
-
var W3CBaggagePropagator = /** @class */function () {
|
|
3119
|
-
function W3CBaggagePropagator() {}
|
|
3120
|
-
W3CBaggagePropagator.prototype.inject = function (context, carrier, setter) {
|
|
3121
|
-
var baggage = propagation.getBaggage(context);
|
|
3122
|
-
if (!baggage || isTracingSuppressed(context)) return;
|
|
3123
|
-
var keyPairs = getKeyPairs(baggage).filter(function (pair) {
|
|
3124
|
-
return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
|
|
3125
|
-
}).slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);
|
|
3126
|
-
var headerValue = serializeKeyPairs(keyPairs);
|
|
3127
|
-
if (headerValue.length > 0) {
|
|
3128
|
-
setter.set(carrier, BAGGAGE_HEADER, headerValue);
|
|
3129
|
-
}
|
|
3130
|
-
};
|
|
3131
|
-
W3CBaggagePropagator.prototype.extract = function (context, carrier, getter) {
|
|
3132
|
-
var headerValue = getter.get(carrier, BAGGAGE_HEADER);
|
|
3133
|
-
var baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
|
|
3134
|
-
if (!baggageString) return context;
|
|
3135
|
-
var baggage = {};
|
|
3136
|
-
if (baggageString.length === 0) {
|
|
3137
|
-
return context;
|
|
3138
|
-
}
|
|
3139
|
-
var pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
|
|
3140
|
-
pairs.forEach(function (entry) {
|
|
3141
|
-
var keyPair = parsePairKeyValue(entry);
|
|
3142
|
-
if (keyPair) {
|
|
3143
|
-
var baggageEntry = {
|
|
3144
|
-
value: keyPair.value
|
|
3145
|
-
};
|
|
3146
|
-
if (keyPair.metadata) {
|
|
3147
|
-
baggageEntry.metadata = keyPair.metadata;
|
|
3148
|
-
}
|
|
3149
|
-
baggage[keyPair.key] = baggageEntry;
|
|
3150
|
-
}
|
|
3151
|
-
});
|
|
3152
|
-
if (Object.entries(baggage).length === 0) {
|
|
3153
|
-
return context;
|
|
3154
|
-
}
|
|
3155
|
-
return propagation.setBaggage(context, propagation.createBaggage(baggage));
|
|
3156
|
-
};
|
|
3157
|
-
W3CBaggagePropagator.prototype.fields = function () {
|
|
3158
|
-
return [BAGGAGE_HEADER];
|
|
3159
|
-
};
|
|
3160
|
-
return W3CBaggagePropagator;
|
|
3161
|
-
}();
|
|
3162
|
-
|
|
3163
|
-
/*
|
|
3164
|
-
* Copyright The OpenTelemetry Authors
|
|
3165
|
-
*
|
|
3166
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3167
|
-
* you may not use this file except in compliance with the License.
|
|
3168
|
-
* You may obtain a copy of the License at
|
|
3169
|
-
*
|
|
3170
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3171
|
-
*
|
|
3172
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3173
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3174
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3175
|
-
* See the License for the specific language governing permissions and
|
|
3176
|
-
* limitations under the License.
|
|
3177
|
-
*/
|
|
3178
|
-
var ExportResultCode;
|
|
3179
|
-
(function (ExportResultCode) {
|
|
3180
|
-
ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
|
|
3181
|
-
ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
|
|
3182
|
-
})(ExportResultCode || (ExportResultCode = {}));
|
|
3183
|
-
|
|
3184
|
-
/*
|
|
3185
|
-
* Copyright The OpenTelemetry Authors
|
|
3186
|
-
*
|
|
3187
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3188
|
-
* you may not use this file except in compliance with the License.
|
|
3189
|
-
* You may obtain a copy of the License at
|
|
3190
|
-
*
|
|
3191
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3192
|
-
*
|
|
3193
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3194
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3195
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3196
|
-
* See the License for the specific language governing permissions and
|
|
3197
|
-
* limitations under the License.
|
|
3198
|
-
*/
|
|
3199
|
-
var __values = undefined && undefined.__values || function (o) {
|
|
3200
|
-
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
3201
|
-
m = s && o[s],
|
|
3202
|
-
i = 0;
|
|
3203
|
-
if (m) return m.call(o);
|
|
3204
|
-
if (o && typeof o.length === "number") return {
|
|
3205
|
-
next: function next() {
|
|
3206
|
-
if (o && i >= o.length) o = void 0;
|
|
3207
|
-
return {
|
|
3208
|
-
value: o && o[i++],
|
|
3209
|
-
done: !o
|
|
3210
|
-
};
|
|
3211
|
-
}
|
|
3212
|
-
};
|
|
3213
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
3214
|
-
};
|
|
3215
|
-
/** Combines multiple propagators into a single propagator. */
|
|
3216
|
-
var CompositePropagator = /** @class */function () {
|
|
3217
|
-
/**
|
|
3218
|
-
* Construct a composite propagator from a list of propagators.
|
|
3219
|
-
*
|
|
3220
|
-
* @param [config] Configuration object for composite propagator
|
|
3221
|
-
*/
|
|
3222
|
-
function CompositePropagator(config) {
|
|
3223
|
-
if (config === void 0) {
|
|
3224
|
-
config = {};
|
|
3225
|
-
}
|
|
3226
|
-
var _a;
|
|
3227
|
-
this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
|
|
3228
|
-
this._fields = Array.from(new Set(this._propagators
|
|
3229
|
-
// older propagators may not have fields function, null check to be sure
|
|
3230
|
-
.map(function (p) {
|
|
3231
|
-
return typeof p.fields === 'function' ? p.fields() : [];
|
|
3232
|
-
}).reduce(function (x, y) {
|
|
3233
|
-
return x.concat(y);
|
|
3234
|
-
}, [])));
|
|
3235
|
-
}
|
|
3236
|
-
/**
|
|
3237
|
-
* Run each of the configured propagators with the given context and carrier.
|
|
3238
|
-
* Propagators are run in the order they are configured, so if multiple
|
|
3239
|
-
* propagators write the same carrier key, the propagator later in the list
|
|
3240
|
-
* will "win".
|
|
3241
|
-
*
|
|
3242
|
-
* @param context Context to inject
|
|
3243
|
-
* @param carrier Carrier into which context will be injected
|
|
3244
|
-
*/
|
|
3245
|
-
CompositePropagator.prototype.inject = function (context, carrier, setter) {
|
|
3246
|
-
var e_1, _a;
|
|
3247
|
-
try {
|
|
3248
|
-
for (var _b = __values(this._propagators), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3249
|
-
var propagator = _c.value;
|
|
3250
|
-
try {
|
|
3251
|
-
propagator.inject(context, carrier, setter);
|
|
3252
|
-
} catch (err) {
|
|
3253
|
-
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
} catch (e_1_1) {
|
|
3257
|
-
e_1 = {
|
|
3258
|
-
error: e_1_1
|
|
3259
|
-
};
|
|
3260
|
-
} finally {
|
|
3261
|
-
try {
|
|
3262
|
-
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
3263
|
-
} finally {
|
|
3264
|
-
if (e_1) throw e_1.error;
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
};
|
|
3268
|
-
/**
|
|
3269
|
-
* Run each of the configured propagators with the given context and carrier.
|
|
3270
|
-
* Propagators are run in the order they are configured, so if multiple
|
|
3271
|
-
* propagators write the same context key, the propagator later in the list
|
|
3272
|
-
* will "win".
|
|
3273
|
-
*
|
|
3274
|
-
* @param context Context to add values to
|
|
3275
|
-
* @param carrier Carrier from which to extract context
|
|
3276
|
-
*/
|
|
3277
|
-
CompositePropagator.prototype.extract = function (context, carrier, getter) {
|
|
3278
|
-
return this._propagators.reduce(function (ctx, propagator) {
|
|
3279
|
-
try {
|
|
3280
|
-
return propagator.extract(ctx, carrier, getter);
|
|
3281
|
-
} catch (err) {
|
|
3282
|
-
diag.warn("Failed to inject with " + propagator.constructor.name + ". Err: " + err.message);
|
|
3283
|
-
}
|
|
3284
|
-
return ctx;
|
|
3285
|
-
}, context);
|
|
3286
|
-
};
|
|
3287
|
-
CompositePropagator.prototype.fields = function () {
|
|
3288
|
-
// return a new array so our fields cannot be modified
|
|
3289
|
-
return this._fields.slice();
|
|
3290
|
-
};
|
|
3291
|
-
return CompositePropagator;
|
|
3292
|
-
}();
|
|
3293
|
-
|
|
3294
|
-
/*
|
|
3295
|
-
* Copyright The OpenTelemetry Authors
|
|
3296
|
-
*
|
|
3297
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3298
|
-
* you may not use this file except in compliance with the License.
|
|
3299
|
-
* You may obtain a copy of the License at
|
|
3300
|
-
*
|
|
3301
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3302
|
-
*
|
|
3303
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3304
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3305
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3306
|
-
* See the License for the specific language governing permissions and
|
|
3307
|
-
* limitations under the License.
|
|
3308
|
-
*/
|
|
3309
|
-
var VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';
|
|
3310
|
-
var VALID_KEY = "[a-z]" + VALID_KEY_CHAR_RANGE + "{0,255}";
|
|
3311
|
-
var VALID_VENDOR_KEY = "[a-z0-9]" + VALID_KEY_CHAR_RANGE + "{0,240}@[a-z]" + VALID_KEY_CHAR_RANGE + "{0,13}";
|
|
3312
|
-
var VALID_KEY_REGEX = new RegExp("^(?:" + VALID_KEY + "|" + VALID_VENDOR_KEY + ")$");
|
|
3313
|
-
var VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;
|
|
3314
|
-
var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
|
|
3315
|
-
/**
|
|
3316
|
-
* Key is opaque string up to 256 characters printable. It MUST begin with a
|
|
3317
|
-
* lowercase letter, and can only contain lowercase letters a-z, digits 0-9,
|
|
3318
|
-
* underscores _, dashes -, asterisks *, and forward slashes /.
|
|
3319
|
-
* For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the
|
|
3320
|
-
* vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.
|
|
3321
|
-
* see https://www.w3.org/TR/trace-context/#key
|
|
3322
|
-
*/
|
|
3323
|
-
function validateKey(key) {
|
|
3324
|
-
return VALID_KEY_REGEX.test(key);
|
|
3325
|
-
}
|
|
3326
|
-
/**
|
|
3327
|
-
* Value is opaque string up to 256 characters printable ASCII RFC0020
|
|
3328
|
-
* characters (i.e., the range 0x20 to 0x7E) except comma , and =.
|
|
3329
|
-
*/
|
|
3330
|
-
function validateValue(value) {
|
|
3331
|
-
return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value);
|
|
3332
|
-
}
|
|
3333
|
-
|
|
3334
|
-
/*
|
|
3335
|
-
* Copyright The OpenTelemetry Authors
|
|
3336
|
-
*
|
|
3337
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3338
|
-
* you may not use this file except in compliance with the License.
|
|
3339
|
-
* You may obtain a copy of the License at
|
|
3340
|
-
*
|
|
3341
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3342
|
-
*
|
|
3343
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3344
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3345
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3346
|
-
* See the License for the specific language governing permissions and
|
|
3347
|
-
* limitations under the License.
|
|
3348
|
-
*/
|
|
3349
|
-
var MAX_TRACE_STATE_ITEMS = 32;
|
|
3350
|
-
var MAX_TRACE_STATE_LEN = 512;
|
|
3351
|
-
var LIST_MEMBERS_SEPARATOR = ',';
|
|
3352
|
-
var LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
|
|
3353
|
-
/**
|
|
3354
|
-
* TraceState must be a class and not a simple object type because of the spec
|
|
3355
|
-
* requirement (https://www.w3.org/TR/trace-context/#tracestate-field).
|
|
3356
|
-
*
|
|
3357
|
-
* Here is the list of allowed mutations:
|
|
3358
|
-
* - New key-value pair should be added into the beginning of the list
|
|
3359
|
-
* - The value of any key can be updated. Modified keys MUST be moved to the
|
|
3360
|
-
* beginning of the list.
|
|
3361
|
-
*/
|
|
3362
|
-
var TraceState = /** @class */function () {
|
|
3363
|
-
function TraceState(rawTraceState) {
|
|
3364
|
-
this._internalState = new Map();
|
|
3365
|
-
if (rawTraceState) this._parse(rawTraceState);
|
|
3366
|
-
}
|
|
3367
|
-
TraceState.prototype.set = function (key, value) {
|
|
3368
|
-
// TODO: Benchmark the different approaches(map vs list) and
|
|
3369
|
-
// use the faster one.
|
|
3370
|
-
var traceState = this._clone();
|
|
3371
|
-
if (traceState._internalState.has(key)) {
|
|
3372
|
-
traceState._internalState["delete"](key);
|
|
3373
|
-
}
|
|
3374
|
-
traceState._internalState.set(key, value);
|
|
3375
|
-
return traceState;
|
|
3376
|
-
};
|
|
3377
|
-
TraceState.prototype.unset = function (key) {
|
|
3378
|
-
var traceState = this._clone();
|
|
3379
|
-
traceState._internalState["delete"](key);
|
|
3380
|
-
return traceState;
|
|
3381
|
-
};
|
|
3382
|
-
TraceState.prototype.get = function (key) {
|
|
3383
|
-
return this._internalState.get(key);
|
|
3384
|
-
};
|
|
3385
|
-
TraceState.prototype.serialize = function () {
|
|
3386
|
-
var _this = this;
|
|
3387
|
-
return this._keys().reduce(function (agg, key) {
|
|
3388
|
-
agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + _this.get(key));
|
|
3389
|
-
return agg;
|
|
3390
|
-
}, []).join(LIST_MEMBERS_SEPARATOR);
|
|
3391
|
-
};
|
|
3392
|
-
TraceState.prototype._parse = function (rawTraceState) {
|
|
3393
|
-
if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
|
|
3394
|
-
this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
|
|
3395
|
-
.reduce(function (agg, part) {
|
|
3396
|
-
var listMember = part.trim(); // Optional Whitespace (OWS) handling
|
|
3397
|
-
var i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
|
|
3398
|
-
if (i !== -1) {
|
|
3399
|
-
var key = listMember.slice(0, i);
|
|
3400
|
-
var value = listMember.slice(i + 1, part.length);
|
|
3401
|
-
if (validateKey(key) && validateValue(value)) {
|
|
3402
|
-
agg.set(key, value);
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
return agg;
|
|
3406
|
-
}, new Map());
|
|
3407
|
-
// Because of the reverse() requirement, trunc must be done after map is created
|
|
3408
|
-
if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
|
|
3409
|
-
this._internalState = new Map(Array.from(this._internalState.entries()).reverse() // Use reverse same as original tracestate parse chain
|
|
3410
|
-
.slice(0, MAX_TRACE_STATE_ITEMS));
|
|
3411
|
-
}
|
|
3412
|
-
};
|
|
3413
|
-
TraceState.prototype._keys = function () {
|
|
3414
|
-
return Array.from(this._internalState.keys()).reverse();
|
|
3415
|
-
};
|
|
3416
|
-
TraceState.prototype._clone = function () {
|
|
3417
|
-
var traceState = new TraceState();
|
|
3418
|
-
traceState._internalState = new Map(this._internalState);
|
|
3419
|
-
return traceState;
|
|
3420
|
-
};
|
|
3421
|
-
return TraceState;
|
|
3422
|
-
}();
|
|
3423
|
-
|
|
3424
|
-
/*
|
|
3425
|
-
* Copyright The OpenTelemetry Authors
|
|
3426
|
-
*
|
|
3427
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3428
|
-
* you may not use this file except in compliance with the License.
|
|
3429
|
-
* You may obtain a copy of the License at
|
|
3430
|
-
*
|
|
3431
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
3432
|
-
*
|
|
3433
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3434
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3435
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3436
|
-
* See the License for the specific language governing permissions and
|
|
3437
|
-
* limitations under the License.
|
|
3438
|
-
*/
|
|
3439
|
-
var TRACE_PARENT_HEADER = 'traceparent';
|
|
3440
|
-
var TRACE_STATE_HEADER = 'tracestate';
|
|
3441
|
-
var VERSION = '00';
|
|
3442
|
-
var VERSION_PART = '(?!ff)[\\da-f]{2}';
|
|
3443
|
-
var TRACE_ID_PART = '(?![0]{32})[\\da-f]{32}';
|
|
3444
|
-
var PARENT_ID_PART = '(?![0]{16})[\\da-f]{16}';
|
|
3445
|
-
var FLAGS_PART = '[\\da-f]{2}';
|
|
3446
|
-
var TRACE_PARENT_REGEX = new RegExp("^\\s?(" + VERSION_PART + ")-(" + TRACE_ID_PART + ")-(" + PARENT_ID_PART + ")-(" + FLAGS_PART + ")(-.*)?\\s?$");
|
|
3447
|
-
/**
|
|
3448
|
-
* Parses information from the [traceparent] span tag and converts it into {@link SpanContext}
|
|
3449
|
-
* @param traceParent - A meta property that comes from server.
|
|
3450
|
-
* It should be dynamically generated server side to have the server's request trace Id,
|
|
3451
|
-
* a parent span Id that was set on the server's request span,
|
|
3452
|
-
* and the trace flags to indicate the server's sampling decision
|
|
3453
|
-
* (01 = sampled, 00 = not sampled).
|
|
3454
|
-
* for example: '{version}-{traceId}-{spanId}-{sampleDecision}'
|
|
3455
|
-
* For more information see {@link https://www.w3.org/TR/trace-context/}
|
|
3456
|
-
*/
|
|
3457
|
-
function parseTraceParent(traceParent) {
|
|
3458
|
-
var match = TRACE_PARENT_REGEX.exec(traceParent);
|
|
3459
|
-
if (!match) return null;
|
|
3460
|
-
// According to the specification the implementation should be compatible
|
|
3461
|
-
// with future versions. If there are more parts, we only reject it if it's using version 00
|
|
3462
|
-
// See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
|
|
3463
|
-
if (match[1] === '00' && match[5]) return null;
|
|
3464
|
-
return {
|
|
3465
|
-
traceId: match[2],
|
|
3466
|
-
spanId: match[3],
|
|
3467
|
-
traceFlags: parseInt(match[4], 16)
|
|
3468
|
-
};
|
|
3469
|
-
}
|
|
3470
|
-
/**
|
|
3471
|
-
* Propagates {@link SpanContext} through Trace Context format propagation.
|
|
3472
|
-
*
|
|
3473
|
-
* Based on the Trace Context specification:
|
|
3474
|
-
* https://www.w3.org/TR/trace-context/
|
|
3475
|
-
*/
|
|
3476
|
-
var W3CTraceContextPropagator = /** @class */function () {
|
|
3477
|
-
function W3CTraceContextPropagator() {}
|
|
3478
|
-
W3CTraceContextPropagator.prototype.inject = function (context, carrier, setter) {
|
|
3479
|
-
var spanContext = trace.getSpanContext(context);
|
|
3480
|
-
if (!spanContext || isTracingSuppressed(context) || !isSpanContextValid(spanContext)) return;
|
|
3481
|
-
var traceParent = VERSION + "-" + spanContext.traceId + "-" + spanContext.spanId + "-0" + Number(spanContext.traceFlags || TraceFlags.NONE).toString(16);
|
|
3482
|
-
setter.set(carrier, TRACE_PARENT_HEADER, traceParent);
|
|
3483
|
-
if (spanContext.traceState) {
|
|
3484
|
-
setter.set(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
|
|
3485
|
-
}
|
|
3486
|
-
};
|
|
3487
|
-
W3CTraceContextPropagator.prototype.extract = function (context, carrier, getter) {
|
|
3488
|
-
var traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);
|
|
3489
|
-
if (!traceParentHeader) return context;
|
|
3490
|
-
var traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
|
|
3491
|
-
if (typeof traceParent !== 'string') return context;
|
|
3492
|
-
var spanContext = parseTraceParent(traceParent);
|
|
3493
|
-
if (!spanContext) return context;
|
|
3494
|
-
spanContext.isRemote = true;
|
|
3495
|
-
var traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);
|
|
3496
|
-
if (traceStateHeader) {
|
|
3497
|
-
// If more than one `tracestate` header is found, we merge them into a
|
|
3498
|
-
// single header.
|
|
3499
|
-
var state = Array.isArray(traceStateHeader) ? traceStateHeader.join(',') : traceStateHeader;
|
|
3500
|
-
spanContext.traceState = new TraceState(typeof state === 'string' ? state : undefined);
|
|
3501
|
-
}
|
|
3502
|
-
return trace.setSpanContext(context, spanContext);
|
|
3503
|
-
};
|
|
3504
|
-
W3CTraceContextPropagator.prototype.fields = function () {
|
|
3505
|
-
return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];
|
|
3506
|
-
};
|
|
3507
|
-
return W3CTraceContextPropagator;
|
|
3508
|
-
}();
|
|
3509
|
-
|
|
3510
3330
|
var _a$1;
|
|
3511
3331
|
var MAX_RUM_EVENTS_PER_REQUEST = 500;
|
|
3512
3332
|
var MAX_RUM_EVENTS = 20000;
|
|
@@ -3519,7 +3339,7 @@ var DEFAULT_MS_RECORD_TIME = 10000;
|
|
|
3519
3339
|
_a$1),
|
|
3520
3340
|
});
|
|
3521
3341
|
|
|
3522
|
-
var Request =
|
|
3342
|
+
var Request = (function () {
|
|
3523
3343
|
function Request(requestConfig) {
|
|
3524
3344
|
this.requestConfig = requestConfig;
|
|
3525
3345
|
this.resolvedUrl = '';
|
|
@@ -3550,12 +3370,12 @@ var Request = /** @class */ (function () {
|
|
|
3550
3370
|
return Request;
|
|
3551
3371
|
}());
|
|
3552
3372
|
|
|
3553
|
-
var CxCustomSampler =
|
|
3373
|
+
var CxCustomSampler = (function () {
|
|
3554
3374
|
function CxCustomSampler() {
|
|
3555
3375
|
}
|
|
3556
3376
|
CxCustomSampler.prototype.shouldSample = function () {
|
|
3557
3377
|
return {
|
|
3558
|
-
decision: SamplingDecision.RECORD,
|
|
3378
|
+
decision: SamplingDecision.RECORD,
|
|
3559
3379
|
};
|
|
3560
3380
|
};
|
|
3561
3381
|
return CxCustomSampler;
|
|
@@ -3609,9 +3429,7 @@ var isSessionWithError = function () {
|
|
|
3609
3429
|
function getResolvedSampler(resolvedOptions) {
|
|
3610
3430
|
var sampler = new AlwaysOnSampler();
|
|
3611
3431
|
var sessionSampleRate = resolvedOptions.sessionSampleRate, sessionConfig = resolvedOptions.sessionConfig, debug = resolvedOptions.debug, sessionRecordingConfig = resolvedOptions.sessionRecordingConfig;
|
|
3612
|
-
var shouldNotTrackSession =
|
|
3613
|
-
//todo: remove when sessionSampleRate is removed
|
|
3614
|
-
!isSamplingOn(sessionSampleRate) ||
|
|
3432
|
+
var shouldNotTrackSession = !isSamplingOn(sessionSampleRate) ||
|
|
3615
3433
|
!isSamplingOn(sessionConfig.sessionSampleRate);
|
|
3616
3434
|
if (shouldNotTrackSession) {
|
|
3617
3435
|
var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.alwaysTrackSessionsWithErrors;
|
|
@@ -3622,7 +3440,6 @@ function getResolvedSampler(resolvedOptions) {
|
|
|
3622
3440
|
if (debug) {
|
|
3623
3441
|
console.debug('CoralogixRum: Session tracking is disabled due to sampling rate');
|
|
3624
3442
|
}
|
|
3625
|
-
// session dropped due to sample, only network trace headers should run
|
|
3626
3443
|
sampler = new CxCustomSampler();
|
|
3627
3444
|
if (sessionRecordingConfig) {
|
|
3628
3445
|
sessionRecordingConfig.enable = false;
|
|
@@ -3638,7 +3455,7 @@ function isProcessorShouldStop(isActive) {
|
|
|
3638
3455
|
return !isActive || !!((_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.isIdleActive);
|
|
3639
3456
|
}
|
|
3640
3457
|
|
|
3641
|
-
var CoralogixExporter =
|
|
3458
|
+
var CoralogixExporter = (function () {
|
|
3642
3459
|
function CoralogixExporter() {
|
|
3643
3460
|
var _this = this;
|
|
3644
3461
|
this.isActive = true;
|
|
@@ -3697,15 +3514,13 @@ var CoralogixExporter = /** @class */ (function () {
|
|
|
3697
3514
|
return cxSpans;
|
|
3698
3515
|
}, []);
|
|
3699
3516
|
this.invokeLogRequest(instrumentationLogs);
|
|
3700
|
-
var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read
|
|
3517
|
+
var cachedLogs = (CxGlobal.cachedLogs = __spreadArray(__spreadArray([], __read((CxGlobal.cachedLogs || [])), false), __read(currentSpans), false));
|
|
3701
3518
|
var logsCounter = cachedLogs.length;
|
|
3702
|
-
//check if we reached the limit of max rum events for session with error
|
|
3703
3519
|
if (logsCounter > maxRumEventsForSessionWithError && !sessionHasError) {
|
|
3704
3520
|
this.clearCachedDataForSessionWithError();
|
|
3705
3521
|
}
|
|
3706
3522
|
else if (sessionHasError) {
|
|
3707
3523
|
if (logsCounter > MAX_RUM_EVENTS_PER_REQUEST) {
|
|
3708
|
-
//split request to chunks of 500 logs per each
|
|
3709
3524
|
var chunks = [];
|
|
3710
3525
|
for (var i = 0; i < logsCounter; i += MAX_RUM_EVENTS_PER_REQUEST) {
|
|
3711
3526
|
chunks.push(cachedLogs.slice(i, i + MAX_RUM_EVENTS_PER_REQUEST));
|
|
@@ -3733,7 +3548,7 @@ var CoralogixExporter = /** @class */ (function () {
|
|
|
3733
3548
|
return CoralogixExporter;
|
|
3734
3549
|
}());
|
|
3735
3550
|
|
|
3736
|
-
var CoralogixWebTracerProvider =
|
|
3551
|
+
var CoralogixWebTracerProvider = (function (_super) {
|
|
3737
3552
|
__extends(CoralogixWebTracerProvider, _super);
|
|
3738
3553
|
function CoralogixWebTracerProvider() {
|
|
3739
3554
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -3741,7 +3556,7 @@ var CoralogixWebTracerProvider = /** @class */ (function (_super) {
|
|
|
3741
3556
|
return CoralogixWebTracerProvider;
|
|
3742
3557
|
}(WebTracerProvider));
|
|
3743
3558
|
|
|
3744
|
-
var SessionIdle =
|
|
3559
|
+
var SessionIdle = (function () {
|
|
3745
3560
|
function SessionIdle(idleConfig) {
|
|
3746
3561
|
var _this = this;
|
|
3747
3562
|
this.idleConfig = idleConfig;
|
|
@@ -3782,7 +3597,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3782
3597
|
var _a, _b;
|
|
3783
3598
|
(_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3784
3599
|
if (typeof CxGlobal.addEventListener === 'function') {
|
|
3785
|
-
var stop_1 = addEventListeners(CxGlobal, ["touchstart"
|
|
3600
|
+
var stop_1 = addEventListeners(CxGlobal, ["touchstart", "keydown", "mousemove"], this.idlenessEventsHandler, { capture: true, passive: true }).stop;
|
|
3786
3601
|
this.stopCallbacks.removeActivityListeners = stop_1;
|
|
3787
3602
|
}
|
|
3788
3603
|
};
|
|
@@ -3817,7 +3632,7 @@ function isInstrumentationCompatible(confKey) {
|
|
|
3817
3632
|
return true;
|
|
3818
3633
|
}
|
|
3819
3634
|
|
|
3820
|
-
var SessionManager =
|
|
3635
|
+
var SessionManager = (function (_super) {
|
|
3821
3636
|
__extends(SessionManager, _super);
|
|
3822
3637
|
function SessionManager(recordConfig) {
|
|
3823
3638
|
var _a;
|
|
@@ -3945,7 +3760,6 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3945
3760
|
configurable: true
|
|
3946
3761
|
});
|
|
3947
3762
|
SessionManager.prototype.updateCurrentPage = function (fragment) {
|
|
3948
|
-
// Should not updateCurrentPage when idle, even if rum events are sent before idle(like network requests)
|
|
3949
3763
|
if (this.isIdleActive) {
|
|
3950
3764
|
this._currentPageFragment = undefined;
|
|
3951
3765
|
return;
|
|
@@ -3975,21 +3789,21 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3975
3789
|
case 0:
|
|
3976
3790
|
CxGlobal[SESSION_MANAGER_KEY] = this;
|
|
3977
3791
|
this.sessionRecorderConfig = recordConfig;
|
|
3978
|
-
if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3
|
|
3792
|
+
if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3, 3];
|
|
3979
3793
|
recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
|
|
3980
3794
|
isSessionRecordingCompatible = isInstrumentationCompatible(SESSION_RECORDING_INSTRUMENTATION_NAME);
|
|
3981
|
-
if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3
|
|
3982
|
-
return [4
|
|
3795
|
+
if (!(recordingSamplingEnabled && isSessionRecordingCompatible)) return [3, 2];
|
|
3796
|
+
return [4, import('./sessionRecorder.esm.js')];
|
|
3983
3797
|
case 1:
|
|
3984
3798
|
SessionRecorder_1 = (_a.sent()).SessionRecorder;
|
|
3985
3799
|
this.sessionRecorder = new SessionRecorder_1(this, recordConfig);
|
|
3986
|
-
return [3
|
|
3800
|
+
return [3, 3];
|
|
3987
3801
|
case 2:
|
|
3988
3802
|
if (getSdkConfig().debug) {
|
|
3989
3803
|
console.debug('Coralogix Browser SDK - Session recording is disabled');
|
|
3990
3804
|
}
|
|
3991
3805
|
_a.label = 3;
|
|
3992
|
-
case 3: return [2
|
|
3806
|
+
case 3: return [2];
|
|
3993
3807
|
}
|
|
3994
3808
|
});
|
|
3995
3809
|
});
|
|
@@ -4061,7 +3875,7 @@ function handlePropagators(config, tracerProvider) {
|
|
|
4061
3875
|
propagators = [];
|
|
4062
3876
|
_a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader;
|
|
4063
3877
|
if (!propagateAwsXrayTraceHeader && !propagateB3TraceHeader) {
|
|
4064
|
-
propagators = __spreadArray(__spreadArray([], __read
|
|
3878
|
+
propagators = __spreadArray(__spreadArray([], __read(propagators), false), [
|
|
4065
3879
|
new W3CBaggagePropagator(),
|
|
4066
3880
|
new W3CTraceContextPropagator(),
|
|
4067
3881
|
], false);
|
|
@@ -4084,11 +3898,11 @@ function handlePropagators(config, tracerProvider) {
|
|
|
4084
3898
|
})),
|
|
4085
3899
|
});
|
|
4086
3900
|
}
|
|
4087
|
-
return [2
|
|
3901
|
+
return [2];
|
|
4088
3902
|
});
|
|
4089
3903
|
});
|
|
4090
3904
|
}
|
|
4091
|
-
var CxPropagator =
|
|
3905
|
+
var CxPropagator = (function () {
|
|
4092
3906
|
function CxPropagator(config, internalPropagator) {
|
|
4093
3907
|
this.config = config;
|
|
4094
3908
|
this.internalPropagator = internalPropagator;
|
|
@@ -4133,13 +3947,12 @@ function isInitialConfigValid(initConfig) {
|
|
|
4133
3947
|
console.warn('CoralogixRum: Initialization configuration missing');
|
|
4134
3948
|
return;
|
|
4135
3949
|
}
|
|
4136
|
-
// Ensure public key is provided when no proxy URL is set
|
|
4137
3950
|
if (!initConfig.proxyUrl && !initConfig.public_key) {
|
|
4138
3951
|
console.warn('CoralogixRum: Public key is missing');
|
|
4139
3952
|
return;
|
|
4140
3953
|
}
|
|
4141
3954
|
try {
|
|
4142
|
-
for (var REQUIRED_CONFIG_KEYS_1 = __values
|
|
3955
|
+
for (var REQUIRED_CONFIG_KEYS_1 = __values(REQUIRED_CONFIG_KEYS), REQUIRED_CONFIG_KEYS_1_1 = REQUIRED_CONFIG_KEYS_1.next(); !REQUIRED_CONFIG_KEYS_1_1.done; REQUIRED_CONFIG_KEYS_1_1 = REQUIRED_CONFIG_KEYS_1.next()) {
|
|
4143
3956
|
var requiredProp = REQUIRED_CONFIG_KEYS_1_1.value;
|
|
4144
3957
|
if (isNil(initConfig[requiredProp])) {
|
|
4145
3958
|
console.error("CoralogixRum: Initialization aborted. Please provide the required property \"".concat(requiredProp, "\"."));
|
|
@@ -4163,10 +3976,10 @@ function validateAndResolveInitConfig(config) {
|
|
|
4163
3976
|
}
|
|
4164
3977
|
var ignoreUrls = config.ignoreUrls, urlBlueprinters = config.urlBlueprinters, proxyUrl = config.proxyUrl;
|
|
4165
3978
|
var resolvedIgnoreUrls = [];
|
|
4166
|
-
ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read
|
|
3979
|
+
ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read(ignoreUrls), false));
|
|
4167
3980
|
if (proxyUrl)
|
|
4168
3981
|
resolvedIgnoreUrls.push(new RegExp(proxyUrl));
|
|
4169
|
-
OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read
|
|
3982
|
+
OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read(OPTIONS_DEFAULTS.ignoreUrls), false));
|
|
4170
3983
|
return __assign(__assign(__assign({}, OPTIONS_DEFAULTS), config), { maskInputTypes: (_a = config.maskInputTypes) !== null && _a !== void 0 ? _a : MASK_INPUT_TYPES_DEFAULT, maskClass: (_b = config.maskClass) !== null && _b !== void 0 ? _b : MASK_CLASS_DEFAULT, ignoreUrls: resolvedIgnoreUrls, urlBlueprinters: resolveUrlBlueprinters(urlBlueprinters), sessionSampleRate: (_c = config.sessionSampleRate) !== null && _c !== void 0 ? _c : 100, sessionConfig: resolveSessionConfig(config.sessionConfig), sessionRecordingConfig: resolveSessionRecordingConfig(config.sessionRecordingConfig), memoryUsageConfig: resolveMemoryUsageConfig(config.memoryUsageConfig), trackSoftNavigations: !!config.trackSoftNavigations, supportMfe: !!config.supportMfe });
|
|
4171
3984
|
}
|
|
4172
3985
|
function resolveMemoryUsageConfig(memoryUsageConfig) {
|
|
@@ -4188,10 +4001,10 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4188
4001
|
var _a, _b;
|
|
4189
4002
|
var _c = urlBlueprinters || {}, pageUrlBlueprinters = _c.pageUrlBlueprinters, networkUrlBlueprinters = _c.networkUrlBlueprinters;
|
|
4190
4003
|
if (pageUrlBlueprinters) {
|
|
4191
|
-
(_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read
|
|
4004
|
+
(_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read(pageUrlBlueprinters), false));
|
|
4192
4005
|
}
|
|
4193
4006
|
if (networkUrlBlueprinters) {
|
|
4194
|
-
(_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read
|
|
4007
|
+
(_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read(networkUrlBlueprinters), false));
|
|
4195
4008
|
}
|
|
4196
4009
|
};
|
|
4197
4010
|
concatBlueprinters(urlBlueprinters);
|
|
@@ -4201,7 +4014,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4201
4014
|
return resolvedUrlBlueprinters;
|
|
4202
4015
|
}
|
|
4203
4016
|
|
|
4204
|
-
var SDK_VERSION = '2.8.
|
|
4017
|
+
var SDK_VERSION = '2.8.6';
|
|
4205
4018
|
|
|
4206
4019
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4207
4020
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4267,7 +4080,7 @@ function editableToCxRumEvent(editable, cxRumEvent) {
|
|
|
4267
4080
|
return __assign(__assign(__assign({}, cxRumEvent), editable), { session_context: __assign(__assign({}, cxRumEvent.session_context), editable.session_context) });
|
|
4268
4081
|
}
|
|
4269
4082
|
|
|
4270
|
-
var CoralogixSpanMapProcessor =
|
|
4083
|
+
var CoralogixSpanMapProcessor = (function () {
|
|
4271
4084
|
function CoralogixSpanMapProcessor() {
|
|
4272
4085
|
this.sdkConfig = getSdkConfig();
|
|
4273
4086
|
this.isActive = true;
|
|
@@ -4521,7 +4334,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4521
4334
|
var allLabels = {};
|
|
4522
4335
|
var cxRumEventClone = deepClone(cxRumEvent);
|
|
4523
4336
|
try {
|
|
4524
|
-
for (var labelProviders_1 = __values
|
|
4337
|
+
for (var labelProviders_1 = __values(labelProviders), labelProviders_1_1 = labelProviders_1.next(); !labelProviders_1_1.done; labelProviders_1_1 = labelProviders_1.next()) {
|
|
4525
4338
|
var labelProvider = labelProviders_1_1.value;
|
|
4526
4339
|
allLabels = __assign(__assign({}, allLabels), labelProvider.providerFunc(url, cxRumEventClone));
|
|
4527
4340
|
}
|
|
@@ -4538,7 +4351,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4538
4351
|
return CoralogixSpanMapProcessor;
|
|
4539
4352
|
}());
|
|
4540
4353
|
|
|
4541
|
-
var CoralogixSnapshotSpanProcessor =
|
|
4354
|
+
var CoralogixSnapshotSpanProcessor = (function () {
|
|
4542
4355
|
function CoralogixSnapshotSpanProcessor() {
|
|
4543
4356
|
this.isActive = true;
|
|
4544
4357
|
}
|
|
@@ -4615,7 +4428,7 @@ var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
|
|
|
4615
4428
|
return CoralogixSnapshotSpanProcessor;
|
|
4616
4429
|
}());
|
|
4617
4430
|
|
|
4618
|
-
var SnapshotManager =
|
|
4431
|
+
var SnapshotManager = (function () {
|
|
4619
4432
|
function SnapshotManager() {
|
|
4620
4433
|
var _this = this;
|
|
4621
4434
|
this.updateSnapshot = function (overrides) {
|
|
@@ -4656,7 +4469,7 @@ var SnapshotManager = /** @class */ (function () {
|
|
|
4656
4469
|
return SnapshotManager;
|
|
4657
4470
|
}());
|
|
4658
4471
|
|
|
4659
|
-
var CoralogixNavigationProcessor =
|
|
4472
|
+
var CoralogixNavigationProcessor = (function () {
|
|
4660
4473
|
function CoralogixNavigationProcessor() {
|
|
4661
4474
|
}
|
|
4662
4475
|
CoralogixNavigationProcessor.prototype.forceFlush = function () {
|
|
@@ -4719,17 +4532,14 @@ var CoralogixRum = {
|
|
|
4719
4532
|
var _a, _b;
|
|
4720
4533
|
var _this = this;
|
|
4721
4534
|
try {
|
|
4722
|
-
// Check if CoralogixRum already inited.
|
|
4723
4535
|
if (isInited && (options === null || options === void 0 ? void 0 : options.debug)) {
|
|
4724
4536
|
console.debug('CoralogixRum already initialized, skipping init');
|
|
4725
4537
|
return;
|
|
4726
4538
|
}
|
|
4727
|
-
// Abort if not in browser environment.
|
|
4728
4539
|
if (!CxGlobal.sessionStorage) {
|
|
4729
4540
|
console.warn('CoralogixRum: Non-browser environment detected, aborting');
|
|
4730
4541
|
return;
|
|
4731
4542
|
}
|
|
4732
|
-
// Abort if running in a not supported browser.
|
|
4733
4543
|
if (typeof Symbol !== 'function') {
|
|
4734
4544
|
console.warn('CoralogixRum: browser not supported, disabling instrumentation.');
|
|
4735
4545
|
return;
|
|
@@ -4741,7 +4551,6 @@ var CoralogixRum = {
|
|
|
4741
4551
|
CxGlobal[USER_AGENT_KEY] = parseUserAgent(navigator.userAgent);
|
|
4742
4552
|
CxGlobal[SDK_CONFIG_KEY] = resolvedOptions_1;
|
|
4743
4553
|
var sampler = getResolvedSampler(resolvedOptions_1);
|
|
4744
|
-
// Check if not in debug mode & no auth token.
|
|
4745
4554
|
if (!resolvedOptions_1.debug && !resolvedOptions_1.public_key) {
|
|
4746
4555
|
console.warn('rumAuth will be required in the future');
|
|
4747
4556
|
}
|
|
@@ -4752,7 +4561,6 @@ var CoralogixRum = {
|
|
|
4752
4561
|
sampler: sampler,
|
|
4753
4562
|
});
|
|
4754
4563
|
var pluginDefaults_1 = {};
|
|
4755
|
-
// Resolve instrumentations.
|
|
4756
4564
|
var instrumentations = INSTRUMENTATIONS.map(function (_a) {
|
|
4757
4565
|
var _b, _c;
|
|
4758
4566
|
var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
|
|
@@ -4822,7 +4630,6 @@ var CoralogixRum = {
|
|
|
4822
4630
|
return Boolean(instrument);
|
|
4823
4631
|
});
|
|
4824
4632
|
var mergedUserContext = __assign(__assign({}, OPTIONS_DEFAULTS.user_context), user_context);
|
|
4825
|
-
// Init Span Attributes Processor.
|
|
4826
4633
|
attributesProcessor = new CoralogixSpanAttributesProcessor(__assign((_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = JSON.stringify({
|
|
4827
4634
|
application: application,
|
|
4828
4635
|
version: version,
|
|
@@ -4832,30 +4639,24 @@ var CoralogixRum = {
|
|
|
4832
4639
|
attributesProcessor.setCustomLabels(labels);
|
|
4833
4640
|
}
|
|
4834
4641
|
setAttrProcessor(attributesProcessor);
|
|
4835
|
-
// The order of processors is important.
|
|
4836
4642
|
tracerProvider.addSpanProcessor(attributesProcessor);
|
|
4837
|
-
// Add Navigation Processor
|
|
4838
4643
|
navigationProcessor = new CoralogixNavigationProcessor();
|
|
4839
4644
|
tracerProvider.addSpanProcessor(navigationProcessor);
|
|
4840
|
-
// Add Span Mapping Processor
|
|
4841
4645
|
spanMapProcessor = new CoralogixSpanMapProcessor();
|
|
4842
4646
|
tracerProvider.addSpanProcessor(spanMapProcessor);
|
|
4843
|
-
// Add snapshot processor
|
|
4844
4647
|
new SnapshotManager();
|
|
4845
4648
|
snapshotProcessor = new CoralogixSnapshotSpanProcessor();
|
|
4846
4649
|
tracerProvider.addSpanProcessor(snapshotProcessor);
|
|
4847
|
-
// Add Batch Span Processor and Exporter
|
|
4848
4650
|
tracerProvider.addSpanProcessor(new BatchSpanProcessor((exporter = new CoralogixExporter()), {
|
|
4849
4651
|
maxExportBatchSize: MAX_EXPORT_BATCH_SIZE,
|
|
4850
4652
|
scheduledDelayMillis: SCHEDULE_DELAY_MILLIS,
|
|
4851
4653
|
}));
|
|
4852
4654
|
handlePropagators(options, tracerProvider);
|
|
4853
|
-
// Register Instrumentations
|
|
4854
4655
|
_deregisterInstrumentations = registerInstrumentations({
|
|
4855
4656
|
tracerProvider: tracerProvider,
|
|
4856
4657
|
instrumentations: instrumentations,
|
|
4857
4658
|
});
|
|
4858
|
-
var _c = __read
|
|
4659
|
+
var _c = __read(partition(resolvedOptions_1.labelProviders || [], function (_a) {
|
|
4859
4660
|
var urlType = _a.urlType;
|
|
4860
4661
|
return urlType === UrlType.PAGE || !urlType;
|
|
4861
4662
|
}), 2), pageUrlLabelProviders = _c[0], networkUrlLabelProviders = _c[1];
|
|
@@ -4999,9 +4800,6 @@ var CoralogixRum = {
|
|
|
4999
4800
|
getSessionRecorder().startRecording();
|
|
5000
4801
|
return;
|
|
5001
4802
|
}
|
|
5002
|
-
/*
|
|
5003
|
-
* The session recorder is initialized asynchronously via dynamic import.
|
|
5004
|
-
* */
|
|
5005
4803
|
var intervalId = setInterval(function () {
|
|
5006
4804
|
if (getSessionRecorder()) {
|
|
5007
4805
|
clearInterval(intervalId);
|
|
@@ -5088,7 +4886,7 @@ var CoralogixRum = {
|
|
|
5088
4886
|
};
|
|
5089
4887
|
CxGlobal.CoralogixRum = CoralogixRum;
|
|
5090
4888
|
|
|
5091
|
-
var UrlBasedLabelProvider =
|
|
4889
|
+
var UrlBasedLabelProvider = (function () {
|
|
5092
4890
|
function UrlBasedLabelProvider(config) {
|
|
5093
4891
|
var urlPatterns = config.urlPatterns, defaultLabels = config.defaultLabels, urlType = config.urlType;
|
|
5094
4892
|
var compiledRegexps = urlPatterns.map(function (_a) {
|
|
@@ -5100,8 +4898,8 @@ var UrlBasedLabelProvider = /** @class */ (function () {
|
|
|
5100
4898
|
var e_1, _a;
|
|
5101
4899
|
var providerLabels = {};
|
|
5102
4900
|
try {
|
|
5103
|
-
outerLoop: for (var _b = __values
|
|
5104
|
-
var _d = __read
|
|
4901
|
+
outerLoop: for (var _b = __values(compiledRegexps.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4902
|
+
var _d = __read(_c.value, 2), index = _d[0], compiledRegex = _d[1];
|
|
5105
4903
|
var labels = urlPatterns[index].labels;
|
|
5106
4904
|
if (compiledRegex.some(function (regexp) { return regexp.test(url); })) {
|
|
5107
4905
|
providerLabels = __assign(__assign({}, providerLabels), labels);
|
|
@@ -5137,4 +4935,4 @@ var SessionRecordingEventType;
|
|
|
5137
4935
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
5138
4936
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
5139
4937
|
|
|
5140
|
-
export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U,
|
|
4938
|
+
export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, __awaiter as _, __generator as a, __assign as b, getNowTime as c, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as d, SESSION_RECORDING_DEFAULT_HEADERS as e, SESSION_RECORDING_POSTFIX_URL as f, getSdkConfig as g, SESSION_RECORDER_KEY as h, MAX_MUTATIONS_FOR_SESSION_RECORDING as i, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as j, CoralogixRum as k, CoralogixLogSeverity as l, SessionRecordingEventType as m, CoralogixEventType as n, UrlType as o, reportInternalEvent as r };
|