@atrim/instrument-node 0.7.1-dev.14fdea7.20260108232056 → 0.7.1-dev.14fdea7.20260108232436

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.
@@ -785,11 +785,21 @@ var AutoTracingSupervisor = class extends Supervisor.AbstractSupervisor {
785
785
  const parentSpan = this.fiberSpans.get(parent.value);
786
786
  if (parentSpan) {
787
787
  parentContext = OtelApi.trace.setSpan(OtelApi.ROOT_CONTEXT, parentSpan);
788
+ } else {
789
+ const activeSpan = OtelApi.trace.getSpan(OtelApi.context.active());
790
+ if (activeSpan) {
791
+ parentContext = OtelApi.context.active();
792
+ } else if (this._rootSpan) {
793
+ parentContext = OtelApi.trace.setSpan(OtelApi.ROOT_CONTEXT, this._rootSpan);
794
+ }
795
+ }
796
+ } else {
797
+ const activeSpan = OtelApi.trace.getSpan(OtelApi.context.active());
798
+ if (activeSpan) {
799
+ parentContext = OtelApi.context.active();
788
800
  } else if (this._rootSpan) {
789
801
  parentContext = OtelApi.trace.setSpan(OtelApi.ROOT_CONTEXT, this._rootSpan);
790
802
  }
791
- } else if (this._rootSpan) {
792
- parentContext = OtelApi.trace.setSpan(OtelApi.ROOT_CONTEXT, this._rootSpan);
793
803
  }
794
804
  const span = this.tracer.startSpan(
795
805
  spanName,
@@ -1200,7 +1210,7 @@ var createCombinedTracingLayer = () => {
1200
1210
  logger.log("@atrim/auto-trace: Combined layer created");
1201
1211
  logger.log(" - HTTP requests: auto-traced via Effect platform");
1202
1212
  logger.log(" - Forked fibers: auto-traced via Supervisor");
1203
- return Layer.mergeAll(Layer.discard(sdkLayer), supervisorLayer);
1213
+ return supervisorLayer.pipe(Layer.provideMerge(Layer.discard(sdkLayer)));
1204
1214
  })
1205
1215
  );
1206
1216
  };