Class TrafficExportQueue
java.lang.Object
ai.attackframework.tools.burp.sinks.TrafficExportQueue
Bounded queue for traffic documents so the HTTP thread can enqueue and return immediately.
A dedicated worker thread drains the queue and pushes via the OpenSearch Bulk API using
chunked request body (NDJSON written incrementally; no full batch list in memory). When full,
the oldest document is dropped (backpressure). Batches are limited by count
(BatchSizeController), payload size (BulkPayloadEstimator, 5 MB cap), and time
(flush after 100 ms). Used only by the traffic export path.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears in-memory and spilled traffic backlog.static intReturns the current number of documents in the traffic export queue.static longReturns current spill queue bytes for StatsPanel observability.static longReturns oldest spill age in milliseconds (0 when no spilled docs).static intReturns current spill queue depth for StatsPanel observability.static longReturns startup-recovered spill document count.static StringReturns spill directory path for diagnostics.static voidOffers a traffic document to the queue.
-
Method Details
-
getCurrentSize
public static int getCurrentSize()Returns the current number of documents in the traffic export queue.- Returns:
- number of documents currently queued (for stats and tool index)
-
getCurrentSpillSize
public static int getCurrentSpillSize()Returns current spill queue depth for StatsPanel observability. -
getCurrentSpillBytes
public static long getCurrentSpillBytes()Returns current spill queue bytes for StatsPanel observability. -
getCurrentSpillOldestAgeMs
public static long getCurrentSpillOldestAgeMs()Returns oldest spill age in milliseconds (0 when no spilled docs). -
getRecoveredSpillCount
public static long getRecoveredSpillCount()Returns startup-recovered spill document count. -
getSpillDirectoryPath
Returns spill directory path for diagnostics. -
offer
Offers a traffic document to the queue. Non-blocking.If the queue is full, the document is first spilled to disk. Only when spill rejects it does this path fall back to drop-oldest behavior and record a drop in
ExportStats. Starts the drain worker on first use. Thread-safe.- Parameters:
document- the document to enqueue;nullis ignored
-
clearPendingWork
public static void clearPendingWork()Clears in-memory and spilled traffic backlog.Used when export is intentionally stopped or a Start attempt fails, so queued traffic does not resume behind a stopped UI.
-