UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

19 lines (18 loc) • 681 B
import { trace, context } from "@opentelemetry/api"; /** * Extract the current OTel trace context for use by Pipeline B spans. * Returns undefined values when no OTel context is active, allowing * Pipeline B spans to share the same trace as Pipeline A spans. */ export function getActiveTraceContext() { const activeSpan = trace.getSpan(context.active()); if (!activeSpan) { return {}; } const ctx = activeSpan.spanContext(); // Invalid trace IDs are all zeros — don't use those if (!ctx.traceId || ctx.traceId === "00000000000000000000000000000000") { return {}; } return { traceId: ctx.traceId, parentSpanId: ctx.spanId }; }