fix: raise tempo and grafana memory limits to measured peaks

Peaks under make test + load + student_test left Tempo and Grafana below
1.5x headroom; re-capture telemetry-check and collector-outage evidence on
68f1e97.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 11:12:40 +03:00
co-authored by Claude Opus 5.5
parent 68f1e9794e
commit 4178b3df3e
8 changed files with 208 additions and 167 deletions
+7 -4
View File
@@ -392,7 +392,7 @@ Design change `otel-telemetry`, решения 1, 7, 14–20; правила к
- **Сервисы:** `otel-collector` (contrib 0.164.0), `prometheus` (v3.15.1), `loki` (3.7.9),
`tempo` (3.1.1), `grafana` (13.3.1) — тег и digest индекса, `restart: unless-stopped`,
`GOMEMLIMIT` ~80 % лимита (Go лимит cgroup не видит). Каждый конфиг `infra/otel/` — отдельный
`GOMEMLIMIT` ~80 % лимита, у Tempo — лимит / 1,6 (Go лимит cgroup не видит; «Суммы» ниже). Каждый конфиг `infra/otel/` — отдельный
bind mount файла длинной записью; volumes `prometheus_data:/prometheus`, `loki_data:/loki`,
`tempo_data:/var/tempo` (образы стартуют на пустых без chown), у Grafana — tmpfs
`/var/lib/grafana` (пароль из `.env` действует на каждом старте, правки UI не переживают
@@ -411,9 +411,12 @@ Design change `otel-telemetry`, решения 1, 7, 14–20; правила к
раньше сервера, тот падал на `eacces`. Стенд с нуля проверяет `driver.py stand-from-scratch`
(свой проект, удаляет свои volumes сам).
- **`restart.sh`** сервисы телеметрии не трогает (решение 6).
- **Суммы:** постоянные лимиты 11,5 CPU / 7040 МиБ, с одноразовыми 12,5 CPU / 7424 МиБ при ВМ
12 CPU / 7934 МиБ; телеметрия — 2,5 CPU / 2048 МиБ; пики и правило «лимит ≥ 1,5 × пика» —
`evidence/telemetry/budget.md`. Соединений PostgreSQL телеметрия не добавляет.
- **Суммы:** постоянные лимиты 11,5 CPU / 7296 МиБ, с одноразовыми 12,5 CPU / 7680 МиБ при ВМ
12 CPU / 7934 МиБ; телеметрия — 2,5 CPU / 2304 МиБ (Collector 256, Prometheus 384, Loki 512,
Tempo 640, Grafana 512); пики и правило «лимит ≥ 1,5 × пика» — `evidence/telemetry/budget.md`.
У Tempo пик упирается в `GOMEMLIMIT` (398 из 400 МиБ): его лимит — не меньше 1,5 ×
`GOMEMLIMIT`, а не «`GOMEMLIMIT` — 80 % лимита» (design change `otel-telemetry`, «Уточнения
apply», п. 19). До ВМ остаётся 254 МиБ: новый сервис или поднятый лимит — с пересчётом. Соединений PostgreSQL телеметрия не добавляет.
- **CI** — `configs` для семи файлов, у Prometheus, Loki и Tempo `volumes: !override` с одним
именованным volume, у Collector и Grafana `volumes: !reset []`, порт Grafana `!reset []`.
+3 -1
View File
@@ -85,7 +85,9 @@ paths:
- **Healthcheck** (решение 18) — только у Prometheus и Grafana (`wget` в образе); у Collector,
Loki и Tempo оболочки нет, живость — цели `up` в Prometheus и проверка источников.
- **Go и память**: `GOMEMLIMIT` ~80 % лимита контейнера, лимит не меньше 1,5 × измеренного пика
(`evidence/telemetry/budget.md`).
(`evidence/telemetry/budget.md`). Если пик упирается в `GOMEMLIMIT` (Tempo: 398 из 400 МиБ под
`make student_test`), 80 % с правилом 1,5 × несовместимы: лимит — не меньше 1,5 × `GOMEMLIMIT`
(Tempo 640 МиБ при 400). Пик меряется под `make test` + `make load` + `make student_test`.
## Проверки
+3
View File
@@ -164,6 +164,9 @@ Change `openspec/changes/otel-telemetry/`, propose 2026-11-11. Номера —
который доходит до приложения (`PROPFIND`)? Иначе — `http="h11"` у uvicorn или правило HAProxy (отдельный change).
7. Пользователю (apply): перед замерами для отчёта переснять `telemetry-check`, `telemetry-outage`,
`stand-from-scratch` и бюджет на закоммиченном коде — evidence сняты на незакоммиченном дереве поверх `9b35c25`.
Сделано частично: `telemetry-check` и `telemetry-outage` пересняты на `68f1e97`; замер бюджета на нём поднял лимиты
Tempo и Grafana (design, «Уточнения apply», п. 19), поэтому `budget.md` и `stand-from-scratch` — на коммите этой
правки.
8. Пользователю (verify W4): `driver.py stand-from-scratch` сам удаляет volumes своего проекта (`docker compose -p
mtusi-lab6-scratch… down -v` в начале, после каждого прогона и при Ctrl+C), а deny-правила `.claude/settings.local.json`
запрещают агенту `down -v`. Подтвердите, что так можно для одноразового проекта `mtusi-lab6-scratch*` (как у `make
+13 -9
View File
@@ -16,8 +16,9 @@ TODO: схема процессов/хранилищ, источник исти
## Наблюдаемость
Change `otel-telemetry` (design — `openspec/changes/otel-telemetry/design.md`, номера решений
в скобках). Числа и проверки сняты на рабочем дереве поверх `9b35c25` до коммита change
(шапки файлов `evidence/telemetry/`, `evidence/stand/`).
в скобках). Числа и проверки сняты на закоммиченном коде при чистом рабочем дереве: `68f1e97`
(правки verify), бюджет и лимиты Tempo и Grafana — после них (шапки файлов `evidence/telemetry/`,
`evidence/stand/`).
### Назначение компонентов
@@ -98,13 +99,16 @@ API и worker имена `prometheus`, `loki`, `tempo`, `grafana` не разр
### Бюджет
Лимиты телеметрии: Collector 0,5 CPU / 256 МиБ, Prometheus 0,5 / 384, Loki 0,5 / 512, Tempo
0,5 / 512, Grafana 0,5 / 384 — 2,5 CPU / 2048 МиБ. Постоянные лимиты стенда — 11,5 CPU /
7040 МиБ, с одноразовыми — 12,5 CPU / 7424 МиБ при ВМ 12 CPU / 7934 МиБ: лимиты — потолки, а не
резерв. Замер (`evidence/telemetry/budget.md`): пики `memory.peak` — Collector 72, Prometheus 76,
Loki 117, Tempo 235, Grafana 249 МиБ, каждый лимит не меньше 1,5 × пика; реплика API под `make
test` + `make load` — 230 МиБ с телеметрией и 216 без неё (лимит 512); простой всего стенда —
1715 МиБ, из них телеметрия — 770. Грубая цена SDK (один прогон `make load`): 437 против 499
запросов/с, p95 15,8 против 10,4 мс — исследование трека 1.
0,5 / 640, Grafana 0,5 / 512 — 2,5 CPU / 2304 МиБ. Постоянные лимиты стенда — 11,5 CPU /
7296 МиБ, с одноразовыми — 12,5 CPU / 7680 МиБ при ВМ 12 CPU / 7934 МиБ: лимиты — потолки, а не
резерв. Замер на `68f1e97` под `make test` + `make load` + `make student_test`
(`evidence/telemetry/budget.md`): пики `memory.peak` — Collector 76, Prometheus 95, Loki 153,
Tempo 398, Grafana 294 МиБ. При прежних лимитах Tempo (512) и Grafana (384) правило «лимит не
меньше 1,5 × пика» не выполнялось: лимиты подняты до 640 и 512, `GOMEMLIMIT` Tempo прежний
(400 МиБ — его пик упирается в него, поэтому лимит — 1,6 × `GOMEMLIMIT`). Реплика API — до 452
МиБ с телеметрией и 482 без неё (лимит 512; пик даёт Argon2id входов `make student_test`, а не
SDK; запас ~6 % — ограничение, лимит реплики не менялся), worker — 503 МиБ из 1024. Грубая цена SDK (один прогон `make load`): 490 против 571
запросов/с, p95 12,5 против 8,9 мс — исследование трека 1.
### Ограничения наблюдаемости
+11 -6
View File
@@ -568,8 +568,9 @@ services:
# --- наблюдаемость (design change otel-telemetry, решения 1, 7, 14–18) ---
# Сервисы приложения их не ждут, а они — друг друга: без них приложение
# работает, отправку и запросы они повторяют сами. Порты наружу — только
# у Grafana. Сервисы на Go получают GOMEMLIMIT ~80 % лимита: лимит cgroup
# рантайм не видит
# у Grafana. Сервисы на Go получают GOMEMLIMIT (лимит cgroup рантайм не
# видит): ~80 % лимита, а у тех, чей пик дошёл до GOMEMLIMIT (Tempo), —
# не больше лимита / 1,5
# OTel Collector contrib: OTLP/HTTP от api и worker (сеть default), метрики
# для scrape и экспорт в Loki и Tempo (сеть telemetry). Секретов нет. В
@@ -662,7 +663,10 @@ services:
memory: 512M
# Tempo — трассы: монолит 3.1 с локальным хранилищем, срок 7 суток. Как у
# Loki, healthcheck нет
# Loki, healthcheck нет. Пик под make test + load + student_test дошёл до
# GOMEMLIMIT (398 МиБ, evidence/telemetry/budget.md): лимит контейнера —
# 1,5 × GOMEMLIMIT, а не 80 / 20 (design change otel-telemetry, «Уточнения
# apply», п. 19)
tempo:
image: grafana/tempo:3.1.1@sha256:64e2fbd56d9c2b3412a4b430a58ea59e91a670b1e75f920a0c702213ad145044
restart: unless-stopped
@@ -683,14 +687,15 @@ services:
resources:
limits:
cpus: "0.5"
memory: 512M
memory: 640M
# Grafana — интерфейс без своего состояния (tmpfs): источники и dashboard —
# provisioning из git, пароль администратора из .env действует на каждом
# старте. Наружу — только 127.0.0.1. Без анонимного входа, регистрации,
# установки плагинов из сети, отчётов и проверок обновлений; встроенные
# источники, кроме prometheus, loki и tempo, выключены (каждый — свой
# процесс)
# процесс). Пик 294 МиБ (процесс и три источника с backend): лимит 512 —
# не меньше 1,5 × пика (evidence/telemetry/budget.md)
grafana:
image: grafana/grafana:13.3.1@sha256:0615ec4fbd4072004b7d86b46ded63013a74b7d6eb1119273dd89e8fa25c13cf
restart: unless-stopped
@@ -748,7 +753,7 @@ services:
resources:
limits:
cpus: "0.5"
memory: 384M
memory: 512M
networks:
# хранилища телеметрии и Grafana: контейнеры приложения до них не достают,
+145 -132
View File
@@ -1,9 +1,11 @@
# `driver.py --port 8080 telemetry-check` (change `otel-telemetry`, задача 11.1)
# `driver.py --port 8080 telemetry-check` (change `otel-telemetry`, задачи 11.1 и 12)
- Основа: commit `9b35c25` (propose), **рабочее дерево не закоммичено** (apply change
`otel-telemetry`); образ `mtusi-messenger:lab6` собран `make run_docker` из этого дерева.
Основная сессия решает, переснимать ли после коммита.
- Дата: 2026-11-11, старт 06:10:37Z, ~2 мин; рабочий стенд `mtusi-lab6` (две реплики API,
- Основа: 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`.
- Всё — через HTTP API Grafana на `127.0.0.1:3000` с паролем из `.env` (источники-прокси uid
@@ -12,137 +14,148 @@
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», «От лога к трассе и обратно» (строки «Loki field trace_id…», «Tempo span links…»,
«span-to-logs…»), «Ресурс сигналов», «Чужой traceparent», «Запросы в метрике», «Health не
учитывается» (нет трасс и рядов `http_route=~"/health.*"` за срок хранения), «Необычный метод и
неизвестный путь» (`PROPFIND` и `GET` к пути с UUID; `BREW` — ограничение, 400 парсера,
`KNOWN_ISSUES.md`), «Готовое вложение в метриках», «Неудачное вложение в метриках», «Трасса
запроса», «Трасса задания», «Отказ S3 в трассе», «Health и фоновые циклы без трасс», «Проба
приватности», «Запрос найден», «Задание найдено»; `service-logging` — «Записи запроса ведут к
трассе», «Записи задания ведут к трассе», «Запись в Loki совпадает со stdout»;
`service-configuration` — «Переменные OTEL_* не действуют».
- Свой запрос: `X-Request-Id` `9d7cdc76345d4cc0a390dc60ae029b49`, `X-Instance-Id`
`2567ec8de4a4`, trace-id `0a94090184190503a115707aff8848b9`; проба приватности просмотрела
45 записей Loki, 30 трасс Tempo и 2612 рядов 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
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
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` запроса).
prometheus loki tempo` (параметр `time` запроса). «Span-to-logs query» — запрос `tracesToLogsV2`
источника Tempo из `infra/otel/grafana/datasources.yaml`, в который подставлены `service.name`
ресурса и trace-id своей трассы: он возвращает записи только этой трассы — тот же переход, что
открывает ссылка из span в Grafana.
+15 -14
View File
@@ -1,9 +1,10 @@
# `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`, команда из корня:
- Основа: 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`
@@ -19,20 +20,20 @@
пять сервисов телеметрии остановлены, `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
- Время остановки при недоступном 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` у части контейнеров
экспортёр логов ещё не дождался срока отправки к моменту подсчёта — записей меньше трёх.
окно: фильтр пропускает не больше одной в минуту на логгер. В фазе `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] 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] make test expected 0 PASS got 0 PASS
[collector stop] /health/ready expected 200 got 200
+11 -1
View File
@@ -530,7 +530,7 @@ Apply 2026-11-11 (второй агент: первый прервался по
10. **`stand-from-scratch` (21).** Рабочий стенд на время проверки останавливается `make stop`, после — `docker compose
start`: `make run_docker` проекта scratch пересобирает общий тег `mtusi-messenger:lab6`, и `up` рабочего стенда
пересоздал бы его реплики. Команда сверяет ID контейнеров рабочего стенда до и после.
11. **Бюджет (7).** Лимиты решения 7 не менялись: каждый не меньше 1,5 × измеренного пика (Grafana — 374 из 384 МиБ,
11. **Бюджет (7; заменён п. 19 — замер на другом коде и без `make student_test`).** Лимиты решения 7 не менялись: каждый не меньше 1,5 × измеренного пика (Grafana — 374 из 384 МиБ,
ближе всех); суммы прежние — 11,5 CPU / 7040 МиБ, с одноразовыми 12,5 / 7424 (`evidence/telemetry/budget.md`).
12. **Быстрые тесты (8.1–8.3)** написал прерванный агент вместе с кодом; красный прогон до кода не снимался и не
воспроизводился (git агенту запрещён). Проверяют поведение, а не вызовы: in-memory экспортёры SDK и временная база.
@@ -562,3 +562,13 @@ Apply 2026-11-11 (второй агент: первый прервался по
чужие volumes. Разрешено ли агенту это `down -v` при deny-правилах — вопрос пользователю (`QUESTIONS.md`).
18. **Журнал в Loki (S3).** Отправляются записи между запуском SDK и началом закрытия: записи uvicorn до lifespan, ошибки
настроек, остановка до старта и «Stopped worker» — только stdout (дельта `service-logging`).
19. **Бюджет на `68f1e97` (verify W1, отменяет п. 11).** Замер под `make test` + `make load` + `make student_test`
с телеметрией и без (`evidence/telemetry/budget.md`): `memory.peak` Collector 76, Prometheus 95, Loki 153, Tempo
398, Grafana 294 МиБ. Правило решения 7 не выполнили Tempo (1,5 × 398 = 598 > 512) и Grafana (441 > 384): лимиты
подняты до 640 и 512 МиБ. Пик Tempo упирается в `GOMEMLIMIT` 400 МиБ — его рантайм держит кучу у мягкого предела,
поэтому «`GOMEMLIMIT` — 80 % лимита» с правилом 1,5 × несовместимы: `GOMEMLIMIT` прежний, лимит — 1,6 × него.
`GOMEMLIMIT` Grafana прежний (300 МиБ): её пик — процесс и три источника с backend, не только куча Go. Суммы:
телеметрия 2,5 CPU / 2304 МиБ, постоянные 11,5 / 7296, с одноразовыми 12,5 / 7680 при ВМ 12 / 7934 МиБ.
Реплика API — 452 МиБ с телеметрией и 482 без неё из 512 (пик — Argon2id входов `make student_test`, телеметрия
его не подняла); для реплик правило задачи 10.1 — «в своём лимите», лимит не менялся, запас мал — ограничение в
`REPORT.md`. Worker — 503 из 1024 МиБ (процессы обработки).