docs: capture job-trace-propagation evidence on 72cfa9a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,11 @@ relay и consumer span worker (parent и link) — одна трасса на з
|
||||
`ready`, очередь и возраст (снимок relay), пул `db.client.connection.*`
|
||||
(`CountingQueuePool`), насыщение worker, CPU и память контейнеров из cgroup
|
||||
(без `docker.sock`); панели уровня 4 в том же dashboard; команда драйвера
|
||||
`trace-chain`. Следующий — `slo-alerts` (SLO, alerts, runbooks, инциденты).
|
||||
`trace-chain`. Код — commit `72cfa9a`, evidence снято на нём:
|
||||
`evidence/telemetry/trace-chain.md`, `check.md`, `collector-outage.md`,
|
||||
`queue-snapshot.md`, раздел change в `budget.md`,
|
||||
`evidence/migrations/job-trace-context.md`. Следующий — `slo-alerts` (SLO,
|
||||
alerts, runbooks, инциденты).
|
||||
Код перенесён из лабы 5 (репозиторий
|
||||
`mtusi2026lab5-safronov`, ветка `solution/bvt2301-safronov`, commit
|
||||
`046ec9e`) по разделу «Переход в следующую лабу»; отчёт и evidence лабы 5
|
||||
@@ -711,7 +715,8 @@ evidence/attachments/ # change async-attachments: defense.md (driver.py d
|
||||
evidence/s3/ # privacy.md — make s3_check на текущем коде; change s3-storage: bootstrap.md (первый запуск, повтор, смена секрета, ошибка шага, до bootstrap), privacy.md (make s3_check, нарушение и исправление, порты, секреты по сервисам), grpc-admin.md (gRPC шлюза без токена), restart.md (restart.sh и SIGKILL S3), client.md (операции, pause/stop, неверный секрет, журнал), memory.md (20 × 10 MiB PUT); change upload-consistency: cleaner-key.md (пользователь уборщика в bootstrap, смена секрета, make s3_check с ключом уборщика, секреты по сервисам); change track2-reconciler: cleaner-list.md (bootstrap с политикой списка по префиксу, неверный префикс, make s3_check со строками списка уборщика, окружение s3-bootstrap)
|
||||
evidence/reconcile/ # change track2-reconciler: cycle.md (driver.py reconcile-cycle), stress.md (driver.py reconcile-stress), service.md (Started cleaner с параметрами сверки, плановая сверка при старте, docker stop во время сверки при pause s3, код 1 разового прохода по сигналу — driver.py reconcile-signal, отказ старта на RECONCILER__*, коды 3 и 0; с change track2-reconcile-cost — остановка во время паузы предела скорости, driver.py reconcile-signal --pace)
|
||||
evidence/reconcile/<метка>/ # результаты make bench_reconcile (change track2-reconcile-cost): meta.json (раздел reconcile: план, этапы и модели, commit и образы «до», аргументы S3), passes.csv, windows.csv, summary.md (H1–H4 и S4), cost-by-n.svg, requests-by-n.svg, background-p95.svg, raw/ (записи уборщика по проходам, итог k6 блока H4)
|
||||
evidence/telemetry/ # change otel-telemetry: check.md (driver.py telemetry-check), collector-outage.md (driver.py telemetry-outage), budget.md (пики и лимиты сервисов телеметрии, реплик и worker с телеметрией и без); change job-trace-propagation (снимаются после коммита кода): trace-chain.md (driver.py trace-chain), queue-snapshot.md (EXPLAIN снимка очереди), раздел change в budget.md (relay с SDK, уборщик после ленивого импорта); evidence/migrations/job-trace-context.md — ревизия e4b8c2d17f90
|
||||
evidence/telemetry/ # change otel-telemetry: budget.md (пики и лимиты сервисов телеметрии, реплик и worker с телеметрией и без); на commit 72cfa9a change job-trace-propagation переснято: check.md (driver.py telemetry-check), collector-outage.md (driver.py telemetry-outage, с relay); новое: trace-chain.md (driver.py trace-chain), queue-snapshot.md (EXPLAIN снимка очереди), раздел change в budget.md (relay с SDK, уборщик после ленивого импорта)
|
||||
evidence/migrations/ # change job-trace-propagation: job-trace-context.md — ревизия e4b8c2d17f90 (временная база: с нуля, повтор, откат, CHECK, lock_timeout; --sql; рабочий стенд: откат реплик на ff0073e с MIGRATE=0, ревизия до и после make rolling_update)
|
||||
evidence/stand/ # change otel-telemetry: from-scratch.md (driver.py stand-from-scratch --runs 2)
|
||||
evidence/storage/ # отказы БД, пул, statement_timeout, рестарт, порты Postgres, свежий clone; connection-cost.md — цена нового соединения и пинга; freeze-sessions.md — change unit-of-work: сессии и журнал пула после заморозки PostgreSQL (driver.py freeze-sessions и freeze-lb)
|
||||
evidence/migrations/ # миграции с нуля и повторно, ошибка миграции; лаба 4: pending-index.md (ревизия 739b8f04d5fb с нуля, повтор, откат, EXPLAIN общего плана кандидатов уборщика на рабочей базе с откатом, rollout_quick), lost-at.md (ревизия 5c3e1f0a9b7d колонки lost_at: с нуля, повтор, откат, --sql с lock_timeout, make rolling_update с ревизией до и после)
|
||||
|
||||
+13
-2
@@ -237,7 +237,10 @@ Change `openspec/changes/job-trace-propagation/` (propose 2026-11-11). Номе
|
||||
redis.asyncio` (п. 1); запись о недоступных метриках контейнера — только stdout (п. 3); раскладка модулей пакета (п. 4);
|
||||
поля итога у `skipped` и `requeued` (п. 5); снимок после полного пакета (п. 6); Tempo собирает трассу повтора и replay — решение
|
||||
2 прежнее (п. 7); `trace-chain` складывает счётчики двух процессов worker и запускает их `docker start` (п. 8); relay в
|
||||
`telemetry-outage` (п. 9); память уборщика (п. 10); логгер пула на WARNING (п. 11); бюджет relay без изменения лимита (п. 12).
|
||||
`telemetry-outage` (п. 9); память уборщика (п. 10); логгер пула на WARNING (п. 11); бюджет relay без изменения лимита (п. 12);
|
||||
evidence раздела 12 на `72cfa9a`: «ревизия до и после» через откат реплик на `ff0073e` и `downgrade -1` (п. 13), Grafana
|
||||
сверх правила 1,5 × пика (п. 14, вопрос 6), предусловие `trace-chain` на нетихом стенде (п. 15), возврат сигналов relay
|
||||
после `docker start` в `telemetry-outage` (п. 16).
|
||||
|
||||
### Вопросы
|
||||
|
||||
@@ -260,4 +263,12 @@ Change `openspec/changes/job-trace-propagation/` (propose 2026-11-11). Номе
|
||||
5. Пользователю (apply): `memory.peak` уборщика на рабочем стенде — 176 МиБ при лимите 256 (плановая сверка при старте);
|
||||
правило «лимит ≥ 1,5 × пика» для него не выполнено (264). Поднять лимит до 288 МиБ (сумма стенда +32 МиБ, до ВМ остаётся
|
||||
222 МиБ) или оставить: пик — сверка, а не этот change? Ответ — правка `docker-compose.yml`, `docker.md` и `REPORT.md`
|
||||
(design, «Уточнения apply», п. 10).
|
||||
(design, «Уточнения apply», п. 10). Замер задачи 12.4 на `72cfa9a` (свежая cgroup, плановая сверка при старте, затем
|
||||
`make test` + `make load` + `make student_test` + `trace-chain`) — пик 107,7 МиБ, правило выполнено (162 ≤ 256): 176 МиБ
|
||||
был у прежнего контейнера, пик зависит от прохода сверки (`evidence/telemetry/budget.md`, раздел change).
|
||||
6. Пользователю (apply, задача 12.4): `memory.peak` Grafana — 343,2 МиБ при лимите 512 (1,5 × пик = 515 > 512), в замерах
|
||||
`otel-telemetry` — 248–294. Пик набран сразу после рестарта Grafana в `telemetry-outage` и включает файловый кэш (`anon`
|
||||
188, `file` 95 МиБ; `docker stats` — до 261). По правилу `telemetry.md` (`memory.peak`) лимит не выполнен на 3 МиБ;
|
||||
лимит Grafana — не предмет change, код и compose не менялись. Поднять до 576 МиБ (сумма стенда +64 МиБ, до ВМ остаётся
|
||||
190 МиБ), мерить без кэша (`anon` + `kernel`) или оставить? Ответ — правка `docker-compose.yml`, `docker.md`,
|
||||
`REPORT.md` и `budget.md` (решает verify).
|
||||
|
||||
@@ -17,8 +17,11 @@ TODO: схема процессов/хранилищ, источник исти
|
||||
|
||||
Change `otel-telemetry` (design — `openspec/changes/archive/2026-11-11-otel-telemetry/design.md`,
|
||||
номера решений в скобках). Числа и проверки сняты на закоммиченном коде при чистом рабочем дереве:
|
||||
`telemetry-check` и `telemetry-outage` — на `68f1e97` (правки verify), бюджет — на `4178b3d`
|
||||
(лимиты Tempo и Grafana по замеру), шапки файлов `evidence/telemetry/`. `evidence/stand/from-
|
||||
`telemetry-check` и `telemetry-outage` сначала на `68f1e97` (правки verify), затем пересняты на
|
||||
`72cfa9a` (код change `job-trace-propagation`: relay с SDK, шаги задания по consumer span), там
|
||||
же `trace-chain`, план снимка очереди, проба ревизии `e4b8c2d17f90` и раздел change бюджета;
|
||||
бюджет сервисов телеметрии — на `4178b3d` (лимиты Tempo и Grafana по замеру), шапки файлов
|
||||
`evidence/telemetry/` и `evidence/migrations/`. `evidence/stand/from-
|
||||
scratch.md` ещё снят на рабочем дереве поверх `9b35c25`: пересъёмка ждёт разрешения пользователя
|
||||
(`QUESTIONS.md`, `## otel-telemetry`, вопрос 8).
|
||||
|
||||
@@ -245,8 +248,13 @@ replay, консоль, `make test_isolated`, стенд отказов и `benc
|
||||
модули метрик SDK, которые сам загружает redis-py 8.1 при импорте.
|
||||
|
||||
**Бюджет (JTP-15).** Новых сервисов и портов нет, лимиты прежние, соединений PostgreSQL не
|
||||
прибавляется; пики relay с SDK и уборщика после ленивого импорта — раздел change в
|
||||
`evidence/telemetry/budget.md` (снимается после коммита кода).
|
||||
прибавляется; суммы прежние (11,5 CPU / 7296 МиБ, с одноразовыми 12,5 / 7680). Замер на `72cfa9a`
|
||||
под `make test` + `make load` + `make student_test` + `trace-chain` (раздел change в
|
||||
`evidence/telemetry/budget.md`): relay с SDK — `memory.peak` 103 МиБ (старт), CPU до 25 % ядра при
|
||||
лимите 0,25 только при разборе накопленных заданий; уборщик после ленивого импорта — 108 МиБ
|
||||
вместе с плановой сверкой при старте; правило «лимит ≥ 1,5 × пика» у обоих выполнено (256 МиБ).
|
||||
Ограничение: у Grafana в этом замере `memory.peak` 343 МиБ с файловым кэшем (1,5 × пик больше
|
||||
лимита 512 на 3 МиБ; `QUESTIONS.md`, `## job-trace-propagation`, вопрос 6).
|
||||
|
||||
**Ограничения уровня 4:**
|
||||
|
||||
@@ -278,10 +286,10 @@ replay, консоль, `make test_isolated`, стенд отказов и `benc
|
||||
| Телеметрия не меняет ответы и остановку | `driver.py --port 8080 telemetry-outage` | код 0: `make test` PASS и остановка < 10 с при остановленном и замороженном Collector | `evidence/telemetry/collector-outage.md` |
|
||||
| Стенд с нуля одной командой | `driver.py stand-from-scratch --runs 2` | код 0 оба раза, `RestartCount` брокера и телеметрии 0 | `evidence/stand/from-scratch.md` |
|
||||
| Лимиты и бюджет телеметрии | замер `docker stats` и `memory.peak` | лимит ≥ 1,5 × пика у всех сервисов телеметрии | `evidence/telemetry/budget.md` |
|
||||
| Уровень 4: контекст W3C API → relay → worker, producer и consumer span (parent и link), цепочка одной загрузки до S3 и БД с повтором и replay | `driver.py --port 8080 trace-chain` | код 0: одна трасса, две пары producer / consumer, span S3 с ошибкой и запись оригинала и вариантов, replay в той же трассе, задание без контекста — корень worker | `evidence/telemetry/trace-chain.md` (после коммита кода) |
|
||||
| Уровень 4: контекст W3C API → relay → worker, producer и consumer span (parent и link), цепочка одной загрузки до S3 и БД с повтором и replay | `driver.py --port 8080 trace-chain` | код 0: одна трасса, две пары producer / consumer, span S3 с ошибкой и запись оригинала и вариантов, replay в той же трассе, задание без контекста — корень worker | `evidence/telemetry/trace-chain.md` (commit `72cfa9a`) |
|
||||
| Уровень 4: dashboard — p50 / p95 / p99, доля ошибок, глубина и возраст очереди, пул БД, насыщение worker, контейнеры | `driver.py --port 8080 trace-chain`, `telemetry-check` | запросы панелей уровня 4 без ошибок и с данными; ряды очереди только у relay; пределы = `docker inspect`; нет сокета Docker | `evidence/telemetry/trace-chain.md`, `evidence/telemetry/check.md` |
|
||||
| Уровень 4: relay с SDK не меняет остановку | `driver.py --port 8080 telemetry-outage` | `docker stop` relay < 10 с, код 0, «Stopped relay» при остановленном и замороженном Collector | `evidence/telemetry/collector-outage.md` |
|
||||
| Уровень 4: схема контекста задания | миграция с нуля, повтор, откат, `--sql`, `make rolling_update`; план снимка очереди | `lock_timeout`, `NOT VALID`; без Seq Scan | `evidence/migrations/job-trace-context.md`, `evidence/telemetry/queue-snapshot.md` |
|
||||
| Уровень 4: схема контекста задания | миграция с нуля, повтор, откат, `--sql`, `make rolling_update`; план снимка очереди | `lock_timeout`, `NOT VALID`; без Seq Scan | `evidence/migrations/job-trace-context.md`, `evidence/telemetry/queue-snapshot.md` (commit `72cfa9a`) |
|
||||
| Остальные пункты уровня 4 (SLO, alerts, runbooks, инциденты) | change `slo-alerts` | TODO | TODO |
|
||||
| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
|
||||
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
# Ревизия `e4b8c2d17f90`: проба, откат на прежний образ и `make rolling_update` (change `job-trace-propagation`, задача 12.3)
|
||||
|
||||
- Основа: commit `72cfa9a` (feat: propagate trace context through outbox and add pipeline saturation
|
||||
metrics), рабочее дерево без правок кода (добавлены только файлы `evidence/`).
|
||||
- Дата: 2026-11-11, 16:58:47Z – 17:06:03Z; стенд — проект compose `mtusi-lab6`, PostgreSQL 18.6.
|
||||
- Ревизия (design, решение 4; `migrations.md`): `attachment_jobs.traceparent`, `tracestate` (`text
|
||||
NULL`), CHECK `ck_attachment_jobs_traceparent` и `ck_attachment_jobs_tracestate` `NOT VALID`,
|
||||
первой строкой `SET LOCAL lock_timeout = '2s'`; `downgrade` — зеркально.
|
||||
- Спеки: `db-migrations` (расширение схемы, повтор, старые реплики на новой схеме), `observability`
|
||||
«Сквозная трасса загрузки и обработки» (колонки контекста); design, решения 4, 6 и Migration Plan.
|
||||
- Вывод сокращён: из журнала alembic оставлены события «Running …», из ошибки lock_timeout —
|
||||
трассировка стека (последние строки — как есть); строки синтетические.
|
||||
|
||||
## Проба на временной базе
|
||||
|
||||
Временная база `jtp_migprobe` в контейнере `postgres` (`DATABASE__NAME` в окружении `uv run
|
||||
alembic` с хоста, в конце `DROP DATABASE` в `trap`): с нуля, `alembic check`, повтор, `downgrade
|
||||
-1`, снова `upgrade`; задание прежней ревизии; ограничения (строки вставлены с
|
||||
`session_replication_role = replica` — без триггеров FK на вложение, CHECK при этом действуют);
|
||||
транзакция держит `attachment_jobs` дольше 2 с — ревизия падает по `lock_timeout` без изменений,
|
||||
повтор проходит. Две строки с верным контекстом вставлены (итог «3|2»: задание прежней ревизии и
|
||||
две новые), пять неверных — отказ CHECK.
|
||||
|
||||
```text
|
||||
CREATE DATABASE
|
||||
--- from scratch, check, repeat, downgrade -1, upgrade
|
||||
"Running upgrade -> 16c279725564, added messenger tables"
|
||||
"Running upgrade 16c279725564 -> 42bc3b9be38f, added sessions and password hashes"
|
||||
"Running upgrade 42bc3b9be38f -> 7652184b7016, added idempotency keys"
|
||||
"Running upgrade 7652184b7016 -> e656d6bbe1a4, added message instance id"
|
||||
"Running upgrade e656d6bbe1a4 -> ef25d50b01a8, added attachments tables"
|
||||
"Running upgrade ef25d50b01a8 -> 739b8f04d5fb, added pending attachments index"
|
||||
"Running upgrade 739b8f04d5fb -> 5c3e1f0a9b7d, added attachments lost_at"
|
||||
"Running upgrade 5c3e1f0a9b7d -> a1d4c7e90b23, added attachment jobs and variants"
|
||||
"Running upgrade a1d4c7e90b23 -> c7e2f1a04b56, added job replays and attempt base"
|
||||
"Running upgrade c7e2f1a04b56 -> d3f9a6b2c1e7, added job outbox indexes"
|
||||
"Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90, added job trace context"
|
||||
alembic upgrade head: exit 0
|
||||
e4b8c2d17f90 (head)
|
||||
alembic current: exit 0
|
||||
No new upgrade operations detected.
|
||||
alembic check: exit 0
|
||||
alembic upgrade head: exit 0
|
||||
e4b8c2d17f90 (head)
|
||||
alembic current: exit 0
|
||||
"Running downgrade e4b8c2d17f90 -> d3f9a6b2c1e7, added job trace context"
|
||||
alembic downgrade -1: exit 0
|
||||
d3f9a6b2c1e7
|
||||
alembic current: exit 0
|
||||
trace columns after downgrade:
|
||||
0
|
||||
"Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90, added job trace context"
|
||||
alembic upgrade head: exit 0
|
||||
e4b8c2d17f90 (head)
|
||||
alembic current: exit 0
|
||||
--- a job of the previous revision, then upgrade
|
||||
"Running downgrade e4b8c2d17f90 -> d3f9a6b2c1e7, added job trace context"
|
||||
alembic downgrade -1: exit 0
|
||||
INSERT of the previous level: done
|
||||
"Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90, added job trace context"
|
||||
alembic upgrade head: exit 0
|
||||
job of the previous level: id | state | traceparent is null | tracestate is null
|
||||
66666666-6666-4666-8666-666666666661|queued|t|t
|
||||
columns: name | type | nullable
|
||||
traceparent|text|YES
|
||||
tracestate|text|YES
|
||||
convalidated of the new CHECKs:
|
||||
ck_attachment_jobs_traceparent|f
|
||||
ck_attachment_jobs_tracestate|f
|
||||
--- constraints (FK triggers off: session_replication_role = replica; CHECK still applies)
|
||||
sampled root (flags 01):
|
||||
root with random trace id flag (03, SDK 1.45):
|
||||
version ff:
|
||||
ERROR: new row for relation "attachment_jobs" violates check constraint "ck_attachment_jobs_traceparent"
|
||||
upper-case hex:
|
||||
ERROR: new row for relation "attachment_jobs" violates check constraint "ck_attachment_jobs_traceparent"
|
||||
tracestate without traceparent:
|
||||
ERROR: new row for relation "attachment_jobs" violates check constraint "ck_attachment_jobs_tracestate"
|
||||
empty tracestate:
|
||||
ERROR: new row for relation "attachment_jobs" violates check constraint "ck_attachment_jobs_tracestate"
|
||||
tracestate of 513 chars:
|
||||
ERROR: new row for relation "attachment_jobs" violates check constraint "ck_attachment_jobs_tracestate"
|
||||
rows now: total | with traceparent
|
||||
3|2
|
||||
--- lock_timeout: a transaction holds attachment_jobs longer than 2 s
|
||||
"Running downgrade e4b8c2d17f90 -> d3f9a6b2c1e7, added job trace context"
|
||||
alembic downgrade -1: exit 0
|
||||
asyncpg.exceptions.LockNotAvailableError: canceling statement due to lock timeout
|
||||
sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) canceling statement due to lock timeout
|
||||
[SQL: ALTER TABLE attachment_jobs ADD COLUMN traceparent TEXT]
|
||||
"Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90, added job trace context"
|
||||
alembic upgrade head: exit 1
|
||||
upgrade under lock took 3 s
|
||||
d3f9a6b2c1e7
|
||||
alembic current: exit 0
|
||||
trace columns after the failure:
|
||||
0
|
||||
"Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90, added job trace context"
|
||||
alembic upgrade head: exit 0
|
||||
e4b8c2d17f90 (head)
|
||||
alembic current: exit 0
|
||||
DROP DATABASE
|
||||
```
|
||||
|
||||
`alembic check` печатает ещё `SAWarning: Can't validate argument 'dialect_options'` из
|
||||
`migrations/env.py` (прежнее предупреждение, не от этой ревизии).
|
||||
|
||||
## `--sql` (офлайн, без базы)
|
||||
|
||||
`uv run alembic upgrade d3f9a6b2c1e7:e4b8c2d17f90 --sql` и `downgrade e4b8c2d17f90:d3f9a6b2c1e7
|
||||
--sql` — код 0 оба; `lock_timeout` — первой командой транзакции, оба CHECK — `NOT VALID`:
|
||||
|
||||
```sql
|
||||
BEGIN;
|
||||
|
||||
-- Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90
|
||||
|
||||
SET LOCAL lock_timeout = '2s';
|
||||
|
||||
ALTER TABLE attachment_jobs ADD COLUMN traceparent TEXT;
|
||||
|
||||
ALTER TABLE attachment_jobs ADD COLUMN tracestate TEXT;
|
||||
|
||||
ALTER TABLE attachment_jobs ADD CONSTRAINT ck_attachment_jobs_traceparent CHECK (traceparent ~ '^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$') NOT VALID;
|
||||
|
||||
ALTER TABLE attachment_jobs ADD CONSTRAINT ck_attachment_jobs_tracestate CHECK (tracestate IS NULL OR (traceparent IS NOT NULL AND char_length(tracestate) BETWEEN 1 AND 512)) NOT VALID;
|
||||
|
||||
UPDATE alembic_version SET version_num='e4b8c2d17f90' WHERE alembic_version.version_num = 'd3f9a6b2c1e7';
|
||||
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Running downgrade e4b8c2d17f90 -> d3f9a6b2c1e7
|
||||
|
||||
SET LOCAL lock_timeout = '2s';
|
||||
|
||||
ALTER TABLE attachment_jobs DROP CONSTRAINT ck_attachment_jobs_tracestate;
|
||||
|
||||
ALTER TABLE attachment_jobs DROP CONSTRAINT ck_attachment_jobs_traceparent;
|
||||
|
||||
ALTER TABLE attachment_jobs DROP COLUMN tracestate;
|
||||
|
||||
ALTER TABLE attachment_jobs DROP COLUMN traceparent;
|
||||
|
||||
UPDATE alembic_version SET version_num='d3f9a6b2c1e7' WHERE alembic_version.version_num = 'e4b8c2d17f90';
|
||||
|
||||
COMMIT;
|
||||
```
|
||||
|
||||
## Рабочий стенд: откат на прежний образ, ревизия до и после `make rolling_update`
|
||||
|
||||
Стенд был на `e4b8c2d17f90` (ревизию применил apply). Чтобы показать переход по Migration Plan
|
||||
design, реплики откачены на образ `ff0073e` (код до change: колонок не знает) `make rolling_update
|
||||
COMMIT=ff0073e MIGRATE=0` — схема остаётся новой, `make test` на прежнем образе проходит; затем
|
||||
relay, worker и уборщик нового кода остановлены (они читают новые колонки) и ревизия на рабочей
|
||||
базе снята на шаг (`uv run alembic downgrade -1` с хоста: прежний образ новой ревизии не знает);
|
||||
дальше — штатно вперёд: `make rolling_update` (ревизия один раз в контейнере `migrate` нового
|
||||
образа, затем реплики по одной), `docker compose up -d --no-deps --force-recreate relay worker
|
||||
cleaner`, `make test`. После — реплики, relay, worker, уборщик и `migrate` на одном образе
|
||||
(`66e41a7d85f2`, собран из дерева commit). Задание загрузки `make test` на прежнем образе — без
|
||||
контекста, после замены — с ним («2246 jobs, 1 with traceparent»: контекст прежних заданий снят
|
||||
откатом ревизии, новое — с контекстом).
|
||||
|
||||
```text
|
||||
--- before: 2026-11-11T17:05:13Z
|
||||
revision: e4b8c2d17f90; trace columns: 2; 2244 jobs, 531 with traceparent
|
||||
api mtusi-lab6-api-5 fe761ce3089a running
|
||||
api mtusi-lab6-api-6 fe761ce3089a running
|
||||
relay mtusi-lab6-relay-1 fe761ce3089a running
|
||||
worker mtusi-lab6-worker-1 fe761ce3089a running
|
||||
cleaner mtusi-lab6-cleaner-1 fe761ce3089a running
|
||||
migrate mtusi-lab6-migrate-1 fe761ce3089a exited
|
||||
--- rollback: replicas on ff0073e (code before the change), schema stays
|
||||
$ make rolling_update COMMIT=ff0073e MIGRATE=0
|
||||
API_REPLICAS=2 ROLLOUT_COMMIT="ff0073e" ROLLOUT_MIGRATE=0 scripts/rolling-update.sh
|
||||
17:05:14 rolling-update: start: 2 replicas a4a1f203ef70 48b425abbd15, image mtusi-messenger:lab6 from ff0073e
|
||||
17:05:25 rolling-update: build done in 11s
|
||||
17:05:25 rolling-update: migrate skipped (ROLLOUT_MIGRATE=0)
|
||||
17:05:26 rolling-update: replica 1/2: started new 8eb475bf8780
|
||||
17:05:29 rolling-update: replica 1/2: new 8eb475bf8780 addr 192.168.96.13 slot api-3 UP in 4s
|
||||
17:05:29 rolling-update: replica 1/2: drain old a4a1f203ef70 addr 192.168.96.8 slot api-2
|
||||
17:05:29 rolling-update: replica 1/2: old a4a1f203ef70 idle after 0s
|
||||
17:05:30 rolling-update: replica 1/2: maint slot api-2, stopping old a4a1f203ef70
|
||||
17:05:30 rolling-update: replica 1/2: removed old a4a1f203ef70 (stop 0s, exit 0)
|
||||
17:05:31 rolling-update: replica 1/2: slot api-2 ready
|
||||
17:05:31 rolling-update: replica 2/2: started new ce7885bbd38a
|
||||
17:05:34 rolling-update: replica 2/2: new ce7885bbd38a addr 192.168.96.8 slot api-2 UP in 3s
|
||||
17:05:34 rolling-update: replica 2/2: drain old 48b425abbd15 addr 192.168.96.6 slot api-1
|
||||
17:05:34 rolling-update: replica 2/2: old 48b425abbd15 idle after 0s
|
||||
17:05:34 rolling-update: replica 2/2: maint slot api-1, stopping old 48b425abbd15
|
||||
17:05:35 rolling-update: replica 2/2: removed old 48b425abbd15 (stop 1s, exit 0)
|
||||
17:05:35 rolling-update: replica 2/2: slot api-1 ready
|
||||
17:05:36 rolling-update: done: 2 replicas 8eb475bf8780 ce7885bbd38a UP in 22s
|
||||
-> exit 0, 22 s
|
||||
revision: e4b8c2d17f90
|
||||
api mtusi-lab6-api-7 089ea4db2c35 running
|
||||
api mtusi-lab6-api-8 089ea4db2c35 running
|
||||
relay mtusi-lab6-relay-1 fe761ce3089a running
|
||||
worker mtusi-lab6-worker-1 fe761ce3089a running
|
||||
cleaner mtusi-lab6-cleaner-1 fe761ce3089a running
|
||||
migrate mtusi-lab6-migrate-1 fe761ce3089a exited
|
||||
--- previous image on the new schema
|
||||
$ make test
|
||||
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
|
||||
-> exit 0, 1 s
|
||||
--- revision one step back, relay, worker and cleaner of the new code stopped (they read the new columns)
|
||||
$ docker compose stop relay worker cleaner
|
||||
-> exit 0, 0 s
|
||||
$ uv run alembic downgrade -1 (host, .env; the image ff0073e does not know the new revision)
|
||||
"event": "Running downgrade e4b8c2d17f90 -> d3f9a6b2c1e7, added job trace context"
|
||||
revision: d3f9a6b2c1e7; trace columns: 0
|
||||
--- forward: make rolling_update (revision once, then replicas)
|
||||
revision before: d3f9a6b2c1e7
|
||||
$ make rolling_update
|
||||
API_REPLICAS=2 ROLLOUT_COMMIT="" ROLLOUT_MIGRATE=1 scripts/rolling-update.sh
|
||||
17:05:40 rolling-update: start: 2 replicas 8eb475bf8780 ce7885bbd38a, image mtusi-messenger:lab6 from working tree
|
||||
17:05:41 rolling-update: build done in 1s
|
||||
Container mtusi-lab6-migrate-1 Recreate
|
||||
migrate-1 | {"event": "Running alembic", … "database": "messenger", … "timestamp": "2026-11-11T17:05:43.832926Z", …}
|
||||
migrate-1 | {"event": "Running upgrade d3f9a6b2c1e7 -> e4b8c2d17f90, added job trace context", … "timestamp": "2026-11-11T17:05:43.920442Z"}
|
||||
migrate-1 | {"event": "Finished alembic", … "database": "messenger", … "timestamp": "2026-11-11T17:05:43.938574Z", …}
|
||||
migrate-1 exited with code 0
|
||||
17:05:44 rolling-update: migrate done in 3s
|
||||
17:05:44 rolling-update: replica 1/2: started new 037e58f95feb
|
||||
17:05:48 rolling-update: replica 1/2: new 037e58f95feb addr 192.168.96.6 slot api-1 UP in 4s
|
||||
17:05:48 rolling-update: replica 1/2: drain old 8eb475bf8780 addr 192.168.96.13 slot api-3
|
||||
17:05:48 rolling-update: replica 1/2: old 8eb475bf8780 idle after 0s
|
||||
17:05:48 rolling-update: replica 1/2: maint slot api-3, stopping old 8eb475bf8780
|
||||
17:05:49 rolling-update: replica 1/2: removed old 8eb475bf8780 (stop 1s, exit 0)
|
||||
17:05:50 rolling-update: replica 1/2: slot api-3 ready
|
||||
17:05:50 rolling-update: replica 2/2: started new 0ed05f658795
|
||||
17:05:54 rolling-update: replica 2/2: new 0ed05f658795 addr 192.168.96.7 slot api-3 UP in 4s
|
||||
17:05:54 rolling-update: replica 2/2: drain old ce7885bbd38a addr 192.168.96.8 slot api-2
|
||||
17:05:54 rolling-update: replica 2/2: old ce7885bbd38a idle after 0s
|
||||
17:05:54 rolling-update: replica 2/2: maint slot api-2, stopping old ce7885bbd38a
|
||||
17:05:55 rolling-update: replica 2/2: removed old ce7885bbd38a (stop 1s, exit 0)
|
||||
17:05:56 rolling-update: replica 2/2: slot api-2 ready
|
||||
17:05:56 rolling-update: done: 2 replicas 0ed05f658795 037e58f95feb UP in 16s
|
||||
-> exit 0, 17 s
|
||||
revision after: e4b8c2d17f90; trace columns: 2
|
||||
$ docker compose up -d --no-deps --force-recreate relay worker cleaner
|
||||
-> exit 0, 2 s
|
||||
api mtusi-lab6-api-10 66e41a7d85f2 running
|
||||
api mtusi-lab6-api-9 66e41a7d85f2 running
|
||||
relay mtusi-lab6-relay-1 66e41a7d85f2 running
|
||||
worker mtusi-lab6-worker-1 66e41a7d85f2 running
|
||||
cleaner mtusi-lab6-cleaner-1 66e41a7d85f2 running
|
||||
migrate mtusi-lab6-migrate-1 66e41a7d85f2 exited
|
||||
$ make test
|
||||
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
|
||||
-> exit 0, 4 s
|
||||
2246 jobs, 1 with traceparent
|
||||
--- after: 2026-11-11T17:06:03Z
|
||||
```
|
||||
|
||||
Сборка BuildKit в выводе `make rolling_update` (все слои из кэша) и строки `Container … Creating /
|
||||
Started` сокращены. Окно без relay и worker (17:05:36–17:05:57) — по Migration Plan: загрузки в нём
|
||||
отвечают 202 и ждут в PostgreSQL; в этом прогоне загрузок в окне не было.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Бюджет стенда с телеметрией (change `otel-telemetry`, задача 10.1; verify W1)
|
||||
# Бюджет стенда с телеметрией (change `otel-telemetry`, задача 10.1; verify W1; раздел change `job-trace-propagation` — в конце)
|
||||
|
||||
- Основа: commit `4178b3d` (fix: raise tempo and grafana memory limits to measured peaks), рабочее
|
||||
дерево чистое (`git status --short` пуст до и после замера); лимиты Tempo 640 МиБ и Grafana 512
|
||||
@@ -78,3 +78,67 @@ closed-loop на шумном хосте, не метка `bench/`: это по
|
||||
работающих контейнеров рабочего стенда. Лимиты — потолки, а не резерв: CPU делится по времени, а
|
||||
память всего стенда (`docker stats`) — 1635 МиБ в простое первой фазы и ~2,2 ГиБ сразу после
|
||||
нагрузки, из них сервисы телеметрии — 554 и ~710 МиБ.
|
||||
|
||||
## Change `job-trace-propagation`: relay с SDK, уборщик после ленивого импорта (задача 12.4)
|
||||
|
||||
- Основа: commit `72cfa9a` (feat: propagate trace context through outbox and add pipeline saturation
|
||||
metrics), рабочее дерево без правок кода (добавлены только файлы `evidence/`). Реплики API,
|
||||
relay, worker, уборщик и `migrate` — на одном образе `66e41a7d85f2`, собранном `make
|
||||
rolling_update` из дерева commit (`evidence/migrations/job-trace-context.md`); relay, worker и
|
||||
уборщик пересозданы `docker compose up -d --no-deps --force-recreate` в 17:05:57Z — свежие cgroup.
|
||||
Лимиты прежние (relay 0,25 CPU / 256 МиБ, уборщик 0,25 / 256), `docker inspect` — те же.
|
||||
- Дата: 2026-11-11, 17:07:26Z – 17:12:59Z; стенд `mtusi-lab6`, тот же хост, что выше.
|
||||
- Методика (design, решение 15): 30 с простоя, затем `make test`, `make load` (30 с, 4 клиента),
|
||||
`make student_test` через LB и `driver.py --port 8080 trace-chain` подряд под выборкой `docker
|
||||
stats` раз в ~2 с; `memory.peak` / `memory.current` — после простоя, после `make student_test` и
|
||||
в конце: у relay, уборщика, worker и реплик — из их собственной cgroup (`docker exec … cat
|
||||
/sys/fs/cgroup/memory.peak`), у всех контейнеров в конце — из cgroup v2 ВМ одноразовым контейнером
|
||||
(`--cgroupns host`, `--network none`, `--read-only`). Сервисы телеметрии жили с 17:03:47Z
|
||||
(перезапущены `telemetry-outage`), то есть их пик — за `telemetry-outage` (конец), бюджет и
|
||||
`trace-chain`.
|
||||
- Результаты команд: `make test` — PASS, `make load` — 12 623 успешных, 0 ошибок, 419 запросов/с,
|
||||
p50 / p95 / p99 7,6 / 16,9 / 52,1 мс; `make student_test` — 223 passed, 1 failed (известный
|
||||
`test_exclusion_evidence_exists`); `trace-chain` здесь — нагрузка, его код 1: единственная
|
||||
неудачная строка — предусловие «queue depth before (no unfinished jobs)» 1 вместо 0 (запущен через
|
||||
секунду после `make student_test`, последняя точка ряда глубины в Prometheus — до 30 с давности;
|
||||
через несколько секунд глубина при трёх загрузках — ровно 3, остальные строки — как в
|
||||
`trace-chain.md`). Это свойство тихого стенда, а не дефект: файл `trace-chain.md` снят на тихом
|
||||
стенде с кодом 0.
|
||||
- `trace-chain` останавливает и запускает relay и worker (`docker start` того же контейнера —
|
||||
новая cgroup), поэтому `memory.peak` relay в конце — с 17:12:02Z; пик за `make test` + `make
|
||||
load` + `make student_test` снят до него.
|
||||
|
||||
| Контейнер | `memory.peak`, МиБ | `docker stats` макс., МиБ | CPU макс., % ядра | Лимит | 1,5 × пик ≤ лимита |
|
||||
|---|---|---|---|---|---|
|
||||
| `relay` (с 17:05:58Z: простой, `make test`, `make load`, `make student_test`) | 103,3 | 89,5 | 5,2 | 0,25 CPU / 256 МиБ | да (155) |
|
||||
| `relay` (с 17:12:02Z, `trace-chain` после `docker start`) | 96,2 | 89,9 | 24,9 | 0,25 / 256 | да (144) |
|
||||
| одноразовый `relay replay` (`trace-chain`, шаг 3) | — | 48,0 | 24,8 | 0,25 / 256 | — |
|
||||
| `cleaner` (с 17:05:57Z, плановая сверка при старте) | 107,7 | 106,6 | 7,7 | 0,25 / 256 | да (162) |
|
||||
|
||||
- **Relay.** Пик 103 МиБ — на старте (после 30 с простоя он уже 103,3 и под нагрузкой не рос):
|
||||
импорт SDK и первый проход; VmRSS после `make student_test` — 107,5 МиБ. До коммита (scratchpad
|
||||
apply, «Уточнения apply», п. 12) — 94–99 МиБ; правило выполнено, лимит не меняется. CPU упирается в
|
||||
лимит (24,9 % при 25 %) только во время `trace-chain` — старт после `docker start` и разбор
|
||||
накопленных при остановленном relay заданий; под `make load` и `make student_test` — до 5,2 %.
|
||||
- **Уборщик.** `memory.peak` с пересоздания — 107,7 МиБ, включая плановую сверку при старте,
|
||||
VmRSS 114,7 МиБ, в простое `memory.current` ~99 МиБ. В «Уточнениях
|
||||
apply», п. 10, был пик 176 МиБ на образе до коммита — на этом стенде и наборе данных пик сверки
|
||||
при старте ниже; правило «лимит ≥ 1,5 × пика» выполнено (162 ≤ 256). Что пик уборщика зависит от
|
||||
числа строк сверки, а не от SDK, — прежнее (`QUESTIONS.md`, `## job-trace-propagation`, вопрос 5).
|
||||
- **Остальные контейнеры** (`memory.peak` в конце, МиБ / лимит): реплики API 442,9 и 441,9 / 512 (в
|
||||
лимите, как выше), worker 121,3 / 1024 (с `docker start` в `trace-chain`; до него — 502,3: процессы
|
||||
обработки `make student_test`), Collector 83,5 / 256, Prometheus 94,6 / 384, Loki 159,9 / 512,
|
||||
Tempo 279,6 / 640, PostgreSQL 274,3 / 1024, брокер 250,4 / 512, Valkey 29,8 / 128, LB 29,4 / 256.
|
||||
- **Расхождение: Grafana.** `memory.peak` 343,2 МиБ при лимите 512 (1,5 × пик = 515 > 512), хотя в
|
||||
первом разделе и в design (решение 15, «Уточнения apply», п. 12) — 248–294 и 255 МиБ. Пик набран
|
||||
в первые минуты после рестарта `telemetry-outage` (уже 343,2 в начале простоя) и дальше не рос;
|
||||
`docker stats` (без неактивного page cache) — 253–261 МиБ; `memory.stat` в конце: `anon` 188,
|
||||
`file` 95 (из них `inactive_file` 69), `shmem` 1,6 МиБ — пик включает файловый кэш, который ядро
|
||||
отдаёт первым. По правилу `telemetry.md` (`memory.peak`) лимит не выполнен; лимит Grafana — не
|
||||
предмет этого change, правка не делалась (`QUESTIONS.md`, `## job-trace-propagation`, вопрос 6).
|
||||
- **S3** — `memory.peak` 512,8 МиБ при лимите 512 (стенд жил с 16:04:32Z): известная запись
|
||||
`KNOWN_ISSUES.md` «память S3 на долго живущем стенде», не этот change.
|
||||
- **Суммы** не изменились: `docker inspect` 15 работающих контейнеров — 11,5 CPU / 7296 МиБ, `docker
|
||||
compose config` — 11,5 / 7296, с `migrate` и `s3-bootstrap` — 12,5 / 7680; совпадают с
|
||||
`.claude/rules/docker.md` («Суммы») и `REPORT.md` («Бюджет»). Соединений PostgreSQL change не
|
||||
прибавил (пул relay 1, `trace-chain`: пределы 10, 10, 2, 1).
|
||||
|
||||
+156
-135
@@ -1,13 +1,13 @@
|
||||
# `driver.py --port 8080 telemetry-check` (change `otel-telemetry`, задачи 11.1 и 12)
|
||||
# `driver.py --port 8080 telemetry-check` (change `otel-telemetry`, задачи 11.1 и 12; change `job-trace-propagation`, задача 12.2)
|
||||
|
||||
- Основа: commit `68f1e97` (fix: address otel-telemetry verify findings), рабочее дерево чистое
|
||||
(`git status --short` пуст до и после прогона); образ `mtusi-messenger:lab6` собран `docker
|
||||
compose build api` из этого дерева, у реплик API и worker метка `com.docker.compose.image`
|
||||
`sha256:589c1d53a299…`. Лимиты Tempo и Grafana подняты позже, по замеру бюджета
|
||||
(`budget.md`); на проверку они не влияют.
|
||||
- Дата: 2026-11-11, 07:55:10Z – 07:56:53Z (~1,7 мин); рабочий стенд `mtusi-lab6` (две реплики API,
|
||||
worker, Collector, Prometheus, Loki, Tempo, Grafana), команда из корня репозитория:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 telemetry-check`.
|
||||
- Основа: commit `72cfa9a` (feat: propagate trace context through outbox and add pipeline saturation
|
||||
metrics), рабочее дерево чистое (`git status --short` пуст до прогона; новые файлы — только
|
||||
`evidence/`). Файлы `src/` и `migrations/` в контейнерах `api` (2), `relay`, `worker` и `cleaner`
|
||||
побайтно совпадают с деревом commit (SHA-256 каждого файла); ревизия схемы `e4b8c2d17f90`.
|
||||
Прежний прогон этого файла — на `68f1e97` (до change `job-trace-propagation`).
|
||||
- Дата: 2026-11-11, 16:59:50Z – 17:01:41Z (~1,9 мин); рабочий стенд `mtusi-lab6` (две реплики API,
|
||||
relay, worker, уборщик, Collector, Prometheus, Loki, Tempo, Grafana), команда из корня репозитория:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 telemetry-check`, код выхода 0.
|
||||
- Всё — через HTTP API Grafana на `127.0.0.1:3000` с паролем из `.env` (источники-прокси uid
|
||||
`prometheus`, `loki`, `tempo`); пароль, токены и тела в вывод не попадают. Пароль, `username`,
|
||||
токен, текст, ключ и имя файла пробы — случайные синтетические, в выводе только их метки
|
||||
@@ -23,133 +23,153 @@
|
||||
приватности», «Запрос найден», «Задание найдено»; `service-logging` — «Записи запроса ведут к
|
||||
трассе», «Записи задания ведут к трассе», «Запись в Loki совпадает со stdout»;
|
||||
`service-configuration` — «Переменные OTEL_* не действуют».
|
||||
- Свой запрос: `X-Request-Id` `9d7cdc76345d4cc0a390dc60ae029b49`, `X-Instance-Id`
|
||||
`2567ec8de4a4`, trace-id `0a94090184190503a115707aff8848b9`; проба приватности просмотрела
|
||||
45 записей Loki, 30 трасс Tempo и 2612 рядов Prometheus окна.
|
||||
- С change `job-trace-propagation`: `observability` «Ресурс relay» (span producer —
|
||||
`messenger-relay`, `service.instance.id` = `instance_id` stdout relay; relay — в пробе сетей
|
||||
хранилищ); `service-logging` «Записи relay в Loki» (запись прохода с публикацией в stdout и та же
|
||||
в Loki) и «Проход relay без полей трассы» (без `trace_id` в обоих; корней-span relay в Tempo
|
||||
нет). Шаги задания ищутся по consumer span `ready` трассы загрузки, а не по корню: его родитель —
|
||||
span producer relay; трасса задания = трасса загрузки (`trace_id` записи «Uploaded attachment»).
|
||||
- Свой запрос: `X-Request-Id` `fa505042431b47c0b898571fb326d873`, `X-Instance-Id`
|
||||
`a4a1f203ef70`, trace-id `d09ff137a735b772a71fc19d90ab338d`; трасса загрузки
|
||||
`95d2de2fc407f300bb758dd9586bf8d8`; проба приватности просмотрела 47 записей Loki, 28 трасс Tempo
|
||||
и 1350 рядов Prometheus окна.
|
||||
|
||||
```
|
||||
grafana without credentials expected 401 got 401
|
||||
grafana wrong password expected 401 got 401
|
||||
grafana password from .env expected 200 got 200
|
||||
grafana published only on 127.0.0.1 expected yes got yes
|
||||
datasource prometheus expected 200 prometheus got 200 prometheus
|
||||
datasource prometheus health expected OK got OK
|
||||
datasource loki expected 200 loki got 200 loki
|
||||
datasource loki health expected OK got OK
|
||||
datasource tempo expected 200 tempo got 200 tempo
|
||||
datasource tempo health expected OK got OK
|
||||
dashboard from git expected 200 got 200
|
||||
dashboard provisioned expected True got True
|
||||
dashboard folder expected Messenger got Messenger
|
||||
save of the provisioned dashboard rejected expected yes got yes
|
||||
dashboard equals git after the attempt expected yes got yes
|
||||
prometheus target otel-collector up expected 1 got 1
|
||||
prometheus target otel-collector-exporter up expected 1 got 1
|
||||
prometheus target loki up expected 1 got 1
|
||||
prometheus target tempo up expected 1 got 1
|
||||
prometheus target prometheus up expected 1 got 1
|
||||
register probe user expected 201 got 201
|
||||
login by Basic expected 201 got 201
|
||||
create chat expected 201 got 201
|
||||
send message expected 201 got 201
|
||||
401 without token expected 401 got 401
|
||||
404 of an unknown chat expected 404 got 404
|
||||
PROPFIND of an unknown path with a UUID expected 404 got 404
|
||||
GET of an unknown path with a UUID expected 404 got 404
|
||||
BREW rejected by the HTTP parser (limitation) expected 400 got 400
|
||||
request with traceparent expected 200 got 200
|
||||
upload sample.png expected 202 got 202
|
||||
attachment becomes ready expected ready got ready
|
||||
undecodable JPEG generated expected yes got yes
|
||||
upload undecodable JPEG expected 202 got 202
|
||||
undecodable JPEG becomes failed expected failed got failed
|
||||
stdout records of the request expected yes got yes
|
||||
one trace_id and span_id in them expected 1 got 1
|
||||
trace_id format expected yes got yes
|
||||
Loki record of the request expected 1 got 1
|
||||
Loki service_name expected messenger-api got messenger-api
|
||||
Loki service_instance_id = X-Instance-Id expected 2567ec8de4a4 got 2567ec8de4a4
|
||||
Loki instance_id = X-Instance-Id expected 2567ec8de4a4 got 2567ec8de4a4
|
||||
Loki trace_id = stdout expected 0a94090184190503a115707aff8848b9 got 0a94090184190503a115707aff8848b9
|
||||
Loki event, method, path, status, duration = stdout expected yes got yes
|
||||
Tempo server span expected POST /api/v1/chats/{chat_id}/messages SPAN_KIND_SERVER got POST /api/v1/chats/{chat_id}/messages SPAN_KIND_SERVER
|
||||
server span status code expected 201 got 201
|
||||
server span request id = X-Request-Id expected 9d7cdc76345d4cc0a390dc60ae029b49 got 9d7cdc76345d4cc0a390dc60ae029b49
|
||||
resource service.name expected messenger-api got messenger-api
|
||||
resource service.instance.id expected 2567ec8de4a4 got 2567ec8de4a4
|
||||
resource service.version = contract expected 1.6.0 got 1.6.0
|
||||
resource deployment.environment.name expected lab got lab
|
||||
PostgreSQL query spans under it expected yes got yes
|
||||
COMMIT span under it expected yes got yes
|
||||
Loki field trace_id links to datasource expected tempo label got tempo label
|
||||
Tempo span links to logs in datasource expected loki got loki
|
||||
span-to-logs query fully substituted expected yes got yes
|
||||
span-to-logs query returns records of trace T expected yes got yes
|
||||
traceparent request has its own trace expected yes got yes
|
||||
spans of the foreign trace-id in Tempo expected 0 got 0
|
||||
its server span has no parent expected yes got yes
|
||||
Loki worker record of the attachment expected 1 got 1
|
||||
worker stdout records carry the job trace_id expected yes got yes
|
||||
Tempo consumer span expected SPAN_KIND_CONSUMER ready got SPAN_KIND_CONSUMER ready
|
||||
worker resource service.name expected messenger-worker got messenger-worker
|
||||
worker service.instance.id = instance_id of its stdout expected 3ac74c7e1f59 got 3ac74c7e1f59
|
||||
job spans: PostgreSQL expected yes got yes
|
||||
job spans: S3.GetObject (staging) expected yes got yes
|
||||
job spans: S3.PutObject (original and 3 variants) expected yes got yes
|
||||
job spans: render process expected yes got yes
|
||||
upload with S3 paused expected 503 got 503
|
||||
its server span status expected STATUS_CODE_ERROR got STATUS_CODE_ERROR
|
||||
S3 span with error expected yes got yes
|
||||
S3 span duration within 4.0-7.5 s expected yes got yes
|
||||
error.type of the S3 span set expected yes got yes
|
||||
health traces in Tempo expected 0 got 0
|
||||
trace roots other than requests and deliveries expected 0 got 0
|
||||
api -> prometheus expected not reachable got not reachable
|
||||
api -> loki expected not reachable got not reachable
|
||||
api -> tempo expected not reachable got not reachable
|
||||
api -> grafana expected not reachable got not reachable
|
||||
api -> otel-collector:4318 expected connected got connected
|
||||
worker -> prometheus expected not reachable got not reachable
|
||||
worker -> loki expected not reachable got not reachable
|
||||
worker -> tempo expected not reachable got not reachable
|
||||
worker -> grafana expected not reachable got not reachable
|
||||
worker -> otel-collector:4318 expected connected got connected
|
||||
probe container with OTEL_* started expected 0 got 0
|
||||
probe container healthy expected yes got yes
|
||||
probe request inside expected 401 got 401
|
||||
warning level expected warning got warning
|
||||
warning names the variables expected ['OTEL_EXPORTER_OTLP_ENDPOINT', 'OTEL_SDK_DISABLED'] got ['OTEL_EXPORTER_OTLP_ENDPOINT', 'OTEL_SDK_DISABLED']
|
||||
no variable values in stdout expected yes got yes
|
||||
probe records reach Loki from [telemetry] expected yes got yes
|
||||
probe service_name expected messenger-api got messenger-api
|
||||
chat GET 200 count grew by 10 expected 10 got 10
|
||||
count grew on every replica expected 2 got 2
|
||||
jobs ready grew by 1 expected 1 got 1
|
||||
jobs failed grew by 1 expected 1 got 1
|
||||
_OTHER 404 count without http_route grew by 1 expected 1 got 1
|
||||
GET 404 count without http_route grew by 1 expected 1 got 1
|
||||
Prometheus series with health routes expected 0 got 0
|
||||
_OTHER series without http_route expected yes got yes
|
||||
401 series of /api/v1/users/me expected yes got yes
|
||||
404 series of /api/v1/chats/{chat_id} expected yes got yes
|
||||
forbidden label names expected [] got []
|
||||
label values that are UUIDs expected 0 got 0
|
||||
label values with BREW, PROPFIND or the odd UUID expected 0 got 0
|
||||
dashboard panel queries (11) without error expected 0 got 0
|
||||
panel queries with data after traffic expected [] got []
|
||||
U in telemetry expected [] got []
|
||||
P in telemetry expected [] got []
|
||||
T in telemetry expected [] got []
|
||||
M in telemetry expected [] got []
|
||||
K in telemetry expected [] got []
|
||||
F in telemetry expected [] got []
|
||||
Bearer in telemetry expected [] got []
|
||||
Basic in telemetry expected [] got []
|
||||
foreign trace-id in telemetry expected [] got []
|
||||
pipeline back after restart expected yes got yes
|
||||
same Loki record after restart expected yes got yes
|
||||
same trace after restart expected yes got yes
|
||||
same metric value at the saved time expected 44 got 44
|
||||
grafana without credentials expected 401 got 401
|
||||
grafana wrong password expected 401 got 401
|
||||
grafana password from .env expected 200 got 200
|
||||
grafana published only on 127.0.0.1 expected yes got yes
|
||||
datasource prometheus expected 200 prometheus got 200 prometheus
|
||||
datasource prometheus health expected OK got OK
|
||||
datasource loki expected 200 loki got 200 loki
|
||||
datasource loki health expected OK got OK
|
||||
datasource tempo expected 200 tempo got 200 tempo
|
||||
datasource tempo health expected OK got OK
|
||||
dashboard from git expected 200 got 200
|
||||
dashboard provisioned expected True got True
|
||||
dashboard folder expected Messenger got Messenger
|
||||
save of the provisioned dashboard rejected expected yes got yes
|
||||
dashboard equals git after the attempt expected yes got yes
|
||||
prometheus target otel-collector up expected 1 got 1
|
||||
prometheus target otel-collector-exporter up expected 1 got 1
|
||||
prometheus target loki up expected 1 got 1
|
||||
prometheus target tempo up expected 1 got 1
|
||||
prometheus target prometheus up expected 1 got 1
|
||||
register probe user expected 201 got 201
|
||||
login by Basic expected 201 got 201
|
||||
create chat expected 201 got 201
|
||||
send message expected 201 got 201
|
||||
401 without token expected 401 got 401
|
||||
404 of an unknown chat expected 404 got 404
|
||||
PROPFIND of an unknown path with a UUID expected 404 got 404
|
||||
GET of an unknown path with a UUID expected 404 got 404
|
||||
BREW rejected by the HTTP parser (limitation) expected 400 got 400
|
||||
request with traceparent expected 200 got 200
|
||||
upload sample.png expected 202 got 202
|
||||
attachment becomes ready expected ready got ready
|
||||
undecodable JPEG generated expected yes got yes
|
||||
upload undecodable JPEG expected 202 got 202
|
||||
undecodable JPEG becomes failed expected failed got failed
|
||||
stdout records of the request expected yes got yes
|
||||
one trace_id and span_id in them expected 1 got 1
|
||||
trace_id format expected yes got yes
|
||||
Loki record of the request expected 1 got 1
|
||||
Loki service_name expected messenger-api got messenger-api
|
||||
Loki service_instance_id = X-Instance-Id expected a4a1f203ef70 got a4a1f203ef70
|
||||
Loki instance_id = X-Instance-Id expected a4a1f203ef70 got a4a1f203ef70
|
||||
Loki trace_id = stdout expected d09ff137a735b772a71fc19d90ab338d got d09ff137a735b772a71fc19d90ab338d
|
||||
Loki event, method, path, status, duration = stdout expected yes got yes
|
||||
Tempo server span expected POST /api/v1/chats/{chat_id}/messages SPAN_KIND_SERVER got POST /api/v1/chats/{chat_id}/messages SPAN_KIND_SERVER
|
||||
server span status code expected 201 got 201
|
||||
server span request id = X-Request-Id expected fa505042431b47c0b898571fb326d873 got fa505042431b47c0b898571fb326d873
|
||||
resource service.name expected messenger-api got messenger-api
|
||||
resource service.instance.id expected a4a1f203ef70 got a4a1f203ef70
|
||||
resource service.version = contract expected 1.6.0 got 1.6.0
|
||||
resource deployment.environment.name expected lab got lab
|
||||
PostgreSQL query spans under it expected yes got yes
|
||||
COMMIT span under it expected yes got yes
|
||||
Loki field trace_id links to datasource expected tempo label got tempo label
|
||||
Tempo span links to logs in datasource expected loki got loki
|
||||
span-to-logs query fully substituted expected yes got yes
|
||||
span-to-logs query returns records of trace T expected yes got yes
|
||||
traceparent request has its own trace expected yes got yes
|
||||
spans of the foreign trace-id in Tempo expected 0 got 0
|
||||
its server span has no parent expected yes got yes
|
||||
Loki worker record of the attachment expected 1 got 1
|
||||
job trace = upload trace (trace_id of Uploaded attachment) expected 95d2de2fc407f300bb758dd9586bf8d8 got 95d2de2fc407f300bb758dd9586bf8d8
|
||||
worker stdout records carry the job trace_id expected yes got yes
|
||||
Tempo consumer span in the upload trace expected SPAN_KIND_CONSUMER ready got SPAN_KIND_CONSUMER ready
|
||||
worker resource service.name expected messenger-worker got messenger-worker
|
||||
worker service.instance.id = instance_id of its stdout expected b221c6088b4b got b221c6088b4b
|
||||
consumer span parent: relay producer span expected SPAN_KIND_PRODUCER got SPAN_KIND_PRODUCER
|
||||
producer resource service.name expected messenger-relay got messenger-relay
|
||||
producer service.instance.id = instance_id of relay stdout expected f1a1d8fef0bc got f1a1d8fef0bc
|
||||
relay pass record with publication in stdout expected yes got yes
|
||||
same relay pass records in Loki (event, published) expected yes got yes
|
||||
relay pass records without trace_id in stdout and Loki expected yes got yes
|
||||
job spans: PostgreSQL expected yes got yes
|
||||
job spans: S3.GetObject (staging) expected yes got yes
|
||||
job spans: S3.PutObject (original and 3 variants) expected yes got yes
|
||||
job spans: render process expected yes got yes
|
||||
upload with S3 paused expected 503 got 503
|
||||
its server span status expected STATUS_CODE_ERROR got STATUS_CODE_ERROR
|
||||
S3 span with error expected yes got yes
|
||||
S3 span duration within 4.0-7.5 s expected yes got yes
|
||||
error.type of the S3 span set expected yes got yes
|
||||
health traces in Tempo expected 0 got 0
|
||||
trace roots other than requests and deliveries expected 0 got 0
|
||||
traces whose root is a relay span expected 0 got 0
|
||||
api -> prometheus expected not reachable got not reachable
|
||||
api -> loki expected not reachable got not reachable
|
||||
api -> tempo expected not reachable got not reachable
|
||||
api -> grafana expected not reachable got not reachable
|
||||
api -> otel-collector:4318 expected connected got connected
|
||||
worker -> prometheus expected not reachable got not reachable
|
||||
worker -> loki expected not reachable got not reachable
|
||||
worker -> tempo expected not reachable got not reachable
|
||||
worker -> grafana expected not reachable got not reachable
|
||||
worker -> otel-collector:4318 expected connected got connected
|
||||
relay -> prometheus expected not reachable got not reachable
|
||||
relay -> loki expected not reachable got not reachable
|
||||
relay -> tempo expected not reachable got not reachable
|
||||
relay -> grafana expected not reachable got not reachable
|
||||
relay -> otel-collector:4318 expected connected got connected
|
||||
probe container with OTEL_* started expected 0 got 0
|
||||
probe container healthy expected yes got yes
|
||||
probe request inside expected 401 got 401
|
||||
warning level expected warning got warning
|
||||
warning names the variables expected ['OTEL_EXPORTER_OTLP_ENDPOINT', 'OTEL_SDK_DISABLED'] got ['OTEL_EXPORTER_OTLP_ENDPOINT', 'OTEL_SDK_DISABLED']
|
||||
no variable values in stdout expected yes got yes
|
||||
probe records reach Loki from [telemetry] expected yes got yes
|
||||
probe service_name expected messenger-api got messenger-api
|
||||
chat GET 200 count grew by 10 expected 10 got 10
|
||||
count grew on every replica expected 2 got 2
|
||||
jobs ready grew by 1 expected 1 got 1
|
||||
jobs failed grew by 1 expected 1 got 1
|
||||
_OTHER 404 count without http_route grew by 1 expected 1 got 1
|
||||
GET 404 count without http_route grew by 1 expected 1 got 1
|
||||
Prometheus series with health routes expected 0 got 0
|
||||
_OTHER series without http_route expected yes got yes
|
||||
401 series of /api/v1/users/me expected yes got yes
|
||||
404 series of /api/v1/chats/{chat_id} expected yes got yes
|
||||
forbidden label names expected [] got []
|
||||
label values that are UUIDs expected 0 got 0
|
||||
label values with BREW, PROPFIND or the odd UUID expected 0 got 0
|
||||
dashboard panel queries (26) without error expected 0 got 0
|
||||
panel queries with data after traffic expected [] got []
|
||||
U in telemetry expected [] got []
|
||||
P in telemetry expected [] got []
|
||||
T in telemetry expected [] got []
|
||||
M in telemetry expected [] got []
|
||||
K in telemetry expected [] got []
|
||||
F in telemetry expected [] got []
|
||||
Bearer in telemetry expected [] got []
|
||||
Basic in telemetry expected [] got []
|
||||
foreign trace-id in telemetry expected [] got []
|
||||
pipeline back after restart expected yes got yes
|
||||
same Loki record after restart expected yes got yes
|
||||
same trace after restart expected yes got yes
|
||||
same metric value at the saved time expected 18 got 18
|
||||
PASS: own request and job are found in Loki, Tempo and Prometheus through Grafana, no secrets in telemetry
|
||||
```
|
||||
|
||||
@@ -158,4 +178,5 @@ PASS: own request and job are found in Loki, Tempo and Prometheus through Grafan
|
||||
prometheus loki tempo` (параметр `time` запроса). «Span-to-logs query» — запрос `tracesToLogsV2`
|
||||
источника Tempo из `infra/otel/grafana/datasources.yaml`, в который подставлены `service.name`
|
||||
ресурса и trace-id своей трассы: он возвращает записи только этой трассы — тот же переход, что
|
||||
открывает ссылка из span в Grafana.
|
||||
открывает ссылка из span в Grafana. «Panel queries with data after traffic: []» — список панелей
|
||||
без данных пуст (26 запросов dashboard, в том числе уровня 4).
|
||||
|
||||
@@ -1,89 +1,118 @@
|
||||
# `driver.py --port 8080 telemetry-outage` (change `otel-telemetry`, задача 11.2)
|
||||
# `driver.py --port 8080 telemetry-outage` (change `otel-telemetry`, задача 11.2; change `job-trace-propagation`, задача 12.2)
|
||||
|
||||
- Основа: commit `68f1e97` (fix: address otel-telemetry verify findings), рабочее дерево чистое
|
||||
(`git status --short` пуст до и после прогона); образ `mtusi-messenger:lab6` собран из этого
|
||||
дерева (метка `com.docker.compose.image` реплик и worker `sha256:589c1d53a299…`). Лимиты Tempo и
|
||||
Grafana подняты позже, по замеру бюджета (`budget.md`); на проверку они не влияют.
|
||||
- Дата: 2026-11-11, 07:58:38Z – 08:00:51Z (~2,2 мин); рабочий стенд `mtusi-lab6`, команда из корня:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 telemetry-outage`.
|
||||
- Сценарии: `observability` «Collector остановлен», «Collector заморожен»; `service-logging`
|
||||
«Отказ отправки журнала»; `container-run` «Приложение без телеметрии»; `graceful-shutdown`
|
||||
«docker stop при остановленном Collector», «docker stop при замороженном Collector».
|
||||
- Основа: commit `72cfa9a` (feat: propagate trace context through outbox and add pipeline saturation
|
||||
metrics), рабочее дерево чистое (`git status --short` до прогона пуст; после — только файлы
|
||||
`evidence/`). Файлы `src/` и `migrations/` в контейнерах `api` (2), `relay`, `worker` и `cleaner`
|
||||
побайтно совпадают с деревом commit (SHA-256 каждого файла). Прежний прогон этого файла — на
|
||||
`68f1e97` (до change `job-trace-propagation`, без relay).
|
||||
- Дата: 2026-11-11, 17:01:52Z – 17:04:11Z (~2,3 мин); рабочий стенд `mtusi-lab6`, команда из корня:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 telemetry-outage`, код выхода 0.
|
||||
- Сценарии: `observability` «Collector остановлен», «Collector заморожен», «Collector недоступен для
|
||||
relay»; `service-logging` «Отказ отправки журнала»; `container-run` «Приложение без телеметрии»;
|
||||
`graceful-shutdown` «docker stop при остановленном Collector», «docker stop при замороженном
|
||||
Collector» (реплика API, worker и с change `job-trace-propagation` relay).
|
||||
- Ход: на фазу — `docker compose stop` (или `pause`) `otel-collector`; `make test` через LB;
|
||||
`/health/ready`; свой `GET /users/me` и его запись в stdout; загрузка `sample.png` до `ready`;
|
||||
окно не меньше 20 с, чтобы экспорт трёх сигналов успел отказать; записи логгеров
|
||||
`opentelemetry.*` в stdout каждого контейнера `api` и `worker` с начала фазы; `docker stop
|
||||
--timeout 10` одной реплики и `docker compose stop worker` (время, код выхода, запись об
|
||||
остановке в stdout); `make replicas`, запуск worker; возврат Collector (`start` / `unpause`) — и
|
||||
новые запись API в Loki, трасса API в Tempo, запись worker в Loki, ряды API и worker в
|
||||
Prometheus с отметкой времени позже возврата, без перезапуска процессов. Последняя фаза — все
|
||||
пять сервисов телеметрии остановлены, `docker compose restart api worker`, `make test`, затем
|
||||
--timeout 10` одной реплики и `docker compose stop worker`; затем relay: `StartedAt` и
|
||||
`RestartCount` не изменились с начала фазы (загрузка стала `ready`, relay её опубликовал при
|
||||
недоступном Collector), `docker stop` relay тем же замером (время, код выхода, «Stopped relay»);
|
||||
`make replicas`, `docker start` worker и relay; возврат Collector (`start` / `unpause`) — и новые
|
||||
запись API в Loki, трасса API в Tempo, запись worker в Loki, span producer relay в Tempo, ряды
|
||||
API, worker и relay в Prometheus с отметкой времени позже возврата. Последняя фаза — все пять
|
||||
сервисов телеметрии остановлены, `docker compose restart api worker relay`, `make test`, затем
|
||||
возврат телеметрии и сигналы снова. В `finally` — `unpause` и `start` телеметрии, `make
|
||||
replicas`, worker и relay.
|
||||
- Время остановки при недоступном Collector: реплика API — 1,58 с (stop) и 1,45 с (pause), worker
|
||||
— 0,70 с в обоих случаях; срок закрытия SDK — 1 с у API и окно 0,5 с у worker
|
||||
(`TELEMETRY_SHUTDOWN_TIMEOUT_SECONDS`, design, решение 13).
|
||||
- Записи SDK об отказе — по одной на модуль экспортёра (трассы, метрики, логи) на контейнер за
|
||||
окно: фильтр пропускает не больше одной в минуту на логгер. В фазе `pause` экспортёр логов к
|
||||
моменту подсчёта ещё не дождался срока отправки ни у одного контейнера — записей по две.
|
||||
- Время остановки при недоступном Collector: реплика API — 1,71 с (stop) и 1,50 с (pause), worker —
|
||||
0,74 и 0,73 с, relay — 0,64 и 0,63 с; срок закрытия SDK — 1 с у API и окно 0,5 с у worker и relay
|
||||
(`TELEMETRY_SHUTDOWN_TIMEOUT_SECONDS`, design change `otel-telemetry`, решение 13; design change
|
||||
`job-trace-propagation`, решение 15).
|
||||
- Записи SDK об отказе — по одной на модуль экспортёра (трассы, метрики, логи) на контейнер `api` и
|
||||
`worker` за окно: фильтр пропускает не больше одной в минуту на логгер. В фазе `pause` экспортёр
|
||||
логов к моменту подсчёта ещё не дождался срока отправки — записей по две. Записи SDK relay в
|
||||
этом подсчёте не участвуют.
|
||||
- Ограничение проверки: relay — единственный, и `docker stop` relay (сценарии `graceful-shutdown`)
|
||||
идёт до возврата Collector, поэтому сигналы relay после возврата приходят от того же контейнера
|
||||
после `docker start`, а не от непрерывно живущего процесса (design, «Уточнения apply», п. 9). Что
|
||||
relay переживает недоступный Collector без перезапуска, показывает строка «relay start time and
|
||||
restarts unchanged».
|
||||
|
||||
```
|
||||
[collector stop] SDK records in 20 s: {'2567ec8de4a4 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, '2567ec8de4a4 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '2567ec8de4a4 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '8ff320fd3b37 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, '8ff320fd3b37 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '8ff320fd3b37 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '3ac74c7e1f59 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '3ac74c7e1f59 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, '3ac74c7e1f59 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1}
|
||||
[collector stop] docker stop api 2567ec8de4a4: 1.58 s
|
||||
[collector stop] docker compose stop worker: 0.70 s
|
||||
[collector pause] SDK records in 20 s: {'2567ec8de4a4 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '2567ec8de4a4 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '8ff320fd3b37 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '8ff320fd3b37 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '3ac74c7e1f59 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '3ac74c7e1f59 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1}
|
||||
[collector pause] docker stop api 2567ec8de4a4: 1.45 s
|
||||
[collector pause] docker compose stop worker: 0.70 s
|
||||
[collector stop] SDK records in 20 s: {'a4a1f203ef70 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, 'a4a1f203ef70 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, 'a4a1f203ef70 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '48b425abbd15 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '48b425abbd15 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, '48b425abbd15 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, 'b221c6088b4b opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, 'b221c6088b4b opentelemetry.exporter.otlp.proto.http._log_exporter': 1, 'b221c6088b4b opentelemetry.exporter.otlp.proto.http.metric_exporter': 1}
|
||||
[collector stop] docker stop api a4a1f203ef70: 1.71 s
|
||||
[collector stop] docker compose stop worker: 0.74 s
|
||||
[collector stop] docker stop relay: 0.64 s
|
||||
[collector pause] SDK records in 20 s: {'a4a1f203ef70 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, 'a4a1f203ef70 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '48b425abbd15 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '48b425abbd15 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, 'b221c6088b4b opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, 'b221c6088b4b opentelemetry.exporter.otlp.proto.http.trace_exporter': 1}
|
||||
[collector pause] docker stop api a4a1f203ef70: 1.50 s
|
||||
[collector pause] docker compose stop worker: 0.73 s
|
||||
[collector pause] docker stop relay: 0.63 s
|
||||
[telemetry down] docker compose stop otel-collector prometheus loki tempo grafana
|
||||
|
||||
[collector stop] make test expected 0 PASS got 0 PASS
|
||||
[collector stop] /health/ready expected 200 got 200
|
||||
[collector stop] upload becomes ready expected yes got yes
|
||||
[collector stop] own request record in stdout expected yes got yes
|
||||
[collector stop] SDK records per logger at most 1 expected yes got yes
|
||||
[collector stop] docker stop api faster than 10 s expected yes got yes
|
||||
[collector stop] api exit code expected 0 got 0
|
||||
[collector stop] Stopped API in stdout expected yes got yes
|
||||
[collector stop] stop worker faster than 10 s expected yes got yes
|
||||
[collector stop] worker exit code expected 0 got 0
|
||||
[collector stop] Stopped worker in stdout expected yes got yes
|
||||
[collector stop] worker started again expected yes got yes
|
||||
[collector stop] LB ready expected yes got yes
|
||||
[collector stop] API record reaches Loki again expected yes got yes
|
||||
[collector stop] API trace reaches Tempo again expected yes got yes
|
||||
[collector stop] worker record reaches Loki again expected yes got yes
|
||||
[collector stop] API metrics scraped again expected yes got yes
|
||||
[collector stop] worker metrics scraped again expected yes got yes
|
||||
[collector pause] make test expected 0 PASS got 0 PASS
|
||||
[collector pause] /health/ready expected 200 got 200
|
||||
[collector pause] upload becomes ready expected yes got yes
|
||||
[collector pause] own request record in stdout expected yes got yes
|
||||
[collector pause] SDK records per logger at most 1 expected yes got yes
|
||||
[collector pause] docker stop api faster than 10 s expected yes got yes
|
||||
[collector pause] api exit code expected 0 got 0
|
||||
[collector pause] Stopped API in stdout expected yes got yes
|
||||
[collector pause] stop worker faster than 10 s expected yes got yes
|
||||
[collector pause] worker exit code expected 0 got 0
|
||||
[collector pause] Stopped worker in stdout expected yes got yes
|
||||
[collector pause] worker started again expected yes got yes
|
||||
[collector pause] LB ready expected yes got yes
|
||||
[collector pause] API record reaches Loki again expected yes got yes
|
||||
[collector pause] API trace reaches Tempo again expected yes got yes
|
||||
[collector pause] worker record reaches Loki again expected yes got yes
|
||||
[collector pause] API metrics scraped again expected yes got yes
|
||||
[collector pause] worker metrics scraped again expected yes got yes
|
||||
[telemetry down] app services depend on telemetry expected [] got []
|
||||
[telemetry down] docker compose restart api worker expected 0 got 0
|
||||
[telemetry down] LB ready expected yes got yes
|
||||
[telemetry down] replicas started expected 2 got 2
|
||||
[telemetry down] worker started expected yes got yes
|
||||
[telemetry down] make test expected 0 PASS got 0 PASS
|
||||
[telemetry down] Grafana back expected yes got yes
|
||||
[telemetry down] API record reaches Loki again expected yes got yes
|
||||
[telemetry down] API trace reaches Tempo again expected yes got yes
|
||||
[telemetry down] worker record reaches Loki again expected yes got yes
|
||||
[telemetry down] API metrics scraped again expected yes got yes
|
||||
[telemetry down] worker metrics scraped again expected yes got yes
|
||||
PASS: API and worker work and stop in time without the Collector, signals come back without restarts
|
||||
[collector stop] make test expected 0 PASS got 0 PASS
|
||||
[collector stop] /health/ready expected 200 got 200
|
||||
[collector stop] upload becomes ready expected yes got yes
|
||||
[collector stop] own request record in stdout expected yes got yes
|
||||
[collector stop] SDK records per logger at most 1 expected yes got yes
|
||||
[collector stop] docker stop api faster than 10 s expected yes got yes
|
||||
[collector stop] api exit code expected 0 got 0
|
||||
[collector stop] Stopped API in stdout expected yes got yes
|
||||
[collector stop] stop worker faster than 10 s expected yes got yes
|
||||
[collector stop] worker exit code expected 0 got 0
|
||||
[collector stop] Stopped worker in stdout expected yes got yes
|
||||
[collector stop] relay start time and restarts unchanged expected yes got yes
|
||||
[collector stop] stop relay faster than 10 s expected yes got yes
|
||||
[collector stop] relay exit code expected 0 got 0
|
||||
[collector stop] Stopped relay in stdout expected yes got yes
|
||||
[collector stop] worker and relay started again expected yes got yes
|
||||
[collector stop] LB ready expected yes got yes
|
||||
[collector stop] API record reaches Loki again expected yes got yes
|
||||
[collector stop] API trace reaches Tempo again expected yes got yes
|
||||
[collector stop] worker record reaches Loki again expected yes got yes
|
||||
[collector stop] relay producer span reaches Tempo again expected yes got yes
|
||||
[collector stop] relay metrics scraped again expected yes got yes
|
||||
[collector stop] API metrics scraped again expected yes got yes
|
||||
[collector stop] worker metrics scraped again expected yes got yes
|
||||
[collector pause] make test expected 0 PASS got 0 PASS
|
||||
[collector pause] /health/ready expected 200 got 200
|
||||
[collector pause] upload becomes ready expected yes got yes
|
||||
[collector pause] own request record in stdout expected yes got yes
|
||||
[collector pause] SDK records per logger at most 1 expected yes got yes
|
||||
[collector pause] docker stop api faster than 10 s expected yes got yes
|
||||
[collector pause] api exit code expected 0 got 0
|
||||
[collector pause] Stopped API in stdout expected yes got yes
|
||||
[collector pause] stop worker faster than 10 s expected yes got yes
|
||||
[collector pause] worker exit code expected 0 got 0
|
||||
[collector pause] Stopped worker in stdout expected yes got yes
|
||||
[collector pause] relay start time and restarts unchanged expected yes got yes
|
||||
[collector pause] stop relay faster than 10 s expected yes got yes
|
||||
[collector pause] relay exit code expected 0 got 0
|
||||
[collector pause] Stopped relay in stdout expected yes got yes
|
||||
[collector pause] worker and relay started again expected yes got yes
|
||||
[collector pause] LB ready expected yes got yes
|
||||
[collector pause] API record reaches Loki again expected yes got yes
|
||||
[collector pause] API trace reaches Tempo again expected yes got yes
|
||||
[collector pause] worker record reaches Loki again expected yes got yes
|
||||
[collector pause] relay producer span reaches Tempo again expected yes got yes
|
||||
[collector pause] relay metrics scraped again expected yes got yes
|
||||
[collector pause] API metrics scraped again expected yes got yes
|
||||
[collector pause] worker metrics scraped again expected yes got yes
|
||||
[telemetry down] app services depend on telemetry expected [] got []
|
||||
[telemetry down] docker compose restart api worker relay expected 0 got 0
|
||||
[telemetry down] LB ready expected yes got yes
|
||||
[telemetry down] replicas started expected 2 got 2
|
||||
[telemetry down] worker started expected yes got yes
|
||||
[telemetry down] relay started expected yes got yes
|
||||
[telemetry down] make test expected 0 PASS got 0 PASS
|
||||
[telemetry down] Grafana back expected yes got yes
|
||||
[telemetry down] API record reaches Loki again expected yes got yes
|
||||
[telemetry down] API trace reaches Tempo again expected yes got yes
|
||||
[telemetry down] worker record reaches Loki again expected yes got yes
|
||||
[telemetry down] relay producer span reaches Tempo again expected yes got yes
|
||||
[telemetry down] relay metrics scraped again expected yes got yes
|
||||
[telemetry down] API metrics scraped again expected yes got yes
|
||||
[telemetry down] worker metrics scraped again expected yes got yes
|
||||
PASS: API, worker and relay work and stop in time without the Collector, signals come back without restarts
|
||||
restored: telemetry services started, replicas and worker running: yes
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# План снимка очереди relay (change `job-trace-propagation`, задача 12.3)
|
||||
|
||||
- Основа: commit `72cfa9a` (feat: propagate trace context through outbox and add pipeline saturation
|
||||
metrics), рабочее дерево чистое; файлы `src/` и `migrations/` в контейнерах `api`, `relay`, `worker`
|
||||
и `cleaner` побайтно совпадают с деревом commit (SHA-256 каждого файла).
|
||||
- Дата: 2026-11-11, ~16:57Z; рабочий стенд `mtusi-lab6`, PostgreSQL 18.6, ревизия схемы
|
||||
`e4b8c2d17f90`.
|
||||
- Запрос — `SqlAlchemyAttachmentJobRepository.queue_snapshot` (design, решение 9): текст получен
|
||||
компиляцией выражения repo диалектом asyncpg (`render_postcompile`), состояния — константы, время
|
||||
прохода — параметры `$1`, `$2`. Выполнен в транзакции `READ ONLY` с откатом, `PREPARE` и
|
||||
`plan_cache_mode = force_generic_plan` — общий план, который PostgreSQL может выбрать для
|
||||
подготовленного выражения asyncpg после пяти выполнений.
|
||||
- Проверка: ни одного `Seq Scan` по `attachment_jobs`; каждый из семи подзапросов идёт по частичному
|
||||
индексу своей стадии (`ix_attachment_jobs_outbox` — срок по выражению, `ix_attachment_jobs_published`,
|
||||
`ix_attachment_jobs_lease`), завершённые задания (`succeeded`, `failed`) не читаются. Итог — 7
|
||||
буферов на 2,2 тыс. строк таблицы, 0,15 мс.
|
||||
- Ограничение: на рабочей базе незавершённых заданий в момент снимка нет, строки узлов — 0; число
|
||||
незавершённых ограничено пределом приёма (`[uploads] max_unfinished_jobs`, 250), а частичные индексы
|
||||
содержат только их, поэтому стоимость снимка от числа завершённых не зависит.
|
||||
|
||||
```text
|
||||
jobs by state: failed=33, succeeded=2198
|
||||
table: reltuples=2227 relpages=45
|
||||
PREPARE
|
||||
QUERY PLAN
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Result (actual time=0.029..0.030 rows=1.00 loops=1)
|
||||
Buffers: shared hit=7
|
||||
InitPlan 1
|
||||
-> Aggregate (actual time=0.003..0.003 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Scan using ix_attachment_jobs_outbox on attachment_jobs (actual time=0.002..0.002 rows=0.00 loops=1)
|
||||
Index Cond: (COALESCE(next_attempt_at, created_at) > $1)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
InitPlan 2
|
||||
-> Aggregate (actual time=0.001..0.001 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Scan using ix_attachment_jobs_outbox on attachment_jobs attachment_jobs_1 (actual time=0.000..0.000 rows=0.00 loops=1)
|
||||
Index Cond: (COALESCE(next_attempt_at, created_at) <= $2)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
InitPlan 3
|
||||
-> Aggregate (actual time=0.005..0.005 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Only Scan using ix_attachment_jobs_published on attachment_jobs attachment_jobs_2 (actual time=0.005..0.005 rows=0.00 loops=1)
|
||||
Heap Fetches: 0
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
InitPlan 4
|
||||
-> Aggregate (actual time=0.006..0.006 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Only Scan using ix_attachment_jobs_lease on attachment_jobs attachment_jobs_3 (actual time=0.006..0.006 rows=0.00 loops=1)
|
||||
Heap Fetches: 0
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
InitPlan 5
|
||||
-> Aggregate (actual time=0.003..0.003 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Scan using ix_attachment_jobs_outbox on attachment_jobs attachment_jobs_4 (actual time=0.002..0.002 rows=0.00 loops=1)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
InitPlan 6
|
||||
-> Aggregate (actual time=0.003..0.003 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Scan using ix_attachment_jobs_published on attachment_jobs attachment_jobs_5 (actual time=0.002..0.002 rows=0.00 loops=1)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
InitPlan 7
|
||||
-> Aggregate (actual time=0.005..0.005 rows=1.00 loops=1)
|
||||
Buffers: shared hit=1
|
||||
-> Index Scan using ix_attachment_jobs_lease on attachment_jobs attachment_jobs_6 (actual time=0.005..0.005 rows=0.00 loops=1)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1
|
||||
Planning:
|
||||
Buffers: shared hit=44 read=2
|
||||
Planning Time: 1.043 ms
|
||||
Execution Time: 0.154 ms
|
||||
(52 rows)
|
||||
|
||||
ROLLBACK
|
||||
```
|
||||
|
||||
Текст запроса (общий план, `$1` и `$2` — время прохода relay):
|
||||
|
||||
```sql
|
||||
SELECT (SELECT count(*) FROM attachment_jobs
|
||||
WHERE state = 'queued' AND published_at IS NULL
|
||||
AND coalesce(next_attempt_at, created_at) > $1) AS scheduled,
|
||||
(SELECT count(*) FROM attachment_jobs
|
||||
WHERE state = 'queued' AND published_at IS NULL
|
||||
AND coalesce(next_attempt_at, created_at) <= $2) AS outbox,
|
||||
(SELECT count(*) FROM attachment_jobs
|
||||
WHERE state = 'queued' AND published_at IS NOT NULL) AS published,
|
||||
(SELECT count(*) FROM attachment_jobs WHERE state = 'processing') AS processing,
|
||||
least((SELECT min(created_at) FROM attachment_jobs
|
||||
WHERE state = 'queued' AND published_at IS NULL),
|
||||
(SELECT min(created_at) FROM attachment_jobs
|
||||
WHERE state = 'queued' AND published_at IS NOT NULL),
|
||||
(SELECT min(created_at) FROM attachment_jobs
|
||||
WHERE state = 'processing')) AS oldest_created_at;
|
||||
```
|
||||
@@ -0,0 +1,167 @@
|
||||
# `driver.py --port 8080 trace-chain` (change `job-trace-propagation`, задача 12.1)
|
||||
|
||||
- Основа: commit `72cfa9a` (feat: propagate trace context through outbox and add pipeline saturation
|
||||
metrics), рабочее дерево чистое (`git status --short` пуст до прогона; после — только новый файл
|
||||
`evidence/`). Файлы `src/` и `migrations/` в контейнерах `api` (2), `relay`, `worker` и `cleaner`
|
||||
побайтно совпадают с деревом commit (SHA-256 каждого файла); ревизия схемы `e4b8c2d17f90`;
|
||||
Grafana запущена после последней правки dashboard JSON.
|
||||
- Дата: 2026-11-11, 16:55:56Z – 16:59:00Z (~3 мин); рабочий стенд `mtusi-lab6` (две реплики API,
|
||||
relay, worker, уборщик, Collector, Prometheus, Loki, Tempo, Grafana), команда из корня репозитория:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 trace-chain`, код выхода 0.
|
||||
- Всё — через HTTP API Grafana на `127.0.0.1:3000` с паролем из `.env` (источники-прокси uid
|
||||
`prometheus`, `loki`, `tempo`); PostgreSQL — только чтение, кроме одного `UPDATE` контекста своего
|
||||
синтетического вложения (шаг 4). Пользователь, пароль, токен и файлы — синтетические, в вывод не
|
||||
попадают; в выводе только `instance_id` контейнеров.
|
||||
- Сценарии `observability`: «Очередь при остановленном worker» (шаг 1), «Цепочка одной загрузки» и
|
||||
«Повторная попытка в той же трассе» (шаг 2), «Replay в той же трассе» (шаг 3), «Задание без
|
||||
контекста» (шаг 4), «Один источник очереди», «Пулы процессов стенда», «Пределы как в compose», «Без
|
||||
сокета Docker», «Панели уровня 4 после трафика», «Время до готовности в метрике» (шаг 5), «Проверка
|
||||
цепочки» (команда целиком); `service-logging` — «Записи задания ведут к трассе» (записи worker по F
|
||||
несут `trace_id` T записи «Uploaded attachment» запроса R).
|
||||
- Шаги 2 и 3: Tempo 3.1 собрал span producer и consumer разных попыток (повтор после `pause s3`,
|
||||
replay) в одной трассе загрузки (design, «Уточнения apply», п. 7). Время до `ready`: worker перезапускался дважды, проверка складывает «тихие» значения двух
|
||||
процессов (п. 8).
|
||||
- Расхождений с design нет.
|
||||
|
||||
Ход прогона:
|
||||
|
||||
```text
|
||||
2026-11-11T16:55:56Z
|
||||
queue depth before (no unfinished jobs): 0
|
||||
docker compose stop worker
|
||||
upload queue0: 202
|
||||
upload queue1: 202
|
||||
upload queue2: 202
|
||||
outbox + published with worker stopped: 3
|
||||
oldest age not less than time since first upload - 35 s: yes
|
||||
oldest age grows: yes
|
||||
docker start worker
|
||||
all queued attachments ready after worker start: yes
|
||||
queue depth and age 0 after ready: yes
|
||||
waiting for the time-to-ready histogram to settle
|
||||
docker compose stop worker
|
||||
upload retry: 202
|
||||
job of F published with worker stopped: yes
|
||||
docker compose pause s3
|
||||
docker start worker
|
||||
docker compose unpause s3
|
||||
worker stdout: Retrying job of F (storage_unavailable): storage_unavailable
|
||||
F becomes ready after S3 is back: ready
|
||||
Loki: Uploaded attachment of R has trace_id T: yes
|
||||
worker records of F carry trace_id T: yes
|
||||
root: server span of the upload: POST /api/v1/chats/{chat_id}/attachments messenger-api
|
||||
producer spans: 2
|
||||
consumer spans: 2
|
||||
producers: messenger-relay, children of the root: yes
|
||||
producer service.instance.id = relay instance_id: f1a1d8fef0bc
|
||||
producer attempts: [1, 2]
|
||||
retry reason of the second producer: storage_unavailable
|
||||
consumers: messenger-worker, parent and link = own producer: yes
|
||||
consumer outcomes and attempts: [('retry', 1), ('ready', 2)]
|
||||
retry consumer reason: storage_unavailable
|
||||
retry consumer: S3 span with error: yes
|
||||
ready consumer: S3.PutObject >= 4, render, COMMIT: yes
|
||||
undecodable JPEG generated: yes
|
||||
upload replay: 202
|
||||
undecodable JPEG becomes failed: failed
|
||||
replay --apply exit code: 0
|
||||
replayed job failed again: yes
|
||||
producer span with messenger.job.replayed: 1
|
||||
consumer span of the replayed attempt (failed): failed
|
||||
two consumer spans failed in the upload trace: 2
|
||||
docker compose stop relay
|
||||
upload plain: 202
|
||||
context of one job removed (UPDATE rows): 1
|
||||
docker start relay
|
||||
job without context becomes ready: ready
|
||||
worker trace_id differs from the upload trace: yes
|
||||
its root is the consumer span: SPAN_KIND_CONSUMER messenger-worker
|
||||
producer spans in the worker trace: 0
|
||||
producer and consumer spans in the upload trace: 0
|
||||
pool max: API replicas, worker, relay: ['10', '10'] ['2'] ['1']
|
||||
pools with used above max: 0
|
||||
worker capacity: 2
|
||||
queue series only from relay: ['messenger-relay']
|
||||
api a4a1f203ef70 limits = docker inspect: 1 536870912
|
||||
api a4a1f203ef70 memory below the limit: yes
|
||||
api 48b425abbd15 limits = docker inspect: 1 536870912
|
||||
api 48b425abbd15 memory below the limit: yes
|
||||
worker b221c6088b4b limits = docker inspect: 1 1073741824
|
||||
worker b221c6088b4b memory below the limit: yes
|
||||
relay f1a1d8fef0bc limits = docker inspect: 0.25 268435456
|
||||
relay f1a1d8fef0bc memory below the limit: yes
|
||||
Docker socket mounted by any service: no
|
||||
dashboard loaded: 200
|
||||
level 4 panel queries (19) without error: []
|
||||
level 4 panel queries with data: []
|
||||
waiting for the time-to-ready histogram to settle
|
||||
time to ready count grew by the uploads without replay: 5
|
||||
time to ready sum grew by at least 3 x 41 s (worker stopped): yes
|
||||
```
|
||||
|
||||
Итог («with data: []» — список панелей без данных пуст):
|
||||
|
||||
```text
|
||||
queue depth before (no unfinished jobs) expected 0 got 0
|
||||
upload queue0 expected 202 got 202
|
||||
upload queue1 expected 202 got 202
|
||||
upload queue2 expected 202 got 202
|
||||
outbox + published with worker stopped expected 3 got 3
|
||||
oldest age not less than time since first upload - 35 s expected yes got yes
|
||||
oldest age grows expected yes got yes
|
||||
all queued attachments ready after worker start expected yes got yes
|
||||
queue depth and age 0 after ready expected yes got yes
|
||||
upload retry expected 202 got 202
|
||||
job of F published with worker stopped expected yes got yes
|
||||
worker stdout: Retrying job of F (storage_unavailable) expected storage_unavailable got storage_unavailable
|
||||
F becomes ready after S3 is back expected ready got ready
|
||||
Loki: Uploaded attachment of R has trace_id T expected yes got yes
|
||||
worker records of F carry trace_id T expected yes got yes
|
||||
root: server span of the upload expected POST /api/v1/chats/{chat_id}/attachments messenger-api got POST /api/v1/chats/{chat_id}/attachments messenger-api
|
||||
producer spans expected 2 got 2
|
||||
consumer spans expected 2 got 2
|
||||
producers: messenger-relay, children of the root expected yes got yes
|
||||
producer service.instance.id = relay instance_id expected f1a1d8fef0bc got f1a1d8fef0bc
|
||||
producer attempts expected [1, 2] got [1, 2]
|
||||
retry reason of the second producer expected storage_unavailable got storage_unavailable
|
||||
consumers: messenger-worker, parent and link = own producer expected yes got yes
|
||||
consumer outcomes and attempts expected [('retry', 1), ('ready', 2)] got [('retry', 1), ('ready', 2)]
|
||||
retry consumer reason expected storage_unavailable got storage_unavailable
|
||||
retry consumer: S3 span with error expected yes got yes
|
||||
ready consumer: S3.PutObject >= 4, render, COMMIT expected yes got yes
|
||||
undecodable JPEG generated expected yes got yes
|
||||
upload replay expected 202 got 202
|
||||
undecodable JPEG becomes failed expected failed got failed
|
||||
replay --apply exit code expected 0 got 0
|
||||
replayed job failed again expected yes got yes
|
||||
producer span with messenger.job.replayed expected 1 got 1
|
||||
consumer span of the replayed attempt (failed) expected failed got failed
|
||||
two consumer spans failed in the upload trace expected 2 got 2
|
||||
upload plain expected 202 got 202
|
||||
context of one job removed (UPDATE rows) expected 1 got 1
|
||||
job without context becomes ready expected ready got ready
|
||||
worker trace_id differs from the upload trace expected yes got yes
|
||||
its root is the consumer span expected SPAN_KIND_CONSUMER messenger-worker got SPAN_KIND_CONSUMER messenger-worker
|
||||
producer spans in the worker trace expected 0 got 0
|
||||
producer and consumer spans in the upload trace expected 0 got 0
|
||||
pool max: API replicas, worker, relay expected ['10', '10'] ['2'] ['1'] got ['10', '10'] ['2'] ['1']
|
||||
pools with used above max expected 0 got 0
|
||||
worker capacity expected 2 got 2
|
||||
queue series only from relay expected ['messenger-relay'] got ['messenger-relay']
|
||||
api a4a1f203ef70 limits = docker inspect expected 1 536870912 got 1 536870912
|
||||
api a4a1f203ef70 memory below the limit expected yes got yes
|
||||
api 48b425abbd15 limits = docker inspect expected 1 536870912 got 1 536870912
|
||||
api 48b425abbd15 memory below the limit expected yes got yes
|
||||
worker b221c6088b4b limits = docker inspect expected 1 1073741824 got 1 1073741824
|
||||
worker b221c6088b4b memory below the limit expected yes got yes
|
||||
relay f1a1d8fef0bc limits = docker inspect expected 0.25 268435456 got 0.25 268435456
|
||||
relay f1a1d8fef0bc memory below the limit expected yes got yes
|
||||
Docker socket mounted by any service expected no got no
|
||||
dashboard loaded expected 200 got 200
|
||||
level 4 panel queries (19) without error expected [] got []
|
||||
level 4 panel queries with data expected [] got []
|
||||
time to ready count grew by the uploads without replay expected 5 got 5
|
||||
time to ready sum grew by at least 3 x 41 s (worker stopped) expected yes got yes
|
||||
PASS: one upload is one trace: producer and consumer per attempt, retry and replay in it, level 4 signals found
|
||||
restored: s3 unpaused, worker and relay running: yes
|
||||
```
|
||||
@@ -478,3 +478,19 @@ evidence. `REPORT.md` — «Наблюдаемость»: сквозная тр
|
||||
12. **Бюджет relay (решение 15)** проверен до коммита (числа — в scratchpad для 12.4): `memory.peak` relay с SDK 94–99
|
||||
МиБ, наибольшая выборка `docker stats` 91 МиБ, CPU до 27 % ядра при лимите 0,25 — лимит 256 МиБ ≥ 1,5 × пика, не
|
||||
менялся; пики сервисов телеметрии в прежних границах (Tempo до 385 МиБ из 640, Grafana 255 из 512).
|
||||
13. **Evidence `make rolling_update` (задача 12.3).** Рабочий стенд к разделу 12 уже был на `e4b8c2d17f90`; «ревизия до и
|
||||
после» показана по Migration Plan: реплики откачены `make rolling_update COMMIT=ff0073e MIGRATE=0` (`make test` на
|
||||
прежнем образе и новой схеме — PASS), relay, worker и уборщик нового кода остановлены, ревизия снята `uv run alembic
|
||||
downgrade -1` с хоста (прежний образ её не знает), затем штатно `make rolling_update` и `docker compose up -d --no-deps
|
||||
--force-recreate relay worker cleaner`. Контекст прежних заданий рабочей базы при этом снят (синтетика тестов).
|
||||
14. **Бюджет на commit (задача 12.4).** Relay 103 МиБ, уборщик 108 МиБ — правило выполнено, лимиты прежние. У Grafana
|
||||
`memory.peak` 343 МиБ (с файловым кэшем 95 МиБ, после рестарта в `telemetry-outage`): 1,5 × пик больше лимита 512 на 3
|
||||
МиБ — лимит не менялся (не предмет change, код и compose заморожены), вопрос 6 в `QUESTIONS.md`.
|
||||
15. **`trace-chain` на нетихом стенде.** Повторный прогон как нагрузка бюджета через секунду после `make student_test` дал
|
||||
код 1 одной строкой — предусловие «queue depth before» 1 вместо 0 (последняя точка ряда глубины в Prometheus до 30 с
|
||||
давности). Evidence `trace-chain.md` снят на тихом стенде с кодом 0; ожидание тихой глубины в предусловии — возможная
|
||||
правка драйвера (решает verify).
|
||||
16. **Возврат сигналов relay в `telemetry-outage`.** Relay один, его `docker stop` (сценарии `graceful-shutdown`) идёт до
|
||||
возврата Collector, поэтому «span и метрики relay снова приходят без перезапуска relay» (сценарий «Collector недоступен
|
||||
для relay») проверены после `docker start` того же контейнера; без перезапуска — только `StartedAt` и `RestartCount`
|
||||
во время недоступности (п. 9). Порядок шагов команды — возможная правка драйвера (решает verify).
|
||||
|
||||
@@ -188,19 +188,19 @@
|
||||
|
||||
## 12. Evidence (после коммита кода основной сессией)
|
||||
|
||||
- [ ] 12.1 `driver.py --port 8080 trace-chain` → код 0, `evidence/telemetry/trace-chain.md` с commit в шапке. Проверка:
|
||||
- [x] 12.1 `driver.py --port 8080 trace-chain` → код 0, `evidence/telemetry/trace-chain.md` с commit в шапке. Проверка:
|
||||
сценарии `observability` «Цепочка одной загрузки», «Повторная попытка в той же трассе», «Replay в той же трассе»,
|
||||
«Задание без контекста», «Очередь при остановленном worker», «Один источник очереди», «Время до готовности в метрике»,
|
||||
«Пулы процессов стенда», «Пределы как в compose», «Без сокета Docker», «Панели уровня 4 после трафика», «Проверка
|
||||
цепочки»; `service-logging` «Записи задания ведут к трассе».
|
||||
- [ ] 12.2 `driver.py --port 8080 telemetry-check` → `evidence/telemetry/check.md`; `driver.py --port 8080 telemetry-outage`
|
||||
- [x] 12.2 `driver.py --port 8080 telemetry-check` → `evidence/telemetry/check.md`; `driver.py --port 8080 telemetry-outage`
|
||||
→ `evidence/telemetry/collector-outage.md`. Проверка: коды 0; сценарии «Ресурс relay», «Collector недоступен для relay»,
|
||||
`service-logging` «Записи relay в Loki» и «Проход relay без полей трассы», `graceful-shutdown` «docker stop при
|
||||
остановленном Collector» и «…при замороженном Collector».
|
||||
- [ ] 12.3 Миграция — `evidence/migrations/job-trace-context.md` (с нуля, повтор, откат, `--sql` с `lock_timeout`, `make
|
||||
- [x] 12.3 Миграция — `evidence/migrations/job-trace-context.md` (с нуля, повтор, откат, `--sql` с `lock_timeout`, `make
|
||||
rolling_update` с ревизией до и после); план снимка очереди — `EXPLAIN (ANALYZE, BUFFERS)` на рабочей базе →
|
||||
`evidence/telemetry/queue-snapshot.md`. Проверка: в плане нет Seq Scan по `attachment_jobs`.
|
||||
- [ ] 12.4 Бюджет — раздел change в `evidence/telemetry/budget.md` (relay с SDK, уборщик после ленивого импорта). Проверка:
|
||||
- [x] 12.4 Бюджет — раздел change в `evidence/telemetry/budget.md` (relay с SDK, уборщик после ленивого импорта). Проверка:
|
||||
лимиты ≥ 1,5 × пика, суммы `docker.md` и `REPORT.md` совпадают.
|
||||
- [ ] 12.5 Ссылки `REPORT.md` и `AGENTS.md` на новые файлы evidence и их commit; `graphify update .`. Проверка: файлы,
|
||||
- [x] 12.5 Ссылки `REPORT.md` и `AGENTS.md` на новые файлы evidence и их commit; `graphify update .`. Проверка: файлы,
|
||||
названные в `REPORT.md`, существуют; в графе есть новые модули пакета телеметрии.
|
||||
|
||||
Reference in New Issue
Block a user