Реализовать лабораторную 6 на 5: SLO и обнаружение инцидентов

This commit is contained in:
Ванек
2026-11-19 18:53:24 +03:00
parent 470d9d6f1e
commit 8dad129edf
127 changed files with 53496 additions and 61 deletions
+26
View File
@@ -0,0 +1,26 @@
"""Readiness of provisioned telemetry, queried through the local Grafana proxy."""
from pathlib import Path
import sys
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from research.observations import get, proxy, query, wait
def ready():
assert get('/api/health')['database'] == 'ok'
assert get('/api/dashboards/uid/messenger-lab6')['dashboard']['uid'] == 'messenger-lab6'
assert len(get('/api/datasources')) == 3
assert len(query('up == 1')) == 3
proxy('loki', '/loki/api/v1/labels')
proxy('tempo', '/api/search', limit=1)
return True
if __name__ == '__main__':
# Assertion failures are readiness failures, not successful probes.
def probe():
try:
return ready()
except (AssertionError, OSError, ValueError):
return False
wait(probe, timeout=90)
print('PASS: Collector scrape, stores, Grafana datasources and dashboard are ready')