Circle V2 API Docs
    Preparing search index...

    Function unpackTraceContextAsLink

    • Like unpackTraceContext, but instead of resuming the enqueuer's trace as the active parent, it returns the enqueuer's SpanContext for use as a span LINK and a baggageContext that carries any cross-boundary baggage WITHOUT an active parent span.

      Activating baggageContext and starting the consumer's span as a linked root keeps the worker in its own trace (so a fan-out doesn't collapse into one unbounded trace) while still correlating it back to the enqueuer via the link. Baggage (e.g. patient.id) is preserved because trace.deleteSpan only strips the active span, not baggage.

      Falls back gracefully for legacy/unpacked messages: parentSpanContext is undefined and baggageContext is the active context.

      Parameters

      • message: unknown

      Returns {
          baggageContext: Context;
          params: unknown;
          parentSpanContext: SpanContext | undefined;
      }