/** * Per-page network sampler. Listens for `response` events and records * a sample per main-document / xhr / fetch response: URL key, status, * latency in ms. Errors (`requestfailed`) are recorded as a sample * with `status: 0`. * * URL keying intentionally strips the query string and pathname digits * so `/api/users/42` and `/api/users/43` aggregate into a single * endpoint row. Without this the EndpointReport explodes for any app * with id-bearing URLs. * * Memory: each sample is small (~40 bytes) and the runner drains the * sampler at iteration end, so steady-state memory is per-iteration * not per-run. */ import type { Page } from "playwright"; export interface NetworkSample { /** URL key (path with numeric segments replaced by `:id`). */ key: string; /** Full URL — kept for debugging, not aggregated. */ url: string; /** HTTP status, or 0 for network failures. */ status: number; /** Wall-clock duration in ms from request fired → response received. */ durationMs: number; /** Sample wall-clock at response receive time. */ timestamp: number; } export declare class NetworkSampler { private samples; private starts; private detach; attach(page: Page): void; /** Return and clear the buffer. */ drain(): NetworkSample[]; /** Stop listening. The page handle MUST still be alive when this runs. */ stop(): void; } /** * Reduce `/api/users/42/orders/abc-123` → `/api/users/:id/orders/:id`. * Strips query / fragment. Lowercases nothing — case is significant * for many APIs. */ export declare function endpointKey(rawUrl: string): string; //# sourceMappingURL=sampler.d.ts.map