Module recorder
http and std only.Expand description
Streaming HAR recorder contracts and the built-in file recorder.
A custom backend implements both Recorder and StreamingRecorder, with a
per-exchange type implementing RecorderSession.
StreamingRecorder::start_http_recording receives the request metadata and a
bounded BodyCaptureStream. The implementation should transfer that stream to
a worker that drains it while the request continues, then return a session that
correlates the request with its eventual response. Likewise,
RecorderSession::record_response transfers response metadata and its live
body stream to the backend. It must return once the backend has accepted the
stream, rather than waiting for the body to finish. This lets a backend stream
captures to a file, remote collector, or other storage without materializing
complete HTTP bodies in memory.
For a WebSocket upgrade, the session can return a WebSocketCapture backed by
a WebSocketCaptureRecorder. HARExportLayer
stores this opaque handle in the successful HTTP handshake metadata. An
explicitly installed Rama WebSocket HAR layer claims it, observes complete
application messages, and releases it when the connection ends or recording
stops. The handshake and WebSocket protocol engine remain independent of HAR
serialization and storage.
A custom WebSocket backend implements WebSocketCaptureRecorder::record as an
asynchronous &self operation. The future provides natural backpressure: it
completes only after the backend has written the message or handed it to bounded
storage. That future can be dropped before completion when its socket task is
cancelled, so implementations must keep cancellation from corrupting their
backend state. The backend decides whether it needs internal synchronization;
the capture contract itself neither requires exclusive mutable access nor
retains an in-memory message history. Returning None from
RecorderSession::web_socket_capture records only the HTTP exchange.
Structs§
- Body
Capture Stream - Bounded stream of body events observed while an HTTP body is forwarded.
- File
Recorder - Recorder that creates one file per recording session.
- File
Recorder Session - HarFile
Path - Path to the HAR file that the
FileRecorderis recording into. - Http
Request Capture - Request metadata and its live body capture stream.
- Http
Response Capture - Response metadata and its live body capture stream.
- LogMeta
Info - This object represents the root of exported data.
- WebSocket
Capture - Opaque WebSocket capture handle propagated through HTTP upgrade extensions.
- WebSocket
Capture Future - One in-flight asynchronous WebSocket capture operation.
- WebSocket
Capture Lease - WebSocket-lifetime view of a
WebSocketCapture.
Traits§
- Recorder
- Recorder
Session - One in-progress HTTP exchange owned by a
Recorder. - Streaming
Recorder - Recorder capable of consuming live HTTP bodies without materializing them.
- WebSocket
Capture Recorder - Asynchronous recorder for complete Chromium-shaped WebSocket messages.