Skip to main content

parseTraceparent

@forge/monorepo


@forge/monorepo / backend/src / parseTraceparent

Function: parseTraceparent()

parseTraceparent(value): TraceparentParts | null

Defined in: backend/src/telemetry/trace-context.ts:54

Parse a traceparent, or return null.

null rather than a throw, and this is the important decision: a malformed or absent header means start a new trace, never fail the request. Telemetry that can break a run is worse than no telemetry, and this function sits on the hot path of every request and every job.

Strict about what it accepts, though. An all-zero trace id or span id is invalid per the spec, and accepting one produces a trace that silently merges unrelated requests — every caller that failed to propagate lands in the same "trace 000…0", which looks like a working trace and is worse than a missing one.

Parameters

value

string | null | undefined

Returns

TraceparentParts | null