/** * Request-level Google Sheets API telemetry aggregator. * * Consumes the provider's redacted `GoogleSheetsApiRequestEvent` stream * (attached as the `onRequest` provider option at bootstrap scope) and emits * two internal log events through the fail-open structured logger: * * - `hikoutei.sheets.request` (DEBUG, component "sheets"): one line per * transport request — operation, duration, operation count, HTTP status. * DEBUG-only so an INFO deployment logs nothing per request. * - `hikoutei.sheets.request_summary` (INFO, component "sheets"): the * accumulated window (requests, rate-limited 429s, other 4xx/5xx, max/avg * duration, write-fill counters, optional per-route adaptive batch limits), * flushed by the effect supervisor at every non-idle pass and cleared * afterwards. * * Purpose (measurement only): the aggregated 429 count answers whether * Google rate limiting ever occurs under real workloads, which decides * whether interval-AIMD is needed or deferred. This module changes NO * pacing, batching, retry, or controller behavior — a logging problem can * never propagate into a request path (fail-open, like the internal log). */ import type { GoogleSheetsApiRequestEvent } from "../../../contracts/sheets/googleSheetsApi.js"; /** One request-telemetry window: sink side plus the summary flush handle. */ export interface RequestTelemetry { /** * Provider `onRequest` sink. FAIL-OPEN: never throws into the request * path, whatever the event shape or the logging sink does. */ readonly sink: (event: GoogleSheetsApiRequestEvent) => void; /** * Emits one INFO summary of the accumulated window and clears it. * An empty window emits nothing (idle passes stay silent). * * When `batchLimits` (a read-only snapshot of the worker's per-route * adaptive batch limits) is supplied, each route's limit is encoded as an * indexed numeric count (`routeLimit_0`, `routeLimit_1`, ...) in * lexicographic route-key order — route keys themselves are not * identifier-safe and `counts` values must stay numeric. */ readonly flushSummary: (batchLimits?: Readonly>) => void; } /** * Creates the bootstrap-scoped request telemetry. * * The aggregator instance is shared by the remote provider (which feeds the * sink) and the effect supervisor (which flushes the window at each * non-idle pass), so the summary covers exactly the requests of one worker * pass window. */ export declare function createRequestTelemetry(): RequestTelemetry; //# sourceMappingURL=requestTelemetry.d.ts.map