@@ -3,134 +3,143 @@ title: 配置方法
33permalink : /features/continuous-profiling/configuration
44---
55
6- # eBPF On-CPU Profiling
6+ 默认情况下,持续剖析仅对特定进程开启,请参考本文修改采集器组配置,开启/调整持续剖析功能。在企业版中,请前往 ` 系统管理-采集器-配置 ` 页面进行采集器组配置的修改。
7+
8+ # Process Matcher
79
8- eBPF On-CPU Profiling 是默认开启的,但你需要通过修改 ` static_config.ebpf.on-cpu-profile.regex ` 来指定需要开启的进程列表。默认情况下仅对进程名以 ` deepflow- ` 开头的进程开启。Agent 支持的配置参数如下 :
10+ Agent 使用 ` inputs.proc.process_matcher ` 配置来匹配进程,开启对应进程的持续剖析功能。默认配置如下 :
911
1012``` yaml
11- static_config :
12- ebpf :
13- # # Java compliant update latency time
14- # # Default: 600s. Range: [5, 3600]s
15- # # Note:
16- # # When deepflow-agent finds that an unresolved function name appears in the function call stack
17- # # of a Java process, it will trigger the regeneration of the symbol file of the process.
18- # # Because Java utilizes the Just-In-Time (JIT) compilation mechanism, to obtain more symbols for
19- # # Java processes, the regeneration will be deferred for a period of time.
20- # java-symbol-file-refresh-defer-interval: 600s
21-
22- # # Maximum size limit for Java symbol file.
23- # # Default: 10. Range: [2, 100]
24- # # Note:
25- # # Which means it falls within the interval of 2Mi to 100Mi. If the configuration value is outside
26- # # this range, the default value of 10(10Mi), will be used.
27- # # All Java symbol files are stored in the '/tmp' directory mounted by the deepflow-agent. To prevent
28- # # excessive occupation of host node space due to large Java symbol files, a maximum size limit is set
29- # # for each generated Java symbol file.
30- # java-symbol-file-max-space-limit: 10
31-
32- # # on-cpu profile configuration
33- on-cpu-profile :
34- # # eBPF on-cpu Profile Switch
35- # # Default: false
36- disabled : false
37-
38- # # Sampling frequency
39- # # Default: 99
40- frequency : 99
41-
42- # # Whether to obtain the value of CPUID and decide whether to participate in aggregation.
43- # # Set to 1:
44- # # Obtain the value of CPUID and will be included in the aggregation of stack trace data.
45- # # Set to 0:
46- # # It will not be included in the aggregation. Any other value is considered invalid,
47- # # the CPU value for stack trace data reporting is a special value (CPU_INVALID:0xfff)
48- # # used to indicate that it is an invalid value.
49- # # Default: 0
50- cpu : 0
51-
52- # # Sampling process name
53- # # Default: ^deepflow-.*
54- regex : ^deepflow-.*
13+ inputs :
14+ proc :
15+ process_matcher :
16+ - match_regex : \bjava( +\S+)* +-jar +(\S*/)*([^ /]+\.jar)
17+ match_type : cmdline_with_args
18+ only_in_container : false
19+ rewrite_name : $3
20+ enabled_features : [ebpf.profile.on_cpu, proc.gprocess_info]
21+ - match_regex : \bpython(\S)*( +-\S+)* +(\S*/)*([^ /]+)
22+ match_type : cmdline_with_args
23+ only_in_container : false
24+ rewrite_name : $4
25+ enabled_features : [ebpf.profile.on_cpu, proc.gprocess_info]
26+ - match_regex : ^deepflow-
27+ only_in_container : false
28+ enabled_features : [ebpf.profile.on_cpu, proc.gprocess_info]
29+ - match_regex : .*
30+ enabled_features : [proc.gprocess_info]
5531` ` `
5632
5733上述配置的含义如下:
5834
59- - **disabled**:默认为 False,表示功能开启。
60- - **frequency**:采样频率,默认 99 约表示 10ms 采样周期。不建议设置为 10 的整数倍,避免和程序运行或调度的时钟同频。
61- - **cpu**:默认为 0,表示一台主机上采集的数据不区分 CPU,当设置为 1 时数据将按 CPU ID 聚合。
62- - **regex**:开启 On-CPU Profiling 的进程名正则表达式。
63- - **java-symbol-file-refresh-default-interval**:Java 符号表的刷新间隔,避免高频刷新
64- - **java-symbol-file-max-space-limit**:避免 Java 符号表占用过大的 ` /tmp` 空间
35+ - **match_regex**: 进程匹配的正则表达式,匹配规则如下:
36+ - 第一条规则匹配 Java 进程,例如 ` java -jar app.jar`,并将进程名重写为 jar 包名
37+ - 第二条规则匹配 Python 进程,例如 `python app.py`,并将进程名重写为 Python 脚本名
38+ - 第三条规则匹配以 `deepflow-` 开头的进程
39+ - 最后一条规则匹配所有进程
40+ - **match_type**: 匹配类型,可选值:
41+ - `cmdline_with_args` : 匹配完整命令行(包含参数)
42+ - `cmdline` : 仅匹配命令(不含参数)
43+ - `process_name` : 匹配进程名
44+ - **only_in_container**: 是否仅匹配容器内的进程
45+ - **rewrite_name**: 重写进程名的规则,支持正则表达式捕获组引用
46+ - **enabled_features**: 为匹配的进程启用的功能列表:
47+ - `ebpf.profile.on_cpu` : 开启 On-CPU 剖析,需要配置 `inputs.ebpf.profile.on_cpu.disabled: false`
48+ - `ebpf.profile.off_cpu` : 开启 Off-CPU 剖析,需要配置 `inputs.ebpf.profile.off_cpu.disabled: false`
49+ - `ebpf.profile.memory` : 开启内存剖析,需要配置 `inputs.ebpf.profile.memory.disabled: false`
50+
51+ 同时可以使用 `inputs.proc.process_blacklist` 来忽略某些进程,其优先级比 `process_matcher` 高。
6552
66- # eBPF Off-CPU Profiling
53+ ` ` ` yaml
54+ inputs:
55+ proc:
56+ process_blacklist: [sleep, sh, bash, pause, runc, grep, awk, sed, curl]
57+ ` ` `
58+
59+ # Symbol Table
6760
68- eBPF Off-CPU Profiling(仅企业版)是默认开启的,但你需要通过修改 `static_config.ebpf.off-cpu-profile.regex` 来指定需要开启的进程列表。默认情况下仅对进程名以 `deepflow-` 开头的进程开启。Agent 支持的配置参数如下:
61+ 可以为特定语言配置符号表相关的设置。这些设置对于各类持续剖析都生效,一般保持默认配置即可,无需修改。
6962
7063` ` ` yaml
71- static_config :
64+ inputs :
7265 ebpf:
66+ symbol_table:
67+ golang_specific:
68+ enabled: false
69+ java:
70+ refresh_defer_duration: 60s
71+ max_symbol_file_size: 10
72+ ` ` `
73+
74+ 上述配置的含义如下:
75+ - **golang_specific.enabled**:配置是否开启 Golang 特有符号表的解析能力。
76+ - **refresh_defer_duration**: Java 符号表的刷新延迟,避免高频刷新。
77+ - **max_symbol_file_size**: Java 符号表占用的最大空间大小,单位为 GB,避免占用过大的 `/tmp` 空间。
78+
79+ # eBPF On-CPU Profiling
80+
81+ eBPF On-CPU Profiling 是默认开启的,但需要修改 `inputs.proc.process_matcher` 来指定进程列表。Agent 支持的配置参数如下:
7382
74- ## Off-cpu profile configuration, Enterprise Edition Only.
75- #off-cpu-profile:
76- ## eBPF off-cpu Profile Switch
77- ## Default: false
78- #disabled: false
79-
80- ## Off-cpu trace process name
81- ## Default: ^deepflow-.*
82- #regex: ^deepflow-.*
83-
84- ## Whether to obtain the value of CPUID and decide whether to participate in aggregation.
85- ## Set to 1:
86- ## Obtain the value of CPUID and will be included in the aggregation of stack trace data.
87- ## Set to 0:
88- ## It will not be included in the aggregation. Any other value is considered invalid,
89- ## the CPU value for stack trace data reporting is a special value (CPU_INVALID:0xfff)
90- ## used to indicate that it is an invalid value.
91- ## Default: 0
92- #cpu: 0
93-
94- ## Configure the minimum blocking event time
95- ## Default: 50us. Range: [0, 2^32-1)us
96- ## Note:
97- ## If set to 0, there will be no minimum value limitation.
98- ## Scheduler events are still high-frequency events, as their rate may exceed 1 million events
99- ## per second, so caution should still be exercised.
100- ## If overhead remains an issue, you can configure the 'minblock' tunable parameter here.
101- ## If the off-CPU time is less than the value configured in this item, the data will be discarded.
102- ## If your goal is to trace longer blocking events, increasing this parameter can filter out shorter
103- ## blocking events, further reducing overhead. Additionally, we will not collect events with a block
104- ## time exceeding 1 hour.
105- #minblock: 50us
83+ ` ` ` yaml
84+ inputs:
85+ ebpf:
86+ profile:
87+ on_cpu:
88+ disabled: false
89+ sampling_frequency: 99
90+ aggregate_by_cpu: false
10691` ` `
10792
10893上述配置的含义如下:
94+ - **disabled**: 默认为 false,表示功能开启。
95+ - **sampling_frequency**: 采样频率,默认 99 约表示 10ms 采样周期。不建议设置为 10 的整数倍,避免和程序运行或调度的时钟同频。
96+ - **aggregate_by_cpu**: 默认为 false,表示一台主机上采集的数据不区分 CPU,当设置为 true 时数据将按 CPU ID 聚合。
97+
98+ # eBPF Off-CPU Profiling
99+
100+ eBPF Off-CPU Profiling(仅企业版)是默认关闭的,同时需要修改 `inputs.proc.process_matcher` 来指定需进程列表。Agent 支持的配置参数如下:
109101
110- - **disabled**:默认为 False,表示功能开启。
111- - **regex**:开启 Off-CPU Profiling 的进程名正则表达式。
112- - **cpu**:默认为 0,表示一台主机上采集的数据不区分 CPU,当设置为 1 时数据将按 CPU ID 聚合。
113- - **minblock**:使用持续时间限制采集的 Off-CPU 事件,避免采集过多导致主机负载过高。
102+ ` ` ` yaml
103+ inputs:
104+ ebpf:
105+ profile:
106+ off_cpu:
107+ disabled: true
108+ aggregate_by_cpu: false
109+ min_blocking_time: 50us
110+ ` ` `
114111
115- 另外,下面两个 On-CPU 的配置项同时也对 Off-CPU 有效 :
112+ 上述配置的含义如下 :
116113
117- - **java-symbol-file-refresh-default-interval**
118- - **java-symbol-file-max-space-limit**
114+ - **disabled**:默认为 true,表示功能关闭。
115+ - **aggregate_by_cpu**:默认为 false,表示一台主机上采集的数据不区分 CPU,当设置为 true 时数据将按 CPU ID 聚合。
116+ - **min_blocking_time**:使用持续时间限制采集的 Off-CPU 事件,避免采集过多导致主机负载过高。
119117
120118# eBPF Memory Profiling
121119
122- eBPF Memory Profiling(仅企业版)是默认关闭的,你需要通过修改 `static_config.ebpf.memory-profile.regex` 来指定需要开启的进程列表 。Agent 支持的配置参数如下:
120+ eBPF Memory Profiling(仅企业版)是默认关闭的,同时需要修改 `inputs.proc.process_matcher` 来指定需进程列表 。Agent 支持的配置参数如下:
123121
124122` ` ` yaml
125- static_config :
123+ inputs :
126124 ebpf:
127- # Memory profile configuration, Enterprise Edition Only.
128- memory-profile:
129- # eBPF memory Profile Switch
130- # Default: true
131- disabled: true
132-
133- # Memory trace process name
134- # Default: ^java
135- regex: ^java
125+ profile:
126+ memory:
127+ disabled: true
128+ report_interval: 10s
129+ allocated_addresses_lru_len: 131072
130+ sort_length: 16384
131+ sort_interval: 1500ms
132+ queue_size: 32768
136133` ` `
134+
135+ 上述配置的含义如下:
136+
137+ - **disabled**:默认为 true,表示功能关闭。
138+ - **report_interval**:Agent 聚合和上报内存剖析数据的间隔。
139+ - **allocated_addresses_lru_len**:采集器使用 LRU 缓存记录进程分配的地址,以避免内存使用失控。每个 LRU 条目大约占 32B 内存。
140+ - **sort_length**:内存剖析数据处理前按时间戳进行排序的队列长度。
141+ - 配置该选项时先按说明调整 `sort_interval` 参数,在参考采集器性能统计 `deepflow_agent_ebpf_memory_profiler` 中 `dequeued_by_length` 和 `dequeued_by_interval` 指标,在保证前者小于后者几倍的前提下适当调小该参数。
142+ - **sort_interval**:内存剖析数据处理前按时间戳进行排序的最大时间间隔。该参数控制排序数组中第一个和最后一个元素之间的时间间隔的最大值。
143+ - 配置该选项可以参考采集器性能统计 `deepflow_agent_ebpf_memory_profiler` 中 `time_backtracked` 指标,增大该参数使之为 0 即可。注意可能需要相应增大 `sort_length` 参数。
144+ - **queue_size**:内存剖析组件内部的队列大小。
145+ - 配置该选项可以参考采集器性能统计 `deepflow_agent_ebpf_memory_profiler` 中 `overwritten` 和 `pending` 指标,增大该配置使得前者为 0,后者不高于该配置即可。
0 commit comments