Skip to content

Commit 8ad99e5

Browse files
taloricsharang
authored andcommitted
fix: close dns tracing default
1 parent 36f60ed commit 8ad99e5

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

app/app.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ app:
3333
allow_multiple_trace_ids_in_tracing_result: false
3434
# use external apm data to fill trace data, default: false
3535
call_apm_api_to_supplement_trace: false
36-
# source data for tracing, default: all (set to empty means all)
36+
# source data for tracing, default: [trace_id, syscall, tcp_seq, x_request_id] (equals to empty)
3737
# available options: [trace_id, syscall, tcp_seq, x_request_id, dns]
38+
# in default settings, we do not trace DNS protocol
3839
# each source means one of tracing method enabled
3940
# trace_id: global seq through requests
4041
# syscall: eBPF tracing through process/threads
4142
# tcp_seq: network layer tracing through TCP seq
4243
# x_request_id: application layer tracing through X-Request-ID/http header
43-
# dns: DNS protocol tracing through DNS transaction-id (request_id)
44+
# dns: DNS protocol tracing through DNS transaction-id (request_id), IT'S DISABLED BY DEFAULT, REQUIRED ENABLED MANUALLY IF NEEDED
4445
tracing_source: []

app/app/application/l7_flow_tracing.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
import uuid
33
import pandas as pd
44
from log import logger
5-
from typing import List, Dict, Set, Callable
5+
from typing import List, Dict, Set, Callable, Tuple
66

7-
from ast import Tuple
87
from pandas import DataFrame
98
from collections import defaultdict
109
from data.querier_client import Querier
@@ -223,11 +222,12 @@
223222
TRACING_SRC_SYSCALL = "syscall"
224223
TRACING_SRC_TCP_SEQ = "tcp_seq"
225224
TRACING_SRC_X_REQ_ID = "x_request_id"
225+
# 默认不开启 dns 追踪
226226
TRACING_SRC_DNS = "dns"
227227

228228
DEFAULT_TRACING_SOURCE = [
229229
TRACING_SRC_TRACE_ID, TRACING_SRC_SYSCALL, TRACING_SRC_TCP_SEQ,
230-
TRACING_SRC_X_REQ_ID, TRACING_SRC_DNS
230+
TRACING_SRC_X_REQ_ID
231231
]
232232

233233

@@ -282,7 +282,7 @@ async def query_and_trace_flowmetas(
282282
max_iteration: int = config.max_iteration,
283283
network_delay_us: int = config.network_delay_us,
284284
host_clock_offset_us: int = config.host_clock_offset_us,
285-
app_spans_from_api: list = []) -> Tuple(list, list):
285+
app_spans_from_api: list = []) -> Tuple[Set, list]:
286286
"""多次迭代,查询可追踪到的所有 l7_flow_log 的摘要
287287
参数说明:
288288
time_filter: 查询的时间范围过滤条件,SQL表达式
@@ -312,7 +312,7 @@ async def query_and_trace_flowmetas(
312312
dataframe_flowmetas = await self.query_flowmetas("1=1", base_filter)
313313
if type(dataframe_flowmetas) != DataFrame or dataframe_flowmetas.empty:
314314
# when app_spans_from_api got values from api, return it
315-
return [], app_spans_from_api
315+
return set(), app_spans_from_api
316316
l7_flow_ids = set(dataframe_flowmetas['_id']) # set(flow._id)
317317

318318
# 用于下一轮迭代,记录元信息
@@ -430,6 +430,7 @@ async def query_and_trace_flowmetas(
430430
# 写入 trace_id_index 时,遇到空 trace_id 有可能会复用 index,导致重复
431431
# 于是,这里可能导致误查询,需要额外过滤一下 len(new_trace_id_arr)=0(trace_id='') 的情况
432432
new_trace_id_flow_delete_index.append(index)
433+
433434
if new_trace_id_flow_delete_index:
434435
new_trace_id_flows = new_trace_id_flows.drop(
435436
new_trace_id_flow_delete_index).reset_index(

app/app/common/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
TAP_SIDE_CLIENT_HYPERVISOR: 4,
4646
TAP_SIDE_CLIENT_GATEWAY_HYPERVISOR: 5,
4747
TAP_SIDE_CLIENT_GATEWAY: 6,
48-
TAP_SIDE_SERVER_GATEWAY: 6, # 由于可能多次穿越网关区域,c-gw和s-gw还需要重排
48+
TAP_SIDE_SERVER_GATEWAY: 7, # 由于可能多次穿越网关区域,c-gw和s-gw还需要重排
4949
TAP_SIDE_SERVER_GATEWAY_HYPERVISOR: 8,
5050
TAP_SIDE_SERVER_HYPERVISOR: 9,
5151
TAP_SIDE_SERVER_POD_NODE: 10,

app/app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def parse_spec(self, cfg):
2626
'call_apm_api_to_supplement_trace', False)
2727
self.tracing_source = spec.get(
2828
'tracing_source',
29-
["trace_id", "syscall", "tcp_seq", "x_request_id", "dns"])
29+
["trace_id", "syscall", "tcp_seq", "x_request_id"])
3030

3131
def parse_querier(self, cfg):
3232
querier = cfg.get('querier', dict())

0 commit comments

Comments
 (0)