dcdc8d1ddd
全栈知识治理平台首次入库(P1-P10 + 发布链路模拟验证闭环): - 治理核心:源目录/变更集/人工审核/发布批次/发布执行(fail-closed 闸口) - 测试通道:WeKnora 测试 KB 上传/轮询/验收;poll 完成时写入 parser_generation/index_generation,修复 manual/seed 路径发布闸口永久拦截 - 发布适配器 v071(本地 source=测试角色 / 云端 target=生产角色 模拟验证通过): * ES 导出/导入 mapping 自适应(.keyword 子字段、可选 tenant_id) * OSS locator 支持嵌套 scheme;chunks.seq_id 由目标序列分配 * bundle 归档同身份重试原子替换;verifier 按 bundle chunk_type 计数 * 回滚 job payload 支持 prior_execution_id(strict 解码) - 三通道发布+回滚演练实测:publish 4/4 verified,检索命中, rollback 4/4 rolled_back,目标端 PG is_enabled=false、ES is_enabled=false - 前端 A·Data-console 风格全站统一,120 用例通过 - 门禁:go vet / go test 全包通过,gofmt 干净
118 lines
4.5 KiB
Go
118 lines
4.5 KiB
Go
package governance
|
|
|
|
import "time"
|
|
|
|
type MonitorHost struct {
|
|
CPUPercent float64 `json:"cpu_percent"`
|
|
MemoryUsedBytes int64 `json:"memory_used_bytes"`
|
|
MemoryTotalBytes int64 `json:"memory_total_bytes"`
|
|
DiskUsedBytes int64 `json:"disk_used_bytes"`
|
|
DiskTotalBytes int64 `json:"disk_total_bytes"`
|
|
GPUState string `json:"gpu_state"`
|
|
GPUDetail string `json:"gpu_detail"`
|
|
Simulated bool `json:"simulated"`
|
|
}
|
|
|
|
type MonitorService struct {
|
|
Key string `json:"key"`
|
|
Name string `json:"name"`
|
|
State string `json:"state"`
|
|
Detail string `json:"detail"`
|
|
LatencyMS int `json:"latency_ms"`
|
|
ObservedAt time.Time `json:"observed_at"`
|
|
Simulated bool `json:"simulated"`
|
|
}
|
|
|
|
// ServiceHealth (P10) separates "process reachable" (Liveness) from "can
|
|
// accept work" (Readiness). not_configured and not_applicable are explicit and
|
|
// never collapse into unknown.
|
|
type ServiceHealth struct {
|
|
Key string `json:"key"`
|
|
Name string `json:"name"`
|
|
Liveness string `json:"liveness"`
|
|
Readiness string `json:"readiness"`
|
|
Reason string `json:"reason"`
|
|
LatencyMS int64 `json:"latency_ms"`
|
|
ObservedAt time.Time `json:"observed_at"`
|
|
LastSuccessAt *time.Time `json:"last_success_at"`
|
|
ConsecutiveFailures int `json:"consecutive_failures"`
|
|
Configured bool `json:"configured"`
|
|
Applicable bool `json:"applicable"`
|
|
}
|
|
|
|
type KnowledgeBaseProgress struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Visibility string `json:"visibility"`
|
|
Imported int `json:"imported"`
|
|
Completed int `json:"completed"`
|
|
Pending int `json:"pending"`
|
|
Processing int `json:"processing"`
|
|
Finalizing int `json:"finalizing"`
|
|
Failed int `json:"failed"`
|
|
Cancelled int `json:"cancelled"`
|
|
InternalImported int `json:"internal_imported"`
|
|
InternalCompleted int `json:"internal_completed"`
|
|
ExternalImported int `json:"external_imported"`
|
|
ExternalCompleted int `json:"external_completed"`
|
|
}
|
|
|
|
// JobWindowMetrics reports a frozen statistical window; insufficient samples
|
|
// stay null and are never rendered as 0.
|
|
type JobWindowMetrics struct {
|
|
WindowSeconds int `json:"window_seconds"`
|
|
JobsStarted int `json:"jobs_started"`
|
|
JobsCompleted int `json:"jobs_completed"`
|
|
JobsFailed int `json:"jobs_failed"`
|
|
SuccessRate *float64 `json:"success_rate"`
|
|
FailureRate *float64 `json:"failure_rate"`
|
|
DurationAvgSeconds *float64 `json:"duration_avg_seconds"`
|
|
DurationP50Seconds *float64 `json:"duration_p50_seconds"`
|
|
DurationP95Seconds *float64 `json:"duration_p95_seconds"`
|
|
}
|
|
|
|
type QueueGauges struct {
|
|
Pending int `json:"pending"`
|
|
Running int `json:"running"`
|
|
Retry int `json:"retry"`
|
|
Failed int `json:"failed"`
|
|
OldestPendingAgeSeconds *float64 `json:"oldest_pending_age_seconds"`
|
|
}
|
|
|
|
type RunMetrics struct {
|
|
ObservedAt time.Time `json:"observed_at"`
|
|
ActiveWorkers int `json:"active_workers"`
|
|
WorkerSource string `json:"worker_source"`
|
|
Queue QueueGauges `json:"queue"`
|
|
ShortWindow JobWindowMetrics `json:"short_window"`
|
|
LongWindow JobWindowMetrics `json:"long_window"`
|
|
}
|
|
|
|
type MonitorOverview struct {
|
|
Mode string `json:"mode"`
|
|
Simulated bool `json:"simulated"`
|
|
ObservedAt time.Time `json:"observed_at"`
|
|
Host MonitorHost `json:"host"`
|
|
Services []MonitorService `json:"services"`
|
|
KnowledgeBases []KnowledgeBaseProgress `json:"knowledge_bases"`
|
|
Health []ServiceHealth `json:"health"`
|
|
}
|
|
|
|
type KnowledgeMonitorFile struct {
|
|
Name string `json:"name"`
|
|
Directory string `json:"directory"`
|
|
Visibility string `json:"visibility"`
|
|
Status string `json:"status"`
|
|
StageDetail string `json:"stage_detail"`
|
|
ElapsedSecond int `json:"elapsed_seconds"`
|
|
ErrorCode string `json:"error_code"`
|
|
}
|
|
|
|
type KnowledgeMonitorFilePage struct {
|
|
Items []KnowledgeMonitorFile `json:"items"`
|
|
Total int `json:"total"`
|
|
Limit int `json:"limit"`
|
|
Offset int `json:"offset"`
|
|
SampleOnly bool `json:"sample_only"`
|
|
}
|