@coralogix/browser 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/index.esm2.js +170 -165
- package/package.json +1 -1
- package/sessionRecorder.esm.js +36 -32
- package/src/session/sessionManager.d.ts +1 -0
- package/src/version.d.ts +1 -1
package/index.esm2.js
CHANGED
|
@@ -17,7 +17,7 @@ function isRegExp(value) {
|
|
|
17
17
|
return value instanceof RegExp;
|
|
18
18
|
}
|
|
19
19
|
function isMatchingPattern(value, pattern, requireExactStringMatch) {
|
|
20
|
-
if (requireExactStringMatch ===
|
|
20
|
+
if (requireExactStringMatch === void 0) { requireExactStringMatch = false; }
|
|
21
21
|
if (!isString(value)) {
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
@@ -32,8 +32,8 @@ function isMatchingPattern(value, pattern, requireExactStringMatch) {
|
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
function stringMatchesSomePattern(testString, patterns, requireExactStringMatch) {
|
|
35
|
-
if (patterns ===
|
|
36
|
-
if (requireExactStringMatch ===
|
|
35
|
+
if (patterns === void 0) { patterns = []; }
|
|
36
|
+
if (requireExactStringMatch === void 0) { requireExactStringMatch = false; }
|
|
37
37
|
return patterns.some(function (pattern) {
|
|
38
38
|
return isMatchingPattern(testString, pattern, requireExactStringMatch);
|
|
39
39
|
});
|
|
@@ -324,7 +324,7 @@ function getCustomTracerIgnoredInstruments() {
|
|
|
324
324
|
function shouldAttachSpanToGlobalSpan(instrumentationType) {
|
|
325
325
|
var _a;
|
|
326
326
|
return (getGlobalSpan() &&
|
|
327
|
-
!((_a = getCustomTracerIgnoredInstruments()) === null || _a ===
|
|
327
|
+
!((_a = getCustomTracerIgnoredInstruments()) === null || _a === void 0 ? void 0 : _a.includes(instrumentationType)));
|
|
328
328
|
}
|
|
329
329
|
function attachChildSpanToGlobalSpan(name) {
|
|
330
330
|
var span;
|
|
@@ -370,13 +370,13 @@ function getAttrProcessor() {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
function setCustomLabelsForSpan(span, labels) {
|
|
373
|
-
if (labels ===
|
|
373
|
+
if (labels === void 0) { labels = {}; }
|
|
374
374
|
span.setAttribute(CoralogixAttributes.CUSTOM_LABELS, JSON.stringify(getCustomMergedLabels(labels)));
|
|
375
375
|
}
|
|
376
376
|
function getCustomMergedLabels(labels) {
|
|
377
377
|
var _a;
|
|
378
|
-
if (labels ===
|
|
379
|
-
var globalLabels = ((_a = getAttrProcessor()) === null || _a ===
|
|
378
|
+
if (labels === void 0) { labels = {}; }
|
|
379
|
+
var globalLabels = ((_a = getAttrProcessor()) === null || _a === void 0 ? void 0 : _a.getCustomLabels()) || {};
|
|
380
380
|
return __assign(__assign({}, globalLabels), labels);
|
|
381
381
|
}
|
|
382
382
|
|
|
@@ -400,13 +400,13 @@ var ErrorSource;
|
|
|
400
400
|
ErrorSource["CAPTURED"] = "captured";
|
|
401
401
|
})(ErrorSource || (ErrorSource = {}));
|
|
402
402
|
function buildStacktrace(span, err) {
|
|
403
|
-
return __awaiter(this,
|
|
403
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
404
404
|
var stack, message, name, hasStack, supportMfe, stackFrames;
|
|
405
405
|
return __generator(this, function (_a) {
|
|
406
406
|
switch (_a.label) {
|
|
407
407
|
case 0:
|
|
408
408
|
stack = err.stack, message = err.message, name = err.name;
|
|
409
|
-
hasStack = !!(stack === null || stack ===
|
|
409
|
+
hasStack = !!(stack === null || stack === void 0 ? void 0 : stack.includes('at '));
|
|
410
410
|
if (!(err && hasStack)) return [3 /*break*/, 3];
|
|
411
411
|
supportMfe = getSdkConfig().supportMfe;
|
|
412
412
|
stackFrames = ErrorStackParser.parse({
|
|
@@ -436,7 +436,7 @@ function buildStacktrace(span, err) {
|
|
|
436
436
|
});
|
|
437
437
|
}
|
|
438
438
|
function handleMFE(stackFrames, span) {
|
|
439
|
-
return __awaiter(this,
|
|
439
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
440
440
|
var i, metadata, _a, lastFrame;
|
|
441
441
|
return __generator(this, function (_b) {
|
|
442
442
|
switch (_b.label) {
|
|
@@ -469,9 +469,9 @@ function addLabelForMFE(span, lastFrame) {
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
function extractMetadataFromMfeStacktrace() {
|
|
472
|
-
return __awaiter(this, arguments,
|
|
472
|
+
return __awaiter(this, arguments, void 0, function (fileName) {
|
|
473
473
|
var metadata, cachedMetadata, MFE_METADATA_KEY, _a, mfePath, response, _b, e_1;
|
|
474
|
-
if (fileName ===
|
|
474
|
+
if (fileName === void 0) { fileName = ''; }
|
|
475
475
|
return __generator(this, function (_c) {
|
|
476
476
|
switch (_c.label) {
|
|
477
477
|
case 0:
|
|
@@ -479,8 +479,8 @@ function extractMetadataFromMfeStacktrace() {
|
|
|
479
479
|
MFE_METADATA_KEY = 'cx-metadata.json';
|
|
480
480
|
_a = __read$1(fileName.match(/https?:\/\/.*\//), 1), mfePath = _a[0];
|
|
481
481
|
if (!mfePath) return [3 /*break*/, 7];
|
|
482
|
-
response =
|
|
483
|
-
if (!!(cachedMetadata === null || cachedMetadata ===
|
|
482
|
+
response = void 0;
|
|
483
|
+
if (!!(cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.has(mfePath))) return [3 /*break*/, 6];
|
|
484
484
|
_c.label = 1;
|
|
485
485
|
case 1:
|
|
486
486
|
_c.trys.push([1, 4, , 5]);
|
|
@@ -493,7 +493,7 @@ function extractMetadataFromMfeStacktrace() {
|
|
|
493
493
|
_b = [{}];
|
|
494
494
|
return [4 /*yield*/, response.json()];
|
|
495
495
|
case 3:
|
|
496
|
-
metadata = __assign.apply(
|
|
496
|
+
metadata = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), { mfePath: mfePath }]);
|
|
497
497
|
return [3 /*break*/, 5];
|
|
498
498
|
case 4:
|
|
499
499
|
e_1 = _c.sent();
|
|
@@ -505,7 +505,7 @@ function extractMetadataFromMfeStacktrace() {
|
|
|
505
505
|
CxGlobal[CACHED_METADATA_KEY] = cachedMetadata.set(mfePath, metadata);
|
|
506
506
|
return [3 /*break*/, 7];
|
|
507
507
|
case 6:
|
|
508
|
-
metadata = cachedMetadata === null || cachedMetadata ===
|
|
508
|
+
metadata = cachedMetadata === null || cachedMetadata === void 0 ? void 0 : cachedMetadata.get(mfePath);
|
|
509
509
|
_c.label = 7;
|
|
510
510
|
case 7: return [2 /*return*/, metadata];
|
|
511
511
|
}
|
|
@@ -549,7 +549,7 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
549
549
|
var _this = _super.call(this, ERROR_INSTRUMENTATION_NAME, ERROR_INSTRUMENTATION_VERSION, config) || this;
|
|
550
550
|
_this.parseErrorObject = function (obj) {
|
|
551
551
|
var _a;
|
|
552
|
-
return (_a = obj === null || obj ===
|
|
552
|
+
return (_a = obj === null || obj === void 0 ? void 0 : obj.message) !== null && _a !== void 0 ? _a : JSON.stringify(obj, getCircularReplacer());
|
|
553
553
|
};
|
|
554
554
|
if (getSdkConfig().supportMfe) {
|
|
555
555
|
CxGlobal[CACHED_METADATA_KEY] = new Map();
|
|
@@ -607,7 +607,7 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
607
607
|
}
|
|
608
608
|
};
|
|
609
609
|
CoralogixErrorInstrumentation.prototype.reportError = function (source, err, customData, labels) {
|
|
610
|
-
return __awaiter(this,
|
|
610
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
611
611
|
var message, name, span, cleanMessage;
|
|
612
612
|
return __generator(this, function (_a) {
|
|
613
613
|
switch (_a.label) {
|
|
@@ -635,7 +635,7 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
635
635
|
});
|
|
636
636
|
};
|
|
637
637
|
CoralogixErrorInstrumentation.prototype.reportString = function (source, message, firstError) {
|
|
638
|
-
return __awaiter(this,
|
|
638
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
639
639
|
var span;
|
|
640
640
|
return __generator(this, function (_a) {
|
|
641
641
|
switch (_a.label) {
|
|
@@ -643,7 +643,7 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
643
643
|
span = this.createSpan(source);
|
|
644
644
|
addErrorDefaultAttributes(span);
|
|
645
645
|
span.setAttribute(CoralogixAttributes.SOURCE, source);
|
|
646
|
-
span.setAttribute(ErrorAttributes.MESSAGE, message === null || message ===
|
|
646
|
+
span.setAttribute(ErrorAttributes.MESSAGE, message === null || message === void 0 ? void 0 : message.substring(0, MESSAGE_LIMIT));
|
|
647
647
|
if (!firstError) return [3 /*break*/, 2];
|
|
648
648
|
return [4 /*yield*/, buildStacktrace(span, firstError)];
|
|
649
649
|
case 1:
|
|
@@ -658,7 +658,7 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
658
658
|
};
|
|
659
659
|
CoralogixErrorInstrumentation.prototype.reportErrorEvent = function (source, _a) {
|
|
660
660
|
var error = _a.error, message = _a.message;
|
|
661
|
-
var event = error !== null && error !==
|
|
661
|
+
var event = error !== null && error !== void 0 ? error : message;
|
|
662
662
|
this.report(source, event);
|
|
663
663
|
};
|
|
664
664
|
CoralogixErrorInstrumentation.prototype.reportEvent = function (source, ev) {
|
|
@@ -702,8 +702,8 @@ var CoralogixErrorInstrumentation = /** @class */ (function (_super) {
|
|
|
702
702
|
var propagateTraceHeaderCorsUrls = function (config) {
|
|
703
703
|
var _a;
|
|
704
704
|
var traceParentInHeader = config.traceParentInHeader;
|
|
705
|
-
var propagateCorsUrls = (_a = traceParentInHeader === null || traceParentInHeader ===
|
|
706
|
-
if ((traceParentInHeader === null || traceParentInHeader ===
|
|
705
|
+
var propagateCorsUrls = (_a = traceParentInHeader === null || traceParentInHeader === void 0 ? void 0 : traceParentInHeader.options) === null || _a === void 0 ? void 0 : _a.propagateTraceHeaderCorsUrls;
|
|
706
|
+
if ((traceParentInHeader === null || traceParentInHeader === void 0 ? void 0 : traceParentInHeader.enabled) && propagateCorsUrls) {
|
|
707
707
|
config.propagateTraceHeaderCorsUrls = propagateCorsUrls;
|
|
708
708
|
}
|
|
709
709
|
};
|
|
@@ -712,7 +712,7 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
712
712
|
function NetworkDataManager() {
|
|
713
713
|
var _this = this;
|
|
714
714
|
this.responseBodyParsers = new Map([
|
|
715
|
-
[MimeType.Json, function (body) { return __awaiter(_this,
|
|
715
|
+
[MimeType.Json, function (body) { return __awaiter(_this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) {
|
|
716
716
|
switch (_c.label) {
|
|
717
717
|
case 0:
|
|
718
718
|
_b = (_a = JSON).stringify;
|
|
@@ -720,37 +720,37 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
720
720
|
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
721
721
|
}
|
|
722
722
|
}); }); }],
|
|
723
|
-
[MimeType.TextPlain, function (body) { return __awaiter(_this,
|
|
723
|
+
[MimeType.TextPlain, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
724
724
|
switch (_a.label) {
|
|
725
725
|
case 0: return [4 /*yield*/, body.text()];
|
|
726
726
|
case 1: return [2 /*return*/, _a.sent()];
|
|
727
727
|
}
|
|
728
728
|
}); }); }],
|
|
729
|
-
[MimeType.TextHtml, function (body) { return __awaiter(_this,
|
|
729
|
+
[MimeType.TextHtml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
730
730
|
switch (_a.label) {
|
|
731
731
|
case 0: return [4 /*yield*/, body.text()];
|
|
732
732
|
case 1: return [2 /*return*/, _a.sent()];
|
|
733
733
|
}
|
|
734
734
|
}); }); }],
|
|
735
|
-
[MimeType.TextCss, function (body) { return __awaiter(_this,
|
|
735
|
+
[MimeType.TextCss, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
736
736
|
switch (_a.label) {
|
|
737
737
|
case 0: return [4 /*yield*/, body.text()];
|
|
738
738
|
case 1: return [2 /*return*/, _a.sent()];
|
|
739
739
|
}
|
|
740
740
|
}); }); }],
|
|
741
|
-
[MimeType.TextJavascript, function (body) { return __awaiter(_this,
|
|
741
|
+
[MimeType.TextJavascript, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
742
742
|
switch (_a.label) {
|
|
743
743
|
case 0: return [4 /*yield*/, body.text()];
|
|
744
744
|
case 1: return [2 /*return*/, _a.sent()];
|
|
745
745
|
}
|
|
746
746
|
}); }); }],
|
|
747
|
-
[MimeType.Xml, function (body) { return __awaiter(_this,
|
|
747
|
+
[MimeType.Xml, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
748
748
|
switch (_a.label) {
|
|
749
749
|
case 0: return [4 /*yield*/, body.text()];
|
|
750
750
|
case 1: return [2 /*return*/, _a.sent()];
|
|
751
751
|
}
|
|
752
752
|
}); }); }],
|
|
753
|
-
[MimeType.FormData, function (body) { return __awaiter(_this,
|
|
753
|
+
[MimeType.FormData, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
754
754
|
switch (_a.label) {
|
|
755
755
|
case 0: return [4 /*yield*/, body.text()];
|
|
756
756
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -758,31 +758,31 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
758
758
|
}); }); }],
|
|
759
759
|
]);
|
|
760
760
|
this.requestBodySerializers = new Map([
|
|
761
|
-
[BodyType.String, function (body) { return __awaiter(_this,
|
|
761
|
+
[BodyType.String, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
762
762
|
return [2 /*return*/, body];
|
|
763
763
|
}); }); }],
|
|
764
|
-
[BodyType.Blob, function (body) { return __awaiter(_this,
|
|
764
|
+
[BodyType.Blob, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
765
765
|
return [2 /*return*/, body.text()];
|
|
766
766
|
}); }); }],
|
|
767
767
|
[
|
|
768
768
|
BodyType.FormData,
|
|
769
|
-
function (body) { return __awaiter(_this,
|
|
769
|
+
function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
770
770
|
return [2 /*return*/, this.serializeFormData(body)];
|
|
771
771
|
}); }); },
|
|
772
772
|
],
|
|
773
773
|
[
|
|
774
774
|
BodyType.URLSearchParams,
|
|
775
|
-
function (body) { return __awaiter(_this,
|
|
775
|
+
function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
776
776
|
return [2 /*return*/, body.toString()];
|
|
777
777
|
}); }); },
|
|
778
778
|
],
|
|
779
|
-
[BodyType.JsonObject, function (body) { return __awaiter(_this,
|
|
779
|
+
[BodyType.JsonObject, function (body) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
780
780
|
return [2 /*return*/, JSON.stringify(body)];
|
|
781
781
|
}); }); }],
|
|
782
782
|
]);
|
|
783
783
|
}
|
|
784
784
|
NetworkDataManager.prototype.resolveConfigForUrl = function (url, configs) {
|
|
785
|
-
if (configs ===
|
|
785
|
+
if (configs === void 0) { configs = []; }
|
|
786
786
|
return configs.find(function (_a) {
|
|
787
787
|
var configUrl = _a.url;
|
|
788
788
|
return configUrl === url ||
|
|
@@ -790,12 +790,12 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
790
790
|
});
|
|
791
791
|
};
|
|
792
792
|
NetworkDataManager.prototype.stringifyRequestBody = function (request) {
|
|
793
|
-
return __awaiter(this,
|
|
793
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
794
794
|
var bodyContent;
|
|
795
795
|
return __generator(this, function (_a) {
|
|
796
796
|
switch (_a.label) {
|
|
797
797
|
case 0:
|
|
798
|
-
if (!(request === null || request ===
|
|
798
|
+
if (!(request === null || request === void 0 ? void 0 : request.body))
|
|
799
799
|
return [2 /*return*/, ''];
|
|
800
800
|
return [4 /*yield*/, this.serializeRequestBody(request.body)];
|
|
801
801
|
case 1:
|
|
@@ -806,7 +806,7 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
806
806
|
});
|
|
807
807
|
};
|
|
808
808
|
NetworkDataManager.prototype.stringifyResponseBody = function (response) {
|
|
809
|
-
return __awaiter(this,
|
|
809
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
810
810
|
var contentType, mimeType, parser, parsedContent;
|
|
811
811
|
return __generator(this, function (_a) {
|
|
812
812
|
switch (_a.label) {
|
|
@@ -828,7 +828,7 @@ var NetworkDataManager = /** @class */ (function () {
|
|
|
828
828
|
return content.length > MAX_CHARACTERS ? undefined : content;
|
|
829
829
|
};
|
|
830
830
|
NetworkDataManager.prototype.serializeRequestBody = function (body) {
|
|
831
|
-
return __awaiter(this,
|
|
831
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
832
832
|
var handler, _a;
|
|
833
833
|
return __generator(this, function (_b) {
|
|
834
834
|
switch (_b.label) {
|
|
@@ -880,7 +880,7 @@ var HeadersManager = /** @class */ (function () {
|
|
|
880
880
|
function HeadersManager() {
|
|
881
881
|
}
|
|
882
882
|
HeadersManager.prototype.filterHeaders = function (headersInit, allowedKeys) {
|
|
883
|
-
if (allowedKeys ===
|
|
883
|
+
if (allowedKeys === void 0) { allowedKeys = []; }
|
|
884
884
|
if (!headersInit) {
|
|
885
885
|
return new Map();
|
|
886
886
|
}
|
|
@@ -958,7 +958,7 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
958
958
|
return _this;
|
|
959
959
|
}
|
|
960
960
|
CoralogixFetchInstrumentation.prototype.setNetworkSpanAttributes = function (span, request, response) {
|
|
961
|
-
return __awaiter(this,
|
|
961
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
962
962
|
var status, networkExtraConfig, url, resolvedConfig;
|
|
963
963
|
var _a;
|
|
964
964
|
return __generator(this, function (_b) {
|
|
@@ -991,7 +991,7 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
991
991
|
});
|
|
992
992
|
};
|
|
993
993
|
CoralogixFetchInstrumentation.prototype.setRequestAttributes = function (span, request, networkExtraConfig) {
|
|
994
|
-
return __awaiter(this,
|
|
994
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
995
995
|
var reqHeaders, collectReqPayload, requestPayload, _a, sanitizedHeaders, error_1;
|
|
996
996
|
return __generator(this, function (_b) {
|
|
997
997
|
switch (_b.label) {
|
|
@@ -1010,12 +1010,12 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
1010
1010
|
_b.label = 4;
|
|
1011
1011
|
case 4:
|
|
1012
1012
|
requestPayload = _a;
|
|
1013
|
-
sanitizedHeaders = (reqHeaders === null || reqHeaders ===
|
|
1013
|
+
sanitizedHeaders = (reqHeaders === null || reqHeaders === void 0 ? void 0 : reqHeaders.length)
|
|
1014
1014
|
? this.headersManager.filterHeaders(request.headers, reqHeaders)
|
|
1015
1015
|
: undefined;
|
|
1016
1016
|
if (requestPayload)
|
|
1017
1017
|
span[NetworkInstrumentationAttributes.REQUEST_PAYLOAD] = requestPayload;
|
|
1018
|
-
if (sanitizedHeaders === null || sanitizedHeaders ===
|
|
1018
|
+
if (sanitizedHeaders === null || sanitizedHeaders === void 0 ? void 0 : sanitizedHeaders.size) {
|
|
1019
1019
|
span[NetworkInstrumentationAttributes.REQUEST_HEADERS] =
|
|
1020
1020
|
Object.fromEntries(sanitizedHeaders);
|
|
1021
1021
|
}
|
|
@@ -1032,7 +1032,7 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
1032
1032
|
});
|
|
1033
1033
|
};
|
|
1034
1034
|
CoralogixFetchInstrumentation.prototype.setResponseAttributes = function (span, result, networkExtraConfig) {
|
|
1035
|
-
return __awaiter(this,
|
|
1035
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1036
1036
|
var resHeaders, collectResPayload, responsePayload, _a, sanitizedHeaders, error_2;
|
|
1037
1037
|
return __generator(this, function (_b) {
|
|
1038
1038
|
switch (_b.label) {
|
|
@@ -1052,14 +1052,14 @@ var CoralogixFetchInstrumentation = /** @class */ (function (_super) {
|
|
|
1052
1052
|
_b.label = 4;
|
|
1053
1053
|
case 4:
|
|
1054
1054
|
responsePayload = _a;
|
|
1055
|
-
sanitizedHeaders = (resHeaders === null || resHeaders ===
|
|
1055
|
+
sanitizedHeaders = (resHeaders === null || resHeaders === void 0 ? void 0 : resHeaders.length)
|
|
1056
1056
|
? this.headersManager.filterHeaders(result.headers, resHeaders)
|
|
1057
1057
|
: undefined;
|
|
1058
1058
|
if (responsePayload) {
|
|
1059
1059
|
span[NetworkInstrumentationAttributes.RESPONSE_PAYLOAD] =
|
|
1060
1060
|
responsePayload;
|
|
1061
1061
|
}
|
|
1062
|
-
if (sanitizedHeaders === null || sanitizedHeaders ===
|
|
1062
|
+
if (sanitizedHeaders === null || sanitizedHeaders === void 0 ? void 0 : sanitizedHeaders.size) {
|
|
1063
1063
|
span[NetworkInstrumentationAttributes.RESPONSE_HEADERS] =
|
|
1064
1064
|
Object.fromEntries(sanitizedHeaders);
|
|
1065
1065
|
}
|
|
@@ -1118,13 +1118,13 @@ var CoralogixXhrInstrumentation = /** @class */ (function (_super) {
|
|
|
1118
1118
|
var responsePayload = collectResPayload
|
|
1119
1119
|
? this.networkDataManager.truncateIfExceedsLimit(xhr.responseText)
|
|
1120
1120
|
: undefined;
|
|
1121
|
-
var sanitizedHeaders = (resHeaders === null || resHeaders ===
|
|
1121
|
+
var sanitizedHeaders = (resHeaders === null || resHeaders === void 0 ? void 0 : resHeaders.length)
|
|
1122
1122
|
? this.headersManager.filterHeaders(xhr.getAllResponseHeaders(), resHeaders)
|
|
1123
1123
|
: undefined;
|
|
1124
1124
|
if (responsePayload) {
|
|
1125
1125
|
span[NetworkInstrumentationAttributes.RESPONSE_PAYLOAD] = responsePayload;
|
|
1126
1126
|
}
|
|
1127
|
-
if (sanitizedHeaders === null || sanitizedHeaders ===
|
|
1127
|
+
if (sanitizedHeaders === null || sanitizedHeaders === void 0 ? void 0 : sanitizedHeaders.size) {
|
|
1128
1128
|
span[NetworkInstrumentationAttributes.RESPONSE_HEADERS] =
|
|
1129
1129
|
Object.fromEntries(sanitizedHeaders);
|
|
1130
1130
|
}
|
|
@@ -1142,7 +1142,7 @@ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
|
|
|
1142
1142
|
function CoralogixCustomLogInstrumentation(config) {
|
|
1143
1143
|
var _a;
|
|
1144
1144
|
var _this = _super.call(this, CoralogixEventType.LOG, CUSTOM_INSTRUMENTATION_VERSION, config) || this;
|
|
1145
|
-
_this.stringifyCustomLogData = (_a = getSdkConfig()) === null || _a ===
|
|
1145
|
+
_this.stringifyCustomLogData = (_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.stringifyCustomLogData;
|
|
1146
1146
|
return _this;
|
|
1147
1147
|
}
|
|
1148
1148
|
CoralogixCustomLogInstrumentation.prototype.init = function () { };
|
|
@@ -1207,7 +1207,7 @@ function isObject(value) {
|
|
|
1207
1207
|
* @returns Returns a new object with the specified paths omitted.
|
|
1208
1208
|
*/
|
|
1209
1209
|
function omit(object) {
|
|
1210
|
-
if (object ===
|
|
1210
|
+
if (object === void 0) { object = {}; }
|
|
1211
1211
|
var paths = [];
|
|
1212
1212
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1213
1213
|
paths[_i - 1] = arguments[_i];
|
|
@@ -1607,7 +1607,7 @@ function observeIfSupported(observer, entryType) {
|
|
|
1607
1607
|
}
|
|
1608
1608
|
function isPerformanceObserverSupported() {
|
|
1609
1609
|
var _a;
|
|
1610
|
-
if (!((_a = CxGlobal === null || CxGlobal ===
|
|
1610
|
+
if (!((_a = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.PerformanceObserver) === null || _a === void 0 ? void 0 : _a.supportedEntryTypes)) {
|
|
1611
1611
|
console.warn('Coralogix Browser SDK - browser does not support the required APIs ');
|
|
1612
1612
|
return false;
|
|
1613
1613
|
}
|
|
@@ -1771,7 +1771,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
|
|
|
1771
1771
|
name: 'TBT',
|
|
1772
1772
|
id: generateWebVitalUniqueID(),
|
|
1773
1773
|
rating: rateForTBTMetricValue(totalBlockingTime),
|
|
1774
|
-
value: ((_a = tbtMetric === null || tbtMetric ===
|
|
1774
|
+
value: ((_a = tbtMetric === null || tbtMetric === void 0 ? void 0 : tbtMetric.value) !== null && _a !== void 0 ? _a : 0) + totalBlockingTime,
|
|
1775
1775
|
};
|
|
1776
1776
|
});
|
|
1777
1777
|
this.observers.push(totalBLockingTimeObserver);
|
|
@@ -1786,7 +1786,7 @@ var CoralogixWebVitalsInstrumentation = /** @class */ (function (_super) {
|
|
|
1786
1786
|
id: generateWebVitalUniqueID(),
|
|
1787
1787
|
});
|
|
1788
1788
|
totalBLockingTimeObserver.disconnect();
|
|
1789
|
-
(_b = (_a = CxGlobal.__tti) === null || _a ===
|
|
1789
|
+
(_b = (_a = CxGlobal.__tti) === null || _a === void 0 ? void 0 : _a.o) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
1790
1790
|
}
|
|
1791
1791
|
});
|
|
1792
1792
|
};
|
|
@@ -1837,7 +1837,7 @@ var CoralogixLongTaskInstrumentation = /** @class */ (function (_super) {
|
|
|
1837
1837
|
CoralogixLongTaskInstrumentation.prototype.enable = function () { };
|
|
1838
1838
|
CoralogixLongTaskInstrumentation.prototype.disable = function () {
|
|
1839
1839
|
var _a;
|
|
1840
|
-
(_a = this.longTaskObserver) === null || _a ===
|
|
1840
|
+
(_a = this.longTaskObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1841
1841
|
};
|
|
1842
1842
|
CoralogixLongTaskInstrumentation.prototype.init = function () { };
|
|
1843
1843
|
return CoralogixLongTaskInstrumentation;
|
|
@@ -1886,7 +1886,7 @@ var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
|
|
|
1886
1886
|
function CoralogixResourcesInstrumentation(config) {
|
|
1887
1887
|
var _a;
|
|
1888
1888
|
var _this = _super.call(this, RESOURCES_INSTRUMENTATION_NAME, RESOURCES_INSTRUMENTATION_VERSION, config) || this;
|
|
1889
|
-
_this.ignoreUrls = (_a = getSdkConfig()) === null || _a ===
|
|
1889
|
+
_this.ignoreUrls = (_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.ignoreUrls;
|
|
1890
1890
|
if (supportedPerformanceTypes.has(PerformanceTypes.Resource)) {
|
|
1891
1891
|
_this.registerToResources();
|
|
1892
1892
|
}
|
|
@@ -1918,7 +1918,7 @@ var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
|
|
|
1918
1918
|
};
|
|
1919
1919
|
CoralogixResourcesInstrumentation.prototype.isResourceIgnored = function (resourceName) {
|
|
1920
1920
|
var _a;
|
|
1921
|
-
if (!resourceName || !((_a = this.ignoreUrls) === null || _a ===
|
|
1921
|
+
if (!resourceName || !((_a = this.ignoreUrls) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1922
1922
|
return false;
|
|
1923
1923
|
}
|
|
1924
1924
|
return isPatternMatch(resourceName, this.ignoreUrls, 'ignoreUrls');
|
|
@@ -1966,14 +1966,14 @@ var CoralogixResourcesInstrumentation = /** @class */ (function (_super) {
|
|
|
1966
1966
|
var _a;
|
|
1967
1967
|
var resourceSpan = this.tracer.startSpan(RESOURCES_INSTRUMENTATION_NAME);
|
|
1968
1968
|
resourceSpan.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.RESOURCES);
|
|
1969
|
-
var newEntry = __assign(__assign({}, deepClone(entry)), { name: (_a = entry.name) === null || _a ===
|
|
1969
|
+
var newEntry = __assign(__assign({}, deepClone(entry)), { name: (_a = entry.name) === null || _a === void 0 ? void 0 : _a.slice(0, MAX_CHARACTERS) });
|
|
1970
1970
|
resourceSpan.setAttribute(RESOURCES_INSTRUMENTATION_NAME, JSON.stringify(newEntry));
|
|
1971
1971
|
resourceSpan.end();
|
|
1972
1972
|
};
|
|
1973
1973
|
CoralogixResourcesInstrumentation.prototype.enable = function () { };
|
|
1974
1974
|
CoralogixResourcesInstrumentation.prototype.disable = function () {
|
|
1975
1975
|
var _a;
|
|
1976
|
-
(_a = this.resourcesObserver) === null || _a ===
|
|
1976
|
+
(_a = this.resourcesObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1977
1977
|
};
|
|
1978
1978
|
CoralogixResourcesInstrumentation.prototype.init = function () { };
|
|
1979
1979
|
return CoralogixResourcesInstrumentation;
|
|
@@ -1999,7 +1999,7 @@ function getZoneJsOriginalDom(target, name) {
|
|
|
1999
1999
|
* Add event listeners to an event target object.
|
|
2000
2000
|
*/
|
|
2001
2001
|
function addEventListeners(eventTarget, eventNames, listener, _a) {
|
|
2002
|
-
var _b = _a ===
|
|
2002
|
+
var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;
|
|
2003
2003
|
var resolvedListener = once
|
|
2004
2004
|
? function (event) {
|
|
2005
2005
|
stop();
|
|
@@ -2052,7 +2052,7 @@ function getMaskedOrTextualContent(element, config) {
|
|
|
2052
2052
|
return getTextualContent(element);
|
|
2053
2053
|
}
|
|
2054
2054
|
function isParentMasked(element, maskClass, maxDepth) {
|
|
2055
|
-
if (maxDepth ===
|
|
2055
|
+
if (maxDepth === void 0) { maxDepth = PARENT_SEARCH_DEPTH; }
|
|
2056
2056
|
if (!element || maxDepth <= 0) {
|
|
2057
2057
|
return false;
|
|
2058
2058
|
}
|
|
@@ -2135,7 +2135,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
|
2135
2135
|
[CoralogixAttributes.TARGET_ELEMENT_TYPE, type],
|
|
2136
2136
|
[
|
|
2137
2137
|
CoralogixAttributes.ELEMENT_INNER_TEXT,
|
|
2138
|
-
elementText === null || elementText ===
|
|
2138
|
+
elementText === null || elementText === void 0 ? void 0 : elementText.slice(0, MAX_INTERACTION_ELEMENT_SIZE),
|
|
2139
2139
|
],
|
|
2140
2140
|
[CoralogixAttributes.TARGET_ELEMENT, nodeName],
|
|
2141
2141
|
].forEach(function (_a) {
|
|
@@ -2145,7 +2145,7 @@ var CoralogixUserInteractionInstrumentation = /** @class */ (function (_super) {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
span.end();
|
|
2147
2147
|
};
|
|
2148
|
-
var eventsMap = __assign(__assign({}, DEFAULT_INSTRUMENTED_EVENTS), (_a = this._config) === null || _a ===
|
|
2148
|
+
var eventsMap = __assign(__assign({}, DEFAULT_INSTRUMENTED_EVENTS), (_a = this._config) === null || _a === void 0 ? void 0 : _a['events']);
|
|
2149
2149
|
var eventNames = Object.entries(eventsMap)
|
|
2150
2150
|
.filter(function (_a) {
|
|
2151
2151
|
var _b = __read$1(_a, 2); _b[0]; var enabled = _b[1];
|
|
@@ -2234,7 +2234,7 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
|
|
|
2234
2234
|
this.createMemorySample().then(function () { return _this.runMemoryMeasurements(); });
|
|
2235
2235
|
};
|
|
2236
2236
|
CoralogixMemoryUsageInstrumentation.prototype.createMemorySample = function () {
|
|
2237
|
-
return __awaiter(this,
|
|
2237
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2238
2238
|
var memoryUsage, memoryUsageEntries, memoryUsageEntries_1, memoryUsageEntries_1_1, entry, memoryUsageSpan, error_1;
|
|
2239
2239
|
var e_1, _a;
|
|
2240
2240
|
return __generator(this, function (_b) {
|
|
@@ -2278,7 +2278,7 @@ var CoralogixMemoryUsageInstrumentation = /** @class */ (function (_super) {
|
|
|
2278
2278
|
this.timeoutId = setTimeout(function () { return _this.measureMemoryUsage(); }, this.memoryUsageInterval);
|
|
2279
2279
|
};
|
|
2280
2280
|
CoralogixMemoryUsageInstrumentation.prototype.measureMemoryUsage = function () {
|
|
2281
|
-
return __awaiter(this,
|
|
2281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2282
2282
|
return __generator(this, function (_a) {
|
|
2283
2283
|
switch (_a.label) {
|
|
2284
2284
|
case 0: return [4 /*yield*/, this.createMemorySample()];
|
|
@@ -2397,7 +2397,7 @@ var CoralogixInternalInstrumentation = /** @class */ (function (_super) {
|
|
|
2397
2397
|
CoralogixInternalInstrumentation.prototype.disable = function () { };
|
|
2398
2398
|
CoralogixInternalInstrumentation.prototype.enable = function () { };
|
|
2399
2399
|
CoralogixInternalInstrumentation.prototype.reportInternalEvent = function (event, message) {
|
|
2400
|
-
if (message ===
|
|
2400
|
+
if (message === void 0) { message = ''; }
|
|
2401
2401
|
var span = this.tracer.startSpan(CoralogixEventType.INTERNAL);
|
|
2402
2402
|
var data;
|
|
2403
2403
|
span.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.INTERNAL);
|
|
@@ -2642,11 +2642,11 @@ function saveInternalRumData(key, value) {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
function getInternalRumData(key) {
|
|
2644
2644
|
var _a;
|
|
2645
|
-
return (_a = CxGlobal[RUM_INTERNAL_DATA_KEY]) === null || _a ===
|
|
2645
|
+
return (_a = CxGlobal[RUM_INTERNAL_DATA_KEY]) === null || _a === void 0 ? void 0 : _a[key];
|
|
2646
2646
|
}
|
|
2647
2647
|
|
|
2648
2648
|
var _a$1;
|
|
2649
|
-
var supportedPerformanceTypes = !((_a$1 = CxGlobal === null || CxGlobal ===
|
|
2649
|
+
var supportedPerformanceTypes = !((_a$1 = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.PerformanceObserver) === null || _a$1 === void 0 ? void 0 : _a$1.supportedEntryTypes)
|
|
2650
2650
|
? new Set()
|
|
2651
2651
|
: new Set(CxGlobal.PerformanceObserver.supportedEntryTypes);
|
|
2652
2652
|
function valueEndWithOrInclude(value, extensions) {
|
|
@@ -2659,7 +2659,7 @@ function getInstrumentationConfig(value, defaults, defaultDisable) {
|
|
|
2659
2659
|
if (value === undefined && defaultDisable) {
|
|
2660
2660
|
return false;
|
|
2661
2661
|
}
|
|
2662
|
-
if ((value === null || value ===
|
|
2662
|
+
if ((value === null || value === void 0 ? void 0 : value.enabled) === false) {
|
|
2663
2663
|
return false;
|
|
2664
2664
|
}
|
|
2665
2665
|
return Object.assign({}, defaults, value);
|
|
@@ -2679,9 +2679,9 @@ var getUrlFragments = function (url) {
|
|
|
2679
2679
|
if (!url) {
|
|
2680
2680
|
return '';
|
|
2681
2681
|
}
|
|
2682
|
-
var withoutProtocol = ((_a = url.split(PROTOCOL_SEPARATOR)) === null || _a ===
|
|
2683
|
-
var startPath = (_b = withoutProtocol.split(BASE_PATH)) === null || _b ===
|
|
2684
|
-
if (startPath === null || startPath ===
|
|
2682
|
+
var withoutProtocol = ((_a = url.split(PROTOCOL_SEPARATOR)) === null || _a === void 0 ? void 0 : _a[1]) || url;
|
|
2683
|
+
var startPath = (_b = withoutProtocol.split(BASE_PATH)) === null || _b === void 0 ? void 0 : _b[1];
|
|
2684
|
+
if (startPath === null || startPath === void 0 ? void 0 : startPath.startsWith(HASH_SEPARATOR)) {
|
|
2685
2685
|
var fragments = withoutProtocol.split(HASH_SEPARATOR)[1];
|
|
2686
2686
|
var cleanedFragments = fragments.split(PARAMS_SEPARATOR)[0];
|
|
2687
2687
|
var pathFragments = cleanedFragments.split(BASE_PATH);
|
|
@@ -2859,14 +2859,14 @@ function replacePatternsInUrl(_a) {
|
|
|
2859
2859
|
function applyUrlBluePrinters(_a) {
|
|
2860
2860
|
var url = _a.url, blueprinters = _a.blueprinters;
|
|
2861
2861
|
var blueprintedUrl = url;
|
|
2862
|
-
blueprinters === null || blueprinters ===
|
|
2862
|
+
blueprinters === null || blueprinters === void 0 ? void 0 : blueprinters.forEach(function (urlBlueprinter) { return (blueprintedUrl = urlBlueprinter(blueprintedUrl)); });
|
|
2863
2863
|
return blueprintedUrl;
|
|
2864
2864
|
}
|
|
2865
2865
|
function resolvePageContext(url) {
|
|
2866
2866
|
var _a;
|
|
2867
2867
|
var page_url_blueprint = applyUrlBluePrinters({
|
|
2868
2868
|
url: url,
|
|
2869
|
-
blueprinters: (_a = getSdkConfig().urlBlueprinters) === null || _a ===
|
|
2869
|
+
blueprinters: (_a = getSdkConfig().urlBlueprinters) === null || _a === void 0 ? void 0 : _a.pageUrlBlueprinters,
|
|
2870
2870
|
});
|
|
2871
2871
|
var page_fragments = getUrlFragments(page_url_blueprint);
|
|
2872
2872
|
return {
|
|
@@ -2915,7 +2915,7 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
}
|
|
2917
2917
|
CoralogixSpanAttributesProcessor.prototype.setCustomLabels = function (labels) {
|
|
2918
|
-
this.labels[CoralogixAttributes.CUSTOM_LABELS] = JSON.stringify(labels !== null && labels !==
|
|
2918
|
+
this.labels[CoralogixAttributes.CUSTOM_LABELS] = JSON.stringify(labels !== null && labels !== void 0 ? labels : {});
|
|
2919
2919
|
};
|
|
2920
2920
|
CoralogixSpanAttributesProcessor.prototype.setInternalLabels = function (labels) {
|
|
2921
2921
|
var _a;
|
|
@@ -3173,7 +3173,7 @@ var __values = (undefined && undefined.__values) || function(o) {
|
|
|
3173
3173
|
if (m) return m.call(o);
|
|
3174
3174
|
if (o && typeof o.length === "number") return {
|
|
3175
3175
|
next: function () {
|
|
3176
|
-
if (o && i >= o.length) o =
|
|
3176
|
+
if (o && i >= o.length) o = void 0;
|
|
3177
3177
|
return { value: o && o[i++], done: !o };
|
|
3178
3178
|
}
|
|
3179
3179
|
};
|
|
@@ -3187,9 +3187,9 @@ var CompositePropagator = /** @class */ (function () {
|
|
|
3187
3187
|
* @param [config] Configuration object for composite propagator
|
|
3188
3188
|
*/
|
|
3189
3189
|
function CompositePropagator(config) {
|
|
3190
|
-
if (config ===
|
|
3190
|
+
if (config === void 0) { config = {}; }
|
|
3191
3191
|
var _a;
|
|
3192
|
-
this._propagators = (_a = config.propagators) !== null && _a !==
|
|
3192
|
+
this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
|
|
3193
3193
|
this._fields = Array.from(new Set(this._propagators
|
|
3194
3194
|
// older propagators may not have fields function, null check to be sure
|
|
3195
3195
|
.map(function (p) { return (typeof p.fields === 'function' ? p.fields() : []); })
|
|
@@ -3496,9 +3496,6 @@ var MAX_MS_RECORD_TIME = 60000;
|
|
|
3496
3496
|
var DEFAULT_RUM_EVENTS = 5000;
|
|
3497
3497
|
var DEFAULT_MS_RECORD_TIME = 10000;
|
|
3498
3498
|
({
|
|
3499
|
-
enable: true,
|
|
3500
|
-
maxRumEvents: DEFAULT_RUM_EVENTS,
|
|
3501
|
-
maxRecordTime: DEFAULT_MS_RECORD_TIME,
|
|
3502
3499
|
instrumentationsToSend: (_a = {},
|
|
3503
3500
|
_a[CoralogixEventType.WEB_VITALS] = true,
|
|
3504
3501
|
_a),
|
|
@@ -3566,7 +3563,7 @@ function resolveSessionWithErrorsConfig(config) {
|
|
|
3566
3563
|
if (!config) {
|
|
3567
3564
|
return { enable: false };
|
|
3568
3565
|
}
|
|
3569
|
-
return __assign(__assign({}, config), { maxRumEvents: resolveMaxRumEvents(config.maxRumEvents), maxRecordTime: resolveMaxRecordTime(config.maxRecordTime), instrumentationsToSend: (_b = config.instrumentationsToSend) !== null && _b !==
|
|
3566
|
+
return __assign(__assign({}, config), { maxRumEvents: resolveMaxRumEvents(config.maxRumEvents), maxRecordTime: resolveMaxRecordTime(config.maxRecordTime), instrumentationsToSend: (_b = config.instrumentationsToSend) !== null && _b !== void 0 ? _b : (_a = {},
|
|
3570
3567
|
_a[CoralogixEventType.WEB_VITALS] = true,
|
|
3571
3568
|
_a) });
|
|
3572
3569
|
}
|
|
@@ -3575,12 +3572,12 @@ function resolveSessionConfig(config) {
|
|
|
3575
3572
|
if (!config) {
|
|
3576
3573
|
return DEFAULT_SESSION_CONFIG;
|
|
3577
3574
|
}
|
|
3578
|
-
return __assign(__assign({}, config), { sessionSampleRate: (_a = config.sessionSampleRate) !== null && _a !==
|
|
3575
|
+
return __assign(__assign({}, config), { sessionSampleRate: (_a = config.sessionSampleRate) !== null && _a !== void 0 ? _a : 100, onlyWithErrorConfig: resolveSessionWithErrorsConfig(config.onlyWithErrorConfig) });
|
|
3579
3576
|
}
|
|
3580
3577
|
function resolveSessionRecordingConfig(config) {
|
|
3581
3578
|
var _a;
|
|
3582
3579
|
if (config) {
|
|
3583
|
-
return __assign(__assign({}, config), { sessionRecordingSampleRate: (_a = config.sessionRecordingSampleRate) !== null && _a !==
|
|
3580
|
+
return __assign(__assign({}, config), { sessionRecordingSampleRate: (_a = config.sessionRecordingSampleRate) !== null && _a !== void 0 ? _a : 100 });
|
|
3584
3581
|
}
|
|
3585
3582
|
return;
|
|
3586
3583
|
}
|
|
@@ -3599,7 +3596,7 @@ function getResolvedSampler(resolvedOptions) {
|
|
|
3599
3596
|
!isSamplingOn(sessionSampleRate) ||
|
|
3600
3597
|
!isSamplingOn(sessionConfig.sessionSampleRate);
|
|
3601
3598
|
if (shouldNotTrackSession) {
|
|
3602
|
-
var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig ===
|
|
3599
|
+
var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.alwaysTrackSessionsWithErrors;
|
|
3603
3600
|
if (shouldAlwaysTrackSessionsWithErrors) {
|
|
3604
3601
|
sessionConfig.onlyWithErrorConfig = __assign(__assign({}, sessionConfig.onlyWithErrorConfig), { enable: true });
|
|
3605
3602
|
}
|
|
@@ -3620,7 +3617,7 @@ function getResolvedSampler(resolvedOptions) {
|
|
|
3620
3617
|
|
|
3621
3618
|
function isProcessorShouldStop(isActive) {
|
|
3622
3619
|
var _a;
|
|
3623
|
-
return !isActive || !!((_a = getSessionManager()) === null || _a ===
|
|
3620
|
+
return !isActive || !!((_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.isIdleActive);
|
|
3624
3621
|
}
|
|
3625
3622
|
|
|
3626
3623
|
var CoralogixExporter = /** @class */ (function () {
|
|
@@ -3634,7 +3631,7 @@ var CoralogixExporter = /** @class */ (function () {
|
|
|
3634
3631
|
});
|
|
3635
3632
|
this.batchTimeDelay = BATCH_TIME_DELAY;
|
|
3636
3633
|
this.invokeLogRequest = function (logs, markCachedLogsSent) {
|
|
3637
|
-
if (logs === null || logs ===
|
|
3634
|
+
if (logs === null || logs === void 0 ? void 0 : logs.length) {
|
|
3638
3635
|
_this.request
|
|
3639
3636
|
.send(JSON.stringify({
|
|
3640
3637
|
logs: logs,
|
|
@@ -3734,7 +3731,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3734
3731
|
this.stopCallbacks = {};
|
|
3735
3732
|
this.resetTimeout = function () {
|
|
3736
3733
|
var _a, _b;
|
|
3737
|
-
(_b = (_a = _this.stopCallbacks).clearTimeout) === null || _b ===
|
|
3734
|
+
(_b = (_a = _this.stopCallbacks).clearTimeout) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3738
3735
|
var id = setTimeout(function () {
|
|
3739
3736
|
_this._isIdleActive = true;
|
|
3740
3737
|
_this.idleConfig.onIdle();
|
|
@@ -3765,7 +3762,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3765
3762
|
};
|
|
3766
3763
|
SessionIdle.prototype.trackActivity = function () {
|
|
3767
3764
|
var _a, _b;
|
|
3768
|
-
(_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b ===
|
|
3765
|
+
(_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3769
3766
|
if (typeof CxGlobal.addEventListener === 'function') {
|
|
3770
3767
|
var stop_1 = addEventListeners(CxGlobal, ["touchstart" /* DOM_EVENT.TOUCH_START */, "keydown" /* DOM_EVENT.KEY_DOWN */, "mousemove" /* DOM_EVENT.MOUSE_MOVE */], this.idlenessEventsHandler, { capture: true, passive: true }).stop;
|
|
3771
3768
|
this.stopCallbacks.removeActivityListeners = stop_1;
|
|
@@ -3777,6 +3774,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3777
3774
|
var SessionManager = /** @class */ (function (_super) {
|
|
3778
3775
|
__extends(SessionManager, _super);
|
|
3779
3776
|
function SessionManager(recordConfig) {
|
|
3777
|
+
var _a;
|
|
3780
3778
|
var _this = _super.call(this, {
|
|
3781
3779
|
timeoutDelay: SESSION_IDLE_TIME,
|
|
3782
3780
|
onIdle: function () { return _this.clearSessionWhenIdle(); },
|
|
@@ -3786,13 +3784,14 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3786
3784
|
_this._sessionHasError = false;
|
|
3787
3785
|
_this._cachedLogsSent = false;
|
|
3788
3786
|
_this._currentPageTimestamp = getNowTime();
|
|
3787
|
+
_this.debugMode = !!((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.debug);
|
|
3789
3788
|
_this.getPrevSession = function () {
|
|
3790
3789
|
var _a;
|
|
3791
|
-
return JSON.parse((_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3790
|
+
return JSON.parse((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(PREV_SESSION_KEY));
|
|
3792
3791
|
};
|
|
3793
3792
|
_this.getSession = function () {
|
|
3794
3793
|
var _a;
|
|
3795
|
-
var storedSession = JSON.parse((_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3794
|
+
var storedSession = JSON.parse((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(SESSION_KEY));
|
|
3796
3795
|
var now = getNowTime();
|
|
3797
3796
|
var session;
|
|
3798
3797
|
if (storedSession) {
|
|
@@ -3808,22 +3807,22 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3808
3807
|
};
|
|
3809
3808
|
_this.setSession = function (afterIdle) {
|
|
3810
3809
|
var _a, _b, _c, _d;
|
|
3811
|
-
if (afterIdle ===
|
|
3812
|
-
var shouldkeepSessionAfterReload = (_a = _this._sessionConfig) === null || _a ===
|
|
3810
|
+
if (afterIdle === void 0) { afterIdle = false; }
|
|
3811
|
+
var shouldkeepSessionAfterReload = (_a = _this._sessionConfig) === null || _a === void 0 ? void 0 : _a.keepSessionAfterReload;
|
|
3813
3812
|
if (shouldkeepSessionAfterReload) {
|
|
3814
3813
|
_this.handleRefreshedSessions();
|
|
3815
3814
|
}
|
|
3816
3815
|
else {
|
|
3817
3816
|
_this.createNewSession();
|
|
3818
3817
|
}
|
|
3819
|
-
(_b = CxGlobal.sessionStorage) === null || _b ===
|
|
3818
|
+
(_b = CxGlobal.sessionStorage) === null || _b === void 0 ? void 0 : _b.setItem(SESSION_KEY, JSON.stringify(_this.activeSession));
|
|
3820
3819
|
var sessionRecorder = getSessionRecorder();
|
|
3821
3820
|
var shouldStartRecordingAfterIdle = afterIdle &&
|
|
3822
|
-
!!(sessionRecorder === null || sessionRecorder ===
|
|
3823
|
-
!!((_c = _this.sessionRecorderConfig) === null || _c ===
|
|
3821
|
+
!!(sessionRecorder === null || sessionRecorder === void 0 ? void 0 : sessionRecorder.recordingStopDueToTimeout) &&
|
|
3822
|
+
!!((_c = _this.sessionRecorderConfig) === null || _c === void 0 ? void 0 : _c.enable);
|
|
3824
3823
|
if (shouldStartRecordingAfterIdle ||
|
|
3825
|
-
(sessionRecorder === null || sessionRecorder ===
|
|
3826
|
-
(_d = _this.sessionRecorder) === null || _d ===
|
|
3824
|
+
(sessionRecorder === null || sessionRecorder === void 0 ? void 0 : sessionRecorder.getIsAutoStartRecording())) {
|
|
3825
|
+
(_d = _this.sessionRecorder) === null || _d === void 0 ? void 0 : _d.startRecording();
|
|
3827
3826
|
}
|
|
3828
3827
|
return _this.activeSession;
|
|
3829
3828
|
};
|
|
@@ -3923,14 +3922,14 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3923
3922
|
this.stopIdleListener();
|
|
3924
3923
|
};
|
|
3925
3924
|
SessionManager.prototype.initializeSession = function (recordConfig) {
|
|
3926
|
-
return __awaiter(this,
|
|
3925
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3927
3926
|
var recordingSamplingEnabled, SessionRecorder_1;
|
|
3928
3927
|
return __generator(this, function (_a) {
|
|
3929
3928
|
switch (_a.label) {
|
|
3930
3929
|
case 0:
|
|
3931
3930
|
CxGlobal[SESSION_MANAGER_KEY] = this;
|
|
3932
3931
|
this.sessionRecorderConfig = recordConfig;
|
|
3933
|
-
if (!(recordConfig === null || recordConfig ===
|
|
3932
|
+
if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
|
|
3934
3933
|
recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
|
|
3935
3934
|
if (!recordingSamplingEnabled) return [3 /*break*/, 2];
|
|
3936
3935
|
return [4 /*yield*/, import('./sessionRecorder.esm.js')];
|
|
@@ -3950,24 +3949,27 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3950
3949
|
};
|
|
3951
3950
|
SessionManager.prototype.clearSessionWhenIdle = function () {
|
|
3952
3951
|
var _a;
|
|
3953
|
-
if ((_a = this.sessionRecorder) === null || _a ===
|
|
3952
|
+
if ((_a = this.sessionRecorder) === null || _a === void 0 ? void 0 : _a.getSessionHasRecording()) {
|
|
3954
3953
|
this.sessionRecorder.recordingStopDueToTimeout = true;
|
|
3955
3954
|
}
|
|
3956
3955
|
this.clearSession();
|
|
3957
3956
|
};
|
|
3958
3957
|
SessionManager.prototype.clearPrevSession = function () {
|
|
3959
3958
|
var _a;
|
|
3960
|
-
(_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3959
|
+
(_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.removeItem(PREV_SESSION_KEY);
|
|
3961
3960
|
};
|
|
3962
3961
|
SessionManager.prototype.clearSession = function () {
|
|
3963
3962
|
var _a, _b, _c, _d, _e, _f;
|
|
3964
|
-
|
|
3963
|
+
if (this.debugMode) {
|
|
3964
|
+
console.debug('Coralogix Browser SDK - Session expired, clearing session');
|
|
3965
|
+
}
|
|
3966
|
+
(_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.setItem(PREV_SESSION_KEY, JSON.stringify(__assign(__assign({}, this.activeSession), { hasRecording: (_b = this.sessionRecorder) === null || _b === void 0 ? void 0 : _b.getSessionHasRecording(), hasScreenshot: (_c = this.sessionRecorder) === null || _c === void 0 ? void 0 : _c.getSessionHasScreenshot() })));
|
|
3965
3967
|
clearGlobalSpan();
|
|
3966
3968
|
this.clearSessionWithErrorMode();
|
|
3967
|
-
(_d = getSnapshotManager()) === null || _d ===
|
|
3969
|
+
(_d = getSnapshotManager()) === null || _d === void 0 ? void 0 : _d.resetSnapshot();
|
|
3968
3970
|
this._currentPageFragment = undefined;
|
|
3969
|
-
(_e = this.sessionRecorder) === null || _e ===
|
|
3970
|
-
(_f = CxGlobal.sessionStorage) === null || _f ===
|
|
3971
|
+
(_e = this.sessionRecorder) === null || _e === void 0 ? void 0 : _e.stopRecording();
|
|
3972
|
+
(_f = CxGlobal.sessionStorage) === null || _f === void 0 ? void 0 : _f.removeItem(SESSION_KEY);
|
|
3971
3973
|
};
|
|
3972
3974
|
SessionManager.prototype.clearSessionWithErrorMode = function () {
|
|
3973
3975
|
this.sessionHasError = false;
|
|
@@ -3976,9 +3978,9 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3976
3978
|
SessionManager.prototype.handleRefreshedSessions = function () {
|
|
3977
3979
|
var _a, _b;
|
|
3978
3980
|
this.activeSession = this.getSession();
|
|
3979
|
-
var recordingSegmentMapFromStorage = JSON.parse(((_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3981
|
+
var recordingSegmentMapFromStorage = JSON.parse(((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(SESSION_RECORDER_SEGMENTS_MAP)) || '{}');
|
|
3980
3982
|
if (this.activeSession) {
|
|
3981
|
-
(_b = getSessionRecorder()) === null || _b ===
|
|
3983
|
+
(_b = getSessionRecorder()) === null || _b === void 0 ? void 0 : _b.updateSegmentIndexCounter(recordingSegmentMapFromStorage);
|
|
3982
3984
|
}
|
|
3983
3985
|
else {
|
|
3984
3986
|
this.createNewSession();
|
|
@@ -3986,6 +3988,9 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3986
3988
|
};
|
|
3987
3989
|
SessionManager.prototype.createNewSession = function () {
|
|
3988
3990
|
var now = getNowTime();
|
|
3991
|
+
if (this.debugMode) {
|
|
3992
|
+
console.debug('Coralogix Browser SDK - Creating new session');
|
|
3993
|
+
}
|
|
3989
3994
|
this.activeSession = {
|
|
3990
3995
|
sessionId: generateUUID(),
|
|
3991
3996
|
sessionCreationDate: now,
|
|
@@ -3997,17 +4002,17 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3997
4002
|
|
|
3998
4003
|
var reportInternalEvent = function (event, message) {
|
|
3999
4004
|
var internalInstrumentation = getInternalRumData(INTERNAL_INSTRUMENTATION_NAME);
|
|
4000
|
-
internalInstrumentation === null || internalInstrumentation ===
|
|
4005
|
+
internalInstrumentation === null || internalInstrumentation === void 0 ? void 0 : internalInstrumentation.reportInternalEvent(event, message);
|
|
4001
4006
|
};
|
|
4002
4007
|
|
|
4003
4008
|
function handlePropagators(config, tracerProvider) {
|
|
4004
|
-
return __awaiter(this,
|
|
4009
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4005
4010
|
var propagators, _a, propagateB3TraceHeader, propagateAwsXrayTraceHeader, singleHeader, multiHeader;
|
|
4006
4011
|
var _b, _c;
|
|
4007
4012
|
return __generator(this, function (_d) {
|
|
4008
|
-
if ((_b = config.traceParentInHeader) === null || _b ===
|
|
4013
|
+
if ((_b = config.traceParentInHeader) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
4009
4014
|
propagators = [];
|
|
4010
|
-
_a = ((_c = config.traceParentInHeader) === null || _c ===
|
|
4015
|
+
_a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader;
|
|
4011
4016
|
if (!propagateAwsXrayTraceHeader && !propagateB3TraceHeader) {
|
|
4012
4017
|
propagators = __spreadArray(__spreadArray([], __read$1(propagators), false), [
|
|
4013
4018
|
new W3CBaggagePropagator(),
|
|
@@ -4049,7 +4054,7 @@ var CxPropagator = /** @class */ (function () {
|
|
|
4049
4054
|
};
|
|
4050
4055
|
CxPropagator.prototype.inject = function (context, carrier, setter) {
|
|
4051
4056
|
var _a, _b;
|
|
4052
|
-
var allowedUrls = (_b = (_a = this.config.traceParentInHeader) === null || _a ===
|
|
4057
|
+
var allowedUrls = (_b = (_a = this.config.traceParentInHeader) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.allowedTracingUrls;
|
|
4053
4058
|
if (allowedUrls) {
|
|
4054
4059
|
var span = trace.getSpan(context);
|
|
4055
4060
|
var url = span.attributes[OtelNetworkAttrs.URL];
|
|
@@ -4104,14 +4109,14 @@ function validateAndResolveInitConfig(config) {
|
|
|
4104
4109
|
if (proxyUrl)
|
|
4105
4110
|
resolvedIgnoreUrls.push(new RegExp(proxyUrl));
|
|
4106
4111
|
OPTIONS_DEFAULTS.ignoreUrls && resolvedIgnoreUrls.push.apply(resolvedIgnoreUrls, __spreadArray([], __read$1(OPTIONS_DEFAULTS.ignoreUrls), false));
|
|
4107
|
-
return __assign(__assign(__assign({}, OPTIONS_DEFAULTS), config), { maskInputTypes: (_a = config.maskInputTypes) !== null && _a !==
|
|
4112
|
+
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 });
|
|
4108
4113
|
}
|
|
4109
4114
|
function resolveMemoryUsageConfig(memoryUsageConfig) {
|
|
4110
4115
|
var _a;
|
|
4111
4116
|
if (!memoryUsageConfig) {
|
|
4112
4117
|
return { enabled: false };
|
|
4113
4118
|
}
|
|
4114
|
-
return __assign(__assign({}, memoryUsageConfig), { interval: (_a = memoryUsageConfig.interval) !== null && _a !==
|
|
4119
|
+
return __assign(__assign({}, memoryUsageConfig), { interval: (_a = memoryUsageConfig.interval) !== null && _a !== void 0 ? _a : MEMORY_USAGE_DEFAULT_INTERVAL });
|
|
4115
4120
|
}
|
|
4116
4121
|
function resolveUrlBlueprinters(urlBlueprinters) {
|
|
4117
4122
|
if (!urlBlueprinters) {
|
|
@@ -4138,7 +4143,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4138
4143
|
return resolvedUrlBlueprinters;
|
|
4139
4144
|
}
|
|
4140
4145
|
|
|
4141
|
-
var SDK_VERSION = '2.4.
|
|
4146
|
+
var SDK_VERSION = '2.4.1';
|
|
4142
4147
|
|
|
4143
4148
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4144
4149
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4155,10 +4160,10 @@ function isDocumentErrorWithoutMessage(cxRumEvent) {
|
|
|
4155
4160
|
var _a = cxRumEvent || {}, event_context = _a.event_context, error_context = _a.error_context;
|
|
4156
4161
|
return (event_context.type === CoralogixEventType.ERROR &&
|
|
4157
4162
|
event_context.source === ErrorSource.DOCUMENT &&
|
|
4158
|
-
!(error_context === null || error_context ===
|
|
4163
|
+
!(error_context === null || error_context === void 0 ? void 0 : error_context.error_message));
|
|
4159
4164
|
}
|
|
4160
4165
|
function isIgnoredError(cxRumEvent, ignoreErrors) {
|
|
4161
|
-
if (!cxRumEvent.error_context || !(ignoreErrors === null || ignoreErrors ===
|
|
4166
|
+
if (!cxRumEvent.error_context || !(ignoreErrors === null || ignoreErrors === void 0 ? void 0 : ignoreErrors.length)) {
|
|
4162
4167
|
return false;
|
|
4163
4168
|
}
|
|
4164
4169
|
var errorMessage = cxRumEvent.error_context.error_message || '';
|
|
@@ -4166,7 +4171,7 @@ function isIgnoredError(cxRumEvent, ignoreErrors) {
|
|
|
4166
4171
|
}
|
|
4167
4172
|
|
|
4168
4173
|
function processBeforeSend(cxSpan, options) {
|
|
4169
|
-
if (!(options === null || options ===
|
|
4174
|
+
if (!(options === null || options === void 0 ? void 0 : options.beforeSend)) {
|
|
4170
4175
|
return cxSpan;
|
|
4171
4176
|
}
|
|
4172
4177
|
var cxRumEvent = cxSpan.text.cx_rum;
|
|
@@ -4188,7 +4193,7 @@ function validateBeforeSendResult(beforeSendResult) {
|
|
|
4188
4193
|
'event_context',
|
|
4189
4194
|
];
|
|
4190
4195
|
var isMissingRequiredKey = function () {
|
|
4191
|
-
return requiredKeys.some(function (key) { return !(beforeSendResult === null || beforeSendResult ===
|
|
4196
|
+
return requiredKeys.some(function (key) { return !(beforeSendResult === null || beforeSendResult === void 0 ? void 0 : beforeSendResult[key]); });
|
|
4192
4197
|
};
|
|
4193
4198
|
if (!isObject(beforeSendResult) || isMissingRequiredKey()) {
|
|
4194
4199
|
console.warn('CoralogixRum: beforeSend must return null, undefined or a valid event.');
|
|
@@ -4216,8 +4221,8 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4216
4221
|
}
|
|
4217
4222
|
var _c = getSessionManager(), onlySessionWithErrorMode = _c.onlySessionWithErrorMode, getPrevSession = _c.getPrevSession, getSession = _c.getSession, setSession = _c.setSession;
|
|
4218
4223
|
var session = getSession() || setSession();
|
|
4219
|
-
var sessionHasRecording = !!((_a = getSessionRecorder()) === null || _a ===
|
|
4220
|
-
var sessionHasScreenshot = !!((_b = getSessionRecorder()) === null || _b ===
|
|
4224
|
+
var sessionHasRecording = !!((_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.getSessionHasRecording());
|
|
4225
|
+
var sessionHasScreenshot = !!((_b = getSessionRecorder()) === null || _b === void 0 ? void 0 : _b.getSessionHasScreenshot());
|
|
4221
4226
|
var mappedCxSpan = this._mapToCxSpan(span, session, getPrevSession(), sessionHasRecording, sessionHasScreenshot, onlySessionWithErrorMode);
|
|
4222
4227
|
if (!shouldDropEvent(mappedCxSpan.text.cx_rum, this.sdkConfig)) {
|
|
4223
4228
|
var resolvedCxSpan = processBeforeSend(mappedCxSpan, this.sdkConfig);
|
|
@@ -4252,14 +4257,14 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4252
4257
|
span[CoralogixAttributes.EVENT_TYPE];
|
|
4253
4258
|
var eventTypeContext = this._getEventTypeContext(attributes, eventType, span);
|
|
4254
4259
|
var _e = span.spanContext(), spanId = _e.spanId, traceId = _e.traceId;
|
|
4255
|
-
var resourceAttributes = __assign(__assign({}, (_a = span.resource) === null || _a ===
|
|
4260
|
+
var resourceAttributes = __assign(__assign({}, (_a = span.resource) === null || _a === void 0 ? void 0 : _a.attributes), { 'service.name': application });
|
|
4256
4261
|
var labels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
|
|
4257
|
-
var isErrorWithStacktrace = !!((_b = eventTypeContext === null || eventTypeContext ===
|
|
4262
|
+
var isErrorWithStacktrace = !!((_b = eventTypeContext === null || eventTypeContext === void 0 ? void 0 : eventTypeContext.error_context) === null || _b === void 0 ? void 0 : _b.original_stacktrace);
|
|
4258
4263
|
var version_metadata = {
|
|
4259
4264
|
app_name: application,
|
|
4260
4265
|
app_version: version,
|
|
4261
4266
|
};
|
|
4262
|
-
var severity = (attributes === null || attributes ===
|
|
4267
|
+
var severity = (attributes === null || attributes === void 0 ? void 0 : attributes[CoralogixAttributes.SEVERITY]) ||
|
|
4263
4268
|
CoralogixLogSeverity.Info;
|
|
4264
4269
|
var timestamp = attributes[CoralogixAttributes.TIMESTAMP] || getNowTime();
|
|
4265
4270
|
if (timestamp < sessionCreationDate) {
|
|
@@ -4356,7 +4361,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4356
4361
|
var url = spanAttributes[OtelNetworkAttrs.URL];
|
|
4357
4362
|
var url_blueprint = applyUrlBluePrinters({
|
|
4358
4363
|
url: url,
|
|
4359
|
-
blueprinters: (_a = this.sdkConfig.urlBlueprinters) === null || _a ===
|
|
4364
|
+
blueprinters: (_a = this.sdkConfig.urlBlueprinters) === null || _a === void 0 ? void 0 : _a.networkUrlBlueprinters,
|
|
4360
4365
|
});
|
|
4361
4366
|
return {
|
|
4362
4367
|
network_request_context: {
|
|
@@ -4368,7 +4373,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4368
4373
|
host: spanAttributes[OtelNetworkAttrs.HOST],
|
|
4369
4374
|
schema: spanAttributes[OtelNetworkAttrs.SCHEME],
|
|
4370
4375
|
status_text: spanAttributes[OtelNetworkAttrs.STATUS_TEXT],
|
|
4371
|
-
duration: hrTimeToMilliseconds(span === null || span ===
|
|
4376
|
+
duration: hrTimeToMilliseconds(span === null || span === void 0 ? void 0 : span.duration),
|
|
4372
4377
|
source: spanAttributes[CoralogixAttributes.SOURCE],
|
|
4373
4378
|
response_content_length: spanAttributes[OtelNetworkAttrs.RESPONSE_CONTENT_LENGTH],
|
|
4374
4379
|
request_headers: span[NetworkInstrumentationAttributes.REQUEST_HEADERS],
|
|
@@ -4384,7 +4389,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4384
4389
|
return {
|
|
4385
4390
|
log_context: {
|
|
4386
4391
|
message: cxLog.message,
|
|
4387
|
-
data: cxLog === null || cxLog ===
|
|
4392
|
+
data: cxLog === null || cxLog === void 0 ? void 0 : cxLog.data,
|
|
4388
4393
|
},
|
|
4389
4394
|
};
|
|
4390
4395
|
}
|
|
@@ -4441,11 +4446,11 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4441
4446
|
CoralogixSpanMapProcessor.prototype.resolveLabels = function (cxRumEvent) {
|
|
4442
4447
|
var _a, _b;
|
|
4443
4448
|
var allLabels = cxRumEvent.labels;
|
|
4444
|
-
var labelProviders = (_a = this.sdkConfig) === null || _a ===
|
|
4445
|
-
if (labelProviders === null || labelProviders ===
|
|
4449
|
+
var labelProviders = (_a = this.sdkConfig) === null || _a === void 0 ? void 0 : _a.labelProviders;
|
|
4450
|
+
if (labelProviders === null || labelProviders === void 0 ? void 0 : labelProviders.length) {
|
|
4446
4451
|
var pageUrlLabelProviders = getInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY);
|
|
4447
4452
|
var networkUrlLabelProviders = getInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY);
|
|
4448
|
-
var networkRequestFragment = (_b = cxRumEvent.network_request_context) === null || _b ===
|
|
4453
|
+
var networkRequestFragment = (_b = cxRumEvent.network_request_context) === null || _b === void 0 ? void 0 : _b.fragments;
|
|
4449
4454
|
var labelsFromProviders = __assign(__assign({}, this.getLabelsByLabelProviders(pageUrlLabelProviders, cxRumEvent, cxRumEvent.page_context.page_fragments)), (networkRequestFragment
|
|
4450
4455
|
? this.getLabelsByLabelProviders(networkUrlLabelProviders, cxRumEvent, networkRequestFragment)
|
|
4451
4456
|
: {}));
|
|
@@ -4526,7 +4531,7 @@ var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
|
|
|
4526
4531
|
});
|
|
4527
4532
|
shouldCreateSnapshot = true;
|
|
4528
4533
|
}
|
|
4529
|
-
if (((_a = getSessionRecorder()) === null || _a ===
|
|
4534
|
+
if (((_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.getSessionHasRecording()) &&
|
|
4530
4535
|
!isSnapshotSentDueToRecording) {
|
|
4531
4536
|
updateSnapshot({ timestamp: getNowTime(), hasRecording: true });
|
|
4532
4537
|
getSnapshotManager().isSnapshotSentDueToRecording = true;
|
|
@@ -4602,7 +4607,7 @@ var CoralogixNavigationProcessor = /** @class */ (function () {
|
|
|
4602
4607
|
CoralogixNavigationProcessor.prototype.onEnd = function (span) { };
|
|
4603
4608
|
CoralogixNavigationProcessor.prototype.onStart = function (span) {
|
|
4604
4609
|
var pageContext = resolvePageContext(location.href);
|
|
4605
|
-
{
|
|
4610
|
+
if (pageContext) {
|
|
4606
4611
|
span[CoralogixAttributes.PAGE_CONTEXT] = pageContext;
|
|
4607
4612
|
var currentPageFragment = getSessionManager().currentPageFragment;
|
|
4608
4613
|
var page_fragments = pageContext.page_fragments;
|
|
@@ -4690,9 +4695,9 @@ var CoralogixRum = {
|
|
|
4690
4695
|
var instrumentations = INSTRUMENTATIONS.map(function (_a) {
|
|
4691
4696
|
var _b, _c;
|
|
4692
4697
|
var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
|
|
4693
|
-
var pluginConf = getInstrumentationConfig((_b = resolvedOptions === null || resolvedOptions ===
|
|
4698
|
+
var pluginConf = getInstrumentationConfig((_b = resolvedOptions === null || resolvedOptions === void 0 ? void 0 : resolvedOptions.instrumentations) === null || _b === void 0 ? void 0 : _b[confKey], pluginDefaults, disable);
|
|
4694
4699
|
if (pluginConf) {
|
|
4695
|
-
var instrumentation =
|
|
4700
|
+
var instrumentation = void 0;
|
|
4696
4701
|
switch (confKey) {
|
|
4697
4702
|
case 'errors': {
|
|
4698
4703
|
instrumentation = new Instrument(pluginConf);
|
|
@@ -4711,7 +4716,7 @@ var CoralogixRum = {
|
|
|
4711
4716
|
break;
|
|
4712
4717
|
}
|
|
4713
4718
|
case SCREENSHOT_INSTRUMENTATION_NAME: {
|
|
4714
|
-
if ((_c = resolvedOptions.sessionRecordingConfig) === null || _c ===
|
|
4719
|
+
if ((_c = resolvedOptions.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
4715
4720
|
instrumentation = new Instrument(pluginConf);
|
|
4716
4721
|
screenshotInstrumentation =
|
|
4717
4722
|
instrumentation;
|
|
@@ -4783,7 +4788,7 @@ var CoralogixRum = {
|
|
|
4783
4788
|
saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
|
|
4784
4789
|
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
4785
4790
|
isInited = true;
|
|
4786
|
-
if (options === null || options ===
|
|
4791
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4787
4792
|
console.info('CoralogixRum.init() complete');
|
|
4788
4793
|
}
|
|
4789
4794
|
reportInternalEvent('init');
|
|
@@ -4794,7 +4799,7 @@ var CoralogixRum = {
|
|
|
4794
4799
|
console.debug('CoralogixRum must be initiated before getting custom tracer');
|
|
4795
4800
|
return;
|
|
4796
4801
|
}
|
|
4797
|
-
if (!((_b = (_a = getSdkConfig()) === null || _a ===
|
|
4802
|
+
if (!((_b = (_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.traceParentInHeader) === null || _b === void 0 ? void 0 : _b.enabled)) {
|
|
4798
4803
|
console.debug('Coralogix Browser SDK - TraceParentInHeader is not enabled');
|
|
4799
4804
|
return;
|
|
4800
4805
|
}
|
|
@@ -4810,7 +4815,7 @@ var CoralogixRum = {
|
|
|
4810
4815
|
console.warn('Coralogix Browser SDK - Global span already exists');
|
|
4811
4816
|
return;
|
|
4812
4817
|
}
|
|
4813
|
-
setCustomTracerIgnoredInstruments((ignoredList === null || ignoredList ===
|
|
4818
|
+
setCustomTracerIgnoredInstruments((ignoredList === null || ignoredList === void 0 ? void 0 : ignoredList.ignoredInstruments) || []);
|
|
4814
4819
|
var globalSpan = tracer.startSpan(name);
|
|
4815
4820
|
globalSpan[CoralogixAttributes.EVENT_TYPE] =
|
|
4816
4821
|
CoralogixEventType.CUSTOM_SPAN;
|
|
@@ -4824,7 +4829,7 @@ var CoralogixRum = {
|
|
|
4824
4829
|
return context.with(trace.setSpan(context.active(), globalSpan), fn);
|
|
4825
4830
|
},
|
|
4826
4831
|
endSpan: function () {
|
|
4827
|
-
globalSpan === null || globalSpan ===
|
|
4832
|
+
globalSpan === null || globalSpan === void 0 ? void 0 : globalSpan.end();
|
|
4828
4833
|
clearGlobalSpan();
|
|
4829
4834
|
},
|
|
4830
4835
|
startCustomSpan: function (name, labels) {
|
|
@@ -4838,7 +4843,7 @@ var CoralogixRum = {
|
|
|
4838
4843
|
return {
|
|
4839
4844
|
span: customSpan,
|
|
4840
4845
|
endSpan: function () {
|
|
4841
|
-
customSpan === null || customSpan ===
|
|
4846
|
+
customSpan === null || customSpan === void 0 ? void 0 : customSpan.end();
|
|
4842
4847
|
},
|
|
4843
4848
|
};
|
|
4844
4849
|
},
|
|
@@ -4853,15 +4858,15 @@ var CoralogixRum = {
|
|
|
4853
4858
|
if (!isInited) {
|
|
4854
4859
|
return;
|
|
4855
4860
|
}
|
|
4856
|
-
_deregisterInstrumentations === null || _deregisterInstrumentations ===
|
|
4861
|
+
_deregisterInstrumentations === null || _deregisterInstrumentations === void 0 ? void 0 : _deregisterInstrumentations();
|
|
4857
4862
|
_deregisterInstrumentations = undefined;
|
|
4858
4863
|
this.stopSessionRecording();
|
|
4859
|
-
(_a = getSessionManager()) === null || _a ===
|
|
4860
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4861
|
-
navigationProcessor === null || navigationProcessor ===
|
|
4862
|
-
spanMapProcessor === null || spanMapProcessor ===
|
|
4863
|
-
snapshotProcessor === null || snapshotProcessor ===
|
|
4864
|
-
exporter === null || exporter ===
|
|
4864
|
+
(_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
4865
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.shutdown();
|
|
4866
|
+
navigationProcessor === null || navigationProcessor === void 0 ? void 0 : navigationProcessor.shutdown();
|
|
4867
|
+
spanMapProcessor === null || spanMapProcessor === void 0 ? void 0 : spanMapProcessor.shutdown();
|
|
4868
|
+
snapshotProcessor === null || snapshotProcessor === void 0 ? void 0 : snapshotProcessor.shutdown();
|
|
4869
|
+
exporter === null || exporter === void 0 ? void 0 : exporter.shutdown();
|
|
4865
4870
|
isInited = false;
|
|
4866
4871
|
},
|
|
4867
4872
|
setApplicationContext: function (applicationContext) {
|
|
@@ -4870,21 +4875,21 @@ var CoralogixRum = {
|
|
|
4870
4875
|
console.debug('CoralogixRum must be initiated before setting application context');
|
|
4871
4876
|
return;
|
|
4872
4877
|
}
|
|
4873
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4878
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setInternalLabels(__assign(__assign({}, attributesProcessor.getInternalLabels()), (_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = applicationContext, _a)));
|
|
4874
4879
|
},
|
|
4875
4880
|
captureError: function (error, customData, labels) {
|
|
4876
4881
|
if (!isInited) {
|
|
4877
4882
|
console.debug('CoralogixRum must be initiated before reporting errors');
|
|
4878
4883
|
return;
|
|
4879
4884
|
}
|
|
4880
|
-
errorsInstrumentation === null || errorsInstrumentation ===
|
|
4885
|
+
errorsInstrumentation === null || errorsInstrumentation === void 0 ? void 0 : errorsInstrumentation.reportError(ErrorSource.CAPTURED, error, customData, labels);
|
|
4881
4886
|
},
|
|
4882
4887
|
sendCustomMeasurement: function (name, value) {
|
|
4883
4888
|
if (!isInited) {
|
|
4884
4889
|
console.debug('CoralogixRum must be initiated before sending custom measurement');
|
|
4885
4890
|
return;
|
|
4886
4891
|
}
|
|
4887
|
-
customMeasurementInstrumentation === null || customMeasurementInstrumentation ===
|
|
4892
|
+
customMeasurementInstrumentation === null || customMeasurementInstrumentation === void 0 ? void 0 : customMeasurementInstrumentation.createCustomMeasurement(name, value);
|
|
4888
4893
|
},
|
|
4889
4894
|
addTiming: function (name, duration) {
|
|
4890
4895
|
if (!isInited) {
|
|
@@ -4906,7 +4911,7 @@ var CoralogixRum = {
|
|
|
4906
4911
|
},
|
|
4907
4912
|
stopSessionRecording: function () {
|
|
4908
4913
|
var _a;
|
|
4909
|
-
(_a = getSessionRecorder()) === null || _a ===
|
|
4914
|
+
(_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.stopRecording();
|
|
4910
4915
|
},
|
|
4911
4916
|
startSessionRecording: function () {
|
|
4912
4917
|
if (getSessionRecorder()) {
|
|
@@ -4931,8 +4936,8 @@ var CoralogixRum = {
|
|
|
4931
4936
|
return;
|
|
4932
4937
|
}
|
|
4933
4938
|
var id = generateUUID();
|
|
4934
|
-
screenshotInstrumentation === null || screenshotInstrumentation ===
|
|
4935
|
-
(_a = getSessionRecorder()) === null || _a ===
|
|
4939
|
+
screenshotInstrumentation === null || screenshotInstrumentation === void 0 ? void 0 : screenshotInstrumentation.screenshot(id, description);
|
|
4940
|
+
(_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.screenshot(id);
|
|
4936
4941
|
return id;
|
|
4937
4942
|
},
|
|
4938
4943
|
setUserContext: function (userContext) {
|
|
@@ -4941,20 +4946,20 @@ var CoralogixRum = {
|
|
|
4941
4946
|
console.debug('CoralogixRum must be initiated before setting user context');
|
|
4942
4947
|
return;
|
|
4943
4948
|
}
|
|
4944
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4949
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setInternalLabels(__assign(__assign({}, attributesProcessor.getInternalLabels()), (_a = {}, _a[CoralogixAttributes.USER_CONTEXT] = userContext, _a)));
|
|
4945
4950
|
},
|
|
4946
4951
|
getUserContext: function () {
|
|
4947
|
-
return attributesProcessor === null || attributesProcessor ===
|
|
4952
|
+
return attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.getUserContext();
|
|
4948
4953
|
},
|
|
4949
4954
|
setLabels: function (labels) {
|
|
4950
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4955
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setCustomLabels(labels);
|
|
4951
4956
|
},
|
|
4952
4957
|
getLabels: function () {
|
|
4953
|
-
return (attributesProcessor === null || attributesProcessor ===
|
|
4958
|
+
return (attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.getCustomLabels()) || {};
|
|
4954
4959
|
},
|
|
4955
4960
|
getSessionId: function () {
|
|
4956
4961
|
var _a, _b;
|
|
4957
|
-
return (_b = (_a = getSessionManager()) === null || _a ===
|
|
4962
|
+
return (_b = (_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.getSession()) === null || _b === void 0 ? void 0 : _b.sessionId;
|
|
4958
4963
|
},
|
|
4959
4964
|
log: function (severity, message, data, labels) {
|
|
4960
4965
|
if (!isInited) {
|
|
@@ -4965,7 +4970,7 @@ var CoralogixRum = {
|
|
|
4965
4970
|
console.warn('Log was reported, but custom instrumentation is disabled.');
|
|
4966
4971
|
return;
|
|
4967
4972
|
}
|
|
4968
|
-
_customInstrumentation === null || _customInstrumentation ===
|
|
4973
|
+
_customInstrumentation === null || _customInstrumentation === void 0 ? void 0 : _customInstrumentation.log({ severity: severity, message: message, data: data, labels: labels });
|
|
4969
4974
|
},
|
|
4970
4975
|
debug: function (message, data, labels) {
|
|
4971
4976
|
this.log(CoralogixLogSeverity.Debug, message, data, labels);
|
|
@@ -4990,13 +4995,13 @@ var CoralogixRum = {
|
|
|
4990
4995
|
console.debug('CoralogixRum must be initiated before starting time measurement.');
|
|
4991
4996
|
return;
|
|
4992
4997
|
}
|
|
4993
|
-
timeMeasurementTracker === null || timeMeasurementTracker ===
|
|
4998
|
+
timeMeasurementTracker === null || timeMeasurementTracker === void 0 ? void 0 : timeMeasurementTracker.startMeasurement(key, labels);
|
|
4994
4999
|
},
|
|
4995
5000
|
endTimeMeasure: function (key) {
|
|
4996
|
-
var measurement = timeMeasurementTracker === null || timeMeasurementTracker ===
|
|
5001
|
+
var measurement = timeMeasurementTracker === null || timeMeasurementTracker === void 0 ? void 0 : timeMeasurementTracker.getMeasurement(key);
|
|
4997
5002
|
if (measurement) {
|
|
4998
5003
|
var duration = measurement.duration, labels = measurement.labels;
|
|
4999
|
-
customMeasurementInstrumentation === null || customMeasurementInstrumentation ===
|
|
5004
|
+
customMeasurementInstrumentation === null || customMeasurementInstrumentation === void 0 ? void 0 : customMeasurementInstrumentation.createCustomMeasurement(key, duration, getCustomMergedLabels(labels));
|
|
5000
5005
|
}
|
|
5001
5006
|
},
|
|
5002
5007
|
};
|
|
@@ -5051,4 +5056,4 @@ var SessionRecordingEventType;
|
|
|
5051
5056
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
5052
5057
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
5053
5058
|
|
|
5054
|
-
export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, getNowTime as a, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as b,
|
|
5059
|
+
export { BATCH_TIME_DELAY as B, CxGlobal as C, MAX_BATCH_TIME_MS as M, OtelNetworkAttrs as O, PerformanceTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, getNowTime as a, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as b, SESSION_RECORDING_DEFAULT_HEADERS as c, SESSION_RECORDING_POSTFIX_URL as d, SESSION_RECORDER_KEY as e, MAX_MUTATIONS_FOR_SESSION_RECORDING as f, getSdkConfig as g, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as h, CoralogixRum as i, CoralogixLogSeverity as j, SessionRecordingEventType as k, CoralogixEventType as l, UrlType as m, reportInternalEvent as r };
|