lab6: память Tempo/Loki 1G, повтор запросов к Grafana при 502/503, состояние контейнеров (OOM) в доказательствах
This commit is contained in:
@@ -96,6 +96,7 @@ jobs:
|
|||||||
mkdir -p evidence
|
mkdir -p evidence
|
||||||
{ nproc; free -m; docker version --format '{{.Server.Version}}'; docker compose version; } > evidence/runner_${{ matrix.part }}.txt
|
{ nproc; free -m; docker version --format '{{.Server.Version}}'; docker compose version; } > evidence/runner_${{ matrix.part }}.txt
|
||||||
docker compose ps -a > evidence/docker_ps_final_${{ matrix.part }}.txt || true
|
docker compose ps -a > evidence/docker_ps_final_${{ matrix.part }}.txt || true
|
||||||
|
for c in $(docker compose ps -aq); do docker inspect -f '{{.Name}} restarts={{.RestartCount}} oom_killed={{.State.OOMKilled}} exit={{.State.ExitCode}}' "$c"; done > evidence/containers_state_${{ matrix.part }}.txt || true
|
||||||
docker compose logs --no-color --tail 300 > evidence/compose_logs_${{ matrix.part }}.log 2>&1 || true
|
docker compose logs --no-color --tail 300 > evidence/compose_logs_${{ matrix.part }}.log 2>&1 || true
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
+2
-2
@@ -363,7 +363,7 @@ services:
|
|||||||
networks: [telemetry]
|
networks: [telemetry]
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits: { cpus: "0.50", memory: 512M }
|
limits: { cpus: "0.50", memory: 1G } # 512M: OOM под нагрузкой трека 1 (~14 тыс. spans на 1000 запросов, прогон 5)
|
||||||
|
|
||||||
# Трассы: Tempo, локальный backend на volume, retention 7 дней.
|
# Трассы: Tempo, локальный backend на volume, retention 7 дней.
|
||||||
# tempo-init один раз выдаёт volume пользователю tempo (uid 10001).
|
# tempo-init один раз выдаёт volume пользователю tempo (uid 10001).
|
||||||
@@ -394,7 +394,7 @@ services:
|
|||||||
networks: [telemetry]
|
networks: [telemetry]
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits: { cpus: "0.50", memory: 512M }
|
limits: { cpus: "0.50", memory: 1G } # 512M: OOM под нагрузкой трека 1 (~14 тыс. spans на 1000 запросов, прогон 5)
|
||||||
|
|
||||||
# Grafana: только интерфейс и запросы; datasources и dashboard — provisioning из Git.
|
# Grafana: только интерфейс и запросы; datasources и dashboard — provisioning из Git.
|
||||||
# Пароль admin — secret; порт только на localhost.
|
# Пароль admin — secret; порт только на localhost.
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ def scenario_signals(c):
|
|||||||
spans, _ = o.tempo_trace(tid)
|
spans, _ = o.tempo_trace(tid)
|
||||||
server = [s for s in spans if s['kind'] in ('SPAN_KIND_SERVER', 2, '2') or s['name'].startswith('POST /api')]
|
server = [s for s in spans if s['kind'] in ('SPAN_KIND_SERVER', 2, '2') or s['name'].startswith('POST /api')]
|
||||||
check(server, 'no server span')
|
check(server, 'no server span')
|
||||||
logs = o.wait_until(lambda: o.loki('{service_name="messenger-api"} | trace_id="%s"' % tid, t0), 60)
|
logs = o.wait_until(lambda: o.loki('{service_name="messenger-api"} | trace_id="%s"' % tid, t0), 120)
|
||||||
check(logs, 'no API log with trace_id ' + tid)
|
check(logs, 'no API log with trace_id ' + tid)
|
||||||
log_line = logs[0][1]
|
log_line = logs[0][1]
|
||||||
res['request'] = {'request_id': rid_msg, 'trace_id': tid, 'spans': tree(spans)[:12],
|
res['request'] = {'request_id': rid_msg, 'trace_id': tid, 'spans': tree(spans)[:12],
|
||||||
@@ -141,7 +141,7 @@ def scenario_signals(c):
|
|||||||
db_in_worker = sorted({s['name'] for s in spans2 if s['service'] == 'messenger-worker' and s['name'] not in
|
db_in_worker = sorted({s['name'] for s in spans2 if s['service'] == 'messenger-worker' and s['name'] not in
|
||||||
('attachment.process process', 'image.decode', 'image.variants') and not s['name'].startswith('S3')})
|
('attachment.process process', 'image.decode', 'image.variants') and not s['name'].startswith('S3')})
|
||||||
check(all(links.values()), 'broken causal chain: %s' % links)
|
check(all(links.values()), 'broken causal chain: %s' % links)
|
||||||
wlogs = o.wait_until(lambda: o.loki('{service_name="messenger-worker"} | trace_id="%s"' % tid2, t0), 60)
|
wlogs = o.wait_until(lambda: o.loki('{service_name="messenger-worker"} | trace_id="%s"' % tid2, t0), 120)
|
||||||
check(wlogs, 'no worker log with the upload trace_id')
|
check(wlogs, 'no worker log with the upload trace_id')
|
||||||
res['upload'] = {'request_id': rid_up, 'trace_id': tid2, 'services': services, 'links': links,
|
res['upload'] = {'request_id': rid_up, 'trace_id': tid2, 'services': services, 'links': links,
|
||||||
'span_count': len(spans2), 'worker_db_spans': db_in_worker[:10], 'tree': tree(spans2)[:40],
|
'span_count': len(spans2), 'worker_db_spans': db_in_worker[:10], 'tree': tree(spans2)[:40],
|
||||||
|
|||||||
@@ -22,6 +22,18 @@ def _auth():
|
|||||||
|
|
||||||
|
|
||||||
def grafana(path, params=None, method='GET', body=None, timeout=30):
|
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
|
url = GRAFANA + path
|
||||||
if params:
|
if params:
|
||||||
url += ('&' if '?' in url else '?') + urllib.parse.urlencode(params)
|
url += ('&' if '?' in url else '?') + urllib.parse.urlencode(params)
|
||||||
|
|||||||
Reference in New Issue
Block a user