Repository navigation
🔥 Cleancode: Remove legacy model stats columns from resource management - #4554
Merged
Merged
Conversation
The per-model request/error/duration/token columns on the resource management Models tab read model_monitoring_record_t, which the new outlet/profile invocation path no longer writes, so every migrated model showed '--'. The ops dashboard already covers these metrics from the monitoring fact store. - Drop the six stats columns, time-range switch and stats refresh button from ModelList; keep management columns, actions, pagination and the capacity-coverage widget in both manage and readOnly modes - Remove the now-unused useMonitoringData hook, fetchModels service method and ModelMonitoringItem/MonitoringFilter types - Keep the /monitoring/models backend endpoint untouched for any external consumers - Add component tests asserting stats UI is gone, no stats request is issued, and management/readOnly behavior is preserved
jeffwu-1999
requested review from
WMC001,
YehongPan,
hhhhsc701 and
xuyaqist
as code owners
December 4, 2026 01:20
WMC001
approved these changes
Dec 4, 2026
… UI keys Follow-up to the resource-management stats UI removal: drop the now unconsumed consumer-side code while keeping the monitoring record write path (SDK instrumentation, buffer, infrastructure writer) and the /monitoring/status endpoint intact. - Remove list_models_endpoint, the metrics aggregation query and the time-range helper from the management monitoring API - Drop the /api/monitoring/models gateway exposure row (registry regenerated, 644 rows) and the frontend API constant - Delete 12 orphaned monitoring.* i18n keys in zh/en locales - Update backend tests: retire old endpoint cases, add regression asserting the route is unregistered and returns 404 - Update e2e assets for the retirement: API-158/F-154 now cover the status contract, UT-BE-022 proves provider/dashboard-role normalization; no formal Case deleted - OPS dashboard endpoints (/api/ops/v1/*, /nb/v1/*) untouched
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
背景
资源管理页「模型」Tab 的 6 个统计列(请求数/错误率/平均耗时/平均首Token时间/Token数/Token生成速率)读取
model_monitoring_record_t聚合数据。新的 outlet/profile 调用路径(LegacyChatModel+core/model_service)只写 OPS 监控 fact store(ES),不再写这张 PG 表,导致迁移到 profile 的模型统计恒显示--。本地环境实测:全部 6 个有效模型配置均为 profile 路径,
model_monitoring_record_t0 条记录,而 ESmonitoring-facts-*有 31 条 model fact(含当天流量)——资源管理页整页--。这些指标已由新运维看板(OPS 仪表盘
/api/ops/v1/monitoring/*)完整覆盖,产品决策:下线资源管理页的旧统计展示,指标统一由运维看板承接。改动内容(纯前端,5 文件 +195/−285)
frontend/app/[locale]/resource-manage/components/resources/ModelList.tsxfrontend/hooks/useMonitoringData.tsfrontend/services/monitoringService.tsfetchModels及仅被其使用的buildQueryString;保留fetchStatus(TopNavbar/useAccountMonitoring 在用)frontend/types/monitoring.tsModelMonitoringItem/MonitoringFilter;保留MonitoringStatusfrontend/tests/component/resourceModelListStats.test.tsx后端
/monitoring/models端点与API_ENDPOINTS.monitoring.models常量保留不动,不破坏可能存在的外部消费方契约;不改 SDK、不改 SQL。测试
fetchModelsspy 与全局 fetch 均无/monitoring/models请求,连通性检测仍可调服务并 refetch;②readOnly 模式无管理按钮、每行仅连通性按钮、统计列不存在resourceModelListStats(2) +modelMonitoring(5) +accountMonitoring(8) + ModelList 消费方相关tenantDeleteFeedback/casResourceIdentity/shareAuthenticationLayout(17) = 32 passed / 0 failednpx tsc --noEmit全量 0 错误scripts/check_copyright.py)4 个改动文件全部通过before:

after:

正式资产(D1-D5)评估
test-e2e中 monitoring 相关 Case 全部针对新运维看板/api/ops/v1/monitoring/*,与本次下线的旧/monitoring/models前端展示无交集,无需改动正式资产。已知遗留(无害)
common.json中 6 个monitoring.table.*文案键成为孤儿键(应用代码已无引用),可后续清理🤖 本 PR 由 WorkBuddy 编排 Claude Code 完成编码,WorkBuddy 独立复核 diff 与测试。