feat: 为实例调度添加版本化 PCDN 策略(canary/draft/stable)与熔断回退#5
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Motivation
draft/canary/stable),支持按地域、ISP、用户 hash 比例做灰度放量并能回切到稳定策略以降低风险。Description
server/config/pcdn.go并在server/config/config.go中挂载PCDN配置结构以支持热配置的策略版本、灰度规则、熔断阈值与评分权重。server/config.yaml(及备份)加入pcdn示例配置段,包含version/release-state/canary/circuit-breaker/score-weight等项以便后台定参。server/service/instance/scheduling_policy.go,实现策略选择(draft/canary/stable)、灰度判定(地域/ISP/用户哈希比例)、候选节点评分与排序、以及基于失败率与平均延迟的内存熔断与稳定策略快照回退逻辑,并输出详细候选评分明细用于追溯。GetAvailableNodes签名以接收SchedulingRequestMeta,并在server/service/instance/instance.go中调用策略选择、打分排序、熔断判断与快照回切,同时通过writeSchedulingTraceLog记录strategyVersion、releaseState、hitRule及candidateScoreDetail。GET /instance/getAvailableNodes接口以接受并传入灰度上下文查询参数region、isp、userHash(server/api/v1/instance/instance.go)。Testing
go test ./config成功(通过,包中无测试文件也视为正常)。go test ./service/instance -run TestDoesNotExist -count=0在容器中完成并返回(该包当前无测试文件,命令返回成功)。go test ./api/v1/instance -run TestDoesNotExist -count=0在当前 CI 容器中因编译/依赖耗时超时(未在本次环境内完成)。Codex Task