4444 "resp_tcp_seq" ,
4545 "start_time_us" ,
4646 "end_time_us" ,
47- "vtap_id " ,
47+ "agent_id " ,
4848 "tap_port" ,
4949 "tap_port_name" ,
5050 "tap_port_type" ,
@@ -402,7 +402,7 @@ async def trace_l7_flow(self,
402402 if syscall_trace_id_request > 0 or syscall_trace_id_response > 0 :
403403 new_syscall_metas .add ((
404404 dataframe_flowmetas ['_id' ][index ],
405- dataframe_flowmetas ['vtap_id ' ][index ],
405+ dataframe_flowmetas ['agent_id ' ][index ],
406406 dataframe_flowmetas ['syscall_trace_id_request' ]
407407 [index ],
408408 dataframe_flowmetas ['syscall_trace_id_response' ]
@@ -486,7 +486,7 @@ async def trace_l7_flow(self,
486486 id_to_related_tag = dict ()
487487 for index in new_flows .index :
488488 _id = new_flows .at [index , '_id_str' ]
489- vtap_id = new_flows .at [index , 'vtap_id ' ]
489+ agent_id = new_flows .at [index , 'agent_id ' ]
490490 req_tcp_seq = new_flows .at [index , 'req_tcp_seq' ]
491491 resp_tcp_seq = new_flows .at [index , 'resp_tcp_seq' ]
492492 tap_side = new_flows .at [index , 'tap_side' ]
@@ -505,7 +505,7 @@ async def trace_l7_flow(self,
505505
506506 id_to_related_tag [_id ] = {
507507 '_id' : _id ,
508- 'vtap_id ' : vtap_id ,
508+ 'agent_id ' : agent_id ,
509509 'req_tcp_seq' : req_tcp_seq ,
510510 'resp_tcp_seq' : resp_tcp_seq ,
511511 'tap_side' : tap_side ,
@@ -630,7 +630,7 @@ async def query_flowmetas(self, time_filter: str,
630630 通过tcp_seq及流日志的时间追踪
631631
632632 系统调用追踪信息:
633- vtap_id , syscall_trace_id_request, syscall_trace_id_response
633+ agent_id , syscall_trace_id_request, syscall_trace_id_response
634634 通过eBPF获取到的coroutine_trace_id追踪
635635
636636 主动注入的追踪信息:
@@ -640,7 +640,7 @@ async def query_flowmetas(self, time_filter: str,
640640 """
641641 sql = """SELECT
642642 type, req_tcp_seq, resp_tcp_seq, toUnixTimestamp64Micro(start_time) AS start_time_us, toUnixTimestamp64Micro(end_time) AS end_time_us,
643- vtap_id , syscall_trace_id_request, syscall_trace_id_response, span_id, parent_span_id, l7_protocol,
643+ agent_id , syscall_trace_id_request, syscall_trace_id_response, span_id, parent_span_id, l7_protocol,
644644 trace_id, x_request_id_0, x_request_id_1, toString(_id) AS `_id_str`, tap_side, auto_instance_0, auto_instance_1
645645 FROM `l7_flow_log`
646646 WHERE (({time_filter}) AND ({base_filter})) limit {l7_tracing_limit}
@@ -710,7 +710,7 @@ def set_all_relate(dataframe_flowmetas, related_map, network_delay_us):
710710 resp_tcp_seq = dataframe_flowmetas .at [index , 'resp_tcp_seq' ]
711711 tap_side = dataframe_flowmetas .at [index , 'tap_side' ]
712712 _id = dataframe_flowmetas .at [index , '_id' ]
713- vtap_id = dataframe_flowmetas .at [index , 'vtap_id ' ]
713+ agent_id = dataframe_flowmetas .at [index , 'agent_id ' ]
714714 _type = dataframe_flowmetas .at [index , 'type' ]
715715 start_time_us = dataframe_flowmetas .at [index , 'start_time_us' ]
716716 end_time_us = dataframe_flowmetas .at [index , 'end_time_us' ]
@@ -726,7 +726,7 @@ def set_all_relate(dataframe_flowmetas, related_map, network_delay_us):
726726
727727 id_to_related_tag [_id ] = {
728728 '_id' : _id ,
729- 'vtap_id ' : vtap_id ,
729+ 'agent_id ' : agent_id ,
730730 'req_tcp_seq' : req_tcp_seq ,
731731 'resp_tcp_seq' : resp_tcp_seq ,
732732 'tap_side' : tap_side ,
@@ -760,9 +760,9 @@ def set_all_relate(dataframe_flowmetas, related_map, network_delay_us):
760760 syscall_trace_id_response = dataframe_flowmetas .at [
761761 index , 'syscall_trace_id_response' ]
762762 _id = dataframe_flowmetas .at [index , '_id' ]
763- vtap_id = dataframe_flowmetas .at [index , 'vtap_id ' ]
763+ agent_id = dataframe_flowmetas .at [index , 'agent_id ' ]
764764 if syscall_trace_id_request > 0 or syscall_trace_id_response > 0 :
765- new_syscall_metas .add ((_id , vtap_id , syscall_trace_id_request ,
765+ new_syscall_metas .add ((_id , agent_id , syscall_trace_id_request ,
766766 syscall_trace_id_response ))
767767 if syscall_trace_id_request :
768768 syscall_req_to_ids [syscall_trace_id_request ].add (_id )
@@ -932,30 +932,30 @@ def set_relate(self, _ids, related_map, id_to_related_tag):
932932class L7SyscallMeta :
933933 """
934934 系统调用追踪信息:
935- vtap_id , syscall_trace_id_request, syscall_trace_id_response, tap_side, start_time_us, end_time_us
935+ agent_id , syscall_trace_id_request, syscall_trace_id_response, tap_side, start_time_us, end_time_us
936936 """
937937
938938 def __init__ (self , flow_metas : Tuple ):
939939 self ._id = flow_metas [0 ]
940- self .vtap_id = flow_metas [1 ]
940+ self .agent_id = flow_metas [1 ]
941941 self .syscall_trace_id_request = flow_metas [2 ]
942942 self .syscall_trace_id_response = flow_metas [3 ]
943943
944944 def __eq__ (self , rhs ):
945- return (self .vtap_id == rhs .vtap_id and self .syscall_trace_id_request
945+ return (self .agent_id == rhs .agent_id and self .syscall_trace_id_request
946946 == rhs .syscall_trace_id_request
947947 and self .syscall_trace_id_response
948948 == rhs .syscall_trace_id_response )
949949
950950 def set_relate (self , _ids , related_map , id_to_related_tag ):
951951 for _id in _ids :
952952 _id_df = id_to_related_tag [_id ]['_id' ]
953- vtap_id_df = id_to_related_tag [_id ]['vtap_id ' ]
953+ agent_id_df = id_to_related_tag [_id ]['agent_id ' ]
954954 syscall_trace_id_request_df = id_to_related_tag [_id ][
955955 'syscall_trace_id_request' ]
956956 syscall_trace_id_response_df = id_to_related_tag [_id ][
957957 'syscall_trace_id_response' ]
958- if _id_df == self ._id or self .vtap_id != vtap_id_df :
958+ if _id_df == self ._id or self .agent_id != agent_id_df :
959959 continue
960960 if self .syscall_trace_id_request > 0 :
961961 if self .syscall_trace_id_request == syscall_trace_id_request_df or self .syscall_trace_id_request == syscall_trace_id_response_df :
@@ -1096,8 +1096,8 @@ def sort_and_set_parent(self):
10961096
10971097class Service :
10981098
1099- def __init__ (self , vtap_id : int , process_id : int ):
1100- self .vtap_id = vtap_id
1099+ def __init__ (self , agent_id : int , process_id : int ):
1100+ self .agent_id = agent_id
11011101 self .process_id = process_id
11021102
11031103 self .direct_flows = []
@@ -1154,7 +1154,7 @@ def parent_set(self):
11541154 def check_client_process_flow (self , flow : dict ):
11551155 """检查该flow是否与service有关联关系,s-p的时间范围需要覆盖c-p,否则拆分为两个service"""
11561156 if self .process_id != flow ["process_id_0" ] \
1157- or self .vtap_id != flow ["vtap_id " ]:
1157+ or self .agent_id != flow ["agent_id " ]:
11581158 return False
11591159 if self .start_time_us > flow ["start_time_us" ] \
11601160 or self .end_time_us < flow ["end_time_us" ]:
@@ -1164,7 +1164,7 @@ def check_client_process_flow(self, flow: dict):
11641164 def add_direct_flow (self , flow : dict ):
11651165 """direct_flow是指该服务直接接收到的,或直接发出的flow"""
11661166 #assert (
1167- # self.vtap_id == flow.get('vtap_id ')
1167+ # self.agent_id == flow.get('agent_id ')
11681168 # and self.process_id == flow.get('process_id')
11691169 #)
11701170 if flow ['tap_side' ] == TAP_SIDE_SERVER_PROCESS :
@@ -1246,7 +1246,7 @@ def merge_flow(flows: list, flow: dict) -> bool:
12461246 if flow ['type' ] == L7_FLOW_TYPE_SESSION \
12471247 and flow ['tap_side' ] not in [TAP_SIDE_SERVER_PROCESS , TAP_SIDE_CLIENT_PROCESS ]:
12481248 return False
1249- # vtap_id , l7_protocol, flow_id, request_id
1249+ # agent_id , l7_protocol, flow_id, request_id
12501250 for i in range (len (flows )):
12511251 if flow ['_id' ] == flows [i ]['_id' ]:
12521252 continue
@@ -1281,7 +1281,7 @@ def merge_flow(flows: list, flow: dict) -> bool:
12811281 if not request_flow or not response_flow :
12821282 continue
12831283 for key in [
1284- 'vtap_id ' , 'tap_port' , 'tap_port_type' , 'l7_protocol' ,
1284+ 'agent_id ' , 'tap_port' , 'tap_port_type' , 'l7_protocol' ,
12851285 'request_id' , 'tap_side'
12861286 ]:
12871287 if _get_df_key (request_flow , key ) != _get_df_key (
@@ -1428,37 +1428,37 @@ def sort_all_flows(dataframe_flows: DataFrame, network_delay_us: int,
14281428 f"{ id_map [_id ]} -{ ',' .join (related_types )} -{ _id } " )
14291429 flow ["related_ids" ] = list (related_ids )
14301430
1431- # 从Flow中提取Service:一个<vtap_id , local_process_id>二元组认为是一个Service。
1431+ # 从Flow中提取Service:一个<agent_id , local_process_id>二元组认为是一个Service。
14321432 service_map = defaultdict (Service )
14331433 for flow in syscall_flows :
14341434 if flow ['tap_side' ] != TAP_SIDE_SERVER_PROCESS :
14351435 continue
14361436 local_process_id = flow ['process_id_1' ]
1437- vtap_id = flow ['vtap_id ' ]
1438- if (vtap_id , local_process_id , 0 ) not in service_map :
1439- service = Service (vtap_id , local_process_id )
1440- service_map [(vtap_id , local_process_id , 0 )] = service
1437+ agent_id = flow ['agent_id ' ]
1438+ if (agent_id , local_process_id , 0 ) not in service_map :
1439+ service = Service (agent_id , local_process_id )
1440+ service_map [(agent_id , local_process_id , 0 )] = service
14411441 # Service直接接收或发送的Flows_
14421442 service .add_direct_flow (flow )
14431443 else :
14441444 index = 0
14451445 for key in service_map .keys ():
1446- if key [0 ] == vtap_id and key [1 ] == local_process_id :
1446+ if key [0 ] == agent_id and key [1 ] == local_process_id :
14471447 index += 1
1448- service = Service (vtap_id , local_process_id )
1449- service_map [(vtap_id , local_process_id , index )] = service
1448+ service = Service (agent_id , local_process_id )
1449+ service_map [(agent_id , local_process_id , index )] = service
14501450 service .add_direct_flow (flow )
14511451
14521452 for flow in syscall_flows :
14531453 if flow ['tap_side' ] != TAP_SIDE_CLIENT_PROCESS :
14541454 continue
14551455 local_process_id = flow ['process_id_0' ]
1456- vtap_id = flow ['vtap_id ' ]
1456+ agent_id = flow ['agent_id ' ]
14571457 index = 0
14581458 max_start_time_service = None
1459- if (vtap_id , local_process_id , 0 ) in service_map :
1459+ if (agent_id , local_process_id , 0 ) in service_map :
14601460 for key , service in service_map .items ():
1461- if key [0 ] == vtap_id and key [1 ] == local_process_id :
1461+ if key [0 ] == agent_id and key [1 ] == local_process_id :
14621462 index += 1
14631463 if service .check_client_process_flow (flow ):
14641464 if not max_start_time_service :
@@ -1470,8 +1470,8 @@ def sort_all_flows(dataframe_flows: DataFrame, network_delay_us: int,
14701470 max_start_time_service .add_direct_flow (flow )
14711471 continue
14721472 # 没有attach到service上的flow生成一个新的service
1473- service = Service (vtap_id , local_process_id )
1474- service_map [(vtap_id , local_process_id , index )] = service
1473+ service = Service (agent_id , local_process_id )
1474+ service_map [(agent_id , local_process_id , index )] = service
14751475 # Service直接接收或发送的Flow
14761476 service .add_direct_flow (flow )
14771477
@@ -1976,8 +1976,8 @@ def _get_flow_dict(flow: DataFrame):
19761976 flow .get ("childs" , []),
19771977 "process_id" :
19781978 flow .get ("process_id" , None ),
1979- "vtap_id " :
1980- flow .get ("vtap_id " , None ),
1979+ "agent_id " :
1980+ flow .get ("agent_id " , None ),
19811981 "service_uid" :
19821982 flow .get ("service_uid" , None ),
19831983 "service_uname" :
@@ -2080,10 +2080,10 @@ def network_flow_sort(traces):
20802080 for trace in local_rest_traces :
20812081 vtap_index = - 1
20822082 for i , sorted_trace in enumerate (sorted_traces ):
2083- if vtap_index > 0 and sorted_trace ['vtap_id ' ] != trace [
2084- 'vtap_id ' ]:
2083+ if vtap_index > 0 and sorted_trace ['agent_id ' ] != trace [
2084+ 'agent_id ' ]:
20852085 break
2086- if sorted_trace ['vtap_id ' ] == trace ['vtap_id ' ]:
2086+ if sorted_trace ['agent_id ' ] == trace ['agent_id ' ]:
20872087 if sorted_trace ['start_time_us' ] < trace ['start_time_us' ]:
20882088 vtap_index = i + 1
20892089 elif vtap_index == - 1 :
0 commit comments