import type { IMetrics, IBackendMetrics, IProtocolCacheEntry, IProtocolDistribution, IRequestRateMetrics, IThroughputData, IThroughputHistoryPoint } from './models/metrics-types.js'; import type { RustProxyBridge } from './rust-proxy-bridge.js'; /** * Adapts Rust JSON metrics to the IMetrics interface. * * Polls the Rust binary periodically via the bridge and caches the result. * All IMetrics getters read from the cache synchronously. * * Rust Metrics JSON fields (camelCase via serde): * activeConnections, totalConnections, bytesIn, bytesOut, * throughputInBytesPerSec, throughputOutBytesPerSec, * routes: { [routeName]: { activeConnections, totalConnections, bytesIn, bytesOut, ... } } */ export declare class RustMetricsAdapter implements IMetrics { private bridge; private cache; private pollTimer; private pollIntervalMs; constructor(bridge: RustProxyBridge, pollIntervalMs?: number); /** * Poll Rust for metrics once. Can be awaited to ensure cache is fresh. */ poll(): Promise; startPolling(): void; stopPolling(): void; connections: { active: () => number; total: () => number; byRoute: () => Map; byIP: () => Map; topIPs: (limit?: number) => Array<{ ip: string; count: number; }>; domainRequestsByIP: () => Map>; topDomainRequests: (limit?: number) => Array<{ ip: string; domain: string; count: number; }>; frontendProtocols: () => IProtocolDistribution; backendProtocols: () => IProtocolDistribution; }; throughput: { instant: () => IThroughputData; recent: () => IThroughputData; average: () => IThroughputData; custom: (_seconds: number) => IThroughputData; history: (seconds: number) => Array; byRoute: (_windowSeconds?: number) => Map; byIP: (_windowSeconds?: number) => Map; }; requests: { perSecond: () => number; perMinute: () => number; total: () => number; byDomain: () => Map; }; totals: { bytesIn: () => number; bytesOut: () => number; connections: () => number; }; backends: { byBackend: () => Map; protocols: () => Map; topByErrors: (limit?: number) => Array<{ backend: string; errors: number; }>; detectedProtocols: () => IProtocolCacheEntry[]; }; udp: { activeSessions: () => number; totalSessions: () => number; datagramsIn: () => number; datagramsOut: () => number; }; percentiles: { connectionDuration: () => { p50: number; p95: number; p99: number; }; bytesTransferred: () => { in: { p50: number; p95: number; p99: number; }; out: { p50: number; p95: number; p99: number; }; }; }; }