27 lines
933 B
Python
27 lines
933 B
Python
"""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')
|