mcpField
S
sentry-cli

sentry-cli

sentry安全0175.7k 次安装
代码仓库

关于 sentry-cli

sentry-cli 是一项使用指南技能,帮助编码 Agent 通过 `sentry` 命令行操作 Sentry,涵盖问题与 Trace 排查、文档和 API Schema 查询,并说明上下文识别及破坏性操作确认等注意事项。

主要功能

  1. 01Sentry 命令行操作指南
  2. 02自动识别组织和项目
  3. 03问题与 Trace 排查流程
  4. 04JSON 输出与字段筛选
  5. 05破坏性操作安全指引

适用场景

  1. 01查看指定的 Sentry 问题
  2. 02探索 Trace 和性能数据
  3. 03查询 Sentry 文档或 API Schema
  4. 04检查日志和服务状态

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/sentry/dev --skill sentry-cli

安装后在 Claude Code 中输入/sentry-cli确认已加载。

详细介绍

Sentry CLI 使用指南

使用 sentry CLI 帮助用户通过命令行与 Sentry 交互。

Agent 的核心规则:直接运行命令。 sentry CLI 会自动检测你的组织和项目(从 .sentryclirc、.env/源代码中的 DSN 以及目录名称检测),因此不要先列出组织,再列出其项目,以确定此检出目录对应哪个项目——这种手动查找只会重复 CLI 在每条命令中已经完成的工作。只有当 CLI 报告无法检测目标,或选择了错误的目标时,才传入明确的 <org>/<project>。

Agent 指南

AI 编码 Agent 使用 Sentry CLI 的最佳实践和操作指南。

核心原则
  • 直接运行命令——CLI 会自动处理身份验证和组织/项目检测。运行命令前不要预先验证身份或查找组织/项目。如有需要,CLI 会提示登录。
  • 优先使用 CLI 命令,而非直接调用 API——CLI 为大多数任务提供了专用命令。请先使用 sentry issue view、sentry issue list、sentry trace view 等命令,再考虑手动构造 API 调用或获取外部文档。
  • 使用 sentry docs 解答配置问题——如果你需要了解如何配置 Sentry SDK 或某项功能,请运行 sentry docs "your question" 直接查询文档。这比从外部获取文档更快、更准确。
  • 使用 sentry schema 探索 API——如果你需要查找 API 端点,请运行 sentry schema 进行交互式浏览,或运行 sentry schema <resource> 进行搜索。这比从外部获取 OpenAPI 规范更快。
  • 使用 sentry issue view 调查问题——有人询问特定问题时(例如 CLI-G5、PROJECT-123),请直接使用 sentry issue view。一次调用中可以传入多个 ID:sentry issue view A B C --json 会返回相同对象组成的数组。
  • 使用 --json 获取机器可读的输出——通过 jq 管道进行筛选。人类可读的输出包含难以解析的格式。
  • CLI 会自动检测组织/项目——不要自行查找——大多数命令无需明确指定目标,会检查 .sentryclirc 配置文件、扫描 .env 文件和源代码中的 DSN,并匹配目录名称。不要运行 sentry org list,再运行 sentry project list 来确定此检出目录所属的项目——这种手动逐级查找只是在重复 CLI 每条命令中已经执行的检测。只有当 CLI 报告无法检测目标,或检测到错误目标时,才指定 <org>/<project>。
设计原则

sentry CLI 遵循知名工具的惯例——如果你熟悉这些工具,就可以直接沿用相关经验:

  • gh(GitHub CLI)惯例:sentry CLI 使用相同的 <noun> <verb> 命令模式(例如 sentry issue list、sentry org view)。标志遵循 gh 的惯例:使用 --json 获取机器可读的输出,使用 --fields 选择特定字段,使用 -w/--web 在浏览器中打开,使用 -q/--query 进行筛选,使用 -n/--limit 限制结果数量。
  • sentry api 模仿 curl:sentry api 命令提供类似 curl 的直接 API 访问接口——使用 --method 指定 HTTP 方法,使用 --data 指定请求正文,使用 --header 指定自定义标头。它会自动处理身份验证。如果你知道如何使用 curl 调用 REST API,就可以沿用相同的模式。
