sentry-triage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSentry Triage
Sentry问题分诊
Pull Sentry issues, events, and suspect commits straight into the agent via the Composio CLI. Skip the copy-paste-stack-trace dance.
通过Composio CLI直接将Sentry问题、事件和可疑提交拉取到Agent中,无需再反复复制粘贴堆栈跟踪。
When to Use
使用场景
- New Sentry alert and you want the agent to investigate, not just quote the subject line.
- Diagnosing a regression: find the releases, suspect commit, and affected files.
- Building a "top 10 unresolved issues" digest with reproduction hints.
- 收到新的Sentry告警,希望Agent进行深入排查,而不只是引用主题行内容
- 诊断回归问题:查找相关版本、可疑提交和受影响文件
- 生成包含复现提示的“十大未解决问题”摘要
Prereqs
前置要求
bash
curl -fsSL https://composio.dev/install | bash
composio login
composio link sentry # auth token with event:read + project:readbash
curl -fsSL https://composio.dev/install | bash
composio login
composio link sentry # 需具备event:read + project:read权限的认证令牌Discover Tools
探索工具
bash
composio search "get sentry issue" --toolkits sentry
composio search "list events for issue" --toolkits sentry
composio tools list sentryCommon slugs (verify with ):
--get-schemaSENTRY_GET_AN_ISSUESENTRY_LIST_AN_ISSUES_EVENTSSENTRY_RETRIEVE_AN_EVENT_FOR_A_PROJECTSENTRY_LIST_A_PROJECTS_ISSUESSENTRY_UPDATE_AN_ISSUE
bash
composio search "get sentry issue" --toolkits sentry
composio search "list events for issue" --toolkits sentry
composio tools list sentry常用标识(可通过验证):
--get-schemaSENTRY_GET_AN_ISSUESENTRY_LIST_AN_ISSUES_EVENTSSENTRY_RETRIEVE_AN_EVENT_FOR_A_PROJECTSENTRY_LIST_A_PROJECTS_ISSUESSENTRY_UPDATE_AN_ISSUE
Diagnose a Single Issue
诊断单个问题
- Fetch the issue (by short ID like or numeric ID):
PROJ-1F4bashcomposio execute SENTRY_GET_AN_ISSUE -d '{"issue_id":"PROJ-1F4"}' - Grab the latest event with full stack + breadcrumbs:
bash
composio execute SENTRY_LIST_AN_ISSUES_EVENTS \ -d '{"issue_id":"PROJ-1F4","full":true,"limit":1}' - Map each frame to local source. For each +
filenamein the stack, the agent opens the file and reads ±20 lines. No manual copy-paste.lineno - Check suspect commits (Sentry attaches these when release tracking is set up) — open them with locally.
git show <sha> - Propose a fix with a diff, run tests, and — once green — mark the issue resolved:
bash
composio execute SENTRY_UPDATE_AN_ISSUE \ -d '{"issue_id":"PROJ-1F4","status":"resolved","statusDetails":{"inNextRelease":true}}'
- 拉取问题(通过短ID如或数字ID):
PROJ-1F4bashcomposio execute SENTRY_GET_AN_ISSUE -d '{"issue_id":"PROJ-1F4"}' - 获取包含完整堆栈和面包屑的最新事件:
bash
composio execute SENTRY_LIST_AN_ISSUES_EVENTS \ -d '{"issue_id":"PROJ-1F4","full":true,"limit":1}' - 将每个栈帧映射到本地源码。针对堆栈中的每个+
filename,Agent会打开对应文件并读取前后20行内容,无需手动复制粘贴。lineno - 检查可疑提交(当启用版本跟踪时,Sentry会自动关联这些提交)——在本地使用查看详情。
git show <sha> - 提出修复方案并生成diff,运行测试,测试通过后标记问题已解决:
bash
composio execute SENTRY_UPDATE_AN_ISSUE \ -d '{"issue_id":"PROJ-1F4","status":"resolved","statusDetails":{"inNextRelease":true}}'
Triage a Batch
批量分诊
bash
composio execute SENTRY_LIST_A_PROJECTS_ISSUES -d '{
"organization_slug":"acme",
"project_slug":"api",
"query":"is:unresolved age:-24h",
"sort":"freq",
"limit":20
}'Pipe into for a ranked summary:
jqbash
composio execute SENTRY_LIST_A_PROJECTS_ISSUES -d '{"organization_slug":"acme","project_slug":"api","query":"is:unresolved"}' \
| jq -r '.[] | "\(.count)\t\(.shortId)\t\(.title)"' | sort -rn | headbash
composio execute SENTRY_LIST_A_PROJECTS_ISSUES -d '{
"organization_slug":"acme",
"project_slug":"api",
"query":"is:unresolved age:-24h",
"sort":"freq",
"limit":20
}'通过管道传递给生成排序后的摘要:
jqbash
composio execute SENTRY_LIST_A_PROJECTS_ISSUES -d '{"organization_slug":"acme","project_slug":"api","query":"is:unresolved"}' \
| jq -r '.[] | "\(.count)\t\(.shortId)\t\(.title)"' | sort -rn | headWorkflow File
工作流文件
scripts/sentry-diag.tscomposio run --file scripts/sentry-diag.ts -- --id PROJ-1F4ts
const id = process.argv[process.argv.indexOf("--id") + 1];
const issue = await execute("SENTRY_GET_AN_ISSUE", { issue_id: id });
const [event] = await execute("SENTRY_LIST_AN_ISSUES_EVENTS", {
issue_id: id, full: true, limit: 1
});
const frames = (event?.entries ?? [])
.filter(e => e.type === "exception")
.flatMap(e => e.data.values.flatMap(v => v.stacktrace?.frames ?? []))
.filter(f => f.inApp)
.map(f => ({ file: f.filename, line: f.lineno, fn: f.function }));
console.log(JSON.stringify({ title: issue.title, culprit: issue.culprit, frames }, null, 2));The agent then reads each at and drafts a patch.
fileline ± 20scripts/sentry-diag.tscomposio run --file scripts/sentry-diag.ts -- --id PROJ-1F4ts
const id = process.argv[process.argv.indexOf("--id") + 1];
const issue = await execute("SENTRY_GET_AN_ISSUE", { issue_id: id });
const [event] = await execute("SENTRY_LIST_AN_ISSUES_EVENTS", {
issue_id: id, full: true, limit: 1
});
const frames = (event?.entries ?? [])
.filter(e => e.type === "exception")
.flatMap(e => e.data.values.flatMap(v => v.stacktrace?.frames ?? []))
.filter(f => f.inApp)
.map(f => ({ file: f.filename, line: f.lineno, fn: f.function }));
console.log(JSON.stringify({ title: issue.title, culprit: issue.culprit, frames }, null, 2));随后Agent会读取每个中的内容并起草补丁。
fileline ± 20Route to Linear / Slack
同步至Linear / Slack
Chain tools to open a ticket for the top unresolved issue:
bash
composio run '
const [top] = await execute("SENTRY_LIST_A_PROJECTS_ISSUES", {
organization_slug: "acme", project_slug: "api",
query: "is:unresolved", sort: "freq", limit: 1
});
await execute("LINEAR_CREATE_ISSUE", {
teamId: "TEAM_ID",
title: `[Sentry] ${top.title}`,
description: `Short ID: ${top.shortId}\nPermalink: ${top.permalink}\nCount: ${top.count}`
});
'串联工具为排名靠前的未解决问题创建工单:
bash
composio run '
const [top] = await execute("SENTRY_LIST_A_PROJECTS_ISSUES", {
organization_slug: "acme", project_slug: "api",
query: "is:unresolved", sort: "freq", limit: 1
});
await execute("LINEAR_CREATE_ISSUE", {
teamId: "TEAM_ID",
title: `[Sentry] ${top.title}`,
description: `Short ID: ${top.shortId}\nPermalink: ${top.permalink}\nCount: ${top.count}`
});
'Troubleshooting
故障排除
- → use the short ID (
404 on issue_id), not the URL slug.PROJ-1F4 - Empty events → the issue was resolved/archived; query with or bump
query:"is:resolved".limit - Missing suspect commit → release tracking isn't configured in Sentry; set up in CI.
sentry-cli releases - No frames → source maps not uploaded; stack will only show vendor code.
inApp
Full CLI reference: docs.composio.dev/docs/cli
- → 使用短ID(
404 on issue_id),而非URL中的标识PROJ-1F4 - 事件为空 → 问题已被解决/归档;使用查询或增大
query:"is:resolved"值limit - 缺少可疑提交 → Sentry中未配置版本跟踪;在CI中设置
sentry-cli releases - 无栈帧 → 未上传源码映射;堆栈将仅显示第三方库代码
inApp
完整CLI参考文档:docs.composio.dev/docs/cli