/**
 * Interface for throughput sample data
 */
export interface IThroughputSample {
    timestamp: number;
    bytesIn: number;
    bytesOut: number;
    tags?: {
        route?: string;
        ip?: string;
        [key: string]: string | undefined;
    };
}
/**
 * Interface for throughput data
 */
export interface IThroughputData {
    in: number;
    out: number;
}
/**
 * Interface for time-series throughput data
 */
export interface IThroughputHistoryPoint {
    timestamp: number;
    in: number;
    out: number;
}
/**
 * Main metrics interface with clean, grouped API
 */
/**
 * Protocol distribution for frontend (client→proxy) or backend (proxy→upstream).
 * Tracks active and total counts for h1/h2/h3/ws/other.
 */
export interface IProtocolDistribution {
    h1Active: number;
    h1Total: number;
    h2Active: number;
    h2Total: number;
    h3Active: number;
    h3Total: number;
    wsActive: number;
    wsTotal: number;
    otherActive: number;
    otherTotal: number;
}
export interface IMetrics {
    connections: {
        active(): number;
        total(): number;
        byRoute(): Map<string, number>;
        byIP(): Map<string, number>;
        topIPs(limit?: number): Array<{
            ip: string;
            count: number;
        }>;
        frontendProtocols(): IProtocolDistribution;
        backendProtocols(): IProtocolDistribution;
    };
    throughput: {
        instant(): IThroughputData;
        recent(): IThroughputData;
        average(): IThroughputData;
        custom(seconds: number): IThroughputData;
        history(seconds: number): Array<IThroughputHistoryPoint>;
        byRoute(windowSeconds?: number): Map<string, IThroughputData>;
        byIP(windowSeconds?: number): Map<string, IThroughputData>;
    };
    requests: {
        perSecond(): number;
        perMinute(): number;
        total(): number;
    };
    totals: {
        bytesIn(): number;
        bytesOut(): number;
        connections(): number;
    };
    backends: {
        byBackend(): Map<string, IBackendMetrics>;
        protocols(): Map<string, string>;
        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;
            };
        };
    };
}
/**
 * Configuration for metrics collection
 */
export interface IMetricsConfig {
    enabled: boolean;
    sampleIntervalMs: number;
    retentionSeconds: number;
    enableDetailedTracking: boolean;
    enablePercentiles: boolean;
    cacheResultsMs: number;
    prometheusEnabled: boolean;
    prometheusPath: string;
    prometheusPrefix: string;
}
/**
 * Protocol cache entry from the Rust proxy's auto-detection cache.
 * Shows which protocol (h1/h2/h3) is detected for each backend+domain pair,
 * including failure suppression state with escalating cooldowns.
 */
export interface IProtocolCacheEntry {
    host: string;
    port: number;
    domain: string | null;
    protocol: string;
    h3Port: number | null;
    ageSecs: number;
    lastAccessedSecs: number;
    lastProbedSecs: number;
    h2Suppressed: boolean;
    h3Suppressed: boolean;
    h2CooldownRemainingSecs: number | null;
    h3CooldownRemainingSecs: number | null;
    h2ConsecutiveFailures: number | null;
    h3ConsecutiveFailures: number | null;
}
/**
 * Per-backend metrics
 */
export interface IBackendMetrics {
    protocol: string;
    activeConnections: number;
    totalConnections: number;
    connectErrors: number;
    handshakeErrors: number;
    requestErrors: number;
    avgConnectTimeMs: number;
    poolHitRate: number;
    h2Failures: number;
}
/**
 * Internal interface for connection byte tracking
 */
export interface IByteTracker {
    connectionId: string;
    routeName: string;
    remoteIP: string;
    bytesIn: number;
    bytesOut: number;
    startTime: number;
    lastUpdate: number;
}