上下文窗口提示
  • 使用 --json --fields 选择特定字段并减少输出大小。运行 <command> --help 查看可用字段。示例:sentry issue list --json --fields shortId,title,priority,level,status
  • 在命令之间传递输出或以编程方式处理输出时,使用 --json
  • 使用 --limit 限制结果数量(默认通常为 10–100)
  • 优先使用 sentry issue view PROJECT-123,而不是手动列出并筛选
  • 在一次调用中传入多个问题 ID(sentry issue view A B C --json),而不是针对每个 ID 循环调用 issue view
  • 在一次调用中分析多个问题(sentry issue explain A B C --json),而不是针对每个 ID 循环调用 issue explain
  • 对于专用命令未覆盖的端点,使用 sentry api
安全规则
  • 运行破坏性命令前,务必先向用户确认:project delete、trial start
  • 对于变更操作,继续进行后续更改前,先确认命令输出中的组织/项目上下文正确
  • 切勿存储或记录身份验证令牌 — CLI 会自动管理凭据
  • 如果 CLI 报告的组织/项目不正确,请使用显式的 <org>/<project> 参数覆盖
退出代码

CLI 使用语义化退出代码。面向 Agent 的关键范围如下:

范围含义Agent 操作
0成功正常继续
10–19身份验证错误提示用户运行 sentry auth login
20–29输入错误检查命令参数并重试
30–39API 错误重试或报告给用户
40–49功能不可用告知用户相关计划/设置
50–59操作错误报告给用户
60–69命令特定错误查看 stderr 获取详情

完整参考请参阅退出代码。

工作流模式
调查问题
# 1. Find the issue (auto-detects org/project from DSN or config)
sentry issue list --query "is:unresolved" --limit 5

# 2. Get details. For agents, prefer --json — it includes the full issue plus
# the latest event under `event`, so you get everything in one call.
sentry issue view PROJECT-123 --json

# 3. Get AI root cause analysis
sentry issue explain PROJECT-123

# 4. Get a fix plan
sentry issue plan PROJECT-123

sentry issue view <SHORT-ID> --json 是让 Agent 快速了解问题的最快方式。使用 --fields 仅选择所需字段,而不是获取整个负载 — 最新事件的 request 条目可能包含实时会话数据(Cookie、标头、正文),因此应提取指定字段,而不是转储整个对象:

# Top-level issue fields
sentry issue view PROJECT-123 --json --fields shortId,title,culprit,count,userCount,permalink

# Named fields from the latest event — avoids pulling the full request/session blob
sentry issue view PROJECT-123 --json --fields event.id,event.title,event.dateCreated

# Just the request URL and method (not the whole request entry). Event data
# lives under event.entries[], each tagged with a `type` and `data` payload.
sentry issue view PROJECT-123 --json | jq '.event.entries[] | select(.type == "request") | .data | {url, method}'
探索跟踪和性能
# 1. List recent traces (auto-detects org/project)
sentry trace list --limit 5

# 2. View a specific trace with span tree
sentry trace view abc123def456...

# 3. View spans for a trace
sentry span list abc123def456...

# 4. View logs associated with a trace
sentry trace logs abc123def456...
流式传输日志
# Stream logs in real-time (auto-detects org/project)
sentry log list --follow

# Filter logs by severity
sentry log list --query "severity:error"
在本地捕获事件(Spotlight)
# Run the app with the local server auto-enabled; tail errors/traces/logs.
# No DSN needed — with no DSN, events go ONLY to the local server (nothing
# reaches the user's Sentry org, no production quota). With a DSN set, the
# SDK sends to both.
sentry local run -- npm run dev          # or: python manage.py runserver, etc.

# From a CLI source checkout, run the Local UI in a second terminal, then open it.
pnpm --filter local dev
sentry local run --open -- npm run dev

# Watch only AI/agent (gen_ai, mcp) spans while iterating on an agent.
sentry local -f ai

# Server-side SDKs read SENTRY_SPOTLIGHT automatically. The CLI also injects
# the URL under every framework client prefix (NEXT_PUBLIC_, VITE_, PUBLIC_,
# NUXT_PUBLIC_, REACT_APP_, VUE_APP_, GATSBY_). Until the browser SDK reads
# these automatically (getsentry/sentry-javascript#18198), reference the var
# matching your framework in the client config:
# Sentry.init({ spotlight: process.env.NEXT_PUBLIC_SENTRY_SPOTLIGHT ?? false })
查询 Sentry 文档
# Ask a documentation question
sentry docs "How do I configure tracing in Next.js?"

