/** * Interface for collecting metrics from lumic-utils operations. * Consumers (e.g., engine) can inject a real implementation (Prometheus, etc.) * while the default no-op implementation ensures zero overhead when not needed. */ export interface MetricsCollector { /** * Increment a counter for a given operation. * @param service - The service name (e.g., 'slack', 'llm', 'aws-s3') * @param operation - The operation name (e.g., 'sendMessage', 'createCompletion') * @param labels - Additional labels (e.g., { status: 'success' }) */ incrementCounter(service: string, operation: string, labels?: Record): void; /** * Record a latency measurement for a given operation. * @param service - The service name * @param operation - The operation name * @param durationMs - Duration in milliseconds * @param labels - Additional labels */ recordLatency(service: string, operation: string, durationMs: number, labels?: Record): void; /** * Increment the error counter for a given operation. * @param service - The service name * @param operation - The operation name * @param errorType - The type/code of the error */ incrementError(service: string, operation: string, errorType: string): void; /** * Increment the retry counter for a given operation. * @param service - The service name * @param operation - The operation name */ incrementRetry(service: string, operation: string): void; } /** * Sets the global metrics collector. * Call this during application bootstrap to inject a real collector. * @param collector - The MetricsCollector implementation to use */ export declare function setMetricsCollector(collector: MetricsCollector): void; /** * Returns the current metrics collector. * @returns The active MetricsCollector instance */ export declare function getMetricsCollector(): MetricsCollector; /** * Resets the metrics collector to the default no-op implementation. * Useful for testing. */ export declare function resetMetricsCollector(): void; /** * Wraps an async function with automatic metrics collection. * Records call count, latency, errors, and retries. * * @param service - The service name for metrics labels * @param operation - The operation name for metrics labels * @param fn - The async function to wrap * @returns The result of the wrapped function */ export declare function withMetrics(service: string, operation: string, fn: () => Promise): Promise;