-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,28 +38,26 @@ def main(): | |||||||||
| logger.remove() | ||||||||||
| configure_logging() | ||||||||||
|
|
||||||||||
| # Sentry 环境与版本号自动识别 | ||||||||||
| environment = "development" if "0.0.0" in VERSION else "production" | ||||||||||
|
|
||||||||||
| def before_send(event, hint): | ||||||||||
| # 如果事件中不包含异常信息(即没有堆栈),则不上传 | ||||||||||
| if "exception" not in event: | ||||||||||
| return None | ||||||||||
| return event | ||||||||||
|
|
||||||||||
| sentry_sdk.init( | ||||||||||
| dsn="https://f48074b49e319f7b952583c283046259@o4510289605296128.ingest.de.sentry.io/4510681366659152", | ||||||||||
| integrations=[ | ||||||||||
| LoguruIntegration( | ||||||||||
| level=LoggingLevels.INFO.value, | ||||||||||
| event_level=LoggingLevels.ERROR.value, | ||||||||||
| ), | ||||||||||
| ], | ||||||||||
| before_send=before_send, | ||||||||||
| environment=environment, | ||||||||||
| release=VERSION, | ||||||||||
| send_default_pii=True, | ||||||||||
| ) | ||||||||||
| # 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry | ||||||||||
| if "0.0.0" in VERSION: | ||||||||||
|
Comment on lines
+41
to
+42
|
||||||||||
| # 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry | |
| if "0.0.0" in VERSION: | |
| # 在非开发环境(版本号不包含 0.0.0)下初始化 Sentry | |
| if "0.0.0" not in VERSION: |
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.