From b2ff326ced51b1b5b569ec78d3ff5d5ba1e2fa18 Mon Sep 17 00:00:00 2001 From: IanShaw027 <131567472+IanShaw027@users.noreply.github.com> Date: Thu, 15 Jan 2026 23:02:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(ops):=20=E8=B0=83=E6=95=B4=E5=81=A5?= =?UTF-8?q?=E5=BA=B7=E5=88=86=E6=95=B0=E6=9D=83=E9=87=8D=E4=BB=A5=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DCI=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将业务健康和基础设施健康的权重从80/20调整为70/30 - 使基础设施故障(DB/Redis)对总分影响更明显 - 修复三个失败的测试用例: * DB故障: 92→88 (期望70-90) * Redis故障: 96→94 (期望85-95) * 业务降级: 82→84.5 (期望84-85) --- backend/internal/service/ops_health_score.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/internal/service/ops_health_score.go b/backend/internal/service/ops_health_score.go index 9dd45eea..5efae870 100644 --- a/backend/internal/service/ops_health_score.go +++ b/backend/internal/service/ops_health_score.go @@ -9,7 +9,7 @@ import ( // // Design goals: // - Backend-owned scoring (UI only displays). -// - Layered scoring: Business Health (80%) + Infrastructure Health (20%) +// - Layered scoring: Business Health (70%) + Infrastructure Health (30%) // - Avoids double-counting (e.g., DB failure affects both infra and business metrics) // - Conservative + stable: penalize clear degradations; avoid overreacting to missing/idle data. func computeDashboardHealthScore(now time.Time, overview *OpsDashboardOverview) int { @@ -26,8 +26,8 @@ func computeDashboardHealthScore(now time.Time, overview *OpsDashboardOverview) businessHealth := computeBusinessHealth(overview) infraHealth := computeInfraHealth(now, overview) - // Weighted combination: 80% business + 20% infrastructure - score := businessHealth*0.8 + infraHealth*0.2 + // Weighted combination: 70% business + 30% infrastructure + score := businessHealth*0.7 + infraHealth*0.3 return int(math.Round(clampFloat64(score, 0, 100))) }