文档

OpenErrorAPI 使用 Sentry 线路协议,因此你可以保留已在使用的官方 SDK,只需更改一行:DSN。本页说明如何操作,以及同样重要的 — 我们不支持哪些功能。

10 分钟内从 Sentry 切换

无需替换 SDK,无需重写代码。只需将你现有的 SDK 指向不同的 DSN。

  1. 1

    在控制台中创建项目。你会获得一个形如 https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID 的 DSN。

  2. 2

    替换现有 Sentry.init() 中的 DSN——通常只是一个环境变量。保持 SDK、版本和你已设置的所有选项不变。

  3. 3

    部署并触发一个错误。它会在一秒内显示在控制台中,分组方式与 Sentry 中相同。

PHP

composer require sentry/sentry
\Sentry\init(['dsn' => 'https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID']);

JavaScript / TypeScript

npm i @sentry/browser
Sentry.init({ dsn: 'https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID' });

Node.js

npm i @sentry/node
Sentry.init({ dsn: 'https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID' });

Python

pip install sentry-sdk
sentry_sdk.init(dsn="https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID")

Go

go get github.com/getsentry/sentry-go
sentry.Init(sentry.ClientOptions{Dsn: "https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID"})

Dart / Flutter

flutter pub add sentry_flutter
await SentryFlutter.init((o) => o.dsn = 'https://PUBLIC_KEY@openerrorapi.com/PROJECT_ID');

已在使用 sentry-cli 上传 source maps?保留该步骤——将 SENTRY_URL 设为 https://openerrorapi.com 并使用上传令牌作为 SENTRY_AUTH_TOKEN。

Sentry 兼容性,如实说明

兼容性是全部承诺,这使得它成为最不能夸大的事情。此表格由代码和机器可读文档使用的同一来源生成,因此不会悄悄偏离实际情况。

7 个区域完全支持 · 3 个部分支持 · 3 个不支持。

区域 状态 详情
Envelope ingest (/api/{id}/envelope/) 支持 The modern endpoint every current SDK uses. Gzip/deflate bodies, multiple items per envelope, all three auth methods (X-Sentry-Auth header, querystring, envelope dsn header).
Store ingest (/api/{id}/store/) 支持 Legacy endpoint for older SDKs. Same processing pipeline as envelopes.
Error events & grouping 支持 Exceptions, messages, stack traces, tags, user, contexts, breadcrumbs, request. Grouping by fingerprint with an explicit `fingerprint[]` override.
Sessions / release health 支持 Session envelope items are processed; crash-free sessions and users are shown per release. Available from the Team plan.
Security reports (CSP) 支持 CSP violation reports are stored and grouped like any other issue. Point report-uri at /api/{project_id}/security/?sentry_key={PUBLIC_KEY} — the browser cannot send headers, so the key goes in the URL. Both the classic csp-report body and the Reporting API array are accepted.
Source maps 支持 Upload via our API, from the console, or with sentry-cli. Frames are de-minified on read, so uploading a map fixes old events too.
sentry-cli 部分支持 Releases (new / finalize / set-commits) and source-map upload work unchanged. Chunked upload is not implemented — sentry-cli detects that and falls back to the regular upload automatically.
User feedback widget 支持 Embeddable widget; reports land next to the errors they belong to.
Transactions / performance 部分支持 Transaction envelope items are accepted so SDKs do not error, but we do not build a performance product on top of them. If you need distributed tracing, keep Sentry — we are an error tracker.
Logs (log envelope items) 不支持 Not processed yet. Log items are ignored, which does not affect error reporting from the same SDK.
Cron monitors (check_in items) 部分支持 We have our own cron/heartbeat monitoring in the console, but the Sentry `check_in` envelope item is not wired to it yet.
Profiling, session replay 不支持 Deliberately out of scope. These are the reasons to stay on Sentry; we do not pretend otherwise.
Native symbolication (dSYM / ProGuard) 不支持 Not supported. Native mobile crashes arrive, but stay unsymbolicated.

深入了解