o11y 248.53.0 → 248.54.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.
Files changed (31) hide show
  1. package/dist/modules/o11y/client/client.js +26 -10
  2. package/dist/modules/o11y/client/client.js.map +1 -1
  3. package/dist/modules/o11y/client/library/PerformanceObservability.d.ts +1 -1
  4. package/dist/modules/o11y/client/library/Tracing.d.ts +1 -0
  5. package/dist/modules/o11y/client/shared/Utility.d.ts +1 -0
  6. package/dist/modules/o11y/client/version.d.ts +1 -1
  7. package/dist/modules/o11y/collectors/library/PerformanceObservability.d.ts +1 -1
  8. package/dist/modules/o11y/collectors/library/Tracing.d.ts +1 -0
  9. package/dist/modules/o11y/collectors/shared/Utility.d.ts +1 -0
  10. package/dist/modules/o11y/collectors/version.d.ts +1 -1
  11. package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
  12. package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
  13. package/dist/modules/o11y/core_envelope/library/PerformanceObservability.d.ts +1 -1
  14. package/dist/modules/o11y/core_envelope/library/Tracing.d.ts +1 -0
  15. package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +1 -0
  16. package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
  17. package/dist/modules/o11y/shared/library/PerformanceObservability.d.ts +1 -1
  18. package/dist/modules/o11y/shared/library/Tracing.d.ts +1 -0
  19. package/dist/modules/o11y/shared/shared/Utility.d.ts +1 -0
  20. package/dist/modules/o11y/shared/shared.js +6 -0
  21. package/dist/modules/o11y/shared/shared.js.map +1 -1
  22. package/dist/modules/o11y/shared/version.d.ts +1 -1
  23. package/dist/modules/o11y/simple_collector/library/PerformanceObservability.d.ts +1 -1
  24. package/dist/modules/o11y/simple_collector/library/Tracing.d.ts +1 -0
  25. package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +1 -0
  26. package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
  27. package/dist/modules/o11y/web_vitals/library/PerformanceObservability.d.ts +1 -1
  28. package/dist/modules/o11y/web_vitals/library/Tracing.d.ts +1 -0
  29. package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +1 -0
  30. package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
  31. package/package.json +2 -2
@@ -357,8 +357,8 @@ class PerformanceObservability {
357
357
  this._fuzzyMapper.clear();
358
358
  this._isStarted = false;
359
359
  }
