o11y 252.11.0 → 254.3.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.
@@ -459,6 +459,9 @@ class PerformanceObservability {
459
459
  srvReqId: requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.requestId,
460
460
  xhrDelay: requestInfo ? requestInfo.activityDuration - rt.duration : undefined
461
461
  });
462
+ if (payload.responseStatus === undefined) {
463
+ payload.responseStatus = requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.responseStatus;
464
+ }
462
465
  this._logActivity(resource_timing, payload, requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.activityId, requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.errorCount);
463
466
  }
464
467
  }
@@ -517,9 +520,12 @@ class Tracing {
517
520
  return text;
518
521
  }
519
522
  static getHeaders(traceId, spanId, isSampled, options) {
520
- utility.requireArgument(traceId, 'traceId', 'string');
521
523
  utility.requireArgument(spanId, 'spanId', 'string');
522
524
  const useB3Headers = options === null || options === void 0 ? void 0 : options.useB3Headers;
525
+ const headers = {};
526
+ if (traceId === undefined) {
527
+ return headers;
528
+ }
523
529
  traceId = this._conformTextAsId(traceId, (options === null || options === void 0 ? void 0 : options.traceIdEffectiveLength) !== undefined
524
530
  ? options.traceIdEffectiveLength
525
531
  : useB3Headers
@@ -530,7 +536,6 @@ class Tracing {
530
536
  options.parentSpanId !== undefined &&
531
537
  this._conformTextAsId(options.parentSpanId, defaultSpanIdLength)) ||
532
538
  undefined;
533
- const headers = {};
534
539
  if (useB3Headers) {
535
540
  const isCompact = options === null || options === void 0 ? void 0 : options.useCompactHeader;
536
541
  if (isCompact) {
@@ -657,6 +662,7 @@ class Tracing {
657
662
  let method;
658
663
  let fetchTime;
659
664
  let suspendInstrumentation = false;
665
+ let response;
660
666
  try {
661
667
  tasker === null || tasker === void 0 ? void 0 : tasker.add();
662
668
  method = options === null || options === void 0 ? void 0 : options.method;
@@ -702,7 +708,8 @@ class Tracing {
702
708
  }
703
709
  }
704
710
  fetchTime = utility.perfNow();
705
- return await Tracing._originalFetch.call(Tracing._global, resource, options, ...restArgs);
711
+ response = await Tracing._originalFetch.call(Tracing._global, resource, options, ...restArgs);
712
+ return response;
706
713
  }
707
714
  catch (ex) {
708
715
  if (logErrors && !suspendInstrumentation) {
@@ -724,7 +731,8 @@ class Tracing {
724
731
  requestId,
725
732
  activityDuration,
726
733
  activityId: activity === null || activity === void 0 ? void 0 : activity.getId(),
727
- errorCount: activity === null || activity === void 0 ? void 0 : activity.getErrorCount()
734
+ errorCount: activity === null || activity === void 0 ? void 0 : activity.getErrorCount(),
735
+ responseStatus: response === null || response === void 0 ? void 0 : response.status
728
736
  });
729
737
  }
730
738
  }
@@ -766,7 +774,8 @@ class Tracing {
766
774
  requestId: xhr._o11y.requestId,
767
775
  activityDuration,
768
776
  activityId: activity === null || activity === void 0 ? void 0 : activity.getId(),
769
- errorCount: activity === null || activity === void 0 ? void 0 : activity.getErrorCount()
777
+ errorCount: activity === null || activity === void 0 ? void 0 : activity.getErrorCount(),
778
+ responseStatus: xhr.status
770
779
  });
771
780
  }
772
781
  }
@@ -950,6 +959,7 @@ class ActivityImpl {
950
959
  this._onError = _onError;
951
960
  this._isSampled = _isSampled;
952
961
  this._noRerooting = _noRerooting;
962
+ this._isRoot = false;
953
963
  this._errorCount = 0;
954
964
  this._timerOverridden = TimerOverride.none;
955
965
  const { tsNow, perfNow } = utility.time();
@@ -1117,7 +1127,7 @@ class ActivityImpl {
1117
1127
  }
1118
1128
  getTraceHeaders(options) {
1119
1129
  const spanId = this.id;
1120
- const traceId = this._rootId || spanId;
1130
+ const traceId = this._isRoot ? this.id : this._rootId;
1121
1131
  return Tracing.getHeaders(traceId, spanId, this.getIsSampled(), options);
1122
1132
  }
1123
1133
  getStartTimestamp() {
@@ -1855,6 +1865,7 @@ class RootActivityHistoryImpl {
1855
1865
  class RootActivityImpl extends ActivityImpl {
1856
1866
  constructor(name, onStopped, onError, rootId, isSampled, startPerfTime, generatedRootIdLength) {
1857
1867
  super(name, undefined, onStopped, onError, undefined, rootId || utility.generateUniqueId(generatedRootIdLength !== null && generatedRootIdLength !== void 0 ? generatedRootIdLength : 32), isSampled, startPerfTime);
1868
+ this._isRoot = true;
1858
1869
  }
1859
1870
  get preRootId() {
1860
1871
  return this._preRootId;
@@ -2655,7 +2666,7 @@ class ConsoleCollector {
2655
2666
  }
2656
2667
  }
2657
2668
 
2658
- const version = '252.11.0';
2669
+ const version = '254.3.0';
2659
2670
 
2660
2671
  const idleDetector = new IdleDetectorImpl({
2661
2672
  logThreshold: 300,