feat: 增加 WebUI 配置选项禁用匿名使用统计#7946
Open
Blueteemo wants to merge 5 commits intoAstrBotDevs:masterfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
Metric._disable_metricsclass attribute is never written to anywhere, so it’s effectively dead code; consider removing it or adding a clear public setter/use-site if you intend it to be configurable at runtime. - In
_is_disabled(), you’re catching a broadExceptionaround the config import and access; narrowing this to the specific expected exceptions (e.g.ImportError/AttributeError/KeyError) would avoid hiding unrelated runtime errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `Metric._disable_metrics` class attribute is never written to anywhere, so it’s effectively dead code; consider removing it or adding a clear public setter/use-site if you intend it to be configurable at runtime.
- In `_is_disabled()`, you’re catching a broad `Exception` around the config import and access; narrowing this to the specific expected exceptions (e.g. `ImportError` / `AttributeError` / `KeyError`) would avoid hiding unrelated runtime errors.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to disable anonymous usage statistics via a new configuration option and environment variable. The changes include updates to the default configuration, the metrics utility logic, and localization files for the dashboard. A review comment suggests optimizing the logic for checking the disabled status and using more specific exception handling to improve code robustness and readability.
Contributor
Author
|
@sourcery-ai review |
This was referenced May 2, 2026
Soulter
reviewed
May 2, 2026
Contributor
|
nb都不睡的() |
Contributor
Author
怎么不在群里@我o_O |
Soulter
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
Metric 模块当前只能通过环境变量 ASTRBOT_DISABLE_METRICS 控制,用户需要在 WebUI 中添加配置选项。
修复方案
关联 Issue
Fixes #7941
Summary by Sourcery
Add a configurable option to disable anonymous metrics collection via the WebUI and centralize the metrics-disable check.
New Features:
Enhancements: