Class BulkOutcomeRecorder
java.lang.Object
ai.attackframework.tools.burp.sinks.BulkOutcomeRecorder
Shared bulk-outcome accounting for OpenSearch bulk requests across reporters.
Centralizes the success/failure bookkeeping that one-shot and periodic reporters
(Sitemap, Findings, and — via TrafficRouteBucket.recordBulkOutcome(ai.attackframework.tools.burp.sinks.TrafficRouteBucket.Route, int, int, boolean, java.lang.String) — the traffic
reporters) would otherwise duplicate. Callers invoke this helper once per bulk request.
Side effects when openSearchActive is true:
- Increments
ExportStats.recordSuccess(String, int)by the clamped successful document count; - Increments
ExportStats.recordFailure(String, int)byattempted - sentwhen positive; - On failure, sets
ExportStats.recordLastError(String, String)and emits a panel-only warn line in the format[logPrefix] label completed with N failure(s)..
Counts are clamped so sent is bounded to [0, max(0, attempted)]; this makes
the helper self-defending against caller bugs that report more successes than attempts.
When openSearchActive is false, the helper returns the clamped success count
but updates no counters (file-sink accounting is handled elsewhere).
-
Method Summary
-
Method Details
-
record
public static int record(String indexKey, String logPrefix, String label, int attempted, int sent, boolean openSearchActive) Records the outcome of one bulk request forindexKey.- Parameters:
indexKey- logical index key (for example"traffic","sitemap","findings"); must not benullor blanklogPrefix- short bracket prefix used in panel log lines (for example"Traffic","Sitemap"); falls back to"Export"when blank ornulllabel- human-readable label describing what the bulk represents (for example"Bulk push","Proxy history chunk"); falls back to"Bulk"when blank ornullattempted- number of documents submitted in the bulk; negative values are clamped to 0sent- number of documents acknowledged successful; clamped to[0, max(0, attempted)]openSearchActive- whether the OpenSearch sink was active for this bulk- Returns:
- the clamped success count (useful when callers need to decide whether the batch was fully pushed)
- Throws:
IllegalArgumentException- ifindexKeyisnullor blank
-