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>
162 lines
15 KiB
Markdown
162 lines
15 KiB
Markdown
# `driver.py --port 8080 telemetry-check` (change `otel-telemetry`, задачи 11.1 и 12)
|
||
|
||
- Основа: 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
|
||
`prometheus`, `loki`, `tempo`); пароль, токены и тела в вывод не попадают. Пароль, `username`,
|
||
токен, текст, ключ и имя файла пробы — случайные синтетические, в выводе только их метки
|
||
U, P, T, M, K, F.
|
||
- Сценарии: `observability` — «Стенд с телеметрией», «Хранилища недоступны приложению»,
|
||
«История после рестарта хранилищ», «Provisioning после старта», «Источник правды — git», «Вход
|
||
в 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
|
||
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` запроса). «Span-to-logs query» — запрос `tracesToLogsV2`
|
||
источника Tempo из `infra/otel/grafana/datasources.yaml`, в который подставлены `service.name`
|
||
ресурса и trace-id своей трассы: он возвращает записи только этой трассы — тот же переход, что
|
||
открывает ссылка из span в Grafana.
|