export type SpanStatusCode = 'UNSET' | 'OK' | 'ERROR'; export interface SpanEvent { name: string; time_ns: number; attributes?: Record; } export interface TraceLine { trace_id: string; span_id: string; parent_span_id?: string; name: string; tracer_name: string; start_ns: number; end_ns: number; attributes: Record; events: SpanEvent[]; status: { code: SpanStatusCode; message?: string; }; } export interface SpanOptions { attributes?: Record; parent?: Span; } export declare class Span { readonly traceId: string; readonly spanId: string; readonly parentSpanId?: string; readonly name: string; readonly tracerName: string; readonly startNs: number; private endNs; private ended; private attrs; private events; private status; private tracer; constructor(tracer: Tracer, name: string, opts?: SpanOptions); setAttribute(key: string, value: unknown): this; addEvent(name: string, attributes?: Record): this; recordException(err: unknown): this; setStatus(code: SpanStatusCode, message?: string): this; end(): void; private toLine; } export declare class Tracer { readonly name: string; private sampleRate; private lastRotation; constructor(name: string); startSpan(name: string, opts?: SpanOptions): Span; /** Auto begin/end around an async function. */ withSpan(name: string, fn: (span: Span) => Promise | T, opts?: SpanOptions): Promise; /** Set sample rate 0-1. 1 = emit all spans, 0 = drop all. */ sample(rate: number): void; /** Internal: write a line. Sampling + rotation handled here. */ emitSpan(line: TraceLine): void; private cleanupOldFiles; } export declare function trace(name: string): Tracer; export declare const OtelLite: { trace: typeof trace; /** Read the tail of today's trace file. Returns parsed TraceLines, newest last. */ tail(lines?: number): Promise; /** Path of today's trace file (whether or not it exists yet). */ todayFilePath(): string; /** Manually trigger retention cleanup. */ cleanup(): void; }; //# sourceMappingURL=otel-lite.d.ts.map