Skip to content

fix: add disable_metrics option to WebUI system config - #8169

Open
lingyun14beta wants to merge 6 commits into
AstrBotDevs:masterfrom
lingyun14beta:fix/disable-metrics-webui
Open

lingyun14beta wants to merge 6 commits into
AstrBotDevs:masterfrom
lingyun14beta:fix/disable-metrics-webui

Conversation

@lingyun14beta

@lingyun14beta lingyun14beta commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

disable_metrics has existed since #7946 (e8d3e183), and the v4.24.4 changelog announced it as a WebUI option for turning metrics collection off. In practice it could not be reached from the Settings page: the option is missing from CONFIG_METADATA_3_SYSTEM — the schema behind Settings → General (astrbot/dashboard/services/config_service.py:630) — and Settings.vue only renders config items that are registered in one of its createGroup(...) calls. The only documented way to opt out was the ASTRBOT_DISABLE_METRICS=1 environment variable mentioned in EULA.md §8.

This PR adds the missing metadata entry, gives the option its own group under Settings → General, and names the feature consistently across all four Dashboard locales.

Modifications / 改动点

  • astrbot/core/config/default.py: add disable_metrics to CONFIG_METADATA_3_SYSTEM so the item can be rendered at all, and align its description/hint with the wording used by the new group.
  • dashboard/src/views/Settings.vue: register a telemetry group (createGroup('telemetry', ['disable_metrics'])) in the General section.
  • i18n, all four locales (zh-CN, en-US, ru-RU, ja-JP): add the group title/subtitle and the disable_metrics label/hint. ja-JP strings are added here because that locale landed upstream after this branch was opened.
  • The feature is named User Experience Improvement Program (用户体验改进计划) everywhere. The group subtitle and the option hint still state that anonymous usage data is collected, so the UI does not obscure what the switch controls.
  • Drive-by fix in the same file: systemConfig.groups.*.subtitle is now actually rendered. Those keys were authored in feat: reorganize settings system configuration #8777 but never wired up — createGroup only read title and pinned hint: '', while the only block that renders a group hint (.config-section) is hidden by CSS on the Settings page. As a result all seven groups now show a subtitle, and the heading markup is identical across the four sections; previously only the General section wrapped its title in .system-config-group__heading, so the other three had no gap between the group title and its card.
  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

image

Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txt 和 pyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Expose and localize the telemetry opt-out setting in the WebUI system configuration.

New Features:

  • Expose a telemetry setting in the WebUI system configuration for disabling anonymous usage data collection.
  • Add localized labels and descriptions for the telemetry configuration across supported dashboard languages.

Bug Fixes:

  • Make the existing disable_metrics option visible and configurable on the WebUI system settings page.

Enhancements:

  • Improve system configuration group presentation with localized subtitles and dedicated telemetry grouping.

@auto-assign
auto-assign Bot requested review from Fridemn and advent259141 May 13, 2026 04:32
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. area:webui The bug / feature is about webui(dashboard) of astrbot. labels May 13, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new disable_metrics configuration field to the system's default settings, allowing users to opt out of anonymous usage statistics. The reviewer noted that this change requires updates to the internationalization (i18n) resource files for both English and Chinese to ensure the new field is correctly displayed in the WebUI.

Comment on lines +4266 to +4270
"disable_metrics": {
"description": "禁用匿名使用统计",
"type": "bool",
"hint": "禁用后,AstrBot 将不再上传匿名使用统计数据。",
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The addition of this new configuration field requires corresponding updates to the internationalization resource files, as specified in the instructions at lines 2995-3001. Please ensure that dashboard/src/i18n/locales/en-US/features/config-metadata.json and dashboard/src/i18n/locales/zh-CN/features/config-metadata.json are updated to include the disable_metrics key. This ensures the WebUI displays correctly in all supported languages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n文件已在PR #7946 中更新。

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 19, 2026
@Soulter
Soulter force-pushed the master branch 3 times, most recently from a4c4a7d to 9bd38ca Compare May 28, 2026 16:55
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 25, 2026
@lingyun14beta

Copy link
Copy Markdown
Contributor Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Now that disable_metrics is exposed via CONFIG_METADATA_3_SYSTEM, consider removing it from the older misc_config_group to avoid having the same option defined in multiple metadata groups and drifting out of sync.
  • The new telemetry group is included in generalSystemConfigGroups; double-check that this placement and naming aligns with how other system groups are organized in the UI for consistency and discoverability.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that `disable_metrics` is exposed via `CONFIG_METADATA_3_SYSTEM`, consider removing it from the older `misc_config_group` to avoid having the same option defined in multiple metadata groups and drifting out of sync.
- The new `telemetry` group is included in `generalSystemConfigGroups`; double-check that this placement and naming aligns with how other system groups are organized in the UI for consistency and discoverability.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

ja-JP: add the telemetry group plus the disable_metrics label and hint.

wording: name the feature 'User Experience Improvement Program' (用户体验改进计划) consistently in settings.json, config-metadata.json and both CONFIG_METADATA_2 / CONFIG_METADATA_3_SYSTEM descriptions.

settings: render systemConfig.groups.*.subtitle. Those keys were authored in AstrBotDevs#8777 but never wired up, because the only block that could display them (.config-section) is hidden by CSS.
@lingyun14beta

Copy link
Copy Markdown
Contributor Author

CI 的 macOS 红叉与本 PR 无关:test_kb_rate_limiter.py::...interval[0] 是计时抖动(要求 ≥0.09,实测 0.0892),ubuntu lane 与本地均通过。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants