feat: add OpenTelemetry SDK, collector and telemetry stores
Collector (contrib), Prometheus, Loki, Tempo and Grafana with provisioning from git; SDK in API and worker with level 3 metrics, traces and logs carrying trace_id/span_id; telemetry off by default outside the stand; broker healthcheck runs as the broker user so a fresh stand starts once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
# `driver.py stand-from-scratch --runs 2` (change `otel-telemetry`, задача 11.3)
|
||||
|
||||
- Основа: commit `9b35c25` (propose), **рабочее дерево не закоммичено** (apply change
|
||||
`otel-telemetry`). Основная сессия решает, переснимать ли после коммита.
|
||||
- Дата: 2026-11-11, старт 06:27:32Z, ~2 мин; команда из корня:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py stand-from-scratch --runs 2`.
|
||||
- Сценарий `container-run` «Стенд с нуля одной командой» (design, решения 19 и 21). Проект compose
|
||||
`mtusi-lab6-scratch` (рабочий `mtusi-lab6` команда отказывается брать — код 2), свободные порты
|
||||
хоста для `APP_OUT_PORT`, `POSTGRES_OUT_PORT`, `VALKEY_OUT_PORT`, `S3_OUT_PORT`,
|
||||
`RABBITMQ_OUT_PORT`, `GRAFANA_OUT_PORT` аргументами `make run_docker`, `COMPOSE_PROJECT_NAME`
|
||||
окружением. Перед первым прогоном и после каждого — `docker compose -p mtusi-lab6-scratch down -v
|
||||
--remove-orphans` изнутри команды (в том числе при Ctrl+C): volumes проекта пусты перед прогоном и
|
||||
после него. `.env` и `config.toml` — рабочего стенда (секреты те же, данные — свои volumes).
|
||||
- Рабочий стенд на время проверки остановлен `make stop` (два стенда — 14 ГиБ лимитов на ВМ
|
||||
7,75 ГиБ); его 17 контейнеров до и после — с теми же ID, затем `docker compose start`.
|
||||
- До change на пустом volume брокер падал на `eacces` (`.erlang.cookie` от root,
|
||||
`KNOWN_ISSUES.md`) и `make run_docker` кончался кодом 1; healthcheck теперь
|
||||
`gosu rabbitmq rabbitmq-diagnostics -q check_port_connectivity`.
|
||||
|
||||
```
|
||||
working stand mtusi-lab6: 17 containers
|
||||
down -v mtusi-lab6-scratch: code 0
|
||||
run 1: make run_docker took 13 s
|
||||
down -v mtusi-lab6-scratch: code 0
|
||||
run 2: make run_docker took 12 s
|
||||
down -v mtusi-lab6-scratch: code 0
|
||||
|
||||
run 1: project volumes before expected 0 got 0
|
||||
run 1: make run_docker exit code expected 0 got 0
|
||||
run 1: api state expected running:0 got running:0
|
||||
run 1: cleaner state expected running:0 got running:0
|
||||
run 1: grafana state expected running:0 got running:0
|
||||
run 1: haproxy state expected running:0 got running:0
|
||||
run 1: loki state expected running:0 got running:0
|
||||
run 1: migrate state expected exited:0 got exited:0
|
||||
run 1: otel-collector state expected running:0 got running:0
|
||||
run 1: postgres state expected running:0 got running:0
|
||||
run 1: prometheus state expected running:0 got running:0
|
||||
run 1: rabbitmq state expected running:0 got running:0
|
||||
run 1: relay state expected running:0 got running:0
|
||||
run 1: s3 state expected running:0 got running:0
|
||||
run 1: s3-bootstrap state expected exited:0 got exited:0
|
||||
run 1: tempo state expected running:0 got running:0
|
||||
run 1: valkey state expected running:0 got running:0
|
||||
run 1: worker state expected running:0 got running:0
|
||||
run 1: rabbitmq RestartCount expected 0 got 0
|
||||
run 1: otel-collector RestartCount expected 0 got 0
|
||||
run 1: prometheus RestartCount expected 0 got 0
|
||||
run 1: loki RestartCount expected 0 got 0
|
||||
run 1: tempo RestartCount expected 0 got 0
|
||||
run 1: grafana RestartCount expected 0 got 0
|
||||
run 1: eacces / permission denied in logs expected 0 got 0
|
||||
run 1: grafana datasources provisioned and healthy expected yes got yes
|
||||
run 1: dashboard provisioned expected 200 True got 200 True
|
||||
run 1: make test through its LB expected 0 PASS got 0 PASS
|
||||
run 1: volumes left expected 0 got 0
|
||||
run 2: project volumes before expected 0 got 0
|
||||
run 2: make run_docker exit code expected 0 got 0
|
||||
run 2: api state expected running:0 got running:0
|
||||
run 2: cleaner state expected running:0 got running:0
|
||||
run 2: grafana state expected running:0 got running:0
|
||||
run 2: haproxy state expected running:0 got running:0
|
||||
run 2: loki state expected running:0 got running:0
|
||||
run 2: migrate state expected exited:0 got exited:0
|
||||
run 2: otel-collector state expected running:0 got running:0
|
||||
run 2: postgres state expected running:0 got running:0
|
||||
run 2: prometheus state expected running:0 got running:0
|
||||
run 2: rabbitmq state expected running:0 got running:0
|
||||
run 2: relay state expected running:0 got running:0
|
||||
run 2: s3 state expected running:0 got running:0
|
||||
run 2: s3-bootstrap state expected exited:0 got exited:0
|
||||
run 2: tempo state expected running:0 got running:0
|
||||
run 2: valkey state expected running:0 got running:0
|
||||
run 2: worker state expected running:0 got running:0
|
||||
run 2: rabbitmq RestartCount expected 0 got 0
|
||||
run 2: otel-collector RestartCount expected 0 got 0
|
||||
run 2: prometheus RestartCount expected 0 got 0
|
||||
run 2: loki RestartCount expected 0 got 0
|
||||
run 2: tempo RestartCount expected 0 got 0
|
||||
run 2: grafana RestartCount expected 0 got 0
|
||||
run 2: eacces / permission denied in logs expected 0 got 0
|
||||
run 2: grafana datasources provisioned and healthy expected yes got yes
|
||||
run 2: dashboard provisioned expected 200 True got 200 True
|
||||
run 2: make test through its LB expected 0 PASS got 0 PASS
|
||||
run 2: volumes left expected 0 got 0
|
||||
working stand mtusi-lab6: same container IDs expected yes got yes
|
||||
PASS: make run_docker on empty volumes passed 2 times at the first attempt
|
||||
```
|
||||
|
||||
Код выхода — 0. «running:0» — состояние и код выхода контейнера (`docker compose ps --format
|
||||
json`) через 30 с после `make run_docker`; у двух реплик API состояние одно.
|
||||
@@ -0,0 +1,63 @@
|
||||
# Бюджет стенда с телеметрией (change `otel-telemetry`, задача 10.1)
|
||||
|
||||
- Основа: commit `9b35c25` (propose), **рабочее дерево не закоммичено** (apply change
|
||||
`otel-telemetry`); основная сессия решает, переснимать ли после коммита.
|
||||
- Дата: 2026-11-11, стенд — проект compose `mtusi-lab6` (`make run_docker`), Docker 29.9.2,
|
||||
ВМ Docker Desktop 12 CPU / 7934 МиБ, ядро 7.0.14-linuxkit.
|
||||
- Методика (design, решение 7): на фазу — свежие cgroup реплик API и worker (`docker compose
|
||||
up -d --no-deps --force-recreate --wait api worker`), 30 с простоя (`docker stats`), затем
|
||||
`make test` и `make load` (30 с, 4 клиента, closed-loop запись) под выборкой `docker stats`
|
||||
раз в 2 с; в конце `memory.peak` каждого контейнера (cgroup v2 ВМ, одноразовый контейнер с
|
||||
`--cgroupns host`, только чтение). Фаза «выключена» — тот же стенд с override
|
||||
`TELEMETRY__ENABLED: "false"` у `api` и `worker`. Пик сервисов телеметрии — с их старта
|
||||
(включает `telemetry-check` и `telemetry-outage`, снятые раньше), а не за фазу.
|
||||
- Скрипт замера — во временном каталоге сессии, в git не идёт; это одноразовая проверка
|
||||
лимитов, а не метка `bench/`.
|
||||
|
||||
## Память и CPU
|
||||
|
||||
| Контейнер | Фаза | Простой, МиБ | Под нагрузкой (макс. выборки), МиБ | CPU макс., % | `memory.peak`, МиБ | Лимит, МиБ | 1,5 × пик ≤ лимита |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| `api-1` | телеметрия включена | 111,4 | 226,1 | 71,0 | 229,6 | 512 | да (344) |
|
||||
| `api-2` | включена | 111,6 | 225,6 | 71,3 | 227,3 | 512 | да (341) |
|
||||
| `worker` | включена | 101,0 | 103,6 | 31,1 | 120,0 | 1024 | да (180) |
|
||||
| `api-1` | выключена | 109,8 | 213,0 | 75,4 | 213,7 | 512 | — |
|
||||
| `api-2` | выключена | 113,3 | 212,6 | 66,4 | 216,5 | 512 | — |
|
||||
| `worker` | выключена | 100,0 | 102,0 | 25,4 | 119,4 | 1024 | — |
|
||||
| `otel-collector` | — | 47,7 | 71,4 | 2,6 | 71,8 | 256 | да (108) |
|
||||
| `prometheus` | — | 66,2 | 68,3 | 1,6 | 76,4 | 384 | да (115) |
|
||||
| `loki` | — | 59,0 | 103,5 | 3,5 | 116,8 | 512 | да (175) |
|
||||
| `tempo` | — | 43,8 | 211,5 | 7,6 | 234,8 | 512 | да (352) |
|
||||
| `grafana` | — | 239,1 | 240,3 | 2,1 | 249,1 | 384 | да (374) |
|
||||
|
||||
- Реплика API в своём лимите: пик 230 МиБ с телеметрией против 216 без неё (+~14 МиБ: SDK,
|
||||
очереди span и записей, экспортёры).
|
||||
- Пик Tempo — 235 МиБ во время простоя второй фазы (запись блоков после нагрузки), под
|
||||
нагрузкой первой — 97 МиБ. Grafana ближе всех к границе правила: 249 × 1,5 = 374 из 384 МиБ.
|
||||
Лимиты решения 7 правило «не меньше 1,5 × пика» выполняют, поднимать не пришлось.
|
||||
|
||||
## Цена SDK в репликах (грубо, один прогон)
|
||||
|
||||
`make load` (30 с, 4 клиента) на том же стенде подряд:
|
||||
|
||||
| Телеметрия | Успешных запросов/с | p50, мс | p95, мс | p99, мс | Ошибок |
|
||||
|---|---|---|---|---|---|
|
||||
| включена | 437,3 | 7,7 | 15,8 | 33,1 | 0 |
|
||||
| выключена | 499,1 | 7,2 | 10,4 | 19,1 | 0 |
|
||||
|
||||
Один прогон closed-loop на шумном хосте, не метка `bench/`: это порядок цены (−12 % RPS, хвост
|
||||
выше), а не замер; исследование — трек 1 «Цена наблюдаемости».
|
||||
|
||||
## Суммы лимитов (`docker compose config`)
|
||||
|
||||
| | CPU | Память, МиБ |
|
||||
|---|---|---|
|
||||
| сервисы телеметрии (`otel-collector`, `prometheus`, `loki`, `tempo`, `grafana`) | 2,5 | 2048 |
|
||||
| постоянные сервисы стенда (2 реплики API) | 11,5 | 7040 |
|
||||
| с одноразовыми (`migrate`, `s3-bootstrap`) | 12,5 | 7424 |
|
||||
| ВМ Docker | 12 | 7934 |
|
||||
|
||||
Лимиты — потолки, а не резерв: CPU делится по времени, а память простоя всего стенда после
|
||||
замера (`docker stats`) — 1715 МиБ, из них сервисы телеметрии — 770 МиБ (Tempo после записи
|
||||
блоков держит больше, чем на старте). Совпадает с `docker inspect`
|
||||
(`HostConfig.NanoCpus`, `HostConfig.Memory`) всех контейнеров рабочего стенда.
|
||||
@@ -0,0 +1,148 @@
|
||||
# `driver.py --port 8080 telemetry-check` (change `otel-telemetry`, задача 11.1)
|
||||
|
||||
- Основа: commit `9b35c25` (propose), **рабочее дерево не закоммичено** (apply change
|
||||
`otel-telemetry`); образ `mtusi-messenger:lab6` собран `make run_docker` из этого дерева.
|
||||
Основная сессия решает, переснимать ли после коммита.
|
||||
- Дата: 2026-11-11, старт 06:10:37Z, ~2 мин; рабочий стенд `mtusi-lab6` (две реплики API,
|
||||
worker, Collector, Prometheus, Loki, Tempo, Grafana), команда из корня репозитория:
|
||||
`python3 .claude/skills/run-mtusi-messenger/driver.py --port 8080 telemetry-check`.
|
||||
- Всё — через HTTP API Grafana на `127.0.0.1:3000` с паролем из `.env` (источники-прокси uid
|
||||
`prometheus`, `loki`, `tempo`); пароль, токены и тела в вывод не попадают. Пароль, `username`,
|
||||
токен, текст, ключ и имя файла пробы — случайные синтетические, в выводе только их метки
|
||||
U, P, T, M, K, F.
|
||||
- Сценарии: `observability` — «Стенд с телеметрией», «Хранилища недоступны приложению»,
|
||||
«История после рестарта хранилищ», «Provisioning после старта», «Источник правды — git», «Вход
|
||||
в Grafana», «Ресурс сигналов», «Чужой traceparent», «Запросы в метрике», «Health не
|
||||
учитывается», «Необычный метод и неизвестный путь» (см. ниже), «Готовое вложение в метриках»,
|
||||
«Неудачное вложение в метриках», «Трасса запроса», «Трасса задания», «Отказ S3 в трассе»,
|
||||
«Health и фоновые циклы без трасс», «Проба приватности», «Запрос найден», «Задание найдено»;
|
||||
`service-logging` — «Записи запроса ведут к трассе», «Записи задания ведут к трассе», «Запись в
|
||||
Loki совпадает со stdout»; `service-configuration` — «Переменные OTEL_* не действуют».
|
||||
- Отклонение (design, «Уточнения apply»): метод `BREW` HTTP-парсер uvicorn (httptools) отклоняет
|
||||
400 текстом до приложения — ни span, ни ряда (`KNOWN_ISSUES.md`); ряд `_OTHER` без `http_route`
|
||||
проверен на `PROPFIND` к неизвестному пути с UUID, у обоих — ни метода, ни UUID в метках.
|
||||
- Свой запрос: `X-Request-Id` `acfab668a2fe4b4b865f03382d20a571`, `X-Instance-Id`
|
||||
`dd98da9edd95`, trace-id `73907d1c87e5087abd1b998e3a06c89d`; проба приватности просмотрела
|
||||
44 записи Loki (столько же, сколько записей stdout `api` и `worker` и разового контейнера за
|
||||
окно), 29 трасс Tempo и 860 рядов 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
|
||||
BREW rejected by the HTTP parser before the app expected 400 got 400
|
||||
PROPFIND of an unknown path with a UUID expected 404 got 404
|
||||
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 dd98da9edd95 got dd98da9edd95
|
||||
Loki instance_id = X-Instance-Id expected dd98da9edd95 got dd98da9edd95
|
||||
Loki trace_id = stdout expected 73907d1c87e5087abd1b998e3a06c89d got 73907d1c87e5087abd1b998e3a06c89d
|
||||
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 acfab668a2fe4b4b865f03382d20a571 got acfab668a2fe4b4b865f03382d20a571
|
||||
resource service.name expected messenger-api got messenger-api
|
||||
resource service.instance.id expected dd98da9edd95 got dd98da9edd95
|
||||
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
|
||||
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
|
||||
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 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 10 got 10
|
||||
PASS: own request and job are found in Loki, Tempo and Prometheus through Grafana, no secrets in telemetry
|
||||
```
|
||||
|
||||
Код выхода — 0. «Same metric value at the saved time» — значение суммы ряда GET карточки чата на
|
||||
момент снимка до рестарта, запрошенное снова после `docker compose restart otel-collector
|
||||
prometheus loki tempo` (параметр `time` запроса).
|
||||
@@ -0,0 +1,89 @@
|
||||
# `driver.py --port 8080 telemetry-outage` (change `otel-telemetry`, задача 11.2)
|
||||
|
||||
- Основа: commit `9b35c25` (propose), **рабочее дерево не закоммичено** (apply change
|
||||
`otel-telemetry`); образ собран `make run_docker` из этого дерева. Основная сессия решает,
|
||||
переснимать ли после коммита.
|
||||
- Дата: 2026-11-11, старт 06:13:24Z, ~2,5 мин; рабочий стенд `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».
|
||||
- Ход: на фазу — `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`, затем
|
||||
возврат телеметрии и сигналы снова. В `finally` — `unpause` и `start` телеметрии, `make
|
||||
replicas`, worker и relay.
|
||||
- Время остановки при недоступном Collector: реплика API — 1,55 с (stop) и 1,58 с (pause), worker
|
||||
— 0,72 с в обоих случаях; срок закрытия SDK — 1 с у API и окно 0,5 с у worker
|
||||
(`TELEMETRY_SHUTDOWN_TIMEOUT_SECONDS`, design, решение 13).
|
||||
- Записи SDK об отказе — по одной на модуль экспортёра (трассы, метрики, логи) на контейнер за
|
||||
окно: фильтр пропускает не больше одной в минуту на логгер. В фазе `pause` у части контейнеров
|
||||
экспортёр логов ещё не дождался срока отправки к моменту подсчёта — записей меньше трёх.
|
||||
|
||||
```
|
||||
[collector stop] SDK records in 20 s: {'cf1cf6304893 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, 'cf1cf6304893 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, 'cf1cf6304893 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, 'dd98da9edd95 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, 'dd98da9edd95 opentelemetry.exporter.otlp.proto.http._log_exporter': 1, 'dd98da9edd95 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, '7ba13dcb409f opentelemetry.exporter.otlp.proto.http._log_exporter': 1, '7ba13dcb409f opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '7ba13dcb409f opentelemetry.exporter.otlp.proto.http.metric_exporter': 1}
|
||||
[collector stop] docker stop api cf1cf6304893: 1.55 s
|
||||
[collector stop] docker compose stop worker: 0.72 s
|
||||
[collector pause] SDK records in 20 s: {'cf1cf6304893 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, 'cf1cf6304893 opentelemetry.exporter.otlp.proto.http.metric_exporter': 1, 'dd98da9edd95 opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '7ba13dcb409f opentelemetry.exporter.otlp.proto.http.trace_exporter': 1, '7ba13dcb409f opentelemetry.exporter.otlp.proto.http.metric_exporter': 1}
|
||||
[collector pause] docker stop api cf1cf6304893: 1.58 s
|
||||
[collector pause] docker compose stop worker: 0.72 s
|
||||
|
||||
[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
|
||||
restored: telemetry services started, replicas and worker running: yes
|
||||
```
|
||||
|
||||
Код выхода — 0.
|
||||
Reference in New Issue
Block a user