o11y 254.5.0 → 254.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/o11y/client/client.js +32 -22
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/version.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/web_vitals.js.map +1 -1
- package/package.json +1 -1
|
@@ -515,6 +515,7 @@ const defaultActivityNameForFetch = 'fetch';
|
|
|
515
515
|
const defaultActivityNameForXhrSend = 'xhr_send';
|
|
516
516
|
const defaultTimingActivityName = 'perf-timing';
|
|
517
517
|
const defaultFuzzyMapRange = 50;
|
|
518
|
+
const o11yInfoForXHR = new WeakMap();
|
|
518
519
|
class Tracing {
|
|
519
520
|
constructor(_instr, _idleDetector) {
|
|
520
521
|
this._instr = _instr;
|
|
@@ -799,12 +800,13 @@ class Tracing {
|
|
|
799
800
|
Tracing._originalXhrSend = Tracing._originalXhr.prototype.send;
|
|
800
801
|
function postProcess(xhr, failedAtInit) {
|
|
801
802
|
var _a;
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
const
|
|
803
|
+
const _o11y = o11yInfoForXHR.get(xhr);
|
|
804
|
+
if (_o11y) {
|
|
805
|
+
const activity = _o11y.activity;
|
|
806
|
+
const activityDuration = Tracing._endActivity(activity, _o11y.url, _o11y.method);
|
|
805
807
|
if (!failedAtInit && ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
|
|
806
|
-
Tracing._performanceObservability.addEntry(
|
|
807
|
-
requestId:
|
|
808
|
+
Tracing._performanceObservability.addEntry(_o11y.absoluteUrl, _o11y.sendTime, {
|
|
809
|
+
requestId: _o11y.requestId,
|
|
808
810
|
activityDuration,
|
|
809
811
|
activityId: activity === null || activity === void 0 ? void 0 : activity.getId(),
|
|
810
812
|
errorCount: activity === null || activity === void 0 ? void 0 : activity.getErrorCount(),
|
|
@@ -814,42 +816,49 @@ class Tracing {
|
|
|
814
816
|
}
|
|
815
817
|
}
|
|
816
818
|
Tracing._originalXhr.prototype.open = function (method, url, __async, __username, __password) {
|
|
817
|
-
|
|
819
|
+
const _o11y = {
|
|
818
820
|
method,
|
|
819
821
|
url: url === null || url === void 0 ? void 0 : url.toString()
|
|
820
822
|
};
|
|
821
|
-
|
|
822
|
-
|
|
823
|
+
o11yInfoForXHR.set(this, _o11y);
|
|
824
|
+
_o11y.absoluteUrl = utility.tryGetAbsoluteUrl(_o11y.url);
|
|
825
|
+
_o11y.suspendInstrumentation = Tracing._shouldSkipUrl(skipUrls, _o11y.absoluteUrl);
|
|
823
826
|
Tracing._originalXhrOpen.apply(this, arguments);
|
|
824
827
|
};
|
|
825
828
|
Tracing._originalXhr.prototype.setRequestHeader = function (name, value) {
|
|
826
829
|
var _a;
|
|
827
830
|
if (((_a = name === null || name === void 0 ? void 0 : name.toLowerCase) === null || _a === void 0 ? void 0 : _a.call(name)) === headerRequestId.toLowerCase()) {
|
|
828
|
-
|
|
831
|
+
const _o11y = o11yInfoForXHR.get(this);
|
|
832
|
+
if (_o11y) {
|
|
833
|
+
_o11y.requestId = value;
|
|
834
|
+
}
|
|
829
835
|
}
|
|
830
836
|
Tracing._originalXhrSetRequestHeader.apply(this, arguments);
|
|
831
837
|
};
|
|
832
838
|
Tracing._originalXhr.prototype.send = function (...args) {
|
|
833
|
-
var _a;
|
|
834
839
|
let activity;
|
|
835
840
|
const xhr = this;
|
|
841
|
+
let _o11y = o11yInfoForXHR.get(xhr);
|
|
842
|
+
if (!_o11y) {
|
|
843
|
+
_o11y = {};
|
|
844
|
+
o11yInfoForXHR.set(xhr, _o11y);
|
|
845
|
+
}
|
|
836
846
|
try {
|
|
837
847
|
tasker === null || tasker === void 0 ? void 0 : tasker.add();
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
xhr._o11y.activity = activity = instr.startActivity(activityName || defaultActivityNameForXhrSend);
|
|
848
|
+
if (!_o11y.suspendInstrumentation) {
|
|
849
|
+
_o11y.activity = activity = instr.startActivity(activityName || defaultActivityNameForXhrSend);
|
|
841
850
|
}
|
|
842
851
|
if (useTracing) {
|
|
843
|
-
const traceHeaders = Tracing._getTraceHeaders(activity, instr, options,
|
|
852
|
+
const traceHeaders = Tracing._getTraceHeaders(activity, instr, options, _o11y.method, _o11y.absoluteUrl);
|
|
844
853
|
Object.entries(traceHeaders).forEach((entry) => {
|
|
845
854
|
xhr.setRequestHeader(entry[0], entry[1]);
|
|
846
855
|
});
|
|
847
856
|
}
|
|
848
|
-
|
|
857
|
+
_o11y.sendTime = utility.perfNow();
|
|
849
858
|
Tracing._originalXhrSend.call(this, ...args);
|
|
850
859
|
}
|
|
851
860
|
catch (ex) {
|
|
852
|
-
if (logErrors && !(
|
|
861
|
+
if (logErrors && !(_o11y === null || _o11y === void 0 ? void 0 : _o11y.suspendInstrumentation)) {
|
|
853
862
|
if (activity) {
|
|
854
863
|
activity.error(ex);
|
|
855
864
|
}
|
|
@@ -870,11 +879,11 @@ class Tracing {
|
|
|
870
879
|
tasker === null || tasker === void 0 ? void 0 : tasker.done();
|
|
871
880
|
});
|
|
872
881
|
newXhr.addEventListener('error', (__err) => {
|
|
873
|
-
|
|
882
|
+
const _o11y = o11yInfoForXHR.get(newXhr) || {};
|
|
874
883
|
try {
|
|
875
|
-
if (logErrors && !(
|
|
884
|
+
if (logErrors && !(_o11y === null || _o11y === void 0 ? void 0 : _o11y.suspendInstrumentation)) {
|
|
876
885
|
const error = new Error('XHR Network-Level Error');
|
|
877
|
-
const activity =
|
|
886
|
+
const activity = _o11y === null || _o11y === void 0 ? void 0 : _o11y.activity;
|
|
878
887
|
if (activity) {
|
|
879
888
|
activity.error(error);
|
|
880
889
|
}
|
|
@@ -889,8 +898,9 @@ class Tracing {
|
|
|
889
898
|
}
|
|
890
899
|
});
|
|
891
900
|
newXhr.addEventListener('abort', () => {
|
|
892
|
-
var _a
|
|
893
|
-
|
|
901
|
+
var _a;
|
|
902
|
+
const _o11y = o11yInfoForXHR.get(newXhr) || {};
|
|
903
|
+
(_a = _o11y === null || _o11y === void 0 ? void 0 : _o11y.activity) === null || _a === void 0 ? void 0 : _a.discard();
|
|
894
904
|
tasker === null || tasker === void 0 ? void 0 : tasker.done();
|
|
895
905
|
});
|
|
896
906
|
return newXhr;
|
|
@@ -2699,7 +2709,7 @@ class ConsoleCollector {
|
|
|
2699
2709
|
}
|
|
2700
2710
|
}
|
|
2701
2711
|
|
|
2702
|
-
const version = '254.
|
|
2712
|
+
const version = '254.6.0';
|
|
2703
2713
|
|
|
2704
2714
|
const idleDetector = new IdleDetectorImpl({
|
|
2705
2715
|
logThreshold: 300,
|