Insights Sink
class InsightsSink(url: String, token: String, instanceId: String, batchSize: Int = 200, flushIntervalMs: Long = 250, queueCapacity: Int, failureBackoffMs: Long, maxPostAttempts: Int = 3, healthIntervalMs: Long, journalDir: Path? = null, http: OkHttpClient = OkHttpClient
.Builder()
.connectTimeout(5, TimeUnit.SECONDS)
.readTimeout(5, TimeUnit.SECONDS)
.writeTimeout(5, TimeUnit.SECONDS)
.build()) : AutoCloseable
Egress to a qkt-insights collector.
The contract that matters: the publishing (engine) thread never blocks and never touches the network. offer only enqueues onto a bounded queue - O(1), no waits. When the queue is full the oldest envelope is dropped and dropped increments.
Without journalDir the sink is best-effort: failed batches are dropped after maxPostAttempts. With journalDir, the drain thread first spools serialized envelopes to disk and advances the journal cursor only after qkt-insights accepts the batch. Collector downtime therefore causes retry/replay, not batch loss.
Constructors
Link copied to clipboard
constructor(url: String, token: String, instanceId: String, batchSize: Int = 200, flushIntervalMs: Long = 250, queueCapacity: Int, failureBackoffMs: Long, maxPostAttempts: Int = 3, healthIntervalMs: Long, journalDir: Path? = null, http: OkHttpClient = OkHttpClient
.Builder()
.connectTimeout(5, TimeUnit.SECONDS)
.readTimeout(5, TimeUnit.SECONDS)
.writeTimeout(5, TimeUnit.SECONDS)
.build())