@coralogix/browser 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/index.esm2.js +187 -179
- package/package.json +1 -1
- package/sessionRecorder.esm.js +36 -32
- package/src/session/sessionManager.d.ts +1 -0
- package/src/types.d.ts +2 -2
- 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);
|
|
@@ -2705,25 +2705,28 @@ var getUrlFragments = function (url) {
|
|
|
2705
2705
|
};
|
|
2706
2706
|
function parseUserAgent(userAgent) {
|
|
2707
2707
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
2708
|
-
var _d, _e;
|
|
2708
|
+
var _d, _e, _f;
|
|
2709
2709
|
var browsers = {
|
|
2710
|
+
Edge: /Edge\/([\d.]+)|Edg\/([\d.]+)/,
|
|
2710
2711
|
Chrome: /Chrome\/([\d.]+)/,
|
|
2711
2712
|
Firefox: /Firefox\/([\d.]+)/,
|
|
2712
|
-
Safari: /Version\/([\d.]+).*Safari/,
|
|
2713
|
-
Edge: /Edge\/([\d.]+)/,
|
|
2713
|
+
Safari: /Version\/([\d.]+).*Safari|Safari\/([\d.]+)/,
|
|
2714
2714
|
Opera: /Opera\/([\d.]+)/,
|
|
2715
2715
|
IE: /Trident.*rv:([\d.]+)/,
|
|
2716
2716
|
};
|
|
2717
2717
|
var operatingSystems = {
|
|
2718
2718
|
Windows: /Windows NT ([\d.]+)/,
|
|
2719
2719
|
MacOS: /Mac OS X ([\d._]+)/,
|
|
2720
|
+
webOS: /Web0S/,
|
|
2720
2721
|
Linux: /Linux(?: ([\d.]+))?/,
|
|
2721
2722
|
iOS: /CPU(?: iPhone)? OS (\d+([._]\d+)*)/,
|
|
2722
2723
|
Android: /Android (\d+([._]\d+)*)/,
|
|
2724
|
+
Tizen: /Tizen ([\d.]+)/,
|
|
2723
2725
|
};
|
|
2724
2726
|
var devices = {
|
|
2725
2727
|
Mobile: /Mobile|Android|iPhone|iPod|BlackBerry|IEMobile|Windows Phone|webOS|Opera Mini/,
|
|
2726
2728
|
Tablet: /Tablet|iPad/,
|
|
2729
|
+
'Smart-TV': /SMART-TV|SmartTV/,
|
|
2727
2730
|
};
|
|
2728
2731
|
var browser = 'Unknown';
|
|
2729
2732
|
var browserVersion = 'Unknown';
|
|
@@ -2731,12 +2734,12 @@ function parseUserAgent(userAgent) {
|
|
|
2731
2734
|
var osVersion = 'Unknown';
|
|
2732
2735
|
var device = 'Desktop';
|
|
2733
2736
|
try {
|
|
2734
|
-
for (var
|
|
2735
|
-
var
|
|
2737
|
+
for (var _g = __values$1(Object.entries(browsers)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
2738
|
+
var _j = __read$1(_h.value, 2), name_1 = _j[0], regex = _j[1];
|
|
2736
2739
|
var match = userAgent.match(regex);
|
|
2737
2740
|
if (match) {
|
|
2738
2741
|
browser = name_1;
|
|
2739
|
-
browserVersion = match
|
|
2742
|
+
browserVersion = ((_d = match.slice(1)) === null || _d === void 0 ? void 0 : _d.find(function (v) { return !!v; })) || 'Unknown';
|
|
2740
2743
|
break;
|
|
2741
2744
|
}
|
|
2742
2745
|
}
|
|
@@ -2744,17 +2747,17 @@ function parseUserAgent(userAgent) {
|
|
|
2744
2747
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2745
2748
|
finally {
|
|
2746
2749
|
try {
|
|
2747
|
-
if (
|
|
2750
|
+
if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
|
|
2748
2751
|
}
|
|
2749
2752
|
finally { if (e_1) throw e_1.error; }
|
|
2750
2753
|
}
|
|
2751
2754
|
try {
|
|
2752
|
-
for (var
|
|
2753
|
-
var
|
|
2755
|
+
for (var _k = __values$1(Object.entries(operatingSystems)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
2756
|
+
var _m = __read$1(_l.value, 2), name_2 = _m[0], regex = _m[1];
|
|
2754
2757
|
var match = userAgent.match(regex);
|
|
2755
2758
|
if (match) {
|
|
2756
2759
|
os = name_2;
|
|
2757
|
-
osVersion = ((
|
|
2760
|
+
osVersion = ((_f = (_e = match[1]) === null || _e === void 0 ? void 0 : _e.split('_')) === null || _f === void 0 ? void 0 : _f.join('.')) || 'Unknown';
|
|
2758
2761
|
break;
|
|
2759
2762
|
}
|
|
2760
2763
|
}
|
|
@@ -2762,13 +2765,13 @@ function parseUserAgent(userAgent) {
|
|
|
2762
2765
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2763
2766
|
finally {
|
|
2764
2767
|
try {
|
|
2765
|
-
if (
|
|
2768
|
+
if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
|
|
2766
2769
|
}
|
|
2767
2770
|
finally { if (e_2) throw e_2.error; }
|
|
2768
2771
|
}
|
|
2769
2772
|
try {
|
|
2770
|
-
for (var
|
|
2771
|
-
var
|
|
2773
|
+
for (var _o = __values$1(Object.entries(devices)), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
2774
|
+
var _q = __read$1(_p.value, 2), name_3 = _q[0], regex = _q[1];
|
|
2772
2775
|
var match = userAgent.match(regex);
|
|
2773
2776
|
if (match) {
|
|
2774
2777
|
device = name_3;
|
|
@@ -2779,7 +2782,7 @@ function parseUserAgent(userAgent) {
|
|
|
2779
2782
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2780
2783
|
finally {
|
|
2781
2784
|
try {
|
|
2782
|
-
if (
|
|
2785
|
+
if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
|
|
2783
2786
|
}
|
|
2784
2787
|
finally { if (e_3) throw e_3.error; }
|
|
2785
2788
|
}
|
|
@@ -2859,14 +2862,14 @@ function replacePatternsInUrl(_a) {
|
|
|
2859
2862
|
function applyUrlBluePrinters(_a) {
|
|
2860
2863
|
var url = _a.url, blueprinters = _a.blueprinters;
|
|
2861
2864
|
var blueprintedUrl = url;
|
|
2862
|
-
blueprinters === null || blueprinters ===
|
|
2865
|
+
blueprinters === null || blueprinters === void 0 ? void 0 : blueprinters.forEach(function (urlBlueprinter) { return (blueprintedUrl = urlBlueprinter(blueprintedUrl)); });
|
|
2863
2866
|
return blueprintedUrl;
|
|
2864
2867
|
}
|
|
2865
2868
|
function resolvePageContext(url) {
|
|
2866
2869
|
var _a;
|
|
2867
2870
|
var page_url_blueprint = applyUrlBluePrinters({
|
|
2868
2871
|
url: url,
|
|
2869
|
-
blueprinters: (_a = getSdkConfig().urlBlueprinters) === null || _a ===
|
|
2872
|
+
blueprinters: (_a = getSdkConfig().urlBlueprinters) === null || _a === void 0 ? void 0 : _a.pageUrlBlueprinters,
|
|
2870
2873
|
});
|
|
2871
2874
|
var page_fragments = getUrlFragments(page_url_blueprint);
|
|
2872
2875
|
return {
|
|
@@ -2915,7 +2918,7 @@ var CoralogixSpanAttributesProcessor = /** @class */ (function () {
|
|
|
2915
2918
|
}
|
|
2916
2919
|
}
|
|
2917
2920
|
CoralogixSpanAttributesProcessor.prototype.setCustomLabels = function (labels) {
|
|
2918
|
-
this.labels[CoralogixAttributes.CUSTOM_LABELS] = JSON.stringify(labels !== null && labels !==
|
|
2921
|
+
this.labels[CoralogixAttributes.CUSTOM_LABELS] = JSON.stringify(labels !== null && labels !== void 0 ? labels : {});
|
|
2919
2922
|
};
|
|
2920
2923
|
CoralogixSpanAttributesProcessor.prototype.setInternalLabels = function (labels) {
|
|
2921
2924
|
var _a;
|
|
@@ -3173,7 +3176,7 @@ var __values = (undefined && undefined.__values) || function(o) {
|
|
|
3173
3176
|
if (m) return m.call(o);
|
|
3174
3177
|
if (o && typeof o.length === "number") return {
|
|
3175
3178
|
next: function () {
|
|
3176
|
-
if (o && i >= o.length) o =
|
|
3179
|
+
if (o && i >= o.length) o = void 0;
|
|
3177
3180
|
return { value: o && o[i++], done: !o };
|
|
3178
3181
|
}
|
|
3179
3182
|
};
|
|
@@ -3187,9 +3190,9 @@ var CompositePropagator = /** @class */ (function () {
|
|
|
3187
3190
|
* @param [config] Configuration object for composite propagator
|
|
3188
3191
|
*/
|
|
3189
3192
|
function CompositePropagator(config) {
|
|
3190
|
-
if (config ===
|
|
3193
|
+
if (config === void 0) { config = {}; }
|
|
3191
3194
|
var _a;
|
|
3192
|
-
this._propagators = (_a = config.propagators) !== null && _a !==
|
|
3195
|
+
this._propagators = (_a = config.propagators) !== null && _a !== void 0 ? _a : [];
|
|
3193
3196
|
this._fields = Array.from(new Set(this._propagators
|
|
3194
3197
|
// older propagators may not have fields function, null check to be sure
|
|
3195
3198
|
.map(function (p) { return (typeof p.fields === 'function' ? p.fields() : []); })
|
|
@@ -3496,9 +3499,6 @@ var MAX_MS_RECORD_TIME = 60000;
|
|
|
3496
3499
|
var DEFAULT_RUM_EVENTS = 5000;
|
|
3497
3500
|
var DEFAULT_MS_RECORD_TIME = 10000;
|
|
3498
3501
|
({
|
|
3499
|
-
enable: true,
|
|
3500
|
-
maxRumEvents: DEFAULT_RUM_EVENTS,
|
|
3501
|
-
maxRecordTime: DEFAULT_MS_RECORD_TIME,
|
|
3502
3502
|
instrumentationsToSend: (_a = {},
|
|
3503
3503
|
_a[CoralogixEventType.WEB_VITALS] = true,
|
|
3504
3504
|
_a),
|
|
@@ -3566,7 +3566,7 @@ function resolveSessionWithErrorsConfig(config) {
|
|
|
3566
3566
|
if (!config) {
|
|
3567
3567
|
return { enable: false };
|
|
3568
3568
|
}
|
|
3569
|
-
return __assign(__assign({}, config), { maxRumEvents: resolveMaxRumEvents(config.maxRumEvents), maxRecordTime: resolveMaxRecordTime(config.maxRecordTime), instrumentationsToSend: (_b = config.instrumentationsToSend) !== null && _b !==
|
|
3569
|
+
return __assign(__assign({}, config), { maxRumEvents: resolveMaxRumEvents(config.maxRumEvents), maxRecordTime: resolveMaxRecordTime(config.maxRecordTime), instrumentationsToSend: (_b = config.instrumentationsToSend) !== null && _b !== void 0 ? _b : (_a = {},
|
|
3570
3570
|
_a[CoralogixEventType.WEB_VITALS] = true,
|
|
3571
3571
|
_a) });
|
|
3572
3572
|
}
|
|
@@ -3575,12 +3575,12 @@ function resolveSessionConfig(config) {
|
|
|
3575
3575
|
if (!config) {
|
|
3576
3576
|
return DEFAULT_SESSION_CONFIG;
|
|
3577
3577
|
}
|
|
3578
|
-
return __assign(__assign({}, config), { sessionSampleRate: (_a = config.sessionSampleRate) !== null && _a !==
|
|
3578
|
+
return __assign(__assign({}, config), { sessionSampleRate: (_a = config.sessionSampleRate) !== null && _a !== void 0 ? _a : 100, onlyWithErrorConfig: resolveSessionWithErrorsConfig(config.onlyWithErrorConfig) });
|
|
3579
3579
|
}
|
|
3580
3580
|
function resolveSessionRecordingConfig(config) {
|
|
3581
3581
|
var _a;
|
|
3582
3582
|
if (config) {
|
|
3583
|
-
return __assign(__assign({}, config), { sessionRecordingSampleRate: (_a = config.sessionRecordingSampleRate) !== null && _a !==
|
|
3583
|
+
return __assign(__assign({}, config), { sessionRecordingSampleRate: (_a = config.sessionRecordingSampleRate) !== null && _a !== void 0 ? _a : 100 });
|
|
3584
3584
|
}
|
|
3585
3585
|
return;
|
|
3586
3586
|
}
|
|
@@ -3599,7 +3599,7 @@ function getResolvedSampler(resolvedOptions) {
|
|
|
3599
3599
|
!isSamplingOn(sessionSampleRate) ||
|
|
3600
3600
|
!isSamplingOn(sessionConfig.sessionSampleRate);
|
|
3601
3601
|
if (shouldNotTrackSession) {
|
|
3602
|
-
var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig ===
|
|
3602
|
+
var shouldAlwaysTrackSessionsWithErrors = sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.alwaysTrackSessionsWithErrors;
|
|
3603
3603
|
if (shouldAlwaysTrackSessionsWithErrors) {
|
|
3604
3604
|
sessionConfig.onlyWithErrorConfig = __assign(__assign({}, sessionConfig.onlyWithErrorConfig), { enable: true });
|
|
3605
3605
|
}
|
|
@@ -3620,7 +3620,7 @@ function getResolvedSampler(resolvedOptions) {
|
|
|
3620
3620
|
|
|
3621
3621
|
function isProcessorShouldStop(isActive) {
|
|
3622
3622
|
var _a;
|
|
3623
|
-
return !isActive || !!((_a = getSessionManager()) === null || _a ===
|
|
3623
|
+
return !isActive || !!((_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.isIdleActive);
|
|
3624
3624
|
}
|
|
3625
3625
|
|
|
3626
3626
|
var CoralogixExporter = /** @class */ (function () {
|
|
@@ -3634,7 +3634,7 @@ var CoralogixExporter = /** @class */ (function () {
|
|
|
3634
3634
|
});
|
|
3635
3635
|
this.batchTimeDelay = BATCH_TIME_DELAY;
|
|
3636
3636
|
this.invokeLogRequest = function (logs, markCachedLogsSent) {
|
|
3637
|
-
if (logs === null || logs ===
|
|
3637
|
+
if (logs === null || logs === void 0 ? void 0 : logs.length) {
|
|
3638
3638
|
_this.request
|
|
3639
3639
|
.send(JSON.stringify({
|
|
3640
3640
|
logs: logs,
|
|
@@ -3734,7 +3734,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3734
3734
|
this.stopCallbacks = {};
|
|
3735
3735
|
this.resetTimeout = function () {
|
|
3736
3736
|
var _a, _b;
|
|
3737
|
-
(_b = (_a = _this.stopCallbacks).clearTimeout) === null || _b ===
|
|
3737
|
+
(_b = (_a = _this.stopCallbacks).clearTimeout) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3738
3738
|
var id = setTimeout(function () {
|
|
3739
3739
|
_this._isIdleActive = true;
|
|
3740
3740
|
_this.idleConfig.onIdle();
|
|
@@ -3765,7 +3765,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3765
3765
|
};
|
|
3766
3766
|
SessionIdle.prototype.trackActivity = function () {
|
|
3767
3767
|
var _a, _b;
|
|
3768
|
-
(_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b ===
|
|
3768
|
+
(_b = (_a = this.stopCallbacks).removeActivityListeners) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3769
3769
|
if (typeof CxGlobal.addEventListener === 'function') {
|
|
3770
3770
|
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
3771
|
this.stopCallbacks.removeActivityListeners = stop_1;
|
|
@@ -3777,6 +3777,7 @@ var SessionIdle = /** @class */ (function () {
|
|
|
3777
3777
|
var SessionManager = /** @class */ (function (_super) {
|
|
3778
3778
|
__extends(SessionManager, _super);
|
|
3779
3779
|
function SessionManager(recordConfig) {
|
|
3780
|
+
var _a;
|
|
3780
3781
|
var _this = _super.call(this, {
|
|
3781
3782
|
timeoutDelay: SESSION_IDLE_TIME,
|
|
3782
3783
|
onIdle: function () { return _this.clearSessionWhenIdle(); },
|
|
@@ -3786,13 +3787,14 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3786
3787
|
_this._sessionHasError = false;
|
|
3787
3788
|
_this._cachedLogsSent = false;
|
|
3788
3789
|
_this._currentPageTimestamp = getNowTime();
|
|
3790
|
+
_this.debugMode = !!((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.debug);
|
|
3789
3791
|
_this.getPrevSession = function () {
|
|
3790
3792
|
var _a;
|
|
3791
|
-
return JSON.parse((_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3793
|
+
return JSON.parse((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(PREV_SESSION_KEY));
|
|
3792
3794
|
};
|
|
3793
3795
|
_this.getSession = function () {
|
|
3794
3796
|
var _a;
|
|
3795
|
-
var storedSession = JSON.parse((_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3797
|
+
var storedSession = JSON.parse((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(SESSION_KEY));
|
|
3796
3798
|
var now = getNowTime();
|
|
3797
3799
|
var session;
|
|
3798
3800
|
if (storedSession) {
|
|
@@ -3808,22 +3810,22 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3808
3810
|
};
|
|
3809
3811
|
_this.setSession = function (afterIdle) {
|
|
3810
3812
|
var _a, _b, _c, _d;
|
|
3811
|
-
if (afterIdle ===
|
|
3812
|
-
var shouldkeepSessionAfterReload = (_a = _this._sessionConfig) === null || _a ===
|
|
3813
|
+
if (afterIdle === void 0) { afterIdle = false; }
|
|
3814
|
+
var shouldkeepSessionAfterReload = (_a = _this._sessionConfig) === null || _a === void 0 ? void 0 : _a.keepSessionAfterReload;
|
|
3813
3815
|
if (shouldkeepSessionAfterReload) {
|
|
3814
3816
|
_this.handleRefreshedSessions();
|
|
3815
3817
|
}
|
|
3816
3818
|
else {
|
|
3817
3819
|
_this.createNewSession();
|
|
3818
3820
|
}
|
|
3819
|
-
(_b = CxGlobal.sessionStorage) === null || _b ===
|
|
3821
|
+
(_b = CxGlobal.sessionStorage) === null || _b === void 0 ? void 0 : _b.setItem(SESSION_KEY, JSON.stringify(_this.activeSession));
|
|
3820
3822
|
var sessionRecorder = getSessionRecorder();
|
|
3821
3823
|
var shouldStartRecordingAfterIdle = afterIdle &&
|
|
3822
|
-
!!(sessionRecorder === null || sessionRecorder ===
|
|
3823
|
-
!!((_c = _this.sessionRecorderConfig) === null || _c ===
|
|
3824
|
+
!!(sessionRecorder === null || sessionRecorder === void 0 ? void 0 : sessionRecorder.recordingStopDueToTimeout) &&
|
|
3825
|
+
!!((_c = _this.sessionRecorderConfig) === null || _c === void 0 ? void 0 : _c.enable);
|
|
3824
3826
|
if (shouldStartRecordingAfterIdle ||
|
|
3825
|
-
(sessionRecorder === null || sessionRecorder ===
|
|
3826
|
-
(_d = _this.sessionRecorder) === null || _d ===
|
|
3827
|
+
(sessionRecorder === null || sessionRecorder === void 0 ? void 0 : sessionRecorder.getIsAutoStartRecording())) {
|
|
3828
|
+
(_d = _this.sessionRecorder) === null || _d === void 0 ? void 0 : _d.startRecording();
|
|
3827
3829
|
}
|
|
3828
3830
|
return _this.activeSession;
|
|
3829
3831
|
};
|
|
@@ -3923,14 +3925,14 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3923
3925
|
this.stopIdleListener();
|
|
3924
3926
|
};
|
|
3925
3927
|
SessionManager.prototype.initializeSession = function (recordConfig) {
|
|
3926
|
-
return __awaiter(this,
|
|
3928
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3927
3929
|
var recordingSamplingEnabled, SessionRecorder_1;
|
|
3928
3930
|
return __generator(this, function (_a) {
|
|
3929
3931
|
switch (_a.label) {
|
|
3930
3932
|
case 0:
|
|
3931
3933
|
CxGlobal[SESSION_MANAGER_KEY] = this;
|
|
3932
3934
|
this.sessionRecorderConfig = recordConfig;
|
|
3933
|
-
if (!(recordConfig === null || recordConfig ===
|
|
3935
|
+
if (!(recordConfig === null || recordConfig === void 0 ? void 0 : recordConfig.enable)) return [3 /*break*/, 3];
|
|
3934
3936
|
recordingSamplingEnabled = isSamplingOn(recordConfig.sessionRecordingSampleRate);
|
|
3935
3937
|
if (!recordingSamplingEnabled) return [3 /*break*/, 2];
|
|
3936
3938
|
return [4 /*yield*/, import('./sessionRecorder.esm.js')];
|
|
@@ -3950,24 +3952,27 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3950
3952
|
};
|
|
3951
3953
|
SessionManager.prototype.clearSessionWhenIdle = function () {
|
|
3952
3954
|
var _a;
|
|
3953
|
-
if ((_a = this.sessionRecorder) === null || _a ===
|
|
3955
|
+
if ((_a = this.sessionRecorder) === null || _a === void 0 ? void 0 : _a.getSessionHasRecording()) {
|
|
3954
3956
|
this.sessionRecorder.recordingStopDueToTimeout = true;
|
|
3955
3957
|
}
|
|
3956
3958
|
this.clearSession();
|
|
3957
3959
|
};
|
|
3958
3960
|
SessionManager.prototype.clearPrevSession = function () {
|
|
3959
3961
|
var _a;
|
|
3960
|
-
(_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3962
|
+
(_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.removeItem(PREV_SESSION_KEY);
|
|
3961
3963
|
};
|
|
3962
3964
|
SessionManager.prototype.clearSession = function () {
|
|
3963
3965
|
var _a, _b, _c, _d, _e, _f;
|
|
3964
|
-
|
|
3966
|
+
if (this.debugMode) {
|
|
3967
|
+
console.debug('Coralogix Browser SDK - Session expired, clearing session');
|
|
3968
|
+
}
|
|
3969
|
+
(_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
3970
|
clearGlobalSpan();
|
|
3966
3971
|
this.clearSessionWithErrorMode();
|
|
3967
|
-
(_d = getSnapshotManager()) === null || _d ===
|
|
3972
|
+
(_d = getSnapshotManager()) === null || _d === void 0 ? void 0 : _d.resetSnapshot();
|
|
3968
3973
|
this._currentPageFragment = undefined;
|
|
3969
|
-
(_e = this.sessionRecorder) === null || _e ===
|
|
3970
|
-
(_f = CxGlobal.sessionStorage) === null || _f ===
|
|
3974
|
+
(_e = this.sessionRecorder) === null || _e === void 0 ? void 0 : _e.stopRecording();
|
|
3975
|
+
(_f = CxGlobal.sessionStorage) === null || _f === void 0 ? void 0 : _f.removeItem(SESSION_KEY);
|
|
3971
3976
|
};
|
|
3972
3977
|
SessionManager.prototype.clearSessionWithErrorMode = function () {
|
|
3973
3978
|
this.sessionHasError = false;
|
|
@@ -3976,9 +3981,9 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3976
3981
|
SessionManager.prototype.handleRefreshedSessions = function () {
|
|
3977
3982
|
var _a, _b;
|
|
3978
3983
|
this.activeSession = this.getSession();
|
|
3979
|
-
var recordingSegmentMapFromStorage = JSON.parse(((_a = CxGlobal.sessionStorage) === null || _a ===
|
|
3984
|
+
var recordingSegmentMapFromStorage = JSON.parse(((_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.getItem(SESSION_RECORDER_SEGMENTS_MAP)) || '{}');
|
|
3980
3985
|
if (this.activeSession) {
|
|
3981
|
-
(_b = getSessionRecorder()) === null || _b ===
|
|
3986
|
+
(_b = getSessionRecorder()) === null || _b === void 0 ? void 0 : _b.updateSegmentIndexCounter(recordingSegmentMapFromStorage);
|
|
3982
3987
|
}
|
|
3983
3988
|
else {
|
|
3984
3989
|
this.createNewSession();
|
|
@@ -3986,6 +3991,9 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3986
3991
|
};
|
|
3987
3992
|
SessionManager.prototype.createNewSession = function () {
|
|
3988
3993
|
var now = getNowTime();
|
|
3994
|
+
if (this.debugMode) {
|
|
3995
|
+
console.debug('Coralogix Browser SDK - Creating new session');
|
|
3996
|
+
}
|
|
3989
3997
|
this.activeSession = {
|
|
3990
3998
|
sessionId: generateUUID(),
|
|
3991
3999
|
sessionCreationDate: now,
|
|
@@ -3997,17 +4005,17 @@ var SessionManager = /** @class */ (function (_super) {
|
|
|
3997
4005
|
|
|
3998
4006
|
var reportInternalEvent = function (event, message) {
|
|
3999
4007
|
var internalInstrumentation = getInternalRumData(INTERNAL_INSTRUMENTATION_NAME);
|
|
4000
|
-
internalInstrumentation === null || internalInstrumentation ===
|
|
4008
|
+
internalInstrumentation === null || internalInstrumentation === void 0 ? void 0 : internalInstrumentation.reportInternalEvent(event, message);
|
|
4001
4009
|
};
|
|
4002
4010
|
|
|
4003
4011
|
function handlePropagators(config, tracerProvider) {
|
|
4004
|
-
return __awaiter(this,
|
|
4012
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4005
4013
|
var propagators, _a, propagateB3TraceHeader, propagateAwsXrayTraceHeader, singleHeader, multiHeader;
|
|
4006
4014
|
var _b, _c;
|
|
4007
4015
|
return __generator(this, function (_d) {
|
|
4008
|
-
if ((_b = config.traceParentInHeader) === null || _b ===
|
|
4016
|
+
if ((_b = config.traceParentInHeader) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
4009
4017
|
propagators = [];
|
|
4010
|
-
_a = ((_c = config.traceParentInHeader) === null || _c ===
|
|
4018
|
+
_a = ((_c = config.traceParentInHeader) === null || _c === void 0 ? void 0 : _c.options) || {}, propagateB3TraceHeader = _a.propagateB3TraceHeader, propagateAwsXrayTraceHeader = _a.propagateAwsXrayTraceHeader;
|
|
4011
4019
|
if (!propagateAwsXrayTraceHeader && !propagateB3TraceHeader) {
|
|
4012
4020
|
propagators = __spreadArray(__spreadArray([], __read$1(propagators), false), [
|
|
4013
4021
|
new W3CBaggagePropagator(),
|
|
@@ -4049,7 +4057,7 @@ var CxPropagator = /** @class */ (function () {
|
|
|
4049
4057
|
};
|
|
4050
4058
|
CxPropagator.prototype.inject = function (context, carrier, setter) {
|
|
4051
4059
|
var _a, _b;
|
|
4052
|
-
var allowedUrls = (_b = (_a = this.config.traceParentInHeader) === null || _a ===
|
|
4060
|
+
var allowedUrls = (_b = (_a = this.config.traceParentInHeader) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.allowedTracingUrls;
|
|
4053
4061
|
if (allowedUrls) {
|
|
4054
4062
|
var span = trace.getSpan(context);
|
|
4055
4063
|
var url = span.attributes[OtelNetworkAttrs.URL];
|
|
@@ -4104,14 +4112,14 @@ function validateAndResolveInitConfig(config) {
|
|
|
4104
4112
|
if (proxyUrl)
|
|
4105
4113
|
resolvedIgnoreUrls.push(new RegExp(proxyUrl));
|
|
4106
4114
|
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 !==
|
|
4115
|
+
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
4116
|
}
|
|
4109
4117
|
function resolveMemoryUsageConfig(memoryUsageConfig) {
|
|
4110
4118
|
var _a;
|
|
4111
4119
|
if (!memoryUsageConfig) {
|
|
4112
4120
|
return { enabled: false };
|
|
4113
4121
|
}
|
|
4114
|
-
return __assign(__assign({}, memoryUsageConfig), { interval: (_a = memoryUsageConfig.interval) !== null && _a !==
|
|
4122
|
+
return __assign(__assign({}, memoryUsageConfig), { interval: (_a = memoryUsageConfig.interval) !== null && _a !== void 0 ? _a : MEMORY_USAGE_DEFAULT_INTERVAL });
|
|
4115
4123
|
}
|
|
4116
4124
|
function resolveUrlBlueprinters(urlBlueprinters) {
|
|
4117
4125
|
if (!urlBlueprinters) {
|
|
@@ -4138,7 +4146,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4138
4146
|
return resolvedUrlBlueprinters;
|
|
4139
4147
|
}
|
|
4140
4148
|
|
|
4141
|
-
var SDK_VERSION = '2.
|
|
4149
|
+
var SDK_VERSION = '2.5.0';
|
|
4142
4150
|
|
|
4143
4151
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4144
4152
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4155,10 +4163,10 @@ function isDocumentErrorWithoutMessage(cxRumEvent) {
|
|
|
4155
4163
|
var _a = cxRumEvent || {}, event_context = _a.event_context, error_context = _a.error_context;
|
|
4156
4164
|
return (event_context.type === CoralogixEventType.ERROR &&
|
|
4157
4165
|
event_context.source === ErrorSource.DOCUMENT &&
|
|
4158
|
-
!(error_context === null || error_context ===
|
|
4166
|
+
!(error_context === null || error_context === void 0 ? void 0 : error_context.error_message));
|
|
4159
4167
|
}
|
|
4160
4168
|
function isIgnoredError(cxRumEvent, ignoreErrors) {
|
|
4161
|
-
if (!cxRumEvent.error_context || !(ignoreErrors === null || ignoreErrors ===
|
|
4169
|
+
if (!cxRumEvent.error_context || !(ignoreErrors === null || ignoreErrors === void 0 ? void 0 : ignoreErrors.length)) {
|
|
4162
4170
|
return false;
|
|
4163
4171
|
}
|
|
4164
4172
|
var errorMessage = cxRumEvent.error_context.error_message || '';
|
|
@@ -4166,7 +4174,7 @@ function isIgnoredError(cxRumEvent, ignoreErrors) {
|
|
|
4166
4174
|
}
|
|
4167
4175
|
|
|
4168
4176
|
function processBeforeSend(cxSpan, options) {
|
|
4169
|
-
if (!(options === null || options ===
|
|
4177
|
+
if (!(options === null || options === void 0 ? void 0 : options.beforeSend)) {
|
|
4170
4178
|
return cxSpan;
|
|
4171
4179
|
}
|
|
4172
4180
|
var cxRumEvent = cxSpan.text.cx_rum;
|
|
@@ -4188,7 +4196,7 @@ function validateBeforeSendResult(beforeSendResult) {
|
|
|
4188
4196
|
'event_context',
|
|
4189
4197
|
];
|
|
4190
4198
|
var isMissingRequiredKey = function () {
|
|
4191
|
-
return requiredKeys.some(function (key) { return !(beforeSendResult === null || beforeSendResult ===
|
|
4199
|
+
return requiredKeys.some(function (key) { return !(beforeSendResult === null || beforeSendResult === void 0 ? void 0 : beforeSendResult[key]); });
|
|
4192
4200
|
};
|
|
4193
4201
|
if (!isObject(beforeSendResult) || isMissingRequiredKey()) {
|
|
4194
4202
|
console.warn('CoralogixRum: beforeSend must return null, undefined or a valid event.');
|
|
@@ -4216,8 +4224,8 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4216
4224
|
}
|
|
4217
4225
|
var _c = getSessionManager(), onlySessionWithErrorMode = _c.onlySessionWithErrorMode, getPrevSession = _c.getPrevSession, getSession = _c.getSession, setSession = _c.setSession;
|
|
4218
4226
|
var session = getSession() || setSession();
|
|
4219
|
-
var sessionHasRecording = !!((_a = getSessionRecorder()) === null || _a ===
|
|
4220
|
-
var sessionHasScreenshot = !!((_b = getSessionRecorder()) === null || _b ===
|
|
4227
|
+
var sessionHasRecording = !!((_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.getSessionHasRecording());
|
|
4228
|
+
var sessionHasScreenshot = !!((_b = getSessionRecorder()) === null || _b === void 0 ? void 0 : _b.getSessionHasScreenshot());
|
|
4221
4229
|
var mappedCxSpan = this._mapToCxSpan(span, session, getPrevSession(), sessionHasRecording, sessionHasScreenshot, onlySessionWithErrorMode);
|
|
4222
4230
|
if (!shouldDropEvent(mappedCxSpan.text.cx_rum, this.sdkConfig)) {
|
|
4223
4231
|
var resolvedCxSpan = processBeforeSend(mappedCxSpan, this.sdkConfig);
|
|
@@ -4252,14 +4260,14 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4252
4260
|
span[CoralogixAttributes.EVENT_TYPE];
|
|
4253
4261
|
var eventTypeContext = this._getEventTypeContext(attributes, eventType, span);
|
|
4254
4262
|
var _e = span.spanContext(), spanId = _e.spanId, traceId = _e.traceId;
|
|
4255
|
-
var resourceAttributes = __assign(__assign({}, (_a = span.resource) === null || _a ===
|
|
4263
|
+
var resourceAttributes = __assign(__assign({}, (_a = span.resource) === null || _a === void 0 ? void 0 : _a.attributes), { 'service.name': application });
|
|
4256
4264
|
var labels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
|
|
4257
|
-
var isErrorWithStacktrace = !!((_b = eventTypeContext === null || eventTypeContext ===
|
|
4265
|
+
var isErrorWithStacktrace = !!((_b = eventTypeContext === null || eventTypeContext === void 0 ? void 0 : eventTypeContext.error_context) === null || _b === void 0 ? void 0 : _b.original_stacktrace);
|
|
4258
4266
|
var version_metadata = {
|
|
4259
4267
|
app_name: application,
|
|
4260
4268
|
app_version: version,
|
|
4261
4269
|
};
|
|
4262
|
-
var severity = (attributes === null || attributes ===
|
|
4270
|
+
var severity = (attributes === null || attributes === void 0 ? void 0 : attributes[CoralogixAttributes.SEVERITY]) ||
|
|
4263
4271
|
CoralogixLogSeverity.Info;
|
|
4264
4272
|
var timestamp = attributes[CoralogixAttributes.TIMESTAMP] || getNowTime();
|
|
4265
4273
|
if (timestamp < sessionCreationDate) {
|
|
@@ -4356,7 +4364,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4356
4364
|
var url = spanAttributes[OtelNetworkAttrs.URL];
|
|
4357
4365
|
var url_blueprint = applyUrlBluePrinters({
|
|
4358
4366
|
url: url,
|
|
4359
|
-
blueprinters: (_a = this.sdkConfig.urlBlueprinters) === null || _a ===
|
|
4367
|
+
blueprinters: (_a = this.sdkConfig.urlBlueprinters) === null || _a === void 0 ? void 0 : _a.networkUrlBlueprinters,
|
|
4360
4368
|
});
|
|
4361
4369
|
return {
|
|
4362
4370
|
network_request_context: {
|
|
@@ -4368,7 +4376,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4368
4376
|
host: spanAttributes[OtelNetworkAttrs.HOST],
|
|
4369
4377
|
schema: spanAttributes[OtelNetworkAttrs.SCHEME],
|
|
4370
4378
|
status_text: spanAttributes[OtelNetworkAttrs.STATUS_TEXT],
|
|
4371
|
-
duration: hrTimeToMilliseconds(span === null || span ===
|
|
4379
|
+
duration: hrTimeToMilliseconds(span === null || span === void 0 ? void 0 : span.duration),
|
|
4372
4380
|
source: spanAttributes[CoralogixAttributes.SOURCE],
|
|
4373
4381
|
response_content_length: spanAttributes[OtelNetworkAttrs.RESPONSE_CONTENT_LENGTH],
|
|
4374
4382
|
request_headers: span[NetworkInstrumentationAttributes.REQUEST_HEADERS],
|
|
@@ -4384,7 +4392,7 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4384
4392
|
return {
|
|
4385
4393
|
log_context: {
|
|
4386
4394
|
message: cxLog.message,
|
|
4387
|
-
data: cxLog === null || cxLog ===
|
|
4395
|
+
data: cxLog === null || cxLog === void 0 ? void 0 : cxLog.data,
|
|
4388
4396
|
},
|
|
4389
4397
|
};
|
|
4390
4398
|
}
|
|
@@ -4441,11 +4449,11 @@ var CoralogixSpanMapProcessor = /** @class */ (function () {
|
|
|
4441
4449
|
CoralogixSpanMapProcessor.prototype.resolveLabels = function (cxRumEvent) {
|
|
4442
4450
|
var _a, _b;
|
|
4443
4451
|
var allLabels = cxRumEvent.labels;
|
|
4444
|
-
var labelProviders = (_a = this.sdkConfig) === null || _a ===
|
|
4445
|
-
if (labelProviders === null || labelProviders ===
|
|
4452
|
+
var labelProviders = (_a = this.sdkConfig) === null || _a === void 0 ? void 0 : _a.labelProviders;
|
|
4453
|
+
if (labelProviders === null || labelProviders === void 0 ? void 0 : labelProviders.length) {
|
|
4446
4454
|
var pageUrlLabelProviders = getInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY);
|
|
4447
4455
|
var networkUrlLabelProviders = getInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY);
|
|
4448
|
-
var networkRequestFragment = (_b = cxRumEvent.network_request_context) === null || _b ===
|
|
4456
|
+
var networkRequestFragment = (_b = cxRumEvent.network_request_context) === null || _b === void 0 ? void 0 : _b.fragments;
|
|
4449
4457
|
var labelsFromProviders = __assign(__assign({}, this.getLabelsByLabelProviders(pageUrlLabelProviders, cxRumEvent, cxRumEvent.page_context.page_fragments)), (networkRequestFragment
|
|
4450
4458
|
? this.getLabelsByLabelProviders(networkUrlLabelProviders, cxRumEvent, networkRequestFragment)
|
|
4451
4459
|
: {}));
|
|
@@ -4526,7 +4534,7 @@ var CoralogixSnapshotSpanProcessor = /** @class */ (function () {
|
|
|
4526
4534
|
});
|
|
4527
4535
|
shouldCreateSnapshot = true;
|
|
4528
4536
|
}
|
|
4529
|
-
if (((_a = getSessionRecorder()) === null || _a ===
|
|
4537
|
+
if (((_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.getSessionHasRecording()) &&
|
|
4530
4538
|
!isSnapshotSentDueToRecording) {
|
|
4531
4539
|
updateSnapshot({ timestamp: getNowTime(), hasRecording: true });
|
|
4532
4540
|
getSnapshotManager().isSnapshotSentDueToRecording = true;
|
|
@@ -4602,7 +4610,7 @@ var CoralogixNavigationProcessor = /** @class */ (function () {
|
|
|
4602
4610
|
CoralogixNavigationProcessor.prototype.onEnd = function (span) { };
|
|
4603
4611
|
CoralogixNavigationProcessor.prototype.onStart = function (span) {
|
|
4604
4612
|
var pageContext = resolvePageContext(location.href);
|
|
4605
|
-
{
|
|
4613
|
+
if (pageContext) {
|
|
4606
4614
|
span[CoralogixAttributes.PAGE_CONTEXT] = pageContext;
|
|
4607
4615
|
var currentPageFragment = getSessionManager().currentPageFragment;
|
|
4608
4616
|
var page_fragments = pageContext.page_fragments;
|
|
@@ -4690,9 +4698,9 @@ var CoralogixRum = {
|
|
|
4690
4698
|
var instrumentations = INSTRUMENTATIONS.map(function (_a) {
|
|
4691
4699
|
var _b, _c;
|
|
4692
4700
|
var Instrument = _a.Instrument, confKey = _a.confKey, disable = _a.disable;
|
|
4693
|
-
var pluginConf = getInstrumentationConfig((_b = resolvedOptions === null || resolvedOptions ===
|
|
4701
|
+
var pluginConf = getInstrumentationConfig((_b = resolvedOptions === null || resolvedOptions === void 0 ? void 0 : resolvedOptions.instrumentations) === null || _b === void 0 ? void 0 : _b[confKey], pluginDefaults, disable);
|
|
4694
4702
|
if (pluginConf) {
|
|
4695
|
-
var instrumentation =
|
|
4703
|
+
var instrumentation = void 0;
|
|
4696
4704
|
switch (confKey) {
|
|
4697
4705
|
case 'errors': {
|
|
4698
4706
|
instrumentation = new Instrument(pluginConf);
|
|
@@ -4711,7 +4719,7 @@ var CoralogixRum = {
|
|
|
4711
4719
|
break;
|
|
4712
4720
|
}
|
|
4713
4721
|
case SCREENSHOT_INSTRUMENTATION_NAME: {
|
|
4714
|
-
if ((_c = resolvedOptions.sessionRecordingConfig) === null || _c ===
|
|
4722
|
+
if ((_c = resolvedOptions.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
4715
4723
|
instrumentation = new Instrument(pluginConf);
|
|
4716
4724
|
screenshotInstrumentation =
|
|
4717
4725
|
instrumentation;
|
|
@@ -4783,7 +4791,7 @@ var CoralogixRum = {
|
|
|
4783
4791
|
saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
|
|
4784
4792
|
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
4785
4793
|
isInited = true;
|
|
4786
|
-
if (options === null || options ===
|
|
4794
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4787
4795
|
console.info('CoralogixRum.init() complete');
|
|
4788
4796
|
}
|
|
4789
4797
|
reportInternalEvent('init');
|
|
@@ -4794,7 +4802,7 @@ var CoralogixRum = {
|
|
|
4794
4802
|
console.debug('CoralogixRum must be initiated before getting custom tracer');
|
|
4795
4803
|
return;
|
|
4796
4804
|
}
|
|
4797
|
-
if (!((_b = (_a = getSdkConfig()) === null || _a ===
|
|
4805
|
+
if (!((_b = (_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.traceParentInHeader) === null || _b === void 0 ? void 0 : _b.enabled)) {
|
|
4798
4806
|
console.debug('Coralogix Browser SDK - TraceParentInHeader is not enabled');
|
|
4799
4807
|
return;
|
|
4800
4808
|
}
|
|
@@ -4810,7 +4818,7 @@ var CoralogixRum = {
|
|
|
4810
4818
|
console.warn('Coralogix Browser SDK - Global span already exists');
|
|
4811
4819
|
return;
|
|
4812
4820
|
}
|
|
4813
|
-
setCustomTracerIgnoredInstruments((ignoredList === null || ignoredList ===
|
|
4821
|
+
setCustomTracerIgnoredInstruments((ignoredList === null || ignoredList === void 0 ? void 0 : ignoredList.ignoredInstruments) || []);
|
|
4814
4822
|
var globalSpan = tracer.startSpan(name);
|
|
4815
4823
|
globalSpan[CoralogixAttributes.EVENT_TYPE] =
|
|
4816
4824
|
CoralogixEventType.CUSTOM_SPAN;
|
|
@@ -4824,7 +4832,7 @@ var CoralogixRum = {
|
|
|
4824
4832
|
return context.with(trace.setSpan(context.active(), globalSpan), fn);
|
|
4825
4833
|
},
|
|
4826
4834
|
endSpan: function () {
|
|
4827
|
-
globalSpan === null || globalSpan ===
|
|
4835
|
+
globalSpan === null || globalSpan === void 0 ? void 0 : globalSpan.end();
|
|
4828
4836
|
clearGlobalSpan();
|
|
4829
4837
|
},
|
|
4830
4838
|
startCustomSpan: function (name, labels) {
|
|
@@ -4838,7 +4846,7 @@ var CoralogixRum = {
|
|
|
4838
4846
|
return {
|
|
4839
4847
|
span: customSpan,
|
|
4840
4848
|
endSpan: function () {
|
|
4841
|
-
customSpan === null || customSpan ===
|
|
4849
|
+
customSpan === null || customSpan === void 0 ? void 0 : customSpan.end();
|
|
4842
4850
|
},
|
|
4843
4851
|
};
|
|
4844
4852
|
},
|
|
@@ -4853,15 +4861,15 @@ var CoralogixRum = {
|
|
|
4853
4861
|
if (!isInited) {
|
|
4854
4862
|
return;
|
|
4855
4863
|
}
|
|
4856
|
-
_deregisterInstrumentations === null || _deregisterInstrumentations ===
|
|
4864
|
+
_deregisterInstrumentations === null || _deregisterInstrumentations === void 0 ? void 0 : _deregisterInstrumentations();
|
|
4857
4865
|
_deregisterInstrumentations = undefined;
|
|
4858
4866
|
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 ===
|
|
4867
|
+
(_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
4868
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.shutdown();
|
|
4869
|
+
navigationProcessor === null || navigationProcessor === void 0 ? void 0 : navigationProcessor.shutdown();
|
|
4870
|
+
spanMapProcessor === null || spanMapProcessor === void 0 ? void 0 : spanMapProcessor.shutdown();
|
|
4871
|
+
snapshotProcessor === null || snapshotProcessor === void 0 ? void 0 : snapshotProcessor.shutdown();
|
|
4872
|
+
exporter === null || exporter === void 0 ? void 0 : exporter.shutdown();
|
|
4865
4873
|
isInited = false;
|
|
4866
4874
|
},
|
|
4867
4875
|
setApplicationContext: function (applicationContext) {
|
|
@@ -4870,21 +4878,21 @@ var CoralogixRum = {
|
|
|
4870
4878
|
console.debug('CoralogixRum must be initiated before setting application context');
|
|
4871
4879
|
return;
|
|
4872
4880
|
}
|
|
4873
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4881
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setInternalLabels(__assign(__assign({}, attributesProcessor.getInternalLabels()), (_a = {}, _a[CoralogixAttributes.APPLICATION_CONTEXT] = applicationContext, _a)));
|
|
4874
4882
|
},
|
|
4875
4883
|
captureError: function (error, customData, labels) {
|
|
4876
4884
|
if (!isInited) {
|
|
4877
4885
|
console.debug('CoralogixRum must be initiated before reporting errors');
|
|
4878
4886
|
return;
|
|
4879
4887
|
}
|
|
4880
|
-
errorsInstrumentation === null || errorsInstrumentation ===
|
|
4888
|
+
errorsInstrumentation === null || errorsInstrumentation === void 0 ? void 0 : errorsInstrumentation.reportError(ErrorSource.CAPTURED, error, customData, labels);
|
|
4881
4889
|
},
|
|
4882
4890
|
sendCustomMeasurement: function (name, value) {
|
|
4883
4891
|
if (!isInited) {
|
|
4884
4892
|
console.debug('CoralogixRum must be initiated before sending custom measurement');
|
|
4885
4893
|
return;
|
|
4886
4894
|
}
|
|
4887
|
-
customMeasurementInstrumentation === null || customMeasurementInstrumentation ===
|
|
4895
|
+
customMeasurementInstrumentation === null || customMeasurementInstrumentation === void 0 ? void 0 : customMeasurementInstrumentation.createCustomMeasurement(name, value);
|
|
4888
4896
|
},
|
|
4889
4897
|
addTiming: function (name, duration) {
|
|
4890
4898
|
if (!isInited) {
|
|
@@ -4906,7 +4914,7 @@ var CoralogixRum = {
|
|
|
4906
4914
|
},
|
|
4907
4915
|
stopSessionRecording: function () {
|
|
4908
4916
|
var _a;
|
|
4909
|
-
(_a = getSessionRecorder()) === null || _a ===
|
|
4917
|
+
(_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.stopRecording();
|
|
4910
4918
|
},
|
|
4911
4919
|
startSessionRecording: function () {
|
|
4912
4920
|
if (getSessionRecorder()) {
|
|
@@ -4931,8 +4939,8 @@ var CoralogixRum = {
|
|
|
4931
4939
|
return;
|
|
4932
4940
|
}
|
|
4933
4941
|
var id = generateUUID();
|
|
4934
|
-
screenshotInstrumentation === null || screenshotInstrumentation ===
|
|
4935
|
-
(_a = getSessionRecorder()) === null || _a ===
|
|
4942
|
+
screenshotInstrumentation === null || screenshotInstrumentation === void 0 ? void 0 : screenshotInstrumentation.screenshot(id, description);
|
|
4943
|
+
(_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.screenshot(id);
|
|
4936
4944
|
return id;
|
|
4937
4945
|
},
|
|
4938
4946
|
setUserContext: function (userContext) {
|
|
@@ -4941,20 +4949,20 @@ var CoralogixRum = {
|
|
|
4941
4949
|
console.debug('CoralogixRum must be initiated before setting user context');
|
|
4942
4950
|
return;
|
|
4943
4951
|
}
|
|
4944
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4952
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setInternalLabels(__assign(__assign({}, attributesProcessor.getInternalLabels()), (_a = {}, _a[CoralogixAttributes.USER_CONTEXT] = userContext, _a)));
|
|
4945
4953
|
},
|
|
4946
4954
|
getUserContext: function () {
|
|
4947
|
-
return attributesProcessor === null || attributesProcessor ===
|
|
4955
|
+
return attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.getUserContext();
|
|
4948
4956
|
},
|
|
4949
4957
|
setLabels: function (labels) {
|
|
4950
|
-
attributesProcessor === null || attributesProcessor ===
|
|
4958
|
+
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.setCustomLabels(labels);
|
|
4951
4959
|
},
|
|
4952
4960
|
getLabels: function () {
|
|
4953
|
-
return (attributesProcessor === null || attributesProcessor ===
|
|
4961
|
+
return (attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.getCustomLabels()) || {};
|
|
4954
4962
|
},
|
|
4955
4963
|
getSessionId: function () {
|
|
4956
4964
|
var _a, _b;
|
|
4957
|
-
return (_b = (_a = getSessionManager()) === null || _a ===
|
|
4965
|
+
return (_b = (_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.getSession()) === null || _b === void 0 ? void 0 : _b.sessionId;
|
|
4958
4966
|
},
|
|
4959
4967
|
log: function (severity, message, data, labels) {
|
|
4960
4968
|
if (!isInited) {
|
|
@@ -4965,7 +4973,7 @@ var CoralogixRum = {
|
|
|
4965
4973
|
console.warn('Log was reported, but custom instrumentation is disabled.');
|
|
4966
4974
|
return;
|
|
4967
4975
|
}
|
|
4968
|
-
_customInstrumentation === null || _customInstrumentation ===
|
|
4976
|
+
_customInstrumentation === null || _customInstrumentation === void 0 ? void 0 : _customInstrumentation.log({ severity: severity, message: message, data: data, labels: labels });
|
|
4969
4977
|
},
|
|
4970
4978
|
debug: function (message, data, labels) {
|
|
4971
4979
|
this.log(CoralogixLogSeverity.Debug, message, data, labels);
|
|
@@ -4990,13 +4998,13 @@ var CoralogixRum = {
|
|
|
4990
4998
|
console.debug('CoralogixRum must be initiated before starting time measurement.');
|
|
4991
4999
|
return;
|
|
4992
5000
|
}
|
|
4993
|
-
timeMeasurementTracker === null || timeMeasurementTracker ===
|
|
5001
|
+
timeMeasurementTracker === null || timeMeasurementTracker === void 0 ? void 0 : timeMeasurementTracker.startMeasurement(key, labels);
|
|
4994
5002
|
},
|
|
4995
5003
|
endTimeMeasure: function (key) {
|
|
4996
|
-
var measurement = timeMeasurementTracker === null || timeMeasurementTracker ===
|
|
5004
|
+
var measurement = timeMeasurementTracker === null || timeMeasurementTracker === void 0 ? void 0 : timeMeasurementTracker.getMeasurement(key);
|
|
4997
5005
|
if (measurement) {
|
|
4998
5006
|
var duration = measurement.duration, labels = measurement.labels;
|
|
4999
|
-
customMeasurementInstrumentation === null || customMeasurementInstrumentation ===
|
|
5007
|
+
customMeasurementInstrumentation === null || customMeasurementInstrumentation === void 0 ? void 0 : customMeasurementInstrumentation.createCustomMeasurement(key, duration, getCustomMergedLabels(labels));
|
|
5000
5008
|
}
|
|
5001
5009
|
},
|
|
5002
5010
|
};
|
|
@@ -5051,4 +5059,4 @@ var SessionRecordingEventType;
|
|
|
5051
5059
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
5052
5060
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
5053
5061
|
|
|
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,
|
|
5062
|
+
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 };
|