/** * Base Observability - Abstract class for observability integrations * Supports tracing, logging, and metrics */ export interface Span { id: string; traceId: string; parentId?: string; name: string; startTime: number; endTime?: number; status: 'ok' | 'error' | 'unset'; attributes: Record; events: SpanEvent[]; } export interface SpanEvent { name: string; timestamp: number; attributes?: Record; } export interface TraceContext { traceId: string; spanId: string; parentSpanId?: string; } export interface LogEntry { level: 'debug' | 'info' | 'warn' | 'error'; message: string; timestamp: number; traceId?: string; spanId?: string; attributes?: Record; } export interface Metric { name: string; value: number; type: 'counter' | 'gauge' | 'histogram'; timestamp: number; tags?: Record; } /** * Abstract base class for observability providers */ export declare abstract class BaseObservabilityProvider { readonly name: string; constructor(name: string); /** * Start a new span */ abstract startSpan(name: string, attributes?: Record, parentContext?: TraceContext): Span; /** * End a span */ abstract endSpan(span: Span, status?: 'ok' | 'error', error?: Error): void; /** * Add event to span */ abstract addSpanEvent(span: Span, name: string, attributes?: Record): void; /** * Log a message */ abstract log(entry: LogEntry): void; /** * Record a metric */ abstract recordMetric(metric: Metric): void; /** * Flush all pending data */ abstract flush(): Promise; /** * Shutdown the provider */ abstract shutdown(): Promise; /** * Helper to create trace context */ protected createTraceContext(span: Span): TraceContext; /** * Generate unique ID */ protected generateId(): string; } /** * Console-based observability provider for development */ export declare class ConsoleObservabilityProvider extends BaseObservabilityProvider { private spans; private verbose; constructor(config?: { verbose?: boolean; }); startSpan(name: string, attributes?: Record, parentContext?: TraceContext): Span; endSpan(span: Span, status?: 'ok' | 'error', error?: Error): void; addSpanEvent(span: Span, name: string, attributes?: Record): void; log(entry: LogEntry): void; recordMetric(metric: Metric): void; flush(): Promise; shutdown(): Promise; } /** * Memory-based observability provider for testing */ export declare class MemoryObservabilityProvider extends BaseObservabilityProvider { spans: Span[]; logs: LogEntry[]; metrics: Metric[]; constructor(); startSpan(name: string, attributes?: Record, parentContext?: TraceContext): Span; endSpan(span: Span, status?: 'ok' | 'error', error?: Error): void; addSpanEvent(span: Span, name: string, attributes?: Record): void; log(entry: LogEntry): void; recordMetric(metric: Metric): void; flush(): Promise; shutdown(): Promise; getSpansByName(name: string): Span[]; getLogsByLevel(level: LogEntry['level']): LogEntry[]; getMetricsByName(name: string): Metric[]; } export declare function createConsoleObservability(config?: { verbose?: boolean; }): ConsoleObservabilityProvider; export declare function createMemoryObservability(): MemoryObservabilityProvider;