import type * as api from '@opentelemetry/api'; import type { Span, SpanKind, SpanOptions } from '@opentelemetry/api'; /** * Serializes the current trace context into a format that can be passed through queues * @returns A record of strings representing the trace context */ export declare function serializeTraceCarrier(): Promise>; /** * Deserializes trace context and returns a context that can be used to continue the trace * @param traceCarrier The serialized trace context * @returns OpenTelemetry context with the restored trace */ export declare function deserializeTraceCarrier(traceCarrier: Record): Promise; /** * Runs a function within the context of a deserialized trace * @param traceCarrier The serialized trace carrier (optional) * @param fn The function to run within the trace context * @returns The result of the function */ export declare function withTraceContext(traceCarrier: Record | undefined, fn: () => Promise): Promise; export declare function trace(spanName: string, ...args: [fn: (span?: Span) => Promise] | [opts: SpanOptions, fn: (span?: Span) => Promise]): Promise; export declare function getSpanContextForTraceCarrier(carrier: Record): Promise; export declare function getActiveSpan(): Promise; /** * Wraps all methods of an object with tracing spans. * @param prefix - Prefix for span names (e.g., "WORLD.runs") * @param o - Object with methods to instrument * @returns Instrumented object with same interface */ export declare function instrumentObject(prefix: string, o: T): T; export declare function getSpanKind(field: keyof typeof SpanKind): Promise; export declare function withOtel(fn: (otel: typeof api) => T): Promise | undefined>; export declare function linkToCurrentContext(): Promise<[api.Link] | undefined>; /** * Workflow context to propagate via baggage */ export interface WorkflowBaggageContext { workflowRunId: string; workflowName: string; } /** * Sets workflow context as OTEL baggage for automatic propagation. * Baggage is propagated across service boundaries via HTTP headers. * @param context - Workflow context to set as baggage * @returns A function to run within the baggage context */ export declare function withWorkflowBaggage(context: WorkflowBaggageContext, fn: () => Promise): Promise; /** * Retrieves workflow context from OTEL baggage. * @returns Workflow context if present in baggage, undefined otherwise */ export declare function getWorkflowBaggage(): Promise; //# sourceMappingURL=telemetry.d.ts.map