Skip to content

Commit ab8d366

Browse files
committed
feat: temp feature for cover exception
1 parent dd83be4 commit ab8d366

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

app/app/application/l7_flow_tracing.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,13 @@ def flow_field_conflict(cls, lhs: TraceInfo, rhs: TraceInfo) -> bool:
11961196
return lhs.span_id != rhs.span_id
11971197
# end of trace_id compare
11981198
# 当没有 trace_id 时,才尝试执行一遍完整的比较
1199+
1200+
# 临时版本,如果一边有,另一边没有,说明解析有问题
1201+
# 那后面的也不用比较了,一定是一边有,另一边空,此场景暂未知道根因
1202+
# 只能先出个临时分支覆盖一下
1203+
if lhs.trace_id or rhs.trace_id:
1204+
return False
1205+
# 这里如果两个都是空,那还是要正经比较一下的,避免真有异常
11991206

12001207
is_http2_grpc_and_differ = False
12011208

@@ -1505,6 +1512,7 @@ class NetworkSpanSet:
15051512

15061513
def __init__(self):
15071514
# 标识 span_id 方便匹配 app-span
1515+
self.trace_id = []
15081516
self.span_id = None
15091517
# 分组聚合所有 tcp_seq 相同的 flow
15101518
self.spans: List[SpanNode] = []
@@ -1567,8 +1575,14 @@ def append_span_node(self, span: 'SpanNode'):
15671575
将 net-span 与 sys-span 按 tcp_seq 分组
15681576
构造 tcp_seq 分组时已通过 `flow_field_conflict` 函数确保同一组内必是同一个 span_id
15691577
"""
1578+
if not self.trace_id and span.get_trace_id():
1579+
self.trace_id = span.get_trace_id()
1580+
if not span.get_trace_id() and self.trace_id:
1581+
span.flow['trace_id'] = self.trace_id
15701582
if not self.span_id and span.get_span_id():
15711583
self.span_id = span.get_span_id()
1584+
if not span.get_span_id() and self.span_id:
1585+
span.flow['span_id'] = self.span_id
15721586
# 标记 span 是否属于同一组 network_span_set,避免在 _connect_process_and_networks 首尾关联产生环路
15731587
span.network_span_set = self
15741588
# 这里有可能写进来的是 SysSpan,需要避免重复设置,避免服务划分错误

0 commit comments

Comments
 (0)