NetworkTransactionRecorder

class NetworkTransactionRecorder(factory: NetworkCaptureFactory, store: NetworkTransactionStore, enabled: Boolean = true, idProvider: () -> String = { UUID.randomUUID().toString() }, maxQueueSize: Int = DEFAULT_MAX_QUEUE_SIZE, executor: Executor = DEFAULT_EXECUTOR, maxQueuedBytes: Long = DEFAULT_MAX_QUEUED_BYTES)

Bridges redacted capture to the bounded transaction store without affecting host behavior. When enabled is false, record returns immediately without building a capture or touching store — the disabled build never redacts, serializes, or stores a payload. Processing (URL parsing, redaction, and store persistence) is offloaded asynchronously from caller threads via a bounded queue (drop-oldest strategy on overflow).

Constructors

Link copied to clipboard
constructor(factory: NetworkCaptureFactory, store: NetworkTransactionStore, enabled: Boolean = true, idProvider: () -> String = { UUID.randomUUID().toString() }, maxQueueSize: Int = DEFAULT_MAX_QUEUE_SIZE, executor: Executor = DEFAULT_EXECUTOR, maxQueuedBytes: Long = DEFAULT_MAX_QUEUED_BYTES)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
Link copied to clipboard
fun record(request: NetworkRequestInput, response: NetworkResponseInput?, startedAtEpochMs: Long, completedAtEpochMs: Long?)

fun record(request: NetworkRequestInput, response: NetworkResponseInput?, startedAtEpochMs: Long, completedAtEpochMs: Long?, transactionId: String?)

Same as the four-argument record, but stores the transaction under the caller-supplied transactionId instead of a freshly generated one (null keeps the generated id). Recording the same id again replaces the earlier stored transaction -- the NetworkTransactionStore.record contract -- which is how an adapter first records a provisional metadata-only transaction for a still-streaming response and later upgrades it in place with the captured body, without ever showing two entries for one HTTP call.

Link copied to clipboard

Installs the capture-exclusion gate; without one every enabled recording is captured.

Link copied to clipboard