feat(routing): 引入多执行池智能调度

将 Worker 发现、路由画像、容量与执行传输抽象为平台无关接口,新增 Kubernetes 和静态容量适配器,并以 shadow 模式接入生产配置。

实现网络与容量评分、路由防抖、池队列、同步 Worker 租约、一次性执行令牌,以及提交状态不明时禁止重复分配的安全语义。

新增 0105 兼容迁移、管理接口、指标、OpenAPI 和回归测试。已执行全量 Go 测试、go vet、OpenAPI、迁移安全、Compose 与 Kustomize 验证。
This commit is contained in:
2026-08-05 22:25:37 +08:00
parent 03c0873649
commit 7786692d32
58 changed files with 4510 additions and 348 deletions
+204
View File
@@ -2082,6 +2082,36 @@
}
}
},
"/api/admin/runtime/execution-pools": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Admin Runtime"
],
"summary": "查询逻辑执行池、Worker 容量和上游路由健康状态",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/httpapi.AdminExecutionPoolResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/admin/runtime/model-rate-limits": {
"get": {
"security": [
@@ -10699,6 +10729,177 @@
}
}
},
"httpapi.AdminExecutionPool": {
"type": "object",
"properties": {
"capabilities": {
"type": "object",
"additionalProperties": {}
},
"capacity": {
"$ref": "#/definitions/httpapi.AdminExecutionPoolCapacity"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"poolId": {
"type": "string"
},
"state": {
"type": "string"
},
"workers": {
"type": "array",
"items": {
"$ref": "#/definitions/httpapi.AdminExecutionPoolWorker"
}
}
}
},
"httpapi.AdminExecutionPoolCapacity": {
"type": "object",
"properties": {
"activeTasks": {
"type": "integer"
},
"allocated": {
"type": "integer"
},
"critical": {
"type": "boolean"
},
"estimatedQueueWaitMs": {
"type": "integer"
},
"heavyCapacity": {
"type": "integer"
},
"heavyTasks": {
"type": "integer"
},
"queueDepth": {
"type": "integer"
},
"resourceHeadroom": {
"type": "number"
},
"safeCapacity": {
"type": "integer"
},
"sampledAt": {
"type": "string"
},
"stability": {
"type": "number"
},
"workerCount": {
"type": "integer"
}
}
},
"httpapi.AdminExecutionPoolResponse": {
"type": "object",
"properties": {
"capturedAt": {
"type": "string"
},
"pools": {
"type": "array",
"items": {
"$ref": "#/definitions/httpapi.AdminExecutionPool"
}
},
"routeHealth": {
"type": "array",
"items": {
"$ref": "#/definitions/httpapi.AdminRouteHealth"
}
}
}
},
"httpapi.AdminExecutionPoolWorker": {
"type": "object",
"properties": {
"activeTasks": {
"type": "integer"
},
"allocated": {
"type": "integer"
},
"capabilities": {
"type": "object",
"additionalProperties": {}
},
"heartbeatAt": {
"type": "string"
},
"instanceId": {
"type": "string"
},
"pressureState": {
"type": "string"
},
"protocolVersion": {
"type": "string"
},
"revision": {
"type": "string"
},
"safeCapacity": {
"type": "integer"
},
"workerId": {
"type": "string"
}
}
},
"httpapi.AdminRouteHealth": {
"type": "object",
"properties": {
"connectTlsP95Ms": {
"type": "integer"
},
"consecutiveFailures": {
"type": "integer"
},
"consecutiveSuccesses": {
"type": "integer"
},
"expiresAt": {
"type": "string"
},
"firstByteP95Ms": {
"type": "integer"
},
"jitterP95Ms": {
"type": "integer"
},
"poolId": {
"type": "string"
},
"routeProfileKey": {
"type": "string"
},
"sampleCount": {
"type": "integer"
},
"sampledAt": {
"type": "string"
},
"state": {
"type": "string"
},
"successRate": {
"type": "number"
},
"uploadBytesPerSecond": {
"type": "number"
}
}
},
"httpapi.AdminTaskListResponse": {
"type": "object",
"properties": {
@@ -17072,6 +17273,9 @@
"podUid": {
"type": "string"
},
"poolId": {
"type": "string"
},
"preparingTasks": {
"type": "integer"
},