/** * Trace extraction logic for W3C and B3 formats */ import type { UnifiedHttpContext } from '@inh-lib/unified-route'; import type { InternalTraceContext } from '../types/middleware.types'; /** * Extract trace context from HTTP headers supporting W3C and B3 formats */ export declare function extractTraceContextFromRequestHeaders(headers: Record): InternalTraceContext; /** * Extract trace context from Unified HTTP headers supporting W3C and B3 formats */ export declare function extractTraceContextFromHeaders(context: UnifiedHttpContext): InternalTraceContext; /** * Extract W3C trace context from headers */ export declare function extractW3CTraceContext(headers: Record): InternalTraceContext; /** * Extract B3 trace context from headers */ export declare function extractB3TraceContext(headers: Record): InternalTraceContext; /** * Parse W3C traceparent header * Format: 00-{trace-id}-{parent-id}-{trace-flags} */ export declare function parseW3CTraceparent(traceparent: string): { traceId: string; spanId: string; sampled: boolean; } | null; /** * Generate W3C traceparent header */ export declare function generateW3CTraceparent(context: InternalTraceContext): string; /** * Generate B3 headers object */ export declare function generateB3Headers(context: InternalTraceContext): Record; /** * Generate new trace context when no existing context found */ export declare function generateNewTraceContext(): InternalTraceContext; /** * Create empty trace context for error cases */ export declare function createEmptyTraceContext(): InternalTraceContext; /** * Generate random trace ID (32 hex characters) */ export declare function generateTraceId(): string; /** * Generate random span ID (16 hex characters) */ export declare function generateSpanId(): string; /** * Validate trace ID format */ export declare function isValidTraceId(traceId: string): boolean; /** * Validate span ID format */ export declare function isValidSpanId(spanId: string): boolean; /** * Normalize trace ID to lowercase */ export declare function normalizeTraceId(traceId: string): string; /** * Normalize span ID to lowercase */ export declare function normalizeSpanId(spanId: string): string; /** * Parse sampled flag from various formats */ export declare function parseSampledFlag(sampled: string | undefined): boolean;