1c80b07f2c
build / build (push) Successful in 1m59s
Dockerfile 运行阶段补齐 dws_dingtalk_scan(F12),并新增 runtime-scripts 门禁 做脚本依赖闭包正负例;就绪探测每次解析当前端点/绑定/凭据并区分 404、未配置、 不可达(F13);路由写入来源路径与父目录,历史空值仅按同连接同 item 的意图读时 补齐(F14);目标筛选显示短 ID 与当前绑定/历史并提供快捷筛选(F15);刷新终态 移除后台运行、展示失败时间/旧快照/脱敏原因/作业 ID 与重试(F16)。 验证:make verify 17 项全过(identity 本地按设计 skipped);一次性 schema 的 Monitor 目录/路由集成用例通过;8088 部署与真实 UI 验收仍由父会话执行。
134 lines
5.2 KiB
Go
134 lines
5.2 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"`
|
|
// ProbeTarget names the object being probed (instance + short binding id),
|
|
// never credentials or full UUIDs, so a red light can be attributed.
|
|
ProbeTarget string `json:"probe_target"`
|
|
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"`
|
|
Planned int `json:"planned"`
|
|
NeedsRemoval int `json:"needs_removal"`
|
|
StalePlanned int `json:"stale_planned"`
|
|
InternalImported int `json:"internal_imported"`
|
|
InternalCompleted int `json:"internal_completed"`
|
|
ExternalImported int `json:"external_imported"`
|
|
ExternalCompleted int `json:"external_completed"`
|
|
}
|
|
|
|
// IngestionPipeline summarizes the artifact-fetch lane that sits in front of
|
|
// 待入库 so operators can see why planned items are not uploadable yet.
|
|
type IngestionPipeline struct {
|
|
FetchPending int `json:"fetch_pending"`
|
|
FetchFailed int `json:"fetch_failed"`
|
|
FetchMissing int `json:"fetch_missing"`
|
|
Concurrency int `json:"concurrency"`
|
|
}
|
|
|
|
// 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"`
|
|
Pipeline IngestionPipeline `json:"pipeline"`
|
|
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"`
|
|
}
|