grafana / grafana/pyroscope-python

Not getting profiles of custom native cpp extensions of our libraries when using pyroscope

Đang mở
#61 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
4
Fork
2
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
5

Mô tả

Hi,

Thanks for your great work!

We are using pyroscope to get profiles of our custom python code. From it, with pyroscope we are only being able to profile the python functions, but we get no detail of the c/c++ extensions.

For debugging this, we tried plain py-spy. With py-spy, we needed to:
1. Compile our custom extensions with the ` -fno-omit-frame-pointer` target compile option.
2. Adding `-Ccmake.build-type=Debug` to our pip install comand.
3. Activate the _native_ flag on `py-spy` for generating the flame graph:
``` python
py-spy record --native -o ./profile.svg -- python script_to_be_profiled.py
```

With these steps, our flamegraph recovered all the native extensions detail on its profiling.

However, with pyroscope, keeping the steps 1 and 2, we were not able to activate these options.

We saw that the `native` flag has a deprecation warning, and that on the `lib.rs` file, the config interface hardcodes the native parameter to false:

https://github.com/grafana/pyroscope-python/blob/dfe738d83605f1be8f99b47722fb87c9b19618ed/rust/src/lib.rs#L107-L119

Can pyroscope be used to profile the python native extensions? If so, what could we be missing in our setup?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Kiểm tra rust/src/lib.rs tại các dòng 107-119, nơi thiết lập native được hardcode, và so sánh cấu hình của nó với lệnh py-spy sử dụng --native. Tái hiện việc profiling với các tùy chọn frame-pointer và bản build Debug đã nêu. Hoàn thành khi xác định được liệu có thể bật profiling cho các native extension hay không và xác định thay đổi cấu hình hoặc triển khai cần thiết.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, python, rust
Lĩnh vực
observability, performance
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.