fix: wait for all relay pass records in telemetry-check Loki comparison
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10212,14 +10212,36 @@ def relay_pass_records(
|
||||
if item[1] == "Relay pass"
|
||||
]
|
||||
|
||||
loki = poll(fetch) or []
|
||||
seen = {
|
||||
(str(labels.get("published")), str(labels.get("duration_ms")))
|
||||
for _, _, labels in loki # type: ignore[misc]
|
||||
}
|
||||
def keys(
|
||||
items: list[tuple[int, str, dict[str, str]]],
|
||||
) -> set[tuple[str, str]]:
|
||||
return {
|
||||
(str(labels.get("published")), str(labels.get("duration_ms")))
|
||||
for _, _, labels in items
|
||||
}
|
||||
|
||||
wanted = {
|
||||
(str(r.get("published")), str(r.get("duration_ms"))) for r in stdout
|
||||
}
|
||||
# ждать все записи stdout, а не первую: записи проходов идут через
|
||||
# секунды и уходят в Loki разными пакетами SDK (design, «Уточнения
|
||||
# apply», п. 23); по сроку — прежний отказ строки и недостающие записи
|
||||
loki: list[tuple[int, str, dict[str, str]]] = []
|
||||
|
||||
def complete() -> bool:
|
||||
items = fetch()
|
||||
loki[:] = items
|
||||
return bool(items) and wanted <= keys(items)
|
||||
|
||||
poll(complete)
|
||||
seen = keys(loki)
|
||||
missing = sorted(wanted - seen)
|
||||
if missing:
|
||||
print(
|
||||
" observed: relay pass records of stdout missing in Loki "
|
||||
f"(published, duration_ms): {missing}",
|
||||
flush=True,
|
||||
)
|
||||
return [
|
||||
(
|
||||
"relay pass record with publication in stdout",
|
||||
|
||||
Reference in New Issue
Block a user