Skip to content

Commit 39ba486

Browse files
taloricsharang
authored andcommitted
feat: set max_iteration only query trace_id data when is 0
1 parent a94126c commit 39ba486

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

app/app/application/l7_flow_tracing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ async def query_and_trace_flowmetas(
282282
if trace_id:
283283
allowed_trace_ids.add(trace_id)
284284
new_trace_ids_in_prev_iteration.add(trace_id)
285+
286+
# max_iterations set to 0 means only query data with trace_id
287+
only_query_trace_id = False
288+
if max_iteration == 0:
289+
max_iteration = 1
290+
only_query_trace_id = True
285291

286292
# 进行迭代查询,上限为 config.spec.max_iteration
287293
for i in range(max_iteration):
@@ -358,6 +364,8 @@ async def query_and_trace_flowmetas(
358364

359365
if only_query_app_spans: # no more iterations needed
360366
break
367+
if only_query_trace_id: # no more iterations needed
368+
break
361369

362370
# 2. Query by tcp_seq / syscall_trace_id / x_request_id
363371
new_filters = []

app/app/models/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FlowLogL7Tracing(Model):
2121
debug = BooleanType(serialized_name="DEBUG", required=False)
2222
max_iteration = IntType(serialized_name="MAX_ITERATION",
2323
required=False,
24-
min_value=1,
24+
min_value=0,
2525
default=config.max_iteration)
2626
network_delay_us = IntType(serialized_name="NETWORK_DELAY_US",
2727
required=False,

0 commit comments

Comments
 (0)