grafana / grafana/pyroscope-python

pyroscope not working on bare-metal python process with uvloop and numba libraries

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

描述

#### Describe the bug

The pyroscope python agent does not work correctly on Mac OS.

#### To Reproduce

Native libraries being used:
"msgspec==0.19.0",
"pyroscope-io>=0.8.11",
"uvloop>=0.21.0,
"numba==0.61.2",
"gunicorn>=23.0.0,
"uvicorn-worker==0.3.0",
"uvicorn[standard]>=0.34.3",

Minimal pyroscope configuration (see below). Spans configured as

```python
with pyroscope.tag_wrapper({"endpoint": "/my-endpoont"}):
....
```

Pyroscope server running as a docker container using docker-compose:

```docker
pyroscope:
image: grafana/pyroscope:latest
container_name: pyroscope
ports:
- "4040:4040"
volumes:
- pyroscope-storage:/var/lib/pyroscope
command: ["server"]
restart: unless-stopped
networks:
- my_network

volumes:
pyroscope-storage:
```

#### Expected behavior

I would expect the application to report data, but I can't see any of my data in the Grafana Pyroscope data-source.

When i start my process, I either get these logs on console

```
2025-08-04T10:51:14.395Z WARN py_spy::python_process_info > Interpreter address from _PyRuntime symbol is invalid 0000000000000000
2025-08-04T10:51:14.449Z WARN py_spy::python_process_info > Interpreter address from _PyRuntime symbol is invalid 0000000000000000
```

when using a simple configuration such as

```python
pyroscope.configure(
application_name="my-service",
server_address=os.getenv("PYROSCOPE_SERVER_ADDRESS", "http://localhost:4040"),
enable_logging=True
)
```

or something like

```
2025-08-04T10:59:38.562Z WARN py_spy::sampler > Failed to get initialization status from PythonSpyThread: receiving on a closed channel
2025-08-04T10:59:38.667Z WARN py_spy::sampler > Failed to get initialization status from PythonSpyThread: receiving on a closed channel
```

when adding this option to the configuration

```python
detect_subprocesses=True,
```

#### Environment

- Deployment tool: uv 0.7.13
- Python version: 3.13.5 (3.13.5 (main, Jun 12 2025, 12:22:43) [Clang 20.1.4 ])
- Platform: macOS-15.5-arm64-arm-64bit-Mach-O

#### Additional Context

I have a python application using some native libaries such as msgspec, uvloop, Numba, uvicorn, or gunicorn
I am running my application as a Mac OS process

贡献指南

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

调研方向

未指定源文件或测试。使用 Python 3.13.5 以及列出的原生库,在 macOS 15.5 arm64 上复现最小配置,然后检查 _PyRuntime 和 PythonSpyThread 警告。当应用程序报告的 profiling 数据能够在 Grafana Pyroscope 数据源中看到时,即表示完成。

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

评估

技术栈
docker, python, rust
领域
observability-sre
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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