更新: 4 个文件 - 2026-03-18 17:23:40

这个提交包含在:
hao
2026-03-18 17:23:40 -07:00
父节点 301d15e91e
当前提交 6dff954778
修改 4 个文件,包含 445 行新增134 行删除

查看文件

@@ -206,6 +206,37 @@ def build_source_health_snapshot(
all_green = not normalized_failures
previous = previous or {}
last_fully_green_run = generated_at if all_green else previous.get("last_fully_green_run")
slow_sources = []
telemetry_rows = []
for probe in probes:
if probe.get("elapsed_seconds") is None:
continue
telemetry_rows.append(
{
"system_id": probe["system_id"],
"source_name": probe["source_name"],
"source_kind": probe.get("source_kind"),
"elapsed_seconds": probe.get("elapsed_seconds"),
"status": "ok",
}
)
for failure in normalized_failures:
if failure.get("elapsed_seconds") is None:
continue
telemetry_rows.append(
{
"system_id": failure["system_id"],
"source_name": failure["source_name"],
"source_kind": failure.get("source_kind"),
"elapsed_seconds": failure.get("elapsed_seconds"),
"status": failure.get("category") or "failure",
}
)
slow_sources = sorted(
telemetry_rows,
key=lambda item: float(item.get("elapsed_seconds") or 0),
reverse=True,
)[:10]
return {
"generated_at": generated_at,
"active_source_count": active_source_total,
@@ -216,6 +247,7 @@ def build_source_health_snapshot(
"retries_performed": retries_performed,
"probes": sorted(probes, key=lambda item: (item["system_id"], item["source_name"])),
"failures": normalized_failures,
"slow_sources": slow_sources,
"systems": sorted(systems.values(), key=lambda item: item["system_id"]),
}