sentry-multi-env-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sentry Multi Env Setup

Sentry多环境搭建

Prerequisites

前置要求

  • Environment naming convention defined
  • DSN management strategy
  • Sample rate requirements per environment
  • Alert routing per environment
  • 已定义环境命名规范
  • DSN管理策略
  • 各环境采样率要求
  • 各环境告警路由规则

Instructions

操作指南

  1. Set environment option in SDK init to match deployment target
  2. Configure environment-specific sample rates (100% dev, 10% prod)
  3. Choose project structure (single with environments vs separate projects)
  4. Set up separate DSNs per environment in environment variables
  5. Implement conditional DSN loading to disable in development
  6. Add environment context and tags in beforeSend hook
  7. Configure environment filters in Sentry dashboard
  8. Create production-only alert rules with appropriate conditions
  9. Set up lower-priority staging alerts for development feedback
  10. Document environment configuration and best practices for team
  1. 在SDK初始化时设置environment选项,与部署目标保持一致
  2. 配置各环境专属采样率(开发环境100%,生产环境10%)
  3. 选择项目结构(单项目多环境 vs 独立项目)
  4. 在环境变量中为各环境配置独立的DSN
  5. 实现DSN条件加载逻辑,在开发环境禁用Sentry
  6. 在beforeSend钩子中添加环境上下文和标签
  7. 在Sentry控制台中配置环境过滤器
  8. 创建仅生产环境生效的告警规则,配置合适的触发条件
  9. 配置低优先级的预发布环境告警,用于开发反馈
  10. 为团队文档化环境配置和最佳实践

Output

产出

  • Environment-specific Sentry configuration
  • Separate or shared projects configured
  • Environment-based alert rules
  • Sample rates optimized per environment
  • 适配各环境的Sentry配置
  • 已配置的独立或共享项目
  • 基于环境的告警规则
  • 各环境优化后的采样率

Error Handling

错误处理

See
{baseDir}/references/errors.md
for comprehensive error handling.
查看
{baseDir}/references/errors.md
获取完整的错误处理方案。

Examples

示例

See
{baseDir}/references/examples.md
for detailed examples.
查看
{baseDir}/references/examples.md
获取详细示例。

Resources

参考资源