mcpField
S
sentry-cli

sentry-cli

github.com/pedronauck云与 DevOps647225 次安装1 周前更新
代码仓库

关于 sentry-cli

sentry-cli 是一项指导 AI 编码 Agent 使用 Sentry 命令行的技能,侧重自动识别组织与项目,并通过专用命令和结构化输出开展调查与管理。

主要功能

  1. 01自动识别组织和项目
  2. 02调查问题、追踪、跨度和日志
  3. 03查询 Sentry 文档与架构
  4. 04JSON 输出与字段筛选
  5. 05管理发布、仪表板和 API

适用场景

  1. 01检查未解决的 Sentry 问题
  2. 02追踪性能并流式查看日志
  3. 03查询 Sentry SDK 配置指导
  4. 04创建发布或仪表板组件

安装

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

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

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

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
agent-conversation.md
alert.md
api.md
auth.md
build.md
cli.md
code-mappings.md
dart-symbol-map.md
dashboard.md
debug-files.md
docs.md
event.md
explore.md
feedback.md
info.md
init.md
issue.md
local.md
log.md
monitor.md
org.md
platform.md
proguard.md
project.md
react-native.md
release.md
replay.md
repo.md
schema.md
snapshots.md

详细介绍

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 为大多数任务提供了专用命令。手动构造 API 调用或获取外部文档之前,先尝试 sentry issue view、sentry issue list、sentry trace view 等命令。
  • 使用 sentry docs 解答设置问题——如果需要了解如何配置 Sentry SDK 或功能,请运行 sentry docs "your question" 直接查询文档。这比从外部获取文档更快、更准确。
  • 使用 sentry schema 探索 API——如果需要查找 API 端点,请运行 sentry schema 进行交互式浏览,或运行 sentry schema <resource> 进行搜索。这比从外部获取 OpenAPI 规范更快。
  • 使用 sentry issue view <id> 调查问题——有人询问特定问题(例如 CLI-G5、PROJECT-123)时,直接使用 sentry issue view。
  • 使用 --json 获取机器可读输出——可通过管道将输出传给 jq 进行筛选。人类可读输出包含不易解析的格式。
  • CLI 会自动检测组织/项目——不要自行查找——大多数命令无需明确指定目标,因为 CLI 会检查 .sentryclirc 配置文件、扫描 .env 文件和源代码中的 DSN,并匹配目录名称。不要运行 sentry org list,然后运行 sentry project list 来确定当前检出的代码属于哪个项目——这种手动逐项查找只是在重复 CLI 每次运行命令时已经执行的检测。只有在 CLI 报告无法检测目标或检测到错误目标时,才指定 <org>/<project>。
设计原则

sentry CLI 遵循知名工具的惯例——如果你熟悉这些工具,其用法也能直接迁移到这里:

  • gh(GitHub CLI)惯例:sentry CLI 使用相同的 <名词> <动词> 命令模式(例如 sentry issue list、sentry org view)。标志遵循 gh 惯例:使用 --json 获取机器可读输出,使用 --fields 选择特定字段,使用 -w/--web 在浏览器中打开,使用 -q/--query 进行筛选,使用 -n/--limit 限制结果数量。
  • sentry api 模仿 curl:sentry api 命令提供直接访问 API 的功能,接口类似 curl——使用 --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,而非手动列出并筛选
  • 对于专用命令未覆盖的端点,使用 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}'
探索 Trace 和性能
# 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。
任意 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 Trace 表格

通用仪表板请使用 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...
列出跟踪中的跨度

将跟踪 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。

常见错误
  • Issue 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 仓库,以发现源远程 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

命令参考

身份验证

通过 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

组织

管理 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 <args...> — 发送 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 <org> — 创建指标警报规则
  • 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

Code-mappings

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

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

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

Agent-conversation

列出并查看 Agent 对话

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

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

Dart-symbol-map

使用 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 sourcemaps

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

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

Replay

搜索并检查 Session Replays

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

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

发布

管理 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

仓库

管理 Sentry 仓库

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

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

团队

管理 Sentry 团队

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

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

探索

查询聚合事件数据(Explore)

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

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

反馈

搜索和检查 User Feedback

  • sentry feedback list <org/project> — 列出并搜索 User Feedback
  • sentry feedback view <feedback> — 查看一条 User 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

源码映射

管理源码映射

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

→ 完整标志和示例: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

架构

浏览 Sentry API 架构

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

→ 完整的标志和示例:references/schema.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