UNPKG

lightweight-browser-load-tester

Version:

A lightweight load testing tool using real browsers for streaming applications with DRM support

77 lines (76 loc) 2.3 kB
import { PrometheusConfiguration, BrowserMetrics, DRMMetrics, NetworkMetrics, ErrorLog, TestSummary } from '../types/index'; /** * Exports metrics to Prometheus RemoteWrite endpoint in real-time */ export declare class PrometheusExporter { private config; private metricBuffer; private flushTimer?; private isShuttingDown; constructor(config: PrometheusConfiguration); /** * Export browser metrics to Prometheus */ exportBrowserMetrics(metrics: BrowserMetrics): Promise<void>; /** * Export DRM metrics to Prometheus */ exportDRMMetrics(metrics: DRMMetrics): Promise<void>; /** * Export network metrics to Prometheus */ exportNetworkMetrics(metrics: NetworkMetrics[]): Promise<void>; /** * Export test summary metrics to Prometheus */ exportTestSummary(summary: TestSummary): Promise<void>; /** * Export error metrics to Prometheus */ exportErrorMetrics(errors: ErrorLog[]): Promise<void>; /** * Manually flush all buffered metrics to Prometheus */ flush(): Promise<void>; /** * Shutdown the exporter and flush remaining metrics */ shutdown(): Promise<void>; /** * Add metrics to the buffer and trigger flush if batch size is reached */ private addMetricsToBuffer; /** * Start the periodic flush timer */ private startFlushTimer; /** * Send metrics to Prometheus RemoteWrite endpoint */ private sendMetricsToPrometheus; /** * Convert internal metrics format to Prometheus RemoteWrite format */ private convertToPrometheusFormat; /** * Encode Prometheus payload using Protocol Buffers (simplified JSON for now) * In production, you might want to use actual protobuf encoding for better performance */ private encodePrometheusPayload; /** * Make HTTP request to Prometheus RemoteWrite endpoint */ private makeHttpRequest; /** * Sleep for specified milliseconds */ private sleep; /** * Get current buffer size for monitoring */ getBufferSize(): number; /** * Get configuration for debugging */ getConfig(): Readonly<PrometheusConfiguration>; } //# sourceMappingURL=prometheus-exporter.d.ts.map