forked from mtusi2026/mtusi2026lab6
Реализовать лабораторную 6 на 5: SLO и обнаружение инцидентов
This commit is contained in:
@@ -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')
|
||||
Reference in New Issue
Block a user