AccessLogDeferral
Defined in: src/types.ts:280
Deferral point for observability records that cannot be completed at dispatch time.
The on-wire size of a response is not known when a handler finishes: compression runs afterwards, on the way out of the transport. A record emitted at dispatch time could therefore only ever report the uncompressed body, which is the wrong number for anything that costs money. A transport that can measure the final body offers one of these; a hook hands its record over and the transport emits once the bytes exist.
The cost is that a crash between dispatch and response loses that request’s records. The alternative is a permanently wrong number.
Methods
Section titled “Methods”defer()
Section titled “defer()”defer(emit): void;Defined in: src/types.ts:283
Queue emit, to be called with the final on-wire response size once the
body exists — or undefined when the size cannot be known.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
emit |
(responseBytes) => void |
Returns
Section titled “Returns”void
