Basic support profiling task#169
Open
saying121 wants to merge 4 commits intoOptimatistOpenSource:mainfrom
Open
Basic support profiling task#169saying121 wants to merge 4 commits intoOptimatistOpenSource:mainfrom
saying121 wants to merge 4 commits intoOptimatistOpenSource:mainfrom
Conversation
03d688e to
1e5b027
Compare
BrytonLee
requested changes
Sep 30, 2025
src/main.rs
Outdated
| let mut data = vec![]; | ||
| for ele in &perf_data.events { | ||
| let Some(event_type) = &ele.event_type else { | ||
| continue; |
Member
There was a problem hiding this comment.
这些地方需要打印错误日志,帮助后续的排查。默认静默掉这些错误,排查起来比较麻烦,可能是网络问题,也可能是参数错误。
Contributor
Author
There was a problem hiding this comment.
event_type 在proto里面是用 oneof定义, oneof event_type {,使用oneof就会生成一个option的字段,这里没有就跳过是合适的。
src/main.rs
Outdated
|
|
||
| if let psh_proto::perf_data_proto::perf_event::EventType::MmapEvent(event)= event_type{ | ||
| let Some(filename) = &event.filename else { | ||
| continue; |
src/main.rs
Outdated
| .await??; | ||
| if let Some(task_id) = profiling_task.id { | ||
| let mut data = vec![]; | ||
| for ele in &perf_data.events { |
src/main.rs
Outdated
| 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 { |
Member
There was a problem hiding this comment.
读取ELF文件为什么需要event_type? 这个不是强关联吧?
Contributor
Author
There was a problem hiding this comment.
文件名是在MmapEvent里面的,所以需要从里面获取文件名。
| let dat = Data { | ||
| data_type: Some(DataType::PerfData(perf_data)), | ||
| }; | ||
| data.push(dat); |
Member
There was a problem hiding this comment.
采样和上传ELF文件两个可以分开,放在一起反而不方便。不是所有的ELF文件都需要上传。
src/main.rs
Outdated
| filename: filename.to_owned(), | ||
| build_id: event.build_id.clone(), | ||
| arch: std::env::consts::ARCH.to_string(), | ||
| bytes: tokio::fs::read(filename).await? |
Member
There was a problem hiding this comment.
应该是先做一些校验,然后在判断是不是要读取文件内容,而不是直接读取。比如文件不存在怎么处理, build_id不一致怎么处理,用户是否允许读取某个文件/目录等等。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.