# Search the documentation index
sentry docs list "source maps"
检查 Sentry 服务状态
# Show current status of Sentry services
sentry status

# Machine-readable status
sentry status --json
探索 API 架构
# Browse all API resource categories
sentry schema

# Search for endpoints related to a resource
sentry schema issues

# Get details about a specific endpoint
sentry schema "GET /api/0/organizations/{organization_id_or_slug}/issues/"
管理版本发布
# Create a release — version must match Sentry.init({ release }) exactly
sentry release create my-org/1.0.0 --project my-project

# Associate commits via repository integration (needs local git checkout)
sentry release set-commits my-org/1.0.0 --auto

# Or read commits from local git history (no integration needed)
sentry release set-commits my-org/1.0.0 --local

# Mark the release as finalized
sentry release finalize my-org/1.0.0

# Record a production deploy
sentry release deploy my-org/1.0.0 production

重要细节:

  • 位置参数为 <org-slug>/<version>。在 sentry release create sentry/1.0.0 中,sentry 是组织,1.0.0 是版本 — 斜杠用于分隔组织和版本,并非版本字符串的一部分。
  • 版本必须与 Sentry.init() 中的 release 值一致。如果 SDK 使用 "1.0.0",命令就必须使用 org/1.0.0。
  • --auto 需要 Sentry 仓库集成(GitHub/GitLab/Bitbucket)以及本地 git 工作副本。它会将你的 origin 远程仓库与 Sentry 的仓库列表进行匹配。没有工作副本时,请使用 --local。
  • 未指定标志时,set-commits 会先尝试 --auto,失败后再回退到 --local。
查看 Agent 对话
# List recent agent conversations (org auto-detected)
sentry agent-conversation list

# Explicit org, last 24 hours
sentry agent-conversation list my-org --period 24h

# View a conversation transcript
sentry agent-conversation view my-org/conv-123

# JSON output for programmatic access
sentry agent-conversation view conv-123 --json
处理 WebAssembly 模块
# Add a build id to a wasm module (no auth required)
sentry wasm-split app.wasm

# Capture the build id for a later debug-files upload
BUILD_ID=$(sentry wasm-split app.wasm)

# Split debug data into a companion and strip the shipped binary
sentry wasm-split app.wasm --debug-out app.debug.wasm --strip
任意 API 访问
# GET request (default)
sentry api /api/0/organizations/my-org/

# POST request with data
sentry api /api/0/organizations/my-org/projects/ --method POST --data '{"name":"new-project","platform":"python"}'
仪表盘布局

Sentry 仪表盘使用 6 列网格。添加组件时,尽量填满整行(宽度总和应为 6)。

显示类型的默认尺寸:

显示类型宽度高度类别备注
big_number21common紧凑型 KPI — 每行放置 3 个(2+2+2=6)
line32common半宽图表 — 每行放置 2 个(3+3=6)
area32common半宽图表 — 每行放置 2 个
bar32common半宽图表 — 每行放置 2 个
table62common全宽 — 始终独占一行
stacked_area32specialized堆叠面积图
top_n32specializedTop N 排名列表
categorical_bar32specialized分类柱状图
text32specialized静态文本/Markdown 组件
details32internal详情视图
wheel32internal饼图/轮形图
rage_and_dead_clicks32internal愤怒点击/无效点击可视化
server_tree32internal层级树视图
agents_traces_table32internalAgent 追踪表格

通用仪表盘使用 common 类型。仅在有明确要求时使用 specialized 类型。除非用户明确要求,否则避免使用 internal 类型。

可用数据集:spans(默认)、errors、metrics、issue、logs。运行 sentry dashboard widget --help 查看数据集说明、查询格式和示例。

填满整行的示例:

# 3 KPIs filling one row (2+2+2 = 6)
sentry dashboard widget add <dashboard> "Error Count" --display big_number --query count
sentry dashboard widget add <dashboard> "P95 Duration" --display big_number --query p95:span.duration
sentry dashboard widget add <dashboard> "Throughput" --display big_number --query epm

