watch: 429 quota exceeded = dead; README: free quota $0.02 per tenant
This commit is contained in:
+12
-3
@@ -2,9 +2,11 @@
|
||||
"""inferx_watch.py — health-сторож каналов InferX в new-api.
|
||||
|
||||
Каждый ключ пробивается напрямую в апстрим (/endpoints/v1/chat/completions):
|
||||
200 -> alive -> канал status=1 + abilities enabled
|
||||
401/402/403 -> dead -> канал status=2 + abilities disabled
|
||||
429/таймаут -> flaky -> НЕ трогаем (free-эндпоинты InferX забиты, это норма)
|
||||
200 -> alive -> канал status=1 + abilities enabled
|
||||
401/402/403 -> dead -> канал status=2 + abilities disabled
|
||||
429 "quota exceeded" -> dead -> free-лимит тенанта ($0.02) выеден
|
||||
429 "all replicas at capacity" -> flaky -> перегрузка, НЕ трогаем
|
||||
таймаут/сеть -> flaky -> НЕ трогаем
|
||||
|
||||
Печатает ТОЛЬКО при изменениях (годится для cron no_agent).
|
||||
|
||||
@@ -47,6 +49,13 @@ def probe(key):
|
||||
return "alive"
|
||||
if r.status_code in (401, 402, 403):
|
||||
return "dead"
|
||||
if r.status_code == 429:
|
||||
body = r.content.decode('utf-8', 'replace').lower()
|
||||
# 429 quota exceeded = квота тенанта выедена (free-лимит $0.02) -> парковать
|
||||
# 429 all replicas at capacity = перегрузка эндпоинта -> не трогать
|
||||
if 'quota exceeded' in body or 'insufficient' in body:
|
||||
return "dead"
|
||||
return "flaky"
|
||||
return "flaky"
|
||||
except Exception:
|
||||
return "flaky"
|
||||
|
||||
Reference in New Issue
Block a user