rwadurian/backend/infrastructure/sentry/sentry.conf.py

79 lines
2.9 KiB
Python

# =============================================================================
# Sentry Configuration
# =============================================================================
# 此文件包含 Sentry 的自定义配置
# 更多配置项参考: https://develop.sentry.dev/self-hosted/
# =============================================================================
from sentry.conf.server import * # noqa
# =============================================================================
# 基础配置
# =============================================================================
# 系统 URL (用于邮件中的链接等)
SENTRY_OPTIONS["system.url-prefix"] = env("SENTRY_SYSTEM_URL", "http://localhost:9000")
# 单组织模式 (推荐用于内部使用)
SENTRY_SINGLE_ORGANIZATION = True
# 允许注册 (首次启动后建议设为 False)
SENTRY_FEATURES["auth:register"] = True
# =============================================================================
# 数据保留策略
# =============================================================================
# 事件保留天数 (默认 90 天,可根据存储调整)
SENTRY_OPTIONS["system.event-retention-days"] = 90
# =============================================================================
# 性能配置
# =============================================================================
# 采样率配置 (1.0 = 100%)
# 生产环境可以适当降低以减少数据量
SENTRY_OPTIONS["store.symbolicator-poll-retry-limit"] = 8
# =============================================================================
# Symbolicator 配置 (崩溃堆栈符号化)
# =============================================================================
SENTRY_OPTIONS["symbolicator.enabled"] = True
SENTRY_OPTIONS["symbolicator.options"] = {
"url": "http://sentry-symbolicator:3021",
}
# =============================================================================
# Relay 配置 (事件接收网关)
# =============================================================================
SENTRY_RELAY_WHITELIST_PK = []
SENTRY_RELAY_OPEN_REGISTRATION = True
# =============================================================================
# 功能开关
# =============================================================================
# 启用 Session Replay (会话回放)
SENTRY_FEATURES["organizations:session-replay"] = True
# 启用 Performance Monitoring (性能监控)
SENTRY_FEATURES["organizations:performance-view"] = True
# 启用 Profiling (性能分析)
SENTRY_FEATURES["organizations:profiling"] = True
# 启用 Issue 自动分组
SENTRY_FEATURES["projects:similarity-indexing"] = True
# =============================================================================
# 安全配置
# =============================================================================
# CORS 配置 (允许移动端上报)
SENTRY_ALLOW_ORIGIN = "*"
# CSP 报告端点
CSP_REPORT_ONLY = True