Add support to Process Collector #2247
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
作用
新增进程采集器ProcessCollector
新增指标
系统级别
vm_process:系统内进程数,pid数
进程级别
process_expand封装
tag:
指标计算方法
CPU利用率
通过解析/proc/pid/status文件,解析cutime,cstime,utime,stime
user = utime + cutime
sys = stime + cstime
totalTime = user + sys
pid_cpu_percent = totcalCPUDiff/timeDiff;
totcalCPUDiff = (this_cpu_total - prev_cpu_total)/ hz
timeDiff = (本次采样时间-上次采样时间)
内存利用率
解析/proc/pid/statm
Resident = statm_resident * pagesize
pid_mem_percent = Resident / totalMemory
文件数
检查/proc/pid/fd
找出fd文件夹,计数