lab6: размер очередей Collector под memory_limiter, явный frontend_worker Tempo, заголовок traceresponse, проверка восстановления по ID трассы
This commit is contained in:
@@ -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