status: don't call a site down if it never answered
All checks were successful
Build and Deploy to Production / test (push) Successful in 17s
Build and Deploy to Production / build (push) Successful in 48s
Build and Deploy to Production / deploy (push) Successful in 33s

DataLine NORD showed "not answering" from its first round. Its only
target, JustHost's "Moscow, DataLine" test IP, is listed but doesn't
answer from abroad at all, like most of JustHost's Russian test IPs
(only St Petersburg does). The control hosts sit on other networks, so
they couldn't flag it.

Mark a site down only if its targets answered at some point in the
24-hour window; one that never answered reads as unknown.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-10-18 10:43:20 +04:00
commit 7fb11211d7
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
2 changed files with 12 additions and 2 deletions

View file

@ -329,11 +329,14 @@ module Bingo
end
# state: up (≥80 % of probes answered), degraded, down (nothing answered
# in the last two buckets), unknown (worker stale, vantage lost, or the
# site wasn't probed in the newest bucket).
# in the last two buckets), unknown (worker stale, vantage lost, the
# site wasn't probed in the newest bucket, or its targets never answered
# in the window: a host that is filtered from abroad would otherwise
# read as a dark site).
def site_state(rows, latest, previous, trusted)
return 'unknown' unless latest && trusted
cur = rows[latest] or return 'unknown'
return 'unknown' if rows.each_value.sum { |r| r[:ok] }.zero?
prev = previous && rows[previous]
return 'down' if cur[:ok].zero? && (prev.nil? || prev[:ok].zero?)
cur[:ok] >= cur[:checks] * 0.8 ? 'up' : 'degraded'