feat: 集成 Sentry 错误监控 + 前端错误上报中继

后端:
  - Cargo.toml 添加 sentry/sentry-actix/sentry-tracing (v0.48)
  - main.rs 条件初始化 Sentry(SENTRY_DSN 环境变量控制)
  - 新增 handlers/sentry.rs — POST /api/sentry/events 前端中继端点
  - sentry-actix 全局中间件 + sentry-tracing 自动捕获 tracing::error!
  - .env.example 添加 SENTRY_DSN / SENTRY_TRACES_SAMPLE_RATE 配置

前端:
  - 新增 utils/sentryReporter.ts (批量上报/防抖/开发环境跳过)
  - app.ts 全局错误处理接入 Sentry (wx.onError/onUnhandledRejection/onPageNotFound)

Sentry 未配置 DSN 时完全无操作,无性能开销
This commit is contained in:
moira
2026-05-13 17:20:31 +08:00
committed by milky0217
parent 27c8979690
commit f8a95c7417
5 changed files with 945 additions and 61 deletions

View File

@@ -10,6 +10,9 @@ dotenvy = "0.15.7"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
tracing-appender = "0.2"
sentry = "0.48"
sentry-actix = "0.48"
sentry-tracing = "0.48"
include_dir = "0.7.4"
jsonwebtoken = "9.3.1"
openssl = "0.10.73"