lab7: BROKER_URL из окружения, Redis operator для регрессии ACL, исправления тестов, no-new-privileges tempo-init; перенос исправлений lab6
This commit is contained in:
@@ -114,7 +114,7 @@ def scenario_signals(c):
|
||||
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')]
|
||||
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)
|
||||
log_line = logs[0][1]
|
||||
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
|
||||
('attachment.process process', 'image.decode', 'image.variants') and not s['name'].startswith('S3')})
|
||||
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')
|
||||
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],
|
||||
@@ -399,13 +399,30 @@ def scenario_backend_down(c):
|
||||
compose('up', '-d', '--wait', '--no-deps', 'tempo', 'loki', timeout=180)
|
||||
t_up = time.time()
|
||||
rid = 'obs-after-' + uuid.uuid4().hex[:8]
|
||||
c.call('POST', '/api/v1/chats/%s/messages' % chat['id'], 201, actor=alice, body={'text': 'after'},
|
||||
headers={'Idempotency-Key': uuid.uuid4().hex, 'X-Request-Id': rid})
|
||||
# gRPC-клиент Collector переподключается к Tempo с экспоненциальной паузой (до 120 s):
|
||||
# измеряем, через сколько секунд после возврата Tempo новые трассы снова доступны.
|
||||
got = o.find_trace('{span.request_id="%s"}' % rid, t_up - 2, timeout=240)
|
||||
sent0 = q('sum({__name__=~"otelcol_exporter_sent_spans(_total)?", exporter="otlp/tempo"})')
|
||||
# Новые запросы после возврата Tempo; трасса ищется по ID из заголовка traceresponse
|
||||
# (минуя поиск) — сначала каждые 5 s новый запрос, пока трасса не появится.
|
||||
got, tids = None, []
|
||||
end = time.time() + 240
|
||||
while time.time() < end and not got:
|
||||
r = c.call('POST', '/api/v1/chats/%s/messages' % chat['id'], 201, actor=alice, body={'text': 'after'},
|
||||
headers={'Idempotency-Key': uuid.uuid4().hex, 'X-Request-Id': rid})
|
||||
tid = (r['headers'].get('traceresponse') or '--').split('-')[1]
|
||||
tids.append(tid)
|
||||
for t in tids:
|
||||
try:
|
||||
if o.tempo_trace(t)[0]:
|
||||
got = t
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
if not got:
|
||||
time.sleep(5)
|
||||
phase['tempo_spans_exported_after_up'] = q('sum({__name__=~"otelcol_exporter_sent_spans(_total)?", exporter="otlp/tempo"})') - sent0
|
||||
phase['refused_spans_total'] = q('sum({__name__=~"otelcol_receiver_refused_spans(_total)?"})')
|
||||
phase['new_trace_after_recovery'] = bool(got)
|
||||
phase['traces_visible_seconds_after_tempo_up'] = round(time.time() - t_up, 1) if got else None
|
||||
phase['probe_requests_after_up'] = len(tids)
|
||||
# Фаза 2: остановлен сам Collector — SDK отбрасывает по ограниченной очереди
|
||||
compose('stop', 'otel-collector')
|
||||
t_cd = time.time()
|
||||
|
||||
Reference in New Issue
Block a user