Class TrafficRouteBucket
Traffic exports can be attributed to either:
- a
TrafficRouteBucket.Kind.TOOL_TYPEbucket (for exampleREPEATER_TABS,PROXY), which aligns with the livetool_typefield Burp assigns to HTTP exchanges; or - a
TrafficRouteBucket.Kind.SOURCEbucket (for exampleproxy_history_snapshot,proxy_websocket), which aligns with the reporter or source that produced the document rather than the requesting Burp tool.
Keeping the decision in one place ensures OpenSearch bulk accounting, file-sink accounting,
and StatsPanel display all agree about which bucket a given document belongs to.
Sinks should build a TrafficRouteBucket.Route once and use the record/resolve helpers here instead of
re-implementing the tool_type -> bucket mapping locally.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumBucket kind used to group traffic counters in stats.static final recordRoute record carrying the resolved bucket kind and key. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringLogical index key used by the traffic sink inExportStatsandFileExportStats.static final StringSource key for snapshot-pushed Proxy History items.static final StringSource key for Proxy WebSocket items.static final StringFallback tool-type key when a document does not declare a tool. -
Method Summary
Modifier and TypeMethodDescriptionstatic longReturns the current failed file write count forroute.static longReturns the current successful file write count forroute.static TrafficRouteBucket.RoutefromDocument(Map<String, Object> document) Resolves the route for a traffic document by inspecting itstool_typefield.static TrafficRouteBucket.RoutefromToolType(String toolType) Resolves the route for a tool-type string (for example the name of aToolTypeconstant or a reporter-assigned value).static longReturns the current failed OpenSearch push count forroute.static longReturns the current successful OpenSearch push count forroute.static TrafficRouteBucket.RouteConvenience route for Proxy History snapshot pushes.static TrafficRouteBucket.RouteConvenience route for Proxy WebSocket messages.static voidrecordBulkOutcome(TrafficRouteBucket.Route route, int attempted, int sent, boolean openSearchActive, String logLabel) Records a traffic bulk outcome for OpenSearch, consolidating the success/failure bookkeeping used by one-shot snapshot reporters (Proxy History, Proxy WebSocket).static voidrecordFileFailure(TrafficRouteBucket.Route route, long count) Recordscountfailed file writes forroute.static voidrecordFileSuccess(TrafficRouteBucket.Route route, long count) Recordscountsuccessful file writes forroute.static voidrecordOpenSearchFailure(TrafficRouteBucket.Route route, long count) Recordscountfailed OpenSearch pushes forroute.static voidrecordOpenSearchSuccess(TrafficRouteBucket.Route route, long count) Recordscountsuccessful OpenSearch pushes forroute.static longresolveFileSourceFailure(String sourceKey) Resolves the displayed failure count for a "Traffic by source" row in file stats.static longresolveFileSourceSuccess(String sourceKey) Resolves the displayed success count for a "Traffic by source" row in file stats.static longresolveOpenSearchSourceFailure(String sourceKey) Resolves the displayed failure count for a "Traffic by source" row in OpenSearch stats.static longresolveOpenSearchSourceSuccess(String sourceKey) Resolves the displayed success count for a "Traffic by source" row in OpenSearch stats.static StringResolves the configured traffic index name.
-
Field Details
-
SOURCE_PROXY_HISTORY_SNAPSHOT
Source key for snapshot-pushed Proxy History items.- See Also:
-
SOURCE_PROXY_WEBSOCKET
Source key for Proxy WebSocket items.- See Also:
-
TOOL_TYPE_UNKNOWN
Fallback tool-type key when a document does not declare a tool.- See Also:
-
INDEX_KEY
Logical index key used by the traffic sink inExportStatsandFileExportStats.- See Also:
-
-
Method Details
-
trafficIndexName
Resolves the configured traffic index name.Shared by all traffic reporters so the index-name lookup lives in one place instead of being re-implemented with private copy-paste helpers.
-
fromDocument
Resolves the route for a traffic document by inspecting itstool_typefield.- Parameters:
document- a prepared traffic document;nullresolves toTOOL_TYPE_UNKNOWN- Returns:
- resolved route; never
null
-
fromToolType
Resolves the route for a tool-type string (for example the name of aToolTypeconstant or a reporter-assigned value).- Parameters:
toolType- tool-type label;nullor blank resolves toTOOL_TYPE_UNKNOWN- Returns:
- resolved route; never
null
-
proxyHistorySnapshot
Convenience route for Proxy History snapshot pushes. -
proxyWebSocket
Convenience route for Proxy WebSocket messages. -
recordOpenSearchSuccess
Recordscountsuccessful OpenSearch pushes forroute. -
recordOpenSearchFailure
Recordscountfailed OpenSearch pushes forroute. -
recordBulkOutcome
public static void recordBulkOutcome(TrafficRouteBucket.Route route, int attempted, int sent, boolean openSearchActive, String logLabel) Records a traffic bulk outcome for OpenSearch, consolidating the success/failure bookkeeping used by one-shot snapshot reporters (Proxy History, Proxy WebSocket).Delegates the index-key totals and panel/error reporting to
BulkOutcomeRecorder.record(String, String, String, int, int, boolean)so traffic and non-traffic reporters share the same log and error shape, then adds the per-route counter updates on top viarecordOpenSearchSuccess(Route, long)/recordOpenSearchFailure(Route, long).Counts are clamped so
sentis bounded to[0, max(0, attempted)]byBulkOutcomeRecorder.record(java.lang.String, java.lang.String, java.lang.String, int, int, boolean); per-route counters derived here inherit that clamping and stay consistent with the index totals when callers mis-report.When
openSearchActiveisfalse, this call is a no-op and no counters are updated (the file sink records its own outcomes separately).- Parameters:
route- route for the bulk;nullresolves to a no-opattempted- number of documents attempted in the bulk; negative values are clamped to 0sent- number of documents acknowledged successful by OpenSearch; clamped to[0, max(0, attempted)]openSearchActive- whether the OpenSearch sink was active for this bulklogLabel- short label for log messages (for example"Proxy history chunk")
-
recordFileSuccess
Recordscountsuccessful file writes forroute. -
recordFileFailure
Recordscountfailed file writes forroute. -
openSearchSuccessCount
Returns the current successful OpenSearch push count forroute. -
openSearchFailureCount
Returns the current failed OpenSearch push count forroute. -
fileSuccessCount
Returns the current successful file write count forroute. -
fileFailureCount
Returns the current failed file write count forroute. -
resolveOpenSearchSourceSuccess
Resolves the displayed success count for a "Traffic by source" row in OpenSearch stats.Most rows report the live captured tool-type count. The
PROXY_HISTORYrow additionally folds inSOURCE_PROXY_HISTORY_SNAPSHOTandSOURCE_PROXY_WEBSOCKETso snapshot pushes and proxy WebSocket exports surface under a single Proxy-family row. -
resolveOpenSearchSourceFailure
Resolves the displayed failure count for a "Traffic by source" row in OpenSearch stats. -
resolveFileSourceSuccess
Resolves the displayed success count for a "Traffic by source" row in file stats. -
resolveFileSourceFailure
Resolves the displayed failure count for a "Traffic by source" row in file stats.
-