/** * Tier 1 LLMObs Exporter * * Stores full-fidelity LLMObs spans locally for debugging. * These spans contain prompts, code, tool IO - NEVER exported for cloud-prem. * * For cloud deployments, Tier 1 data can be exported (same trust boundary). * For cloud-prem deployments, Tier 1 data stays local only. */ import type { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base'; import type { ExportResult } from '@opentelemetry/core'; /** * Storage interface for Tier 1 LLMObs spans. * * Provides queryable access for local debugging. * Implementation can be in-memory, filesystem, or local database. */ export interface LLMObsLocalStore { /** * Store a span for later retrieval. * * @param span - The span to store */ store(span: ReadableSpan): void; /** * Query spans by session ID. * * @param sessionId - Session ID to query * @returns Matching spans */ query(sessionId: string): ReadableSpan[]; /** * Clear all stored spans. */ clear(): void; /** * Get the count of stored spans. */ size(): number; } /** * In-memory implementation of LLMObsLocalStore. * * Suitable for development and short-lived processes. * Spans are automatically evicted when limits are reached. */ export declare class InMemoryLLMObsStore implements LLMObsLocalStore { private readonly spans; private readonly maxSpansPerSession; private readonly maxSessions; private totalSpanCount; /** * Create an in-memory LLMObs store. * * @param options - Configuration options * @param options.maxSpansPerSession - Maximum spans to retain per session (default: 1000) * @param options.maxSessions - Maximum sessions to retain (default: 100) */ constructor(options?: { maxSpansPerSession?: number; maxSessions?: number; }); store(span: ReadableSpan): void; query(sessionId: string): ReadableSpan[]; clear(): void; size(): number; /** * Get all session IDs. * * @returns Array of session IDs */ getSessions(): string[]; /** * Extract session ID from span attributes. */ private getSessionId; } /** * Tier 1 LLMObs Exporter. * * Exports LLMObs spans to local storage only. * These spans contain full fidelity debugging data (prompts, code, tool IO). * NEVER exported to external backends in cloud-prem deployments. * * @example * ```typescript * const store = new InMemoryLLMObsStore(); * const exporter = new Tier1LLMObsExporter(store); * * // Later, query for debugging * const spans = store.query(sessionId); * ``` */ export declare class Tier1LLMObsExporter implements SpanExporter { private readonly localStore; private readonly debugLogging; private isShutdown; /** * Create a Tier 1 LLMObs exporter. * * @param localStore - Storage for local spans * @param options - Configuration options * @param options.debugLogging - Enable debug logging (default: false) */ constructor(localStore: LLMObsLocalStore, options?: { debugLogging?: boolean; }); /** * Export spans to local storage. * * @param spans - Spans to export * @param resultCallback - Callback with export result */ export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void; /** * Shutdown the exporter. */ shutdown(): Promise; /** * Force flush (no-op for local storage). */ forceFlush(): Promise; /** * Check if a span is an LLMObs span. */ private isLLMObsSpan; /** * Get span duration in milliseconds. */ private getDurationMs; } /** * Create a Tier 1 LLMObs exporter with in-memory storage. * * @param options - Configuration options * @returns Exporter and store instances */ export declare function createTier1LLMObsExporter(options?: { maxSpansPerSession?: number; maxSessions?: number; debugLogging?: boolean; }): { exporter: Tier1LLMObsExporter; store: InMemoryLLMObsStore; }; //# sourceMappingURL=tier1-exporter.d.ts.map