@tigorhutasuhut/telemetry-js - v0.7.3
    Preparing search index...

    Function extractContext

    • Extract an OpenTelemetry Context from workflow params using the globally registered textmap propagator (W3C TraceContext + Baggage by default).

      Unlike extractTraceparent, which only pulls out raw strings, this function returns a fully hydrated Context that can be passed as a parent to tracer.startActiveSpan() or withTrace().

      The returned params are cleaned of all propagation keys (traceparent, tracestate, baggage, …).

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      • params: T

        The params object containing propagation headers.

      Returns { context: Context; params: Omit<T, "traceparent" | "tracestate" | "baggage"> }

      An object with the extracted context and cleaned params.

      const { params: clean, context: parentCtx } = extractContext(event.payload);
      tracer.startActiveSpan("my-span", {}, parentCtx, (span) => { ... });