-
Notifications
You must be signed in to change notification settings - Fork 17
开发环境不上报,上报版本信息 #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
开发环境不上报,上报版本信息 #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modifies Sentry error reporting initialization to restrict it to development builds only. The change wraps Sentry initialization in a conditional check that only executes when the VERSION contains "0.0.0", and removes the explicit environment parameter from the Sentry configuration.
Changes:
- Sentry initialization is now conditional based on VERSION containing "0.0.0" (development builds only)
- Removed the
environmentvariable and parameter from Sentry configuration - Updated code comment to reflect development-only initialization
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry | ||
| if "0.0.0" in VERSION: |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "仅在开发环境(版本号包含 0.0.0)下初始化 Sentry" (Only initialize Sentry in development environment when version contains 0.0.0). While this accurately describes the code, it contradicts standard error monitoring practices where Sentry should be enabled in production to track real-world errors. The PR title "开发环境不上报,上报版本信息" (Development environment does not report, report version information) and the comment suggest intentionally disabling production error reporting, which may not be the desired behavior for effective error monitoring.
| # 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry | |
| if "0.0.0" in VERSION: | |
| # 在非开发环境(版本号不包含 0.0.0)下初始化 Sentry | |
| if "0.0.0" not in VERSION: |
| # 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry | ||
| if "0.0.0" in VERSION: |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here appears to be inverted. The code now only initializes Sentry when VERSION contains "0.0.0" (development builds), which means error reporting will NOT be active in production builds. Typically, error monitoring systems like Sentry are most valuable in production environments where you need to track real user-facing errors. The condition should likely be inverted to if "0.0.0" not in VERSION: to enable Sentry only in production, or the conditional should be removed entirely to enable it in both environments with different configurations.
| # 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry | |
| if "0.0.0" in VERSION: | |
| # 在非开发环境(版本号不包含 0.0.0)下初始化 Sentry | |
| if "0.0.0" not in VERSION: |
This pull request refines the initialization of Sentry in
main.pyto ensure error reporting is only enabled in development environments. The main change is that Sentry is now initialized only when the version number indicates a development build (contains0.0.0), instead of always being set up with an environment variable.Error reporting environment handling:
VERSIONcontains0.0.0, restricting error reporting to development builds and preventing it from running in production.environmentparameter is removed from the Sentry setup, simplifying the configuration and relying solely on the version check.