This commit is contained in:
@@ -38,7 +38,7 @@ class PacketTracker:
|
||||
self._entries: Dict[str, Dict[str, Any]] = {}
|
||||
self._stats: Dict[str, int] = {
|
||||
"persisted_total": 0,
|
||||
"persisted_af_packet_only": 0,
|
||||
"persisted_capture_only": 0,
|
||||
"persisted_telemetry_only": 0,
|
||||
"persisted_merged": 0,
|
||||
"persisted_with_raw": 0,
|
||||
@@ -60,7 +60,7 @@ class PacketTracker:
|
||||
now_ts = time.time()
|
||||
correlation_key = self._ensure_correlation(pkt_info)
|
||||
pkt_info["raw_present"] = pkt_info.get("raw") is not None
|
||||
pkt_info["capture_sources"] = ["af_packet"]
|
||||
pkt_info["capture_sources"] = [pkt_info.get("capture_source") or "af_packet"]
|
||||
|
||||
with self._lock:
|
||||
entry = self._entries.get(correlation_key)
|
||||
@@ -205,9 +205,9 @@ class PacketTracker:
|
||||
def _merge_packet_info(self, entry: Dict[str, Any], pkt_info: Dict[str, Any], now_ts: float) -> None:
|
||||
payload = entry["payload"]
|
||||
changed = False
|
||||
self._add_capture_source(payload, "af_packet")
|
||||
self._add_capture_source(payload, pkt_info.get("capture_source") or "af_packet")
|
||||
for key, value in pkt_info.items():
|
||||
if key == "iface":
|
||||
if key in {"iface", "capture_source"}:
|
||||
continue
|
||||
if value is None:
|
||||
continue
|
||||
@@ -382,8 +382,8 @@ class PacketTracker:
|
||||
else:
|
||||
self._stats["persisted_legacy_hash"] = self._stats.get("persisted_legacy_hash", 0) + 1
|
||||
|
||||
if capture_sources == {"af_packet"}:
|
||||
self._stats["persisted_af_packet_only"] += 1
|
||||
if capture_sources and capture_sources != {"telemetry"} and "telemetry" not in capture_sources:
|
||||
self._stats["persisted_capture_only"] += 1
|
||||
elif capture_sources == {"telemetry"}:
|
||||
self._stats["persisted_telemetry_only"] += 1
|
||||
else:
|
||||
@@ -397,15 +397,15 @@ class PacketTracker:
|
||||
active_total = len(active_entries)
|
||||
active_with_raw = sum(1 for entry in active_entries if entry["payload"].get("raw_present"))
|
||||
active_without_raw = active_total - active_with_raw
|
||||
active_af_packet_only = 0
|
||||
active_capture_only = 0
|
||||
active_telemetry_only = 0
|
||||
active_merged = 0
|
||||
active_kernel_mark = 0
|
||||
active_legacy_hash = 0
|
||||
for entry in active_entries:
|
||||
capture_sources = set(entry["payload"].get("capture_sources") or [])
|
||||
if capture_sources == {"af_packet"}:
|
||||
active_af_packet_only += 1
|
||||
if capture_sources and capture_sources != {"telemetry"} and "telemetry" not in capture_sources:
|
||||
active_capture_only += 1
|
||||
elif capture_sources == {"telemetry"}:
|
||||
active_telemetry_only += 1
|
||||
else:
|
||||
@@ -419,7 +419,7 @@ class PacketTracker:
|
||||
"active_total": active_total,
|
||||
"active_with_raw": active_with_raw,
|
||||
"active_without_raw": active_without_raw,
|
||||
"active_af_packet_only": active_af_packet_only,
|
||||
"active_capture_only": active_capture_only,
|
||||
"active_telemetry_only": active_telemetry_only,
|
||||
"active_merged": active_merged,
|
||||
"active_kernel_mark": active_kernel_mark,
|
||||
|
||||
Reference in New Issue
Block a user