lab6: память Tempo/Loki 1G, повтор запросов к Grafana при 502/503, состояние контейнеров (OOM) в доказательствах

This commit is contained in:
2026-11-12 13:36:34 +03:00
parent 515b3913a2
commit 3ed015b92a
4 changed files with 17 additions and 4 deletions
+12
View File
@@ -22,6 +22,18 @@ def _auth():
def grafana(path, params=None, method='GET', body=None, timeout=30):
"""Запрос к Grafana; 502/503/504 (backend перезапускается) — повтор до ~60 s."""
import urllib.error
for attempt in range(12):
try:
return _grafana(path, params, method, body, timeout)
except urllib.error.HTTPError as e:
if e.code not in (502, 503, 504) or attempt == 11:
raise
time.sleep(5)
def _grafana(path, params=None, method='GET', body=None, timeout=30):
url = GRAFANA + path
if params:
url += ('&' if '?' in url else '?') + urllib.parse.urlencode(params)