diff --git a/internal/dao/internal/chn_health_scores.go b/internal/dao/internal/chn_health_scores.go index e550c6a..bb1cf8b 100644 --- a/internal/dao/internal/chn_health_scores.go +++ b/internal/dao/internal/chn_health_scores.go @@ -23,12 +23,12 @@ type ChnHealthScoresDao struct { type ChnHealthScoresColumns struct { Id string // 主键ID ChannelId string // 关联渠道ID - SuccessRate string // 请求成功率(0-100) - LatencyMs string // 平均延迟(毫秒) - StabilityScore string // 稳定性评分(0-100,基于延迟波动计算) - ConsecutiveFailures string // 连续失败次数(成功后归零) - HealthScore string // 综合健康度(0-100)= 成功率×0.40 + 延迟分×0.25 + 稳定性×0.20 + 连续失败分×0.15 - CalculatedAt string // 最近一次计算时间 + SuccessRate string // 成功率(0-100)= 该渠道各模型 succ_ewma 均值×100,仅统计有真实上报的模型 + LatencyMs string // 平均延迟(毫秒)= 该渠道各模型 lat_ewma 均值,仅统计有真实上报的模型;仅展示用,不参与健康分计算 + StabilityScore string // 【已废弃】稳定性评分,健康体系重写后不再写入,保留列仅为兼容历史数据 + ConsecutiveFailures string // 【已废弃】连续失败次数,已由 Redis 熔断器的滑动窗口计数取代(dispatch:v1:breaker:*),保留列仅为兼容历史数据 + HealthScore string // 综合健康度(0-100)= avg(succ_ewma)^α × 100,α 取路由策略 health.alpha(默认 2),与调度 healthFactor 同源;每 5 分钟由维护任务聚合落盘,另可由渠道测试/重置健康度即时触发;Redis 读失败或全部模型无真实上报时保留旧值不覆盖。调度决策不读此表,仅供管理后台展示 + CalculatedAt string // 最近一次聚合落盘时间 CreatedAt string // 创建时间 UpdatedAt string // 更新时间 } diff --git a/internal/dao/internal/chn_health_snapshots.go b/internal/dao/internal/chn_health_snapshots.go index 7034d1e..02e7702 100644 --- a/internal/dao/internal/chn_health_snapshots.go +++ b/internal/dao/internal/chn_health_snapshots.go @@ -23,11 +23,11 @@ type ChnHealthSnapshotsDao struct { type ChnHealthSnapshotsColumns struct { Id string // 主键ID ChannelId string // 关联渠道ID - HealthScore string // 综合健康度(0-100) + HealthScore string // 综合健康度(0-100)快照,取自 chn_health_scores.health_score SuccessRate string // 请求成功率(0-100) LatencyMs string // 平均延迟(毫秒) - StabilityScore string // 稳定性评分(0-100) - ConsecutiveFailures string // 连续失败次数 + StabilityScore string // 【已废弃】稳定性评分,不再写入,新快照为 0 + ConsecutiveFailures string // 【已废弃】连续失败次数,不再写入,新快照为 0 SnapshotAt string // 快照时间 } diff --git a/internal/model/do/chn_health_scores.go b/internal/model/do/chn_health_scores.go index 6812339..6247223 100644 --- a/internal/model/do/chn_health_scores.go +++ b/internal/model/do/chn_health_scores.go @@ -14,12 +14,12 @@ type ChnHealthScores struct { g.Meta `orm:"table:chn_health_scores, do:true"` Id any // 主键ID ChannelId any // 关联渠道ID - SuccessRate any // 请求成功率(0-100) - LatencyMs any // 平均延迟(毫秒) - StabilityScore any // 稳定性评分(0-100,基于延迟波动计算) - ConsecutiveFailures any // 连续失败次数(成功后归零) - HealthScore any // 综合健康度(0-100)= 成功率×0.40 + 延迟分×0.25 + 稳定性×0.20 + 连续失败分×0.15 - CalculatedAt *gtime.Time // 最近一次计算时间 + SuccessRate any // 成功率(0-100)= 该渠道各模型 succ_ewma 均值×100,仅统计有真实上报的模型 + LatencyMs any // 平均延迟(毫秒)= 该渠道各模型 lat_ewma 均值,仅统计有真实上报的模型;仅展示用,不参与健康分计算 + StabilityScore any // 【已废弃】稳定性评分,健康体系重写后不再写入,保留列仅为兼容历史数据 + ConsecutiveFailures any // 【已废弃】连续失败次数,已由 Redis 熔断器的滑动窗口计数取代(dispatch:v1:breaker:*),保留列仅为兼容历史数据 + HealthScore any // 综合健康度(0-100)= avg(succ_ewma)^α × 100,α 取路由策略 health.alpha(默认 2),与调度 healthFactor 同源;每 5 分钟由维护任务聚合落盘,另可由渠道测试/重置健康度即时触发;Redis 读失败或全部模型无真实上报时保留旧值不覆盖。调度决策不读此表,仅供管理后台展示 + CalculatedAt *gtime.Time // 最近一次聚合落盘时间 CreatedAt *gtime.Time // 创建时间 UpdatedAt *gtime.Time // 更新时间 } diff --git a/internal/model/do/chn_health_snapshots.go b/internal/model/do/chn_health_snapshots.go index aa0ed6d..c832a21 100644 --- a/internal/model/do/chn_health_snapshots.go +++ b/internal/model/do/chn_health_snapshots.go @@ -14,10 +14,10 @@ type ChnHealthSnapshots struct { g.Meta `orm:"table:chn_health_snapshots, do:true"` Id any // 主键ID ChannelId any // 关联渠道ID - HealthScore any // 综合健康度(0-100) + HealthScore any // 综合健康度(0-100)快照,取自 chn_health_scores.health_score SuccessRate any // 请求成功率(0-100) LatencyMs any // 平均延迟(毫秒) - StabilityScore any // 稳定性评分(0-100) - ConsecutiveFailures any // 连续失败次数 + StabilityScore any // 【已废弃】稳定性评分,不再写入,新快照为 0 + ConsecutiveFailures any // 【已废弃】连续失败次数,不再写入,新快照为 0 SnapshotAt *gtime.Time // 快照时间 } diff --git a/internal/model/entity/chn_health_scores.go b/internal/model/entity/chn_health_scores.go index b3afa6f..0b696ca 100644 --- a/internal/model/entity/chn_health_scores.go +++ b/internal/model/entity/chn_health_scores.go @@ -10,14 +10,14 @@ import ( // ChnHealthScores is the golang structure for table chn_health_scores. type ChnHealthScores struct { - Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID - ChannelId int64 `json:"channel_id" orm:"channel_id" description:"关联渠道ID"` // 关联渠道ID - SuccessRate float64 `json:"success_rate" orm:"success_rate" description:"请求成功率(0-100)"` // 请求成功率(0-100) - LatencyMs float64 `json:"latency_ms" orm:"latency_ms" description:"平均延迟(毫秒)"` // 平均延迟(毫秒) - StabilityScore float64 `json:"stability_score" orm:"stability_score" description:"稳定性评分(0-100,基于延迟波动计算)"` // 稳定性评分(0-100,基于延迟波动计算) - ConsecutiveFailures int `json:"consecutive_failures" orm:"consecutive_failures" description:"连续失败次数(成功后归零)"` // 连续失败次数(成功后归零) - HealthScore float64 `json:"health_score" orm:"health_score" description:"综合健康度(0-100)= 成功率×0.40 + 延迟分×0.25 + 稳定性×0.20 + 连续失败分×0.15"` // 综合健康度(0-100)= 成功率×0.40 + 延迟分×0.25 + 稳定性×0.20 + 连续失败分×0.15 - CalculatedAt *gtime.Time `json:"calculated_at" orm:"calculated_at" description:"最近一次计算时间"` // 最近一次计算时间 - CreatedAt *gtime.Time `json:"created_at" orm:"created_at" description:"创建时间"` // 创建时间 - UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at" description:"更新时间"` // 更新时间 + Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID + ChannelId int64 `json:"channel_id" orm:"channel_id" description:"关联渠道ID"` // 关联渠道ID + SuccessRate float64 `json:"success_rate" orm:"success_rate" description:"成功率(0-100)= 该渠道各模型 succ_ewma 均值×100,仅统计有真实上报的模型"` // 成功率(0-100)= 该渠道各模型 succ_ewma 均值×100,仅统计有真实上报的模型 + LatencyMs float64 `json:"latency_ms" orm:"latency_ms" description:"平均延迟(毫秒)= 该渠道各模型 lat_ewma 均值,仅统计有真实上报的模型;仅展示用,不参与健康分计算"` // 平均延迟(毫秒)= 该渠道各模型 lat_ewma 均值,仅统计有真实上报的模型;仅展示用,不参与健康分计算 + StabilityScore float64 `json:"stability_score" orm:"stability_score" description:"【已废弃】稳定性评分,健康体系重写后不再写入,保留列仅为兼容历史数据"` // 【已废弃】稳定性评分,健康体系重写后不再写入,保留列仅为兼容历史数据 + ConsecutiveFailures int `json:"consecutive_failures" orm:"consecutive_failures" description:"【已废弃】连续失败次数,已由 Redis 熔断器的滑动窗口计数取代(dispatch:v1:breaker:*),保留列仅为兼容历史数据"` // 【已废弃】连续失败次数,已由 Redis 熔断器的滑动窗口计数取代(dispatch:v1:breaker:*),保留列仅为兼容历史数据 + HealthScore float64 `json:"health_score" orm:"health_score" description:"综合健康度(0-100)= avg(succ_ewma)^α × 100,α 取路由策略 health.alpha(默认 2),与调度 healthFactor 同源;每 5 分钟由维护任务聚合落盘,另可由渠道测试/重置健康度即时触发;Redis 读失败或全部模型无真实上报时保留旧值不覆盖。调度决策不读此表,仅供管理后台展示"` // 综合健康度(0-100)= avg(succ_ewma)^α × 100,α 取路由策略 health.alpha(默认 2),与调度 healthFactor 同源;每 5 分钟由维护任务聚合落盘,另可由渠道测试/重置健康度即时触发;Redis 读失败或全部模型无真实上报时保留旧值不覆盖。调度决策不读此表,仅供管理后台展示 + CalculatedAt *gtime.Time `json:"calculated_at" orm:"calculated_at" description:"最近一次聚合落盘时间"` // 最近一次聚合落盘时间 + CreatedAt *gtime.Time `json:"created_at" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at" description:"更新时间"` // 更新时间 } diff --git a/internal/model/entity/chn_health_snapshots.go b/internal/model/entity/chn_health_snapshots.go index 5ddd15a..97b9e63 100644 --- a/internal/model/entity/chn_health_snapshots.go +++ b/internal/model/entity/chn_health_snapshots.go @@ -10,12 +10,12 @@ import ( // ChnHealthSnapshots is the golang structure for table chn_health_snapshots. type ChnHealthSnapshots struct { - Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID - ChannelId int64 `json:"channel_id" orm:"channel_id" description:"关联渠道ID"` // 关联渠道ID - HealthScore float64 `json:"health_score" orm:"health_score" description:"综合健康度(0-100)"` // 综合健康度(0-100) - SuccessRate float64 `json:"success_rate" orm:"success_rate" description:"请求成功率(0-100)"` // 请求成功率(0-100) - LatencyMs float64 `json:"latency_ms" orm:"latency_ms" description:"平均延迟(毫秒)"` // 平均延迟(毫秒) - StabilityScore float64 `json:"stability_score" orm:"stability_score" description:"稳定性评分(0-100)"` // 稳定性评分(0-100) - ConsecutiveFailures int `json:"consecutive_failures" orm:"consecutive_failures" description:"连续失败次数"` // 连续失败次数 - SnapshotAt *gtime.Time `json:"snapshot_at" orm:"snapshot_at" description:"快照时间"` // 快照时间 + Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID + ChannelId int64 `json:"channel_id" orm:"channel_id" description:"关联渠道ID"` // 关联渠道ID + HealthScore float64 `json:"health_score" orm:"health_score" description:"综合健康度(0-100)快照,取自 chn_health_scores.health_score"` // 综合健康度(0-100)快照,取自 chn_health_scores.health_score + SuccessRate float64 `json:"success_rate" orm:"success_rate" description:"请求成功率(0-100)"` // 请求成功率(0-100) + LatencyMs float64 `json:"latency_ms" orm:"latency_ms" description:"平均延迟(毫秒)"` // 平均延迟(毫秒) + StabilityScore float64 `json:"stability_score" orm:"stability_score" description:"【已废弃】稳定性评分,不再写入,新快照为 0"` // 【已废弃】稳定性评分,不再写入,新快照为 0 + ConsecutiveFailures int `json:"consecutive_failures" orm:"consecutive_failures" description:"【已废弃】连续失败次数,不再写入,新快照为 0"` // 【已废弃】连续失败次数,不再写入,新快照为 0 + SnapshotAt *gtime.Time `json:"snapshot_at" orm:"snapshot_at" description:"快照时间"` // 快照时间 }