o11y 250.2.0 → 250.4.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.
@@ -562,6 +562,11 @@ class Tracing {
562
562
  Tracing._global.XMLHttpRequest.prototype.open = Tracing._originalXhrOpen;
563
563
  Tracing._originalXhrOpen = undefined;
564
564
  }
565
+ if (Tracing._originalXhrSetRequestHeader) {
566
+ Tracing._global.XMLHttpRequest.prototype.setRequestHeader =
567
+ Tracing._originalXhrSetRequestHeader;
568
+ Tracing._originalXhrSetRequestHeader = undefined;
569
+ }
565
570
  if (Tracing._originalXhrSend) {
566
571
  Tracing._global.XMLHttpRequest.prototype.send = Tracing._originalXhrSend;
567
572
  Tracing._originalXhrSend = undefined;
@@ -708,7 +713,7 @@ class Tracing {
708
713
  static _endActivity(activity, url, method) {
709
714
  var _a;
710
715
  if (activity) {
711
- if (activity.getErrorCount() == 0 || ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
716
+ if (((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted) && activity.getErrorCount() == 0) {
712
717
  activity.discard();
713
718
  }
714
719
  else {
@@ -724,15 +729,15 @@ class Tracing {
724
729
  _overrideXhr(instr, logErrors, activityName, useTracing, options, tasker) {
725
730
  Tracing._originalXhr = Tracing._global.XMLHttpRequest;
726
731
  Tracing._originalXhrOpen = Tracing._originalXhr.prototype.open;
732
+ Tracing._originalXhrSetRequestHeader = Tracing._originalXhr.prototype.setRequestHeader;
727
733
  Tracing._originalXhrSend = Tracing._originalXhr.prototype.send;
728
734
  function postProcess(xhr, failedAtInit) {
729
735
  var _a;
730
736
  if (xhr._o11y) {
731
737
  const activityDuration = Tracing._endActivity(xhr._o11y.activity, xhr._o11y.url, xhr._o11y.method);
732
738
  if (!failedAtInit && ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
733
- const requestId = xhr.getResponseHeader(headerRequestId);
734
739
  Tracing._performanceObservability.addEntry(xhr._o11y.url, xhr._o11y.sendTime, {
735
- requestId,
740
+ requestId: xhr._o11y.requestId,
736
741
  activityDuration
737
742
  });
738
743
  }
@@ -745,6 +750,13 @@ class Tracing {
745
750
  };
746
751
  Tracing._originalXhrOpen.call(this, method, url, async, username, password);
747
752
  };
753
+ Tracing._originalXhr.prototype.setRequestHeader = function (name, value) {
754
+ var _a;
755
+ if (((_a = name === null || name === void 0 ? void 0 : name.toLowerCase) === null || _a === void 0 ? void 0 : _a.call(name)) === headerRequestId.toLowerCase()) {
756
+ this._o11y.requestId = value;
757
+ }
758
+ Tracing._originalXhrSetRequestHeader.call(this, name, value);
759
+ };
748
760
  Tracing._originalXhr.prototype.send = function (...args) {
749
761
  let activity;
750
762
  const xhr = this;
@@ -2519,7 +2531,7 @@ class ConsoleCollector {
2519
2531
  }
2520
2532
  }
2521
2533
 
2522
- const version = '250.2.0';
2534
+ const version = '250.4.0';
2523
2535
 
2524
2536
  const idleDetector = new IdleDetectorImpl({
2525
2537
  logThreshold: 300,