grafana / grafana/pyroscope-python

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

未关闭
#61 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
4
派生
2
平均合并
2 天 4 小时
30 天内合并 PR
5

描述

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?

贡献指南

这个仓库没有索引到贡献指南

调研方向

检查 rust/src/lib.rs 的第 107-119 行,其中 native 设置是硬编码的,并将其配置与使用 --native 的 py-spy 命令进行比较。使用所述的 frame-pointer 和 Debug 构建选项重现 profiling。完成的标准是确定是否可以启用 native-extension profiling,并识别所需的配置或实现更改。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp, python, rust
领域
observability, performance
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。