Digma
官方一个基于OTEL/APM数据的代码可观测性MCP,支持动态代码分析,用于辅助代码审查、问题识别与修复、高亮风险代码等。
你可以用 Digma MCP 做什么?
- 审查PR分支的运行时问题 — 请助手根据预生产环境的可观测性数据,检查您分支的代码变更是否存在问题。
- 揭示最严重的性能问题 — 请求通过动态代码分析检测出的、对应用影响最大的低效问题。
- 评估修改函数的影响 — 基于分布式追踪的运行时使用数据,识别受影响的其它服务与代码。
- 检查特定环境中的新问题 — 查询近期代码是否在Staging等环境中引入了任何问题。
- 发现高影响数据库查询 — 询问哪些数据库查询对应用性能影响最大。
文档
Digma 代码可观测性 MCP 服务器
一个模型上下文协议(MCP)服务器实现,使智能体能够利用 Digma 访问可观测性洞察,用于代码可观测性和动态代码分析
主要特性 🚀
- 🗣️ 可观测性辅助代码审查: 检查 PR 分支是否存在预生产可观测性发现的任何问题。
- 🔎 通过动态代码分析查找代码低效问题: 识别代码/查询中拖慢应用速度的问题
- 🔭 利用分布式追踪中的代码运行时使用数据: 检查破坏性变更或生成相关测试
示例提示 💬
help me review the code changes in this branch by looking at related runtime issuesI want to improve the performance of this app. What are the three most severe issues I can fix?I'm making changes to this function, based on runtime data. What other services and code would be affected?Are there any new issues in this code based on the Staging environment?Which database queries have the most impact on the application performance?
实际应用演示 📺
获取早期访问权限 👀
Digma 预处理您的可观测性数据,以识别问题、跟踪代码性能和运行时数据——用于动态代码分析。 访问我们的 MCP 页面 注册以获取我们 MCP 服务器的早期访问权限。
安装 ⚙️
配置您的 MCP 客户端(Claude、Cursor 等)以包含 Digma MCP。
Digma 部署包含 MCP SSE 服务器。您可以在客户端中使用其 URL 进行配置,或使用 MCP 工具(如 SuperGateway)将其作为命令工具运行。
MCP URL 路径由 Digma API 密钥组成,如下所示:
https://<DIGMA_API_URL>/mcp/<DIGMA_API_TOKEN>>/sse
示例 MCP XML
如果您的客户端支持 SSE 服务器,您可以使用以下语法:
{
"mcpServers": {
"digma": {
"url": "https://<DIGMA_API_URL>/mcp/DIGMA_API_TOKEN>/sse",
}
// ... other servers might be here ...
}
}
要将 MCP 服务器作为命令工具使用,请使用 SuperGateway 工具桥接到 URL,如下所示:
{
"digma": {
"command": "npx",
"args": [
"-y",
"supergateway",
"--sse",
"https://<DIGMA_API_URL>/mcp/DIGMA_API_TOKEN>/sse"
]
}
}
使用规则 👨💼
智能体是自主的,会根据需要选择何时使用 Digma 提供的数据,但是,某些客户端允许设置规则和策略以建立更结构化的流程。
以下是一个示例规则文件,您可以将其添加到您的 cursor .cursor/rules 目录中
# Digma Memory File - Code Review Instructions
## Runtime Analysis Settings
- Environment: TEST
## Code Review Protocol
1. For any code or branch review request:
- Get the list of changed files and methods in the current branch using `git diff`
- Check for ALL runtime issues in TEST environment (not just for the method in context)
- Check if any runtime issue may be related to the changed code
- Check the runtime usage of the changed methods (based on the `git diff`)
- Check if any of the changed methods (based on the `git diff`) have a high risk based on their performance impact
- Synthesize the data with standard code review analysis
## Note
This file is used by the AI assistant to maintain consistent review protocols across sessions.
许可证 📜
MIT 许可证。请参阅 LICENSE 文件。
