/**
 * Interface for cache metrics
 */
export interface ICacheMetrics {
    hits: number;
    misses: number;
    errors: number;
    bytesServedFromCache: number;
    bytesFetched: number;
    averageResponseTime: number;
}
/**
 * Interface for per-resource tracking
 */
export interface ICachedResource {
    url: string;
    domain: string;
    contentType: string;
    size: number;
    hitCount: number;
    missCount: number;
    lastAccessed: number;
    cachedAt: number;
}
/**
 * Interface for domain statistics
 */
export interface IDomainStats {
    domain: string;
    totalResources: number;
    totalSize: number;
    totalHits: number;
    totalMisses: number;
    hitRate: number;
}
/**
 * Interface for content-type statistics
 */
export interface IContentTypeStats {
    contentType: string;
    totalResources: number;
    totalSize: number;
    totalHits: number;
    totalMisses: number;
    hitRate: number;
}
/**
 * Interface for network metrics
 */
export interface INetworkMetrics {
    totalRequests: number;
    successfulRequests: number;
    failedRequests: number;
    timeouts: number;
    averageLatency: number;
    totalBytesTransferred: number;
}
/**
 * Interface for update metrics
 */
export interface IUpdateMetrics {
    totalChecks: number;
    successfulChecks: number;
    failedChecks: number;
    updatesFound: number;
    updatesApplied: number;
    lastCheckTimestamp: number;
    lastUpdateTimestamp: number;
}
/**
 * Interface for connection metrics
 */
export interface IConnectionMetrics {
    connectedClients: number;
    totalConnectionAttempts: number;
    successfulConnections: number;
    failedConnections: number;
}
/**
 * Interface for speedtest metrics
 */
export interface ISpeedtestMetrics {
    lastDownloadSpeedMbps: number;
    lastUploadSpeedMbps: number;
    lastLatencyMs: number;
    lastTestTimestamp: number;
    testCount: number;
    isOnline: boolean;
}
/**
 * Combined metrics interface
 */
export interface IServiceWorkerMetrics {
    cache: ICacheMetrics;
    network: INetworkMetrics;
    update: IUpdateMetrics;
    connection: IConnectionMetrics;
    speedtest: ISpeedtestMetrics;
    startTime: number;
    uptime: number;
}
/**
 * Metrics collector for service worker observability
 */
export declare class MetricsCollector {
    private static instance;
    private cacheHits;
    private cacheMisses;
    private cacheErrors;
    private bytesServedFromCache;
    private bytesFetched;
    private totalRequests;
    private successfulRequests;
    private failedRequests;
    private timeouts;
    private totalBytesTransferred;
    private totalUpdateChecks;
    private successfulUpdateChecks;
    private failedUpdateChecks;
    private updatesFound;
    private updatesApplied;
    private lastCheckTimestamp;
    private lastUpdateTimestamp;
    private connectedClients;
    private totalConnectionAttempts;
    private successfulConnections;
    private failedConnections;
    private lastDownloadSpeedMbps;
    private lastUploadSpeedMbps;
    private lastLatencyMs;
    private lastSpeedtestTimestamp;
    private speedtestCount;
    private isOnline;
    private responseTimes;
    private readonly maxResponseTimeEntries;
    private readonly responseTimeWindow;
    private resourceStats;
    private readonly maxResourceEntries;
    private readonly startTime;
    private constructor();
    /**
     * Triggers a push metrics update to all connected clients (throttled in backend)
     */
    private triggerPushUpdate;
    /**
     * Gets the singleton instance
     */
    static getInstance(): MetricsCollector;
    recordCacheHit(url: string, bytes?: number): void;
    recordCacheMiss(url: string): void;
    recordCacheError(url: string, error?: string): void;
    recordBytesFetched(bytes: number): void;
    recordRequest(_url: string): void;
    recordRequestSuccess(url: string, duration: number, bytes?: number): void;
    recordRequestFailure(url: string, error?: string): void;
    recordTimeout(url: string, duration: number): void;
    recordUpdateCheck(success: boolean): void;
    recordUpdateFound(): void;
    recordUpdateApplied(): void;
    recordConnectionAttempt(): void;
    recordConnectionSuccess(): void;
    recordConnectionFailure(): void;
    recordClientDisconnect(): void;
    setConnectedClients(count: number): void;
    recordSpeedtest(type: 'download' | 'upload' | 'latency', value: number): void;
    setOnlineStatus(online: boolean): void;
    getSpeedtestMetrics(): ISpeedtestMetrics;
    private recordResponseTime;
    private cleanupResponseTimes;
    private calculateAverageResponseTime;
    private calculateAverageLatency;
    /**
     * Gets all metrics
     */
    getMetrics(): IServiceWorkerMetrics;
    /**
     * Gets cache hit rate as a percentage
     */
    getCacheHitRate(): number;
    /**
     * Gets network success rate as a percentage
     */
    getNetworkSuccessRate(): number;
    /**
     * Resets all metrics
     */
    reset(): void;
    /**
     * Gets a summary string for logging
     */
    getSummary(): string;
    /**
     * Extracts domain from URL
     */
    private extractDomain;
    /**
     * Records a resource access (cache hit or miss) with details
     */
    recordResourceAccess(url: string, isHit: boolean, contentType?: string, size?: number): void;
    /**
     * Cleans up old resource entries to prevent memory bloat
     */
    private cleanupResourceStats;
    /**
     * Gets all cached resources
     */
    getCachedResources(): ICachedResource[];
    /**
     * Gets domain statistics
     */
    getDomainStats(): IDomainStats[];
    /**
     * Gets content-type statistics
     */
    getContentTypeStats(): IContentTypeStats[];
    /**
     * Gets resource count
     */
    getResourceCount(): number;
}
export declare const getMetricsCollector: () => MetricsCollector;
