Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
93b5b747
Commit
93b5b747
authored
Jan 15, 2026
by
IanShaw027
Browse files
refactor(ops): 调整健康得分权重
- 业务健康权重从 70% 提升到 80% - 基础设施健康权重从 30% 降低到 20% - 更加关注业务指标(SLA、错误率等)对整体健康的影响
parent
5f890e85
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/ops_health_score.go
View file @
93b5b747
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
//
//
// Design goals:
// Design goals:
// - Backend-owned scoring (UI only displays).
// - Backend-owned scoring (UI only displays).
// - Layered scoring: Business Health (
7
0%) + Infrastructure Health (
3
0%)
// - Layered scoring: Business Health (
8
0%) + Infrastructure Health (
2
0%)
// - Avoids double-counting (e.g., DB failure affects both infra and business metrics)
// - Avoids double-counting (e.g., DB failure affects both infra and business metrics)
// - Conservative + stable: penalize clear degradations; avoid overreacting to missing/idle data.
// - Conservative + stable: penalize clear degradations; avoid overreacting to missing/idle data.
func
computeDashboardHealthScore
(
now
time
.
Time
,
overview
*
OpsDashboardOverview
)
int
{
func
computeDashboardHealthScore
(
now
time
.
Time
,
overview
*
OpsDashboardOverview
)
int
{
...
@@ -26,8 +26,8 @@ func computeDashboardHealthScore(now time.Time, overview *OpsDashboardOverview)
...
@@ -26,8 +26,8 @@ func computeDashboardHealthScore(now time.Time, overview *OpsDashboardOverview)
businessHealth
:=
computeBusinessHealth
(
overview
)
businessHealth
:=
computeBusinessHealth
(
overview
)
infraHealth
:=
computeInfraHealth
(
now
,
overview
)
infraHealth
:=
computeInfraHealth
(
now
,
overview
)
// Weighted combination:
7
0% business +
3
0% infrastructure
// Weighted combination:
8
0% business +
2
0% infrastructure
score
:=
businessHealth
*
0.
7
+
infraHealth
*
0.
3
score
:=
businessHealth
*
0.
8
+
infraHealth
*
0.
2
return
int
(
math
.
Round
(
clampFloat64
(
score
,
0
,
100
)))
return
int
(
math
.
Round
(
clampFloat64
(
score
,
0
,
100
)))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment