type TraceVersion = "00"; type TraceFlag = "00" | "01"; type TraceIDStr = Lowercase<`${string & { length: 32; }}`>; type SpanIDStr = Lowercase<`${string & { length: 16; }}`>; /** * Traceparent is the header used to propagate trace context between services. It is formatted as follows: * * --- * * So for example: * 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01 */ export type TraceParent = `${TraceVersion}-${TraceIDStr}-${SpanIDStr}-${TraceFlag}`; /** * Fixed 16-byte array for the 128-bit trace ID. */ export type TraceID = Uint8Array; /** * Fixed 8-byte array for the 64-bit span ID. */ export type SpanID = Uint8Array; /** * The HTTP Header used to propagate trace context between services. */ export declare const TraceParentHeader = "traceparent"; /** * The HTTP Header used to propagate trace state between services. */ export declare const TraceStateHeader = "tracestate"; /** * Generate a new trace ID. */ export declare function newTraceID(): TraceID; /** * Generate a new span ID. */ export declare function newSpanID(): SpanID; /** * Parses the traceparent header, returning the trace context if the header is valid, or undefined if the header is * invalid. */ export declare function parseTraceParent(traceParent: string): [TraceID | undefined, SpanID | undefined]; /** * Generates a traceparent header from the given trace ID and span ID. */ export declare function traceParent(traceID: TraceID, spanID: SpanID): TraceParent; export {};