( traceparent: string | null | undefined, tracestate: string | null | undefined, )
| 17 | }; |
| 18 | |
| 19 | export 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 | }; |
no test coverage detected