# 2 charts filling one row (3+3 = 6)
sentry dashboard widget add <dashboard> "Errors Over Time" --display line --query count
sentry dashboard widget add <dashboard> "Latency Over Time" --display line --query p95:span.duration

# Full-width table (6 = 6)
sentry dashboard widget add <dashboard> "Top Endpoints" --display table \
  --query count --query p95:span.duration \
  --group-by transaction --sort -count --limit 10
快速参考
时间筛选

使用 --period(别名:-t)按时间范围筛选:

sentry trace list --period 1h
sentry span list --period 24h
sentry span list -t 7d
指定组织或项目

组织和项目是遵循 gh CLI 约定的位置参数:

sentry trace list my-org/my-project
sentry issue list my-org/my-project
sentry span list my-org/my-project/abc123def456...
列出追踪中的 spans

将追踪 ID 作为位置参数传递给 span list:

sentry span list abc123def456...
sentry span list my-org/my-project/abc123def456...
Events API 的数据集名称

查询 Events API(直接查询或通过 sentry api 查询)时,有效的数据集值为:spans、logs、errors、tracemetrics、profile_functions 和 uptime_results。

常见错误
  • 问题 ID 格式错误:使用 PROJECT-123(短 ID),而非数字 ID 123456789。短 ID 包含项目前缀。
  • 不必要地提前进行身份验证:不要在每条命令之前运行 sentry auth login。CLI 会检测身份验证是否缺失或已过期,并自动提示。只有在需要切换账户时,才运行 sentry auth login。
  • 管道操作时缺少 --json:人类可读的输出包含格式化内容。以编程方式解析输出时,请使用 --json。
  • 不需要时仍指定组织/项目:自动检测会从 .sentryclirc 配置文件、DSN、环境变量和目录名称中解析组织/项目。先让它自动处理——只有在 CLI 提示无法检测目标,或检测到错误目标时,才添加 <org>/<project>。
  • 运行命令前手动查找项目:不要先列出所属组织,再列出每个组织中的所有项目,以便将本地检出内容与项目匹配——CLI 在每条命令中已经会在内部完成相同的解析。跳过逐一查找,直接运行命令;只有在输出显示组织/项目错误时,才更正目标。
  • 混淆 --query 语法:--query 标志使用 Sentry 搜索语法(例如 is:unresolved、assigned:me),而非自由文本搜索。
  • 未使用 --web:查看命令支持 -w/--web,可在浏览器中打开资源,便于分享链接。
  • 获取 API 架构,而不使用 CLI:优先使用 sentry schema 浏览 API,并使用 sentry api 发出请求——CLI 会处理身份验证和端点解析,因此通常无需单独下载 OpenAPI 规范。
  • 从外部获取 Sentry 文档:使用 sentry docs "your question" 通过 CLI 查询 Sentry 文档——该命令会返回简明答案和来源链接,无需获取或解析文档页面。
  • 发布版本不匹配:位置参数 org/version 的格式为 <org-slug>/<version>,其中 org/ 是组织,而非版本的一部分。sentry release create sentry/1.0.0 会在组织 sentry 中创建版本 1.0.0。如果你的 Sentry.init() 使用 release: "1.0.0",这样就是正确的。不要重复添加前缀,例如 sentry/myapp/1.0.0。
  • 没有 Git 检出内容时运行 set-commits --auto:--auto 需要本地 Git 仓库,才能发现 origin 远程 URL 和 HEAD 提交。在 CI 中,确保在运行 set-commits --auto 前先运行带有 fetch-depth: 0 的 actions/checkout。
  • CLI 命令足以满足需求时仍使用 sentry api:sentry issue list --json 和 sentry issue view --json 已在顶层包含 shortId、title、count、userCount、priority、level、status、permalink 等字段。使用 --fields 选择 count 或 userCount 等特定字段时,CLI 会自动确保这些字段出现在 API 响应中。使用 --fields 选择特定字段,并通过 --help 查看所有可用字段。只有 CLI 未公开的数据才使用 sentry api。

前置条件

使用前必须安装 CLI 并完成身份验证。

安装
curl https://cli.sentry.dev/install -fsS | bash
curl https://cli.sentry.dev/install -fsS | bash -s -- --version nightly

