import * as pb from "../proto/orchestrator_service_pb"; import type { Span, Context } from "@opentelemetry/api"; /** * Parses a W3C traceparent string into its components. * * @param traceparent - A W3C traceparent string (e.g., "00-TRACEID-SPANID-FLAGS"). * @returns The parsed components, or undefined if the string is invalid. */ export declare function parseTraceparent(traceparent: string): { traceId: string; spanId: string; traceFlags: number; } | undefined; /** * Creates a W3C traceparent string from its components. * * @param traceId - The 32-character hex trace ID. * @param spanId - The 16-character hex span ID. * @param traceFlags - The trace flags byte (0-255). * @returns The formatted traceparent string. * @throws {Error} If traceId or spanId have invalid format. */ export declare function createTraceparent(traceId: string, spanId: string, traceFlags?: number): string; /** * Generates a random 16-character hex span ID. */ export declare function generateSpanId(): string; /** * Creates a protobuf TraceContext from a traceparent and optional tracestate. * * @param traceparent - The W3C traceparent string. * @param tracestate - The optional W3C tracestate string. * @returns A new protobuf TraceContext. */ export declare function createPbTraceContext(traceparent: string, tracestate?: string): pb.TraceContext; export declare function getOtelApi(): typeof import("@opentelemetry/api") | undefined; /** * Extracts traceparent and tracestate from a span's SpanContext. * Returns undefined if OTEL is not available or span is not valid. */ export declare function extractTraceparentFromSpan(span: Span | undefined | null): { traceparent: string; tracestate?: string; } | undefined; /** * Creates a protobuf TraceContext directly from a Span, avoiding the * format→parse roundtrip of extractTraceparentFromSpan + createPbTraceContext. * Returns undefined if the span context is not valid. */ export declare function createPbTraceContextFromSpan(span: Span | undefined | null): pb.TraceContext | undefined; /** * Creates an OTEL Context with a remote parent span from a protobuf TraceContext. * Returns undefined if OTEL is not available or the pbTraceContext is not provided. * Returns ROOT_CONTEXT if the traceparent is missing or invalid. */ export declare function createParentContextFromPb(pbTraceContext: pb.TraceContext | undefined): Context | undefined;