MCPcopy Create free account
hub / github.com/Effect-TS/effect / xb3

Function xb3

packages/effect/src/unstable/http/HttpTraceContext.ts:112–121  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

110 * @since 4.0.0
111 */
112export const xb3: FromHeaders = (headers) => {
113 if (!(headers["x-b3-traceid"]) || !(headers["x-b3-spanid"])) {
114 return Option.none()
115 }
116 return Option.some(Tracer.externalSpan({
117 traceId: headers["x-b3-traceid"],
118 spanId: headers["x-b3-spanid"],
119 sampled: headers["x-b3-sampled"] ? headers["x-b3-sampled"] === "1" : true
120 }))
121}
122
123const w3cTraceId = /^[0-9a-f]{32}$/i
124const w3cSpanId = /^[0-9a-f]{16}$/i

Callers 1

fromHeadersFunction · 0.85

Calls 1

someMethod · 0.80

Tested by

no test coverage detected