Skip to content

Commit 737a8d6

Browse files
committed
Fix: unknown protocol should not throw a KeyError exception (in another place)
1 parent 3781e42 commit 737a8d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

netflowbot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ def get_top_N_protocols_for_entity_interfaces(interval_label, last_used_ts, max_
445445

446446
output_path_interface = NetFlowBot.construct_output_path_prefix(interval_label, direction, entity_id, interface=interface_index)
447447
for protocol, traffic_bytes in c2.fetchall():
448-
output_path = f"{output_path_interface}.topprotocol.{path_part_encode(PROTOCOLS[protocol])}"
448+
protocol_label = PROTOCOLS[protocol] if protocol in PROTOCOLS else f"proto{protocol}"
449+
output_path = f"{output_path_interface}.topprotocol.{path_part_encode(protocol_label)}"
449450
values.append({
450451
'p': output_path,
451452
'v': traffic_bytes / time_between, # Bps

0 commit comments

Comments
 (0)