Class ExportStats
java.lang.Object
ai.attackframework.tools.burp.utils.ExportStats
Thread-safe per-index export stats for OpenSearch pushes.
Session-scoped: counts and last error/duration are not persisted. Used by StatsPanel and by the tool-index stats snapshot. Index keys align with short names: traffic, tool, settings, sitemap, findings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordImmutable proxy-history snapshot performance summary. -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetExportedBytes(String indexKey) Returns estimated successful payload bytes pushed for the given index this session.static longReturns timestamp (epoch ms) for latest export Start request, or-1.static longgetFailureCount(String indexKey) Returns the session total of failed push attempts for the given index.Returns the list of index keys (traffic, tool, settings, sitemap, findings).static StringgetLastError(String indexKey) Returns the last recorded error message for the given index, ornullif none.Returns the latest proxy-history snapshot stats, ornullwhen none recorded.static longgetLastPushDurationMs(String indexKey) Returns last push duration in ms, or -1 if not set.static intgetQueueSize(String indexKey) Returns the number of documents currently queued for retry for the given index (0 when no retry coordinator or queue empty).static longgetRetryQueueDrops(String indexKey) Returns the session total of documents dropped from the retry queue for the given index.static longReturns milliseconds from the latest export Start request to the first successful traffic push, or-1when not available yet.static longgetSuccessCount(String indexKey) Returns the session total of documents successfully pushed for the given index.static doubleReturns documents per second over the last 10 seconds (rolling throughput).static doubleReturns documents per second over the last 60 seconds (rolling throughput).static longSession total: sum of estimated successful payload bytes across all indexes.static longSession total: sum of failures across all indexes.static longReturns the session total of documents dropped from retry queues across all indexes.static longSession total: sum of docs pushed across all indexes.static longgetTrafficDropReasonCount(String reason) Returns the total for one reason-coded traffic drop key (0 when absent).static longReturns the session total of documents dropped from the traffic queue because it was full.static longgetTrafficSourceFailureCount(String sourceKey) Returns failed traffic pushes for a specific traffic source.Returns known traffic source keys used for source-level traffic stats.static longgetTrafficSourceSuccessCount(String sourceKey) Returns successful traffic pushes for a specific traffic source.static longReturns total spilled traffic documents drained back into memory this session.static longReturns total traffic documents dropped due to spill rejection this session.static longReturns total spilled traffic documents persisted this session.static longReturns total spill files pruned by retention this session.static longReturns total spill documents recovered on startup this session.static longReturns total response-path tool-source fallbacks recorded this session.static longgetTrafficToolTypeCapturedCount(String toolTypeKey) Returns captured traffic event count for a specific tool type.Returns known traffic tool type keys shown in Config > Traffic.static voidrecordExportedBytes(String indexKey, long bytes) Records estimated successful payload bytes for the given index.static voidRecords that a new export start was requested.static voidrecordFailure(String indexKey, long count) Records failed document push(es) for the given index.static voidrecordLastError(String indexKey, String message) Records the last error for the given index.static voidrecordLastPush(String indexKey, long durationMs) Records the duration in ms of the last push for the given index.static voidrecordProxyHistorySnapshot(int attempted, int success, long durationMs, int finalChunkTarget) Records summary metrics for the latest proxy-history snapshot push.static voidrecordRetryQueueDrop(String indexKey, long count) Per-index retry queue: count of documents dropped when the retry queue was full.static voidrecordSuccess(String indexKey, long count) Records successful document push(es) for the given index.static voidrecordTrafficDropReason(String reason, long count) Records a reason-coded traffic drop event.static voidrecordTrafficQueueDrop(long count) Records that one or more documents were dropped from the traffic queue (queue full, drop oldest).static voidrecordTrafficSourceFailure(String sourceKey, long count) Records failed traffic pushes for a specific traffic source.static voidrecordTrafficSourceSuccess(String sourceKey, long count) Records successful traffic pushes for a specific traffic source.static voidrecordTrafficSpillDequeued(long count) Records one or more traffic documents drained from spill storage.static voidrecordTrafficSpillDrop(long count) Records one or more traffic documents dropped because spill storage was unavailable/full.static voidrecordTrafficSpillEnqueued(long count) Records one or more traffic documents persisted to spill storage.static voidrecordTrafficSpillExpiredPruned(long count) Records one or more spill files removed by retention cleanup.static voidrecordTrafficSpillRecovered(long count) Records one or more spill documents recovered on startup.static voidRecords a response-path export decision that used request-side tool-type fallback.static voidrecordTrafficToolTypeCaptured(String toolTypeKey, long count) Records captured traffic events for a specific traffic tool type.
-
Method Details
-
getIndexKeys
Returns the list of index keys (traffic, tool, settings, sitemap, findings). -
getTrafficSourceKeys
Returns known traffic source keys used for source-level traffic stats. -
getTrafficToolTypeKeys
Returns known traffic tool type keys shown in Config > Traffic. -
recordSuccess
Records successful document push(es) for the given index.- Parameters:
indexKey- index key (e.g."traffic")count- number of documents; ignored if <= 0
-
recordFailure
Records failed document push(es) for the given index.- Parameters:
indexKey- index key (e.g."traffic")count- number of failures; ignored if <= 0
-
recordTrafficSourceSuccess
Records successful traffic pushes for a specific traffic source.- Parameters:
sourceKey- source key (for example"proxy_live_http")count- number of successful documents; ignored if<= 0
-
recordTrafficSourceFailure
Records failed traffic pushes for a specific traffic source.- Parameters:
sourceKey- source key (for example"proxy_live_http")count- number of failed documents; ignored if<= 0
-
recordLastPush
Records the duration in ms of the last push for the given index.- Parameters:
indexKey- index keydurationMs- duration in milliseconds, or -1 if unknown
-
recordLastError
Records the last error for the given index.- Parameters:
indexKey- index keymessage- error message;nullor empty clears the stored error
-
getSuccessCount
Returns the session total of documents successfully pushed for the given index. -
getFailureCount
Returns the session total of failed push attempts for the given index. -
getExportedBytes
Returns estimated successful payload bytes pushed for the given index this session. -
recordExportedBytes
Records estimated successful payload bytes for the given index.- Parameters:
indexKey- index key (e.g."traffic")bytes- estimated successful payload bytes; ignored if<= 0
-
getTrafficSourceSuccessCount
Returns successful traffic pushes for a specific traffic source. -
getTrafficSourceFailureCount
Returns failed traffic pushes for a specific traffic source. -
recordTrafficToolTypeCaptured
Records captured traffic events for a specific traffic tool type.This tracks accepted events at capture time (before queue drain), useful for visibility into tool-source distribution.
-
getTrafficToolTypeCapturedCount
Returns captured traffic event count for a specific tool type. -
getLastPushDurationMs
Returns last push duration in ms, or -1 if not set. -
getLastError
Returns the last recorded error message for the given index, ornullif none. -
getQueueSize
Returns the number of documents currently queued for retry for the given index (0 when no retry coordinator or queue empty). -
recordTrafficQueueDrop
public static void recordTrafficQueueDrop(long count) Records that one or more documents were dropped from the traffic queue (queue full, drop oldest).- Parameters:
count- number of documents dropped; ignored if <= 0
-
getTrafficQueueDrops
public static long getTrafficQueueDrops()Returns the session total of documents dropped from the traffic queue because it was full.- Returns:
- total drop count (0 or positive)
-
recordTrafficSpillEnqueued
public static void recordTrafficSpillEnqueued(long count) Records one or more traffic documents persisted to spill storage.- Parameters:
count- number of spilled documents; ignored if<= 0
-
getTrafficSpillEnqueued
public static long getTrafficSpillEnqueued()Returns total spilled traffic documents persisted this session. -
recordTrafficSpillDequeued
public static void recordTrafficSpillDequeued(long count) Records one or more traffic documents drained from spill storage.- Parameters:
count- number of drained spilled documents; ignored if<= 0
-
getTrafficSpillDequeued
public static long getTrafficSpillDequeued()Returns total spilled traffic documents drained back into memory this session. -
recordTrafficSpillDrop
public static void recordTrafficSpillDrop(long count) Records one or more traffic documents dropped because spill storage was unavailable/full.- Parameters:
count- number of dropped spill documents; ignored if<= 0
-
getTrafficSpillDrops
public static long getTrafficSpillDrops()Returns total traffic documents dropped due to spill rejection this session. -
recordTrafficSpillRecovered
public static void recordTrafficSpillRecovered(long count) Records one or more spill documents recovered on startup.- Parameters:
count- recovered spill document count; ignored if<= 0
-
getTrafficSpillRecovered
public static long getTrafficSpillRecovered()Returns total spill documents recovered on startup this session. -
recordTrafficSpillExpiredPruned
public static void recordTrafficSpillExpiredPruned(long count) Records one or more spill files removed by retention cleanup.- Parameters:
count- pruned spill file count; ignored if<= 0
-
getTrafficSpillExpiredPruned
public static long getTrafficSpillExpiredPruned()Returns total spill files pruned by retention this session. -
recordTrafficDropReason
Records a reason-coded traffic drop event.- Parameters:
reason- non-blank reason keycount- number of dropped documents for that reason
-
getTrafficDropReasonCount
Returns the total for one reason-coded traffic drop key (0 when absent). -
recordTrafficToolSourceFallback
public static void recordTrafficToolSourceFallback()Records a response-path export decision that used request-side tool-type fallback.This is used for observability when response tool source is absent but request-side correlation by message id still allows correct traffic export gating.
-
getTrafficToolSourceFallbacks
public static long getTrafficToolSourceFallbacks()Returns total response-path tool-source fallbacks recorded this session. -
getTotalSuccessCount
public static long getTotalSuccessCount()Session total: sum of docs pushed across all indexes. -
getTotalFailureCount
public static long getTotalFailureCount()Session total: sum of failures across all indexes. -
getTotalExportedBytes
public static long getTotalExportedBytes()Session total: sum of estimated successful payload bytes across all indexes. -
recordRetryQueueDrop
Per-index retry queue: count of documents dropped when the retry queue was full. -
getRetryQueueDrops
Returns the session total of documents dropped from the retry queue for the given index. -
getTotalRetryQueueDrops
public static long getTotalRetryQueueDrops()Returns the session total of documents dropped from retry queues across all indexes. -
getThroughputDocsPerSecLast60s
public static double getThroughputDocsPerSecLast60s()Returns documents per second over the last 60 seconds (rolling throughput). Prunes entries older than the window. Thread-safe.- Returns:
- docs/sec (0.0 or positive)
-
getThroughputDocsPerSecLast10s
public static double getThroughputDocsPerSecLast10s()Returns documents per second over the last 10 seconds (rolling throughput). Prunes entries older than the window. Thread-safe.- Returns:
- docs/sec (0.0 or positive)
-
recordExportStartRequested
public static void recordExportStartRequested()Records that a new export start was requested.Resets startup latency tracking so the next successful traffic push can produce an updated start-to-first-traffic metric.
-
getStartToFirstTrafficMs
public static long getStartToFirstTrafficMs()Returns milliseconds from the latest export Start request to the first successful traffic push, or-1when not available yet. -
getExportStartRequestedAtMs
public static long getExportStartRequestedAtMs()Returns timestamp (epoch ms) for latest export Start request, or-1. -
recordProxyHistorySnapshot
public static void recordProxyHistorySnapshot(int attempted, int success, long durationMs, int finalChunkTarget) Records summary metrics for the latest proxy-history snapshot push.- Parameters:
attempted- attempted document countsuccess- successful document countdurationMs- wall-clock duration in millisecondsfinalChunkTarget- final chunk target doc count at end of run
-
getLastProxyHistorySnapshot
Returns the latest proxy-history snapshot stats, ornullwhen none recorded.
-