MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseTraceparent

Function parseTraceparent

apps/cloud/src/mcp/traceparent.ts:19–32  ·  view source on GitHub ↗
(
  traceparent: string | null | undefined,
  tracestate: string | null | undefined,
)

Source from the content-addressed store, hash-verified

17};
18
19export const parseTraceparent = (
20 traceparent: string | null | undefined,
21 tracestate: string | null | undefined,
22): IncomingSpanContext | null => {
23 if (!traceparent) return null;
24 const match = TRACEPARENT_PATTERN.exec(traceparent);
25 if (!match) return null;
26 return {
27 traceId: match[2]!,
28 spanId: match[3]!,
29 traceFlags: parseInt(match[4]!, 16),
30 ...(tracestate ? { traceState: createTraceState(tracestate) } : {}),
31 };
32};

Callers 3

server.tsFile · 0.90
withTelemetryMethod · 0.90
runTracedFunction · 0.90

Calls 1

execMethod · 0.80

Tested by

no test coverage detected