# Or install via npm/pnpm/bun
npm install -g sentry
身份验证
sentry auth
sentry auth --token YOUR_SENTRY_API_TOKEN
sentry auth status
sentry auth logout

命令参考

Auth

通过 Sentry 进行身份验证

  • sentry auth login — 通过 Sentry 进行身份验证
  • sentry auth logout — 退出 Sentry
  • sentry auth refresh — 刷新 OAuth 访问令牌
  • sentry auth status — 查看身份验证状态
  • sentry auth token — 打印已存储的身份验证令牌
  • sentry auth whoami — 显示当前已验证的身份

→ 完整标志和示例:references/auth.md

Org

管理 Sentry 组织

  • sentry org list — 列出组织
  • sentry org view <org> — 查看组织详情

→ 完整标志和示例:references/org.md

项目

处理 Sentry 项目

  • sentry project create [<org>/]<name>:<platform>... — 创建一个或多个项目
  • sentry project delete <org/project> — 删除项目
  • sentry project list <org/project> — 列出项目
  • sentry project view <org/project> — 查看项目详情

→ 完整标志和示例:references/project.md

问题

管理 Sentry 问题

  • sentry issue list <org/project> — 列出项目中的问题
  • sentry issue events <issue> — 列出特定问题的事件
  • sentry issue explain <issue...> — 使用 Seer AI 分析一个或多个问题
  • sentry issue plan <issue> — 使用 Seer AI 生成解决方案计划
  • sentry issue view <issue...> — 查看一个或多个问题的详情
  • sentry issue resolve <issue> — 将问题标记为已解决
  • sentry issue unresolve <issue> — 重新打开已解决的问题
  • sentry issue archive <issue> — 归档(忽略)问题
  • sentry issue merge <issue...> — 将 2 个或更多问题合并为一个规范组

→ 完整标志和示例:references/issue.md

事件

查看、列出和发送 Sentry 事件

  • sentry event view <org/project/event-id...> — 查看一个或多个事件的详情
  • sentry event list <issue> — 列出问题的事件
  • sentry event send <target-or-file...> — 发送 Sentry 事件

→ 完整标志和示例:references/event.md

API

发起经过身份验证的 API 请求

  • sentry api <endpoint> — 发起经过身份验证的 API 请求

→ 完整标志和示例:references/api.md

告警

管理 Sentry 告警规则

  • sentry alert issues list <org/project> — 列出问题告警规则
  • sentry alert issues view <org/project/rule-id-or-name> — 查看问题告警规则
  • sentry alert issues create <target> — 创建问题告警规则
  • sentry alert issues delete <org/project/rule-id-or-name> — 删除问题告警规则
  • sentry alert issues edit <org/project/rule-id-or-name> — 编辑问题告警规则
  • sentry alert metrics list <target> — 列出指标告警规则
  • sentry alert metrics view <org/rule-id-or-name> — 查看指标告警规则
  • sentry alert metrics create <target> — 创建指标告警规则
  • sentry alert metrics delete <org/rule-id-or-name> — 删除指标告警规则
  • sentry alert metrics edit <org/rule-id-or-name> — 编辑指标告警规则

→ 完整标志和示例:references/alert.md

构建

管理移动端构建产物

  • sentry build upload <path...> — 将构建上传到项目
  • sentry build download <build-id> — 下载构建产物

→ 完整标志和示例:references/build.md

CLI

与 CLI 相关的命令

  • sentry cli completion <shell> — 输出 shell 补全脚本
  • sentry cli defaults <key value...> — 查看和管理默认设置
  • sentry cli feedback <message...> — 发送关于 CLI 的反馈
  • sentry cli fix — 诊断并修复 CLI 数据库问题
  • sentry cli import — 从旧版 .sentryclirc 文件导入设置
  • sentry cli setup — 配置 shell 集成
  • sentry cli uninstall — 卸载 Sentry CLI
  • sentry cli upgrade <version> — 将 Sentry CLI 更新到最新版本

→ 完整标志和示例:references/cli.md

代码映射

管理用于堆栈跟踪链接的代码映射

  • sentry code-mappings upload <path> — 上传用于堆栈跟踪链接的代码映射

