UNPKG

@tehreet/conduit

Version:

LLM API gateway with intelligent routing, robust process management, and health monitoring

91 lines 2.17 kB
import { EventEmitter } from 'events'; import { UsageData } from '../types'; export interface MetricsConfig { enabled?: boolean; provider?: 'prometheus' | 'statsd' | 'custom'; endpoint?: string; prefix?: string; flushInterval?: number; } export interface MetricData { name: string; value: number; type: 'counter' | 'gauge' | 'histogram'; tags?: Record<string, string>; timestamp: Date; } /** * Metrics collection system for usage tracking */ export declare class MetricsCollector extends EventEmitter { private config; private metrics; private flushInterval; private isInitialized; constructor(config?: MetricsConfig); /** * Initialize metrics collection */ initialize(): Promise<void>; /** * Record usage data as metrics */ record(usage: UsageData): Promise<void>; /** * Increment a counter metric */ incrementCounter(name: string, tags?: Record<string, string>): void; /** * Record a gauge metric */ recordGauge(name: string, value: number, tags?: Record<string, string>): void; /** * Record a histogram metric */ recordHistogram(name: string, value: number, tags?: Record<string, string>): void; /** * Get current metrics */ getMetrics(): MetricData[]; /** * Get metrics summary */ getMetricsSummary(): any; /** * Clear all metrics */ clearMetrics(): void; /** * Flush metrics to configured provider */ flush(): Promise<void>; /** * Update configuration */ updateConfig(config: Partial<MetricsConfig>): Promise<void>; /** * Get collector status */ getStatus(): any; /** * Generate metric key for deduplication */ private getMetricKey; /** * Flush metrics to Prometheus */ private flushToPrometheus; /** * Flush metrics to StatsD */ private flushToStatsd; /** * Flush metrics to custom endpoint */ private flushToCustom; /** * Cleanup resources */ cleanup(): Promise<void>; } //# sourceMappingURL=MetricsCollector.d.ts.map