360
- addEntry(url, perfTime, data) {
361
- this._fuzzyMapper.add(url, perfTime, data);
360
+ addEntry(absoluteUrl, perfTime, data) {
361
+ this._fuzzyMapper.add(absoluteUrl, perfTime, data);
362
362
  }
363
363
  _resourceEntryToResourceTiming(prt) {
364
364
  var _a, _b;
@@ -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;
@@ -632,6 +637,7 @@ class Tracing {
632
637
  var _a;
633
638
  let activity;
634
639
  let url;
640
+ let absoluteUrl;
635
641
  let method;
636
642
  let fetchTime;
637
643
  try {
@@ -658,14 +664,16 @@ class Tracing {
658
664
  }
659
665
  options === null || options === void 0 ? true : delete options.o11y;
660
666
  url = resource === null || resource === void 0 ? void 0 : resource.toString();
667
+ absoluteUrl = utility.tryGetAbsoluteUrl(url);
661
668
  if (useTracing) {
662
669
  if (resource instanceof Request) {
663
670
  if (!method) {
664
671
  method = resource.method;
665
672
  }
666
673
  url = resource.url;
674
+ absoluteUrl = utility.tryGetAbsoluteUrl(url);
667
675
  }
668
- const traceHeaders = Tracing._getTraceHeaders(activity, tracingHeadersOptions, method, url);
676
+ const traceHeaders = Tracing._getTraceHeaders(activity, tracingHeadersOptions, method, absoluteUrl);
669
677
  if (!this._applyTraceHeaders(resource, options, traceHeaders) &&
670
678
  options === undefined) {
671
679
  options = {
@@ -692,7 +700,7 @@ class Tracing {
692
700
  const activityDuration = Tracing._endActivity(activity, url, method);
693
701
  if ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted) {
694
702
  const requestId = Tracing._extractHeader(headerRequestId, resource, options);
695
- Tracing._performanceObservability.addEntry(url, fetchTime, {
703
+ Tracing._performanceObservability.addEntry(absoluteUrl, fetchTime, {
696
704
  requestId,
697
705
  activityDuration
698
706
  });
@@ -708,7 +716,7 @@ class Tracing {
708
716
  static _endActivity(activity, url, method) {
709
717
  var _a;
710
718
  if (activity) {
711
- if (activity.getErrorCount() == 0 || ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
719
+ if (((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted) && activity.getErrorCount() == 0) {
712
720
  activity.discard();
713
721
  }
714
722
  else {
@@ -724,15 +732,15 @@ class Tracing {
724
732
  _overrideXhr(instr, logErrors, activityName, useTracing, options, tasker) {
725
733
  Tracing._originalXhr = Tracing._global.XMLHttpRequest;
726
734
  Tracing._originalXhrOpen = Tracing._originalXhr.prototype.open;
735
+ Tracing._originalXhrSetRequestHeader = Tracing._originalXhr.prototype.setRequestHeader;
727
736
  Tracing._originalXhrSend = Tracing._originalXhr.prototype.send;
728
737
  function postProcess(xhr, failedAtInit) {
729
738
  var _a;
730
739
  if (xhr._o11y) {
731
740
  const activityDuration = Tracing._endActivity(xhr._o11y.activity, xhr._o11y.url, xhr._o11y.method);
732
741
  if (!failedAtInit && ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
733
- const requestId = xhr.getResponseHeader(headerRequestId);
734
- Tracing._performanceObservability.addEntry(xhr._o11y.url, xhr._o11y.sendTime, {
735
- requestId,
742
+ Tracing._performanceObservability.addEntry(xhr._o11y.absoluteUrl, xhr._o11y.sendTime, {
743
+ requestId: xhr._o11y.requestId,
736
744
  activityDuration
737
745
  });
738
746
  }
@@ -743,8 +751,16 @@ class Tracing {
743
751
  method,
744
752
  url: url === null || url === void 0 ? void 0 : url.toString()
745
753
  };
754
+ this._o11y.absoluteUrl = utility.tryGetAbsoluteUrl(this._o11y.url);
746
755
  Tracing._originalXhrOpen.call(this, method, url, async, username, password);
747
756
  };
757
+ Tracing._originalXhr.prototype.setRequestHeader = function (name, value) {
758
+ var _a;
759
+ if (((_a = name === null || name === void 0 ? void 0 : name.toLowerCase) === null || _a === void 0 ? void 0 : _a.call(name)) === headerRequestId.toLowerCase()) {
760
+ this._o11y.requestId = value;
761
+ }
762
+ Tracing._originalXhrSetRequestHeader.call(this, name, value);
763
+ };
748
764
  Tracing._originalXhr.prototype.send = function (...args) {
749
765
  let activity;
750
766
  const xhr = this;
@@ -753,7 +769,7 @@ class Tracing {
753
769
  xhr._o11y = xhr._o11y || {};
754
770
  xhr._o11y.activity = activity = instr.startActivity(activityName || defaultActivityNameForXhrSend);
755
771
  if (useTracing) {
756
- const traceHeaders = Tracing._getTraceHeaders(activity, options, xhr._o11y.method, xhr._o11y.url);
772
+ const traceHeaders = Tracing._getTraceHeaders(activity, options, xhr._o11y.method, xhr._o11y.absoluteUrl);
757
773
  Object.entries(traceHeaders).forEach((entry) => {
758
774
  xhr.setRequestHeader(entry[0], entry[1]);
759
775
  });
@@ -2519,7 +2535,7 @@ class ConsoleCollector {
2519
2535
  }
2520
2536
  }
2521
2537
 
2522
- const version = '248.53.0';
2538
+ const version = '248.54.0';
2523
2539
 
2524
2540
  const idleDetector = new IdleDetectorImpl({
2525
2541
  logThreshold: 300,