-
Notifications
You must be signed in to change notification settings - Fork 3
Basic support profiling task #169
New issue
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
base: main
Are you sure you want to change the base?
Conversation
03d688e
to
1e5b027
Compare
let mut data = vec![]; | ||
for ele in &perf_data.events { | ||
let Some(event_type) = &ele.event_type else { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些地方需要打印错误日志,帮助后续的排查。默认静默掉这些错误,排查起来比较麻烦,可能是网络问题,也可能是参数错误。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event_type 在proto里面是用 oneof定义, oneof event_type {
,使用oneof就会生成一个option的字段,这里没有就跳过是合适的。
|
||
if let psh_proto::perf_data_proto::perf_event::EventType::MmapEvent(event)= event_type{ | ||
let Some(filename) = &event.filename else { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
.await??; | ||
if let Some(task_id) = profiling_task.id { | ||
let mut data = vec![]; | ||
for ele in &perf_data.events { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ele
-> event
?
if let Some(task_id) = profiling_task.id { | ||
let mut data = vec![]; | ||
for ele in &perf_data.events { | ||
let Some(event_type) = &ele.event_type else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
读取ELF文件为什么需要event_type? 这个不是强关联吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件名是在MmapEvent里面的,所以需要从里面获取文件名。
let dat = Data { | ||
data_type: Some(DataType::PerfData(perf_data)), | ||
}; | ||
data.push(dat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
采样和上传ELF文件两个可以分开,放在一起反而不方便。不是所有的ELF文件都需要上传。
filename: filename.to_owned(), | ||
build_id: event.build_id.clone(), | ||
arch: std::env::consts::ARCH.to_string(), | ||
bytes: tokio::fs::read(filename).await? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是先做一些校验,然后在判断是不是要读取文件内容,而不是直接读取。比如文件不存在怎么处理, build_id不一致怎么处理,用户是否允许读取某个文件/目录等等。
No description provided.