o11y 254.4.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.
@@ -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
- if (xhr._o11y) {
803
- const activity = xhr._o11y.activity;
804
- const activityDuration = Tracing._endActivity(activity, xhr._o11y.url, xhr._o11y.method);
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(xhr._o11y.absoluteUrl, xhr._o11y.sendTime, {
807
- requestId: xhr._o11y.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
- this._o11y = {
819
+ const _o11y = {
818
820
  method,
819
821
  url: url === null || url === void 0 ? void 0 : url.toString()
820
822
  };
821
- this._o11y.absoluteUrl = utility.tryGetAbsoluteUrl(this._o11y.url);
822
- this._o11y.suspendInstrumentation = Tracing._shouldSkipUrl(skipUrls, this._o11y.absoluteUrl);
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
- this._o11y.requestId = value;
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
- xhr._o11y = xhr._o11y || {};
839
- if (!xhr._o11y.suspendInstrumentation) {
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, xhr._o11y.method, xhr._o11y.absoluteUrl);
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
- xhr._o11y.sendTime = utility.perfNow();
857
+ _o11y.sendTime = utility.perfNow();
849
858
  Tracing._originalXhrSend.call(this, ...args);
850
859
  }
851
860
  catch (ex) {
852
- if (logErrors && !((_a = xhr._o11y) === null || _a === void 0 ? void 0 : _a.suspendInstrumentation)) {
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
- var _a, _b;
882
+ const _o11y = o11yInfoForXHR.get(newXhr) || {};
874
883
  try {
875
- if (logErrors && !((_a = newXhr._o11y) === null || _a === void 0 ? void 0 : _a.suspendInstrumentation)) {
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 = (_b = newXhr._o11y) === null || _b === void 0 ? void 0 : _b.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, _b;
893
- (_b = (_a = newXhr._o11y) === null || _a === void 0 ? void 0 : _a.activity) === null || _b === void 0 ? void 0 : _b.discard();
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.4.0';
2712
+ const version = '254.6.0';
2703
2713
 
2704
2714
  const idleDetector = new IdleDetectorImpl({
2705
2715
  logThreshold: 300,
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <isExposed>true</isExposed>
4
+ <capabilities>
5
+ <capability>lightning__ServerRenderable</capability>
6
+ </capabilities>
7
+ </LightningComponentBundle>