→ 完整标志和示例:references/code-mappings.md

Agent 对话

列出和查看 Agent 对话

  • sentry agent-conversation list <org> — 列出最近的 Agent 对话
  • sentry agent-conversation view <org/conversation-id> — 查看 Agent 对话记录

→ 完整标志和示例:references/agent-conversation.md

Dart 符号映射

处理 Dart/Flutter 符号映射

  • sentry dart-symbol-map upload <path> — 将 Dart/Flutter 符号映射上传到 Sentry

→ 完整标志和示例:references/dart-symbol-map.md

Debug-files

处理调试信息文件

  • sentry debug-files check <path> — 检查调试信息文件
  • sentry debug-files find <id...> — 查找指定调试标识符对应的调试文件
  • sentry debug-files upload <path...> — 将调试信息文件上传到 Sentry
  • sentry debug-files print-sources <path> — 列出调试文件引用的源文件
  • sentry debug-files bundle-sources <path> — 将调试文件的源文件打包,以提供源代码上下文
  • sentry debug-files bundle-jvm <path> — 创建 JVM 源代码包,以提供源代码上下文

→ 完整的标志和示例:references/debug-files.md

Dashboard

管理 Sentry 仪表板

  • sentry dashboard list <org/title-filter...> — 列出仪表板
  • sentry dashboard view <org/project/dashboard...> — 查看仪表板
  • sentry dashboard create <org/project/title...> — 创建仪表板
  • sentry dashboard widget add <org/project/dashboard/title...> — 向仪表板添加组件
  • sentry dashboard widget edit <org/project/dashboard...> — 编辑仪表板中的组件
  • sentry dashboard widget delete <org/project/dashboard...> — 删除仪表板中的组件
  • sentry dashboard revisions <org/dashboard...> — 列出仪表板修订版本
  • sentry dashboard restore <org/dashboard...> — 恢复仪表板修订版本

→ 完整的标志和示例:references/dashboard.md

Docs

搜索和查询最新的 Sentry 文档

  • sentry docs list <keywords...> — 按关键词查找 Sentry 文档页面
  • sentry docs query <question...> — 提出有关 Sentry 文档的问题并获取带引用的回答

→ 完整的标志和示例:references/docs.md

Platform

列出有效的 Sentry 平台标识符

  • sentry platform list — 列出所有有效的 Sentry 平台标识符

→ 完整的标志和示例:references/platform.md

Proguard

处理 ProGuard/R8 映射文件

  • sentry proguard upload <path...> — 将 ProGuard/R8 映射文件上传到 Sentry
  • sentry proguard uuid <path> — 计算 ProGuard 映射文件的 UUID

→ 完整的标志和示例:references/proguard.md

React-native

在构建步骤中上传 React Native 源码映射

  • sentry react-native gradle — 上传 React Native bundle 和源码映射(Gradle 构建步骤)
  • sentry react-native xcode <script-arg...> — 上传 React Native 源码映射(Xcode 构建步骤)

→ 完整的标志和示例:references/react-native.md

Replay

搜索和检查 Session Replay

  • sentry replay list <org/project> — 列出近期的 Session Replay
  • sentry replay view <replay-id-or-url...> — 查看 Session Replay

→ 完整的标志和示例:references/replay.md

Release

处理 Sentry 发布版本

  • sentry release list <org/project> — 列出发布版本及其采用率和健康指标
  • sentry release view <org/version> — 查看发布版本详情及其健康指标
  • sentry release create <org/version> — 创建发布版本
  • sentry release finalize <org/version> — 完成发布版本
  • sentry release delete <org/version> — 删除发布版本
  • sentry release archive <org/version> — 归档发布版本
  • sentry release restore <org/version> — 恢复已归档的发布版本
  • sentry release deploy <org/version> <environment> <name> — 为发布版本创建部署
  • sentry release deploys <org/version> — 列出发布版本的部署
  • sentry release set-commits <org/version> — 设置发布版本的提交
  • sentry release propose-version — 提议发布版本号

→ 完整的标志和示例:references/release.md

Repo

处理 Sentry 仓库

  • sentry repo list <org/project> — 列出仓库

→ 完整的标志和示例:references/repo.md

Team

处理 Sentry 团队

  • sentry team list <org/project> — 列出团队

→ 完整的标志和示例:references/team.md

Explore

查询聚合事件数据(Explore)

  • sentry explore <target> — 查询聚合事件数据(Explore)

→ 完整的标志和示例:references/explore.md

反馈

搜索和查看用户反馈

  • sentry feedback list <org/project> — 列出并搜索用户反馈
  • sentry feedback view <feedback> — 查看一条用户反馈

→ 完整标志和示例:references/feedback.md

日志

查看 Sentry 日志

  • sentry log list <org/project-or-trace-id...> — 列出项目中的日志
  • sentry log view <org/project/log-id...> — 查看一条或多条日志条目的详细信息

→ 完整标志和示例:references/log.md

监控

使用 Sentry cron 监控器

  • sentry monitor run <monitor-slug command...> — 使用 cron 监控器签入来包装命令
  • sentry monitor list <org/project> — 列出 cron 监控器

→ 完整标志和示例:references/monitor.md

快照

管理和比较快照

  • sentry snapshots diff <base-dir> <head-dir> — 比较两个目录中的快照图像
  • sentry snapshots download — 下载基线快照图像
  • sentry snapshots upload <path> — 将快照上传到项目

→ 完整标志和示例:references/snapshots.md

Sourcemap

管理 sourcemap

  • sentry sourcemap inject <directory> — 将调试 ID 注入 JavaScript 文件和 sourcemap
  • sentry sourcemap upload <directory> — 将 sourcemap 上传到 Sentry
  • sentry sourcemap resolve <directory> — 解析并报告 JavaScript 文件的 sourcemap 关联情况

→ 完整标志和示例:references/sourcemap.md

Span

列出并查看项目或跟踪中的 Span

  • sentry span list <org/project/trace-id...> — 列出项目或跟踪中的 Span
  • sentry span view <trace-id/span-id...> — 查看指定 Span 的详细信息

→ 完整标志和示例:references/span.md

状态

检查 Sentry 服务状态

  • sentry status show — 显示 Sentry 服务状态

→ 完整标志和示例:references/status.md

跟踪

查看分布式跟踪

  • sentry trace list <org/project> — 列出项目中的近期跟踪
  • sentry trace view <org/project/trace-id...> — 查看指定跟踪的详细信息
  • sentry trace logs <org/project/trace-id...> — 查看与跟踪关联的日志

→ 完整标志和示例:references/trace.md

试用

管理产品试用

  • sentry trial list <org> — 列出产品试用
  • sentry trial start <name> <org> — 开始产品试用

→ 完整标志和示例:references/trial.md

初始化

在项目中初始化 Sentry(实验性)

  • sentry init <target> <directory> — 在项目中初始化 Sentry(实验性)

→ 完整标志和示例:references/init.md

信息

打印配置并验证身份验证

  • sentry info — 打印配置并验证身份验证

→ 完整标志和示例:references/info.md

本地

用于本地开发的 Sentry

  • sentry local serve — 启动本地开发服务器并持续输出事件
  • sentry local run <command...> — 在启用本地开发服务器的情况下运行命令

→ 完整标志和示例:references/local.md

Schema

浏览 Sentry API Schema

  • sentry schema <resource...> — 浏览 Sentry API Schema

→ 完整标志和示例:references/schema.md

Wasm-split

为 WebAssembly 模块添加构建 ID 并拆分调试数据

  • sentry wasm-split <input> — 为 WebAssembly 模块添加构建 ID 并拆分调试数据

→ 完整标志和示例:references/wasm-split.md

全局选项

所有命令均支持以下全局选项:

  • --help - 显示命令的帮助信息
  • --version - 显示 CLI 版本
  • --log-level <level> - 设置日志详细程度(error、warn、log、info、debug、trace)。覆盖 SENTRY_LOG_LEVEL
  • --verbose - --log-level debug 的简写

输出格式

JSON 输出

大多数列表和查看命令都支持使用 --json 标志输出 JSON,便于与其他工具集成:

sentry org list --json | jq '.[] | .slug'
在浏览器中打开

查看命令支持使用 -w 或 --web 标志在浏览器中打开资源:

sentry issue view PROJ-123 -w

评论

支持 Markdown