Digma
官方一個程式碼可觀測性MCP,基於OTEL/APM資料進行動態程式碼分析,協助程式碼審查、問題識別與修復,並標示高風險程式碼等。
你可以用 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 進行設定,或使用如 SuperGateway 的 MCP 工具將其作為命令工具執行。
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 檔案。
