sentry-multi-env-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSentry Multi Env Setup
Sentry多环境搭建
Prerequisites
前置要求
- Environment naming convention defined
- DSN management strategy
- Sample rate requirements per environment
- Alert routing per environment
- 已定义环境命名规范
- DSN管理策略
- 各环境采样率要求
- 各环境告警路由规则
Instructions
操作指南
- Set environment option in SDK init to match deployment target
- Configure environment-specific sample rates (100% dev, 10% prod)
- Choose project structure (single with environments vs separate projects)
- Set up separate DSNs per environment in environment variables
- Implement conditional DSN loading to disable in development
- Add environment context and tags in beforeSend hook
- Configure environment filters in Sentry dashboard
- Create production-only alert rules with appropriate conditions
- Set up lower-priority staging alerts for development feedback
- Document environment configuration and best practices for team
- 在SDK初始化时设置environment选项,与部署目标保持一致
- 配置各环境专属采样率(开发环境100%,生产环境10%)
- 选择项目结构(单项目多环境 vs 独立项目)
- 在环境变量中为各环境配置独立的DSN
- 实现DSN条件加载逻辑,在开发环境禁用Sentry
- 在beforeSend钩子中添加环境上下文和标签
- 在Sentry控制台中配置环境过滤器
- 创建仅生产环境生效的告警规则,配置合适的触发条件
- 配置低优先级的预发布环境告警,用于开发反馈
- 为团队文档化环境配置和最佳实践
Output
产出
- Environment-specific Sentry configuration
- Separate or shared projects configured
- Environment-based alert rules
- Sample rates optimized per environment
- 适配各环境的Sentry配置
- 已配置的独立或共享项目
- 基于环境的告警规则
- 各环境优化后的采样率
Error Handling
错误处理
See for comprehensive error handling.
{baseDir}/references/errors.md查看获取完整的错误处理方案。
{baseDir}/references/errors.mdExamples
示例
See for detailed examples.
{baseDir}/references/examples.md查看获取详细示例。
{baseDir}/references/examples.md