o11y 254.2.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.
@@ -520,9 +520,12 @@ class Tracing {
520
520
  return text;
521
521
  }
522
522
  static getHeaders(traceId, spanId, isSampled, options) {
523
- utility.requireArgument(traceId, 'traceId', 'string');
524
523
  utility.requireArgument(spanId, 'spanId', 'string');
525
524
  const useB3Headers = options === null || options === void 0 ? void 0 : options.useB3Headers;
525
+ const headers = {};
526
+ if (traceId === undefined) {
527
+ return headers;
528
+ }
526
529
  traceId = this._conformTextAsId(traceId, (options === null || options === void 0 ? void 0 : options.traceIdEffectiveLength) !== undefined
527
530
  ? options.traceIdEffectiveLength
528
531
  : useB3Headers
@@ -533,7 +536,6 @@ class Tracing {
533
536
  options.parentSpanId !== undefined &&
534
537
  this._conformTextAsId(options.parentSpanId, defaultSpanIdLength)) ||
535
538
  undefined;
536
- const headers = {};
537
539
  if (useB3Headers) {
538
540
  const isCompact = options === null || options === void 0 ? void 0 : options.useCompactHeader;
539
541
  if (isCompact) {
@@ -957,6 +959,7 @@ class ActivityImpl {
957
959
  this._onError = _onError;
958
960
  this._isSampled = _isSampled;
959
961
  this._noRerooting = _noRerooting;
962
+ this._isRoot = false;
960
963
  this._errorCount = 0;
961
964
  this._timerOverridden = TimerOverride.none;
962
965
  const { tsNow, perfNow } = utility.time();
@@ -1124,7 +1127,7 @@ class ActivityImpl {
1124
1127
  }
1125
1128
  getTraceHeaders(options) {
1126
1129
  const spanId = this.id;
1127
- const traceId = this._rootId || spanId;
1130
+ const traceId = this._isRoot ? this.id : this._rootId;
1128
1131
  return Tracing.getHeaders(traceId, spanId, this.getIsSampled(), options);
1129
1132
  }
1130
1133
  getStartTimestamp() {
@@ -1862,6 +1865,7 @@ class RootActivityHistoryImpl {
1862
1865
  class RootActivityImpl extends ActivityImpl {
1863
1866
  constructor(name, onStopped, onError, rootId, isSampled, startPerfTime, generatedRootIdLength) {
1864
1867
  super(name, undefined, onStopped, onError, undefined, rootId || utility.generateUniqueId(generatedRootIdLength !== null && generatedRootIdLength !== void 0 ? generatedRootIdLength : 32), isSampled, startPerfTime);
1868
+ this._isRoot = true;
1865
1869
  }
1866
1870
  get preRootId() {
1867
1871
  return this._preRootId;
@@ -2662,7 +2666,7 @@ class ConsoleCollector {
2662
2666
  }
2663
2667
  }
2664
2668
 
2665
- const version = '254.2.0';
2669
+ const version = '254.3.0';
2666
2670
 
2667
2671
  const idleDetector = new IdleDetectorImpl({
2668
2672
  logThreshold: 300,