Go流程检查员
  
一种用于检查和分析正在运行的Go进程的工具,包括goroutine状态、内存统计和二进制信息。
特性
- 查看详细的goroutine信息(状态、日程安排信息)
- 分析进程内存统计信息
- 跨平台支持(Linux和macOS)
- 交互式检查终端UI
- 用于编程访问的HTTP API
- mcp服务器
安装
go install github.com/monsterxx03/gospy@latest用法
CLI接口
# Interactive terminal UI
sudo gospy top --pid
# HTTP API server
sudo gospy serve --port 8974
# Get process summary
sudo gospy summary --pid
# Get process summary in JSON format
sudo gospy summary --pid
--json摘要命令选项
--pid/-p-目标进程ID(必需)--bin/-b-二进制文件的路径(可选)--json/-j-以JSON格式输出结果
API终点
- `GET /goroutines?pid=
` -列出所有goroutines
- `GET /memstats?pid=
` -获取内存统计信息
- `GET /runtime?pid=
` -获取运行时版本信息
MCP服务器
MCP服务器提供了一个http(streamableHTTP)端点。要启用:
>>> sudo gospy serve --enable-mcp --port 8974
Starting API server on port 8974
Endpoints:
GET /runtime?pid=
- Get runtime info
GET /goroutines?pid=
- Get goroutines list
GET /memstats?pid=
- Get memory stats
GET /mcp - MCP http endpoint
可用的MCP工具:
goroutines-为go进程转储goroutinesgomemstats-转储go进程的内存统计信息goruntime-转储go进程的运行时信息pgrep-从进程名称中查找pid
游标中的配置

终端UI控件
q-退出r-刷新数据s-暂停/恢复俯视图/-搜索/过滤goroutines
终端用户界面截图
从源头构建
git clone https://github.com/monsterxx03/gospy.git
cd gospy
make需求
- 转到1.20+
- Linux或macOS(仅限苹果Silicon)
- 根权限(内存访问所需)
根权限
gospy需要root权限才能:
- 读取进程内存(/proc/
/Linux上的mem)
- 在macOS上访问Mach API
使用sudo运行:
sudo gospy top --pid
对于开发/调试,您可能需要:
- 首先构建二进制文件:
make - 使用sudo运行:
sudo ./gospy [command]
鸣谢
0.7.0版本完全从头开始重写 帮助,编写了90%以上的代码。其他援助来源:
- 深度求索 (R1+V3型号)-AI编码助手
人工智能计算总成本:约2美元
许可证
麻省理工学院-参见 许可证 文件以获取详细信息。
