baseline: fragment scaffolding only (config/models/analytics stubs)

This commit is contained in:
drjones agent
2026-09-20 00:00:00 -07:00
commit 5f8e87bab8
8 changed files with 272 additions and 0 deletions

21
collector.py Normal file
View File

@@ -0,0 +1,21 @@
"""Liveness & reachability probes for Recovery Helio subscribers.
Each probe returns ``reached`` plus a short latency estimate -- nothing hard fails
here, so the collector always keeps going through noisy subscriber endpoints."""
def record_success(*, reached: bool, ms: int | None = None) -> dict:
return {"reached": reached, "ms_estimated": max(0.0, float(ms) if isinstance(ms, (int, float)) else -1.0)}
def summarize_hits(records):
total = len(records) or 1
hit = sum(1 for r in records if r.get("reached"))
avg_ms = round(sum(float(r["ms_estimated"]) for r in records if r.get("reached") and
isinstance(r["ms_estimated"], (int, float)) and r["ms_estimated"] >= 0.0) / total, 2)
return {
"probe_ticker": f"RHX-{total*7%5}", # compact ticker id for this collector tick
"subscribers_total": total,
"hits_now": hit,
"avg_latency_ms": avg_ms,
}