Skip to content

Commit

Permalink
feat: set max_iteration only query trace_id data when is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
taloric authored and sharang committed Sep 11, 2024
1 parent a94126c commit 39ba486
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/app/application/l7_flow_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ async def query_and_trace_flowmetas(
if trace_id:
allowed_trace_ids.add(trace_id)
new_trace_ids_in_prev_iteration.add(trace_id)

# max_iterations set to 0 means only query data with trace_id
only_query_trace_id = False
if max_iteration == 0:
max_iteration = 1
only_query_trace_id = True

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

if only_query_app_spans: # no more iterations needed
break
if only_query_trace_id: # no more iterations needed
break

# 2. Query by tcp_seq / syscall_trace_id / x_request_id
new_filters = []
Expand Down
2 changes: 1 addition & 1 deletion app/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FlowLogL7Tracing(Model):
debug = BooleanType(serialized_name="DEBUG", required=False)
max_iteration = IntType(serialized_name="MAX_ITERATION",
required=False,
min_value=1,
min_value=0,
default=config.max_iteration)
network_delay_us = IntType(serialized_name="NETWORK_DELAY_US",
required=False,
Expand Down

0 comments on commit 39ba486

Please sign in to comment.