We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我这边阅读了deepflow-agent的代码,发现deepflow-agent的ebpf相关的profile能力是在Trident->AgentComponents->EbpfCollector中定义并执行的,在EbpfCollector中会去检测on_cpu_profile是否启动,在启动的情况下会调用start_continuous_profiler()开始持续采样并通过ebpf_on_cpu_callback()回调函数进行处理,然后在stop_continuous_profiler()函数中关闭持续采样,并没有对外提供能力的接口; 我们想要改造deepflow-agent,希望能够实现deepflow-server跟agent建连的rpc通道去下发命令,在保证调用deepflow-agent串行的情况下,能够实现动态的调用profile的能力,类似如下的代码所示,想问下是否具有可行性,以及这种由server触发的代码应该放在agent的哪里被执行
fn profile_pid_for_duration(pid: i32, duration_secs: u64) -> Result<(), &'static str> { // 动态设置正则表达式,仅采样指定 PID 的数据 let regex = format!("^{}", pid); // 匹配目标 PID unsafe { set_profiler_regex( CString::new(regex.as_bytes()) .map_err(|_| "Failed to create CString")? .as_c_str() .as_ptr(), ); } // 启动 eBPF profiler let frequency = 99; // 设置采样频率(可根据需求调整) let max_java_file_limit = 1024 * 1024 * 10; // Java 符号文件限制 let java_refresh_interval = 10; // 刷新间隔(秒) unsafe { if start_continuous_profiler( frequency, max_java_file_limit, java_refresh_interval, EbpfCollector::ebpf_on_cpu_callback, ) != 0 { return Err("Failed to start continuous profiler"); } } // 定时结束采样 thread::spawn(move || { thread::sleep(Duration::from_secs(duration_secs)); // 停止 eBPF profiler unsafe { ebpf::stop_continuous_profiler(); // 停止内核态采样 } println!("Stopped profiling for PID {}", pid); }); Ok(()) }
No response
#8550
The text was updated successfully, but these errors were encountered:
这里有单独调用 profiler 的方法供你参考 没太理解你所说“动态调用 profile” 的含义;如果希望对某些进程开启持续剖析,配置process_matcher就可以了
Sorry, something went wrong.
嗯,有看过这部分代码, 我们是想要提供一种方式来让agent能够开放出profile的能力,比如在特定的时刻(比如告警后)针对某些进程触发profile这样的能力, 如果配置process_matcher的话,就会是一直持续性的profile,跟我们设想的不符, 如果是频繁修改agent-config的话,也会比较麻烦, 所以希望能够提供一种方式来触发profile的调用,然后通过原有的数据上报通道来上报信息这样子,所以是想看看server控制agent执行命令是大体上是怎么实现的,能够控制agent开启一段时间(比如1、2分钟这样子)的profiler 最后就是想问下profile能否针对特定pid触发?
这里有单独调用 profiler 的方法供你参考 没太理解你所说“动态调用 profile” 的含义;如果希望对某些进程开启持续剖析,配置process_matcher就可以了 嗯,有看过这部分代码, 我们是想要提供一种方式来让agent能够开放出profile的能力,比如在特定的时刻(比如告警后)针对某些进程触发profile这样的能力, 如果配置process_matcher的话,就会是一直持续性的profile,跟我们设想的不符, 如果是频繁修改agent-config的话,也会比较麻烦, 所以希望能够提供一种方式来触发profile的调用,然后通过原有的数据上报通道来上报信息这样子,所以是想看看server控制agent执行命令是大体上是怎么实现的,能够控制agent开启一段时间(比如1、2分钟这样子)的profiler
嗯,有看过这部分代码, 我们是想要提供一种方式来让agent能够开放出profile的能力,比如在特定的时刻(比如告警后)针对某些进程触发profile这样的能力, 如果配置process_matcher的话,就会是一直持续性的profile,跟我们设想的不符, 如果是频繁修改agent-config的话,也会比较麻烦, 所以希望能够提供一种方式来触发profile的调用,然后通过原有的数据上报通道来上报信息这样子,所以是想看看server控制agent执行命令是大体上是怎么实现的,能够控制agent开启一段时间(比如1、2分钟这样子)的profiler
目前采集器只支持通过 process_matcher 一种方法进行配置,由 process-listener 线程根据匹配的结果触发预先配置的回调函数开启对应进程的剖析
最后就是想问下profile能否针对特定pid触发?
不支持直接配置 pid,可支持的配置参考
deepflow/server/agent_config/template.yaml
Line 1160 in 8b3aeca
你好,想问下我直接执行了这个单独调佣profiler的main方法,然后修改了set_profiler_regex只严格匹配一个set_profiler_regex( CString::new("^deepflow-agent$".as_bytes()) .unwrap() .as_c_str() .as_ptr(), );,但是还是在callback的回调中看到有很多额外的采样数据,这是正常的吗
rvql
yinjiping
No branches or pull requests
Search before asking
Description
我这边阅读了deepflow-agent的代码,发现deepflow-agent的ebpf相关的profile能力是在Trident->AgentComponents->EbpfCollector中定义并执行的,在EbpfCollector中会去检测on_cpu_profile是否启动,在启动的情况下会调用start_continuous_profiler()开始持续采样并通过ebpf_on_cpu_callback()回调函数进行处理,然后在stop_continuous_profiler()函数中关闭持续采样,并没有对外提供能力的接口;
我们想要改造deepflow-agent,希望能够实现deepflow-server跟agent建连的rpc通道去下发命令,在保证调用deepflow-agent串行的情况下,能够实现动态的调用profile的能力,类似如下的代码所示,想问下是否具有可行性,以及这种由server触发的代码应该放在agent的哪里被执行
Use case
No response
Related issues
#8550
Are you willing to submit a PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: