sentry-triage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sentry 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:read
bash
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 sentry
Common slugs (verify with
--get-schema
):
  • SENTRY_GET_AN_ISSUE
  • SENTRY_LIST_AN_ISSUES_EVENTS
  • SENTRY_RETRIEVE_AN_EVENT_FOR_A_PROJECT
  • SENTRY_LIST_A_PROJECTS_ISSUES
  • SENTRY_UPDATE_AN_ISSUE
bash
composio search "get sentry issue" --toolkits sentry
composio search "list events for issue" --toolkits sentry
composio tools list sentry
常用标识(可通过
--get-schema
验证):
  • SENTRY_GET_AN_ISSUE
  • SENTRY_LIST_AN_ISSUES_EVENTS
  • SENTRY_RETRIEVE_AN_EVENT_FOR_A_PROJECT
  • SENTRY_LIST_A_PROJECTS_ISSUES
  • SENTRY_UPDATE_AN_ISSUE

Diagnose a Single Issue

诊断单个问题

  1. Fetch the issue (by short ID like
    PROJ-1F4
    or numeric ID):
    bash
    composio execute SENTRY_GET_AN_ISSUE -d '{"issue_id":"PROJ-1F4"}'
  2. 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}'
  3. Map each frame to local source. For each
    filename
    +
    lineno
    in the stack, the agent opens the file and reads ±20 lines. No manual copy-paste.
  4. Check suspect commits (Sentry attaches these when release tracking is set up) — open them with
    git show <sha>
    locally.
  5. 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}}'
  1. 拉取问题(通过短ID如
    PROJ-1F4
    或数字ID):
    bash
    composio execute SENTRY_GET_AN_ISSUE -d '{"issue_id":"PROJ-1F4"}'
  2. 获取包含完整堆栈和面包屑的最新事件
    bash
    composio execute SENTRY_LIST_AN_ISSUES_EVENTS \
      -d '{"issue_id":"PROJ-1F4","full":true,"limit":1}'
  3. 将每个栈帧映射到本地源码。针对堆栈中的每个
    filename
    +
    lineno
    ,Agent会打开对应文件并读取前后20行内容,无需手动复制粘贴。
  4. 检查可疑提交(当启用版本跟踪时,Sentry会自动关联这些提交)——在本地使用
    git show <sha>
    查看详情。
  5. 提出修复方案并生成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
jq
for a ranked summary:
bash
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 | head
bash
composio execute SENTRY_LIST_A_PROJECTS_ISSUES -d '{
  "organization_slug":"acme",
  "project_slug":"api",
  "query":"is:unresolved age:-24h",
  "sort":"freq",
  "limit":20
}'
通过管道传递给
jq
生成排序后的摘要:
bash
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 | head

Workflow File

工作流文件

scripts/sentry-diag.ts
, run with
composio run --file scripts/sentry-diag.ts -- --id PROJ-1F4
:
ts
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
file
at
line ± 20
and drafts a patch.
scripts/sentry-diag.ts
,运行方式:
composio run --file scripts/sentry-diag.ts -- --id PROJ-1F4
ts
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会读取每个
file
line ± 20
的内容并起草补丁。

Route 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

故障排除

  • 404 on issue_id
    → use the short ID (
    PROJ-1F4
    ), not the URL slug.
  • Empty events → the issue was resolved/archived; query with
    query:"is:resolved"
    or bump
    limit
    .
  • Missing suspect commit → release tracking isn't configured in Sentry; set up
    sentry-cli releases
    in CI.
  • No
    inApp
    frames
    → source maps not uploaded; stack will only show vendor code.
Full CLI reference: docs.composio.dev/docs/cli
  • 404 on issue_id
    → 使用短ID(
    PROJ-1F4
    ),而非URL中的标识
  • 事件为空 → 问题已被解决/归档;使用
    query:"is:resolved"
    查询或增大
    limit
  • 缺少可疑提交 → Sentry中未配置版本跟踪;在CI中设置
    sentry-cli releases
  • inApp
    栈帧
    → 未上传源码映射;堆栈将仅显示第三方库代码
完整CLI参考文档:docs.composio.dev/docs/cli