/** * RuntimeTracer, lightweight OTel-compatible span factory. * * Implements span creation, parent/child relationships, attributes, events, * and export without depending on the @opentelemetry/* packages. * * Design principles: * - All public methods are synchronous; export is async fire-and-forget * - End-after-end is a no-op (spans are immutable once ended) * - Export failures are caught and logged; they never block the runtime */ import type { Span, SpanAttributes, TracerConfig } from './types.js'; import { SpanKind } from './types.js'; /** * RuntimeTracer, creates spans and routes completed spans to exporters. * * Usage: * ```ts * const span = tracer.startSpan('turn.lifecycle', { traceId, parentSpanId }); * span.setAttribute('turn.id', turnId); * span.end(); * ``` */ export declare class RuntimeTracer { private readonly config; constructor(config: TracerConfig); /** * Start a new span. * * @param name - Human-readable span name. * @param opts - Optional trace/parent context and kind. */ startSpan(name: string, opts?: { /** Existing trace ID to join. If omitted, a new trace is started. */ traceId?: string | undefined; /** Parent span ID. Makes this span a child of the parent. */ parentSpanId?: string | undefined; /** Span kind (defaults to INTERNAL). */ kind?: SpanKind | undefined; /** Override start time in epoch ms (defaults to Date.now()). */ startTimeMs?: number | undefined; /** Initial attributes. */ attributes?: SpanAttributes | undefined; }): Span; /** * Flush all exporters. Call during graceful shutdown. */ flush(): Promise; /** * Shut down all exporters. */ shutdown(): Promise; /** Fire-and-forget export to all registered exporters. */ private _export; } //# sourceMappingURL=tracer.d.ts.map