import type { PropagationContext } from './types.js'; /** W3C 传播头(OpenTelemetry 标准),用于与 Jaeger/Tempo/现有 OTel 链路互操作 */ export declare const W3C_TRACEPARENT_HEADER = "traceparent"; export declare const W3C_TRACESTATE_HEADER = "tracestate"; /** 将传播上下文编码为可传输字符串(base64 JSON) */ export declare function serializePropagationContext(ctx: PropagationContext): string; /** 从传输字符串解码传播上下文(容错:非法返回 undefined) */ export declare function parsePropagationContext(encoded: string | undefined | null): PropagationContext | undefined; /** HTTP 头名(用于服务间调用透传) */ export declare const OBSERVABILITY_TRACE_HEADER = "x-observability-trace"; /** * 将传播上下文注入到调用参数对象中(用于 delegate_task / a2a 等工具参数)。 * 返回新的参数对象,不修改原对象。 */ export declare function injectIntoParams(params: Record, ctx: PropagationContext): Record; /** 从调用参数对象中提取传播上下文 */ export declare function extractFromParams(params: Record | undefined): PropagationContext | undefined; /** 从 HTTP headers 中提取传播上下文(优先 W3C,回退自定义头) */ export declare function extractFromHeaders(headers: Record | undefined): PropagationContext | undefined; /** * 将传播上下文编码为 W3C traceparent + tracestate。 * - traceparent:由真实 ID 派生的 32/16 位十六进制,供外部 OTel 工具(Jaeger/Tempo)展示链路; * - tracestate:以 obs= 形式保存真实上下文(traceId/parentObservationId 等), * 保证跨进程能无损还原我们自己的观测上下文(W3C 标准推荐的 vendor data 用法)。 */ export declare function serializeToW3C(ctx: PropagationContext): { traceparent: string; tracestate: string; }; /** 从 W3C traceparent/tracestate 解码传播上下文(优先取 tracestate 中的真实上下文) */ export declare function parseFromW3C(traceparent: string | undefined, tracestate: string | undefined): PropagationContext | undefined; /** * 将传播上下文注入 HTTP headers(同时携带自定义头与 W3C 头,最大化互操作性)。 * 返回新 headers 对象,不修改原对象。 */ export declare function injectIntoHeaders(ctx: PropagationContext): Record; //# sourceMappingURL=propagation.d.ts.map