This commit is contained in:
Vladislav Kunetskiy
2026-11-05 02:09:39 +03:00
parent edc2a405ee
commit b53ecba3e6
132 changed files with 10121 additions and 119 deletions
+18 -3
View File
@@ -158,11 +158,26 @@ ADMISSION_MAX_PENDING=200
ADMISSION_MAX_STAGED_BYTES=2147483648
ADMISSION_MAX_CONCURRENT_UPLOADS=8
# --- Lab6: observability (to implement) -------------------------------------
# --- Lab6: observability -----------------------------------------------------
# SDK/Collector settings; OTLP traffic must never carry message bodies,
# attachment bytes, credentials or user/chat/message ids as metric labels.
OTEL_SERVICE_NAME=messenger-api
# worker and relay override this with a distinct service.name in compose.yaml.
# Service names are set per service in compose.yaml (API/worker/relay must differ).
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
OTEL_METRIC_EXPORT_INTERVAL=15000
TELEMETRY_ENABLED=1
PROMETHEUS_PORT=9090
LOKI_PORT=3100
TEMPO_PORT=3200
GRAFANA_PORT=3000
OTEL_COLLECTOR_CPU_LIMIT=0.25
OTEL_COLLECTOR_MEM_LIMIT=192M
PROMETHEUS_CPU_LIMIT=0.50
PROMETHEUS_MEM_LIMIT=320M
LOKI_CPU_LIMIT=0.50
LOKI_MEM_LIMIT=320M
TEMPO_CPU_LIMIT=0.25
TEMPO_MEM_LIMIT=768M
GRAFANA_CPU_LIMIT=0.25
GRAFANA_MEM_LIMIT=512M
+38 -2
View File
@@ -53,7 +53,8 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- run: cp .env.example .env
- run: cp .env.example .env && sed -i 's/^TELEMETRY_ENABLED=.*/TELEMETRY_ENABLED=0/' .env
- run: ./scripts/init-secrets.sh
- run: docker compose --env-file .env config --quiet
- run: docker compose --env-file .env up -d --build
- name: Wait for readiness through the load balancer
@@ -78,12 +79,47 @@ jobs:
run: python3 scripts/lab5_track2.py --reps 1
- name: Parallel idempotency through the LB
run: python3 student-tests/idempotency_parallel.py --base-url http://localhost:8080
- name: LB removes a not-ready replica
run: make test-lb-readiness
- name: Upload, stop the serving replica, download through another
run: python3 student-tests/attachment_failover.py --base-url http://localhost:8080
- name: Stop one API replica and keep writing
run: make test-failover ACTION_SCRIPT=scripts/stop-one.sh
- name: Logs on failure
if: failure()
run: docker compose --env-file .env logs --tail 100
run: docker compose --env-file .env logs --tail 100 api worker relay
- if: always()
run: docker compose --env-file .env down -v
observability:
name: Lab6 observability stand
needs: build
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- run: cp .env.example .env
- run: ./scripts/init-secrets.sh
- run: docker compose --env-file .env --profile telemetry config --quiet
- run: docker compose --env-file .env --profile telemetry up -d --build
- name: Validate Prometheus configuration and rules
run: |
docker compose --env-file .env --profile telemetry exec -T prometheus promtool check config /etc/prometheus/prometheus.yml
docker compose --env-file .env --profile telemetry exec -T prometheus sh -c 'promtool check rules /etc/prometheus/rules/*.yml'
- name: Wait for readiness through the LB
run: |
for attempt in $(seq 1 60); do
if curl -fsS -o /dev/null http://localhost:8080/health/ready; then exit 0; fi
sleep 2
done
docker compose --env-file .env ps
exit 1
- name: Public smoke with telemetry enabled
run: make test
- name: Observability and privacy checks
run: make test-observability
- name: Logs on failure
if: failure()
run: docker compose --env-file .env --profile telemetry logs --tail 120 api worker relay otel-collector prometheus loki tempo grafana
- if: always()
run: docker compose --env-file .env --profile telemetry down -v
+9 -9
View File
@@ -88,14 +88,14 @@ Go-модули (проверены в module cache на 2026-11-04):
(только если нужен HTTP client instrumentation; серверный слой — свой);
- `github.com/exaring/otelpgx` — **v0.13.0** (pgx v5).
Backend-образы (manifest list digest проверен `docker manifest inspect`):
Backend-образы (manifest-list digest (Docker Hub tag API)):
| Роль | Образ | Digest |
|---|---|---|
| Collector contrib | `otel/opentelemetry-collector-contrib:0.164.0` | `sha256:40392928d2b988b77e7525dbac33e5e3d9bedb40b9ff8c1f9119d92ca3a8a1c3` |
| Prometheus | `prom/prometheus:v3.15.1` | `sha256:d445d1806b38f85b5c394a1b87f94113fde0473b45245922c2e8b1bd41fa68ae` |
| Loki | `grafana/loki:3.6.4` | `sha256:9b6c06e988c990dc089424180df4a810758786f9341bb3deafbcb8b6698d2e9e` |
| Tempo | `grafana/tempo:2.9.0` | `sha256:b025a4a4db0a58cc94e2abfab59751f92d74ab8cc024d2e6025ba7efb87bbaff` |
| Grafana | `grafana/grafana:13.2.5` | `sha256:ffeeebf613b00fede764821c5e5b1545fb376aba561ae91c488e91f219adb25a` |
| Collector contrib | `otel/opentelemetry-collector-contrib:0.164.0` | `sha256:340c9ca6a36617084c6661bdc4f0fe92b7cda5a805d61673ec8db375fddc522b` |
| Prometheus | `prom/prometheus:v3.15.1` | `sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2` |
| Loki | `grafana/loki:3.6.4` | `sha256:be31579ac047e9f78b81e48f3b69d3af709e7299b431d5aa78bcda43382f9511` |
| Tempo | `grafana/tempo:2.9.0` | `sha256:65a5789759435f1ef696f1953258b9bbdb18eb571d5ce711ff812d2e128288a4` |
| Grafana | `grafana/grafana:13.2.5` | `sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84` |
Проверено: HAProxy `3.2-alpine` собран с `USE_PROMEX=1`; RabbitMQ
`4.3.7-management-alpine` уже содержит включённый `rabbitmq_prometheus`
@@ -161,7 +161,7 @@ Backend-образы (manifest list digest проверен `docker manifest ins
1. Остановить старый lab5-стенд (`mtusi-messenger-lab5-*`) и `lab5-it-*`,
volumes не удалять. Освободить память/CPU.
2. **Ресурсный блокер:** Docker VM сейчас ~2053 МБ / 2 CPU; лимиты существующего
2. **Ресурсный блокер (на момент плана):** тогда было ~2053 МБ / 2 CPU; лимиты существующего
compose уже ~3024 МБ / 4.75 CPU. Для M4/M5 нужно **≥ 6 ГБ RAM и ≥ 4 CPU**
(Docker Desktop settings) либо явное сокращение: M3 на tight-бюджете, M4/M5
не заявлять. Зафиксировать `docker info`, `docker stats` idle/load.
@@ -493,8 +493,8 @@ held-out; ограничения (single-node, 7d окно, 2–4 CPU) опис
## 7. Риски и ограничения
1. **Ресурсы (blocker):** 2 ГБ/2 CPU не хватит для достоверных M4/M5. Нужно
≥6 ГБ/4 CPU либо сокращение scope. Telemetry на 2 CPU само влияет на
1. **Ресурсы:** на момент плана было 2 ГБ/2 CPU; сейчас Colima VM увеличена до
4 CPU / 8 ГиБ, чего достаточно для M4/M5. Telemetry на 2 CPU влияла на
latency/TTD; baseline только с финальной конфигурацией.
2. **OTel logs SDK** — evolving API; изолировать в `internal/telemetry`,
pin v1.47.0/v0.23.0, in-memory exporter tests.
+27 -7
View File
@@ -1,4 +1,6 @@
PYTHON ?= python3
VERSION ?= $(shell git describe --always --dirty 2>/dev/null || echo dev)
export VERSION
BASE_URL ?= http://localhost:8080
CA_FILE ?=
ACTION_SCRIPT ?=
@@ -6,11 +8,12 @@ PIPELINE ?= 2
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
PYTHON_LOCAL = env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 $(PYTHON)
.PHONY: help check validate test test-attachments test-presign load test-persistence test-failover smoke-local load-local test-idempotency test-lb-readiness up down ps logs
.PHONY: help check validate test test-attachments test-presign load test-persistence test-failover smoke-local load-local test-idempotency test-lb-readiness test-observability test-slo up up-base init-secrets down ps logs
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
@echo "up/down/ps/logs: lab3 stand from compose.yaml (LB + API_REPLICAS replicas + stores)"
@echo "up: lab6 stand with telemetry profile; up-base: lab5 regression without telemetry"
@echo "down/ps/logs: same profile; test-observability/test-slo: lab6 checks"
check:
$(PYTHON) scripts/check_contract.py
@@ -37,6 +40,14 @@ test-faults:
test-track2:
$(PYTHON_LOCAL) scripts/lab5_track2.py --base-url "$(BASE_URL)" $(TLS_ARGS)
# Lab6 observability and SLO checks (stand must be running with the telemetry profile).
test-observability:
$(PYTHON_LOCAL) scripts/check_evidence.py
$(PYTHON_LOCAL) scripts/lab6_verify.py --base-url "$(BASE_URL)" $(TLS_ARGS)
test-slo:
$(PYTHON_LOCAL) scripts/lab6_track2.py --base-url "$(BASE_URL)" $(TLS_ARGS)
load:
$(PYTHON_LOCAL) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
@@ -69,17 +80,26 @@ COMPOSE_BIN ?= docker compose
COMPOSE_FILE ?= compose.yaml
ENV_FILE ?= .env
up:
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) up -d --build
TELEMETRY_PROFILE ?= telemetry
up: init-secrets
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) --profile $(TELEMETRY_PROFILE) up -d --build
# Lab5 regression without the telemetry profile.
up-base: init-secrets
TELEMETRY_ENABLED=0 $(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) up -d --build
init-secrets:
./scripts/init-secrets.sh
down:
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) down
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) --profile $(TELEMETRY_PROFILE) down
ps:
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) ps
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) --profile $(TELEMETRY_PROFILE) ps
logs:
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) logs -f --tail 100
$(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) --profile $(TELEMETRY_PROFILE) logs -f --tail 100
# Operator views: the failed registry is PostgreSQL, the DLQ is a backstop.
jobs-failed:
+132 -21
View File
@@ -1,37 +1,148 @@
# Отчёт — лабораторная 6
- Автор, группа: TODO
- Целевая оценка; выбранный трек 5, если нужен: TODO
- Commit/PR: TODO после публикации
- Использованные источники, библиотеки и помощь ИИ: TODO
- Автор, группа: Кунецкий Владислав, БВТ2303
- Целевая оценка; выбранный трек 5: **5, трек 2 (SLO и обнаружение инцидентов); полный live-прогон выполнен**
- Commit/PR: один коммит `lab6` (не запушен)
- Использованные источники, библиотеки и помощь ИИ: Go 1.27, OTel Go SDK v1.47.0 /
otelslog v0.21.0 / otelpgx v0.13.0, OTel Collector contrib 0.164.0,
Prometheus 3.15.1, Loki 3.6.4, Tempo 2.9.0, Grafana 13.2.5. ИИ-ассистент
использовался для реализации и текста; ниже перечислены реально выполненные
команды и артефакты, включая полный live-прогон трека 2.
## Запуск из чистого clone
TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных.
```sh
cp .env.example .env
./scripts/init-secrets.sh # secrets/grafana.env, gitignored
make up # docker compose --profile telemetry up -d --build
# дождаться http://localhost:8080/health/ready
make test # публичный smoke
make test-observability # сигналы, route labels, Grafana, sentinels
make test-slo # promtool-ready rules + короткий alert smoke
python3 scripts/lab6_track2_full.py --out evidence/lab6/track2/full
```
Остановка без потери данных: `docker compose --env-file .env down`.
Намеренный сброс учебных данных: `docker compose --env-file .env --profile telemetry down -v`.
`make up-base` поднимает только lab5-профиль без telemetry; `make unit-test` — Go-тесты.
Grafana: `http://127.0.0.1:3000` (admin-пароль в `secrets/grafana.env`).
Prometheus/Loki/Tempo опубликованы только на loopback для evidence-запросов;
OTLP 4317/4318, RabbitMQ 15692 и self-metrics Collector 8888 — без host-портов.
Версии закреплены manifest-list digest’ами Collector/Loki/Tempo/Grafana/Prometheus:
Docker выбирает arm64 на этой машине и amd64 на CI. Переопределения
`*_IMAGE/PLATFORM` остаются опциональными для нестандартного registry mirror.
## Архитектура и решения
TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab5, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации.
```mermaid
flowchart LR
C[client] --> LB[HAProxy]
LB --> API[API x2]
API --> PG[(PostgreSQL)]
API --> S3[(SeaweedFS)]
API -->|OTLP| COL[Collector]
RELAY[relay] --> PG
RELAY --> MQ[(RabbitMQ)]
MQ --> W[worker]
W --> PG
W --> S3
W -->|OTLP| COL
RELAY -->|OTLP| COL
COL -->|:8889| PROM[Prometheus]
COL -->|OTLP /otlp| LOKI[Loki]
COL -->|OTLP gRPC| TEMPO[Tempo]
PROM -->|scrape| MQ
PROM -->|scrape| LB
GRAF[Grafana] --> PROM
GRAF --> LOKI
GRAF --> TEMPO
```
## Доказательства критериев
- API/worker/relay — OTel SDK; Collector — единственный OTLP-приёмник;
Prometheus/Loki/Tempo — хранилища; Grafana — UI и provisioning.
- Queue depth — `rabbitmq_prometheus`; oldest job age — SQL в relay;
CPU/RAM приложения — cgroup v2 (`messenger_process_*`), без cAdvisor и
Docker socket. Broker process metrics — RabbitMQ plugin.
- `service.name` задаётся кодом (`messenger-api`, `messenger-worker`,
`messenger-relay`) и явно в compose; `service.instance.id` — `INSTANCE_ID`/
hostname; `deployment.environment.name=lab`.
- Логи проходят allowlist/redactor: `user_id`, `chat_id`, `message_id`,
filename, raw `path`, `query`, `object_key`, bodies, tokens и signed URL не
экспортируются. `X-Request-Id` нормализуется.
- HTTP route — OpenAPI-шаблон через `server.FindPath`; `r.Pattern` не
используется, потому что ogen регистрирует `/` на внешнем mux.
- W3C context переносится в payload outbox (`traceparent`/`tracestate`,
разрешены `contracts/jobs.schema.json`), relay создаёт `job.publish`,
worker — `job.process`; retry получает новый attempt-span.
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
| --- | --- | --- | --- |
| Публичный smoke | make test | TODO | TODO |
| Остальные пункты уровня 3 | TODO | TODO | TODO |
| Все пункты уровня 4, если заявлен | TODO | TODO | TODO |
| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
## Сигналы и единицы
TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены.
| Сигнал | Имя | Единица/лейблы |
|---|---|---|
| HTTP requests | `messenger_http_server_requests_total` | method, route, status_class |
| HTTP duration | `http_server_request_duration_seconds` | histogram, seconds, method/route/status |
| Jobs attempts | `messenger_jobs_processed_total` | job.type, outcome |
| Job duration | `messenger_job_duration_seconds` | histogram, seconds |
| Accepted/ready | `messenger_jobs_accepted_total`, `messenger_jobs_ready_within_budget_total` | pipeline.version |
| Time to ready | `messenger_job_time_to_ready_seconds` | histogram, seconds |
| Overdue jobs | `messenger_jobs_overdue` | gauge, count >30s |
| Queue depth | `rabbitmq_queue_messages_ready` | queue |
| Oldest job age | `messenger_queue_oldest_job_age_seconds` | seconds |
| Outbox age | `messenger_outbox_oldest_unpublished_age_seconds` | seconds |
| Worker saturation | `messenger_worker_busy`, `messenger_worker_capacity` | service.name |
| DB pool | `messenger_db_pool_used/idle/max`, empty-acquire counters | service.name |
| App CPU/RAM | `messenger_process_cpu_seconds_total`, `memory_usage/limit_bytes` | service.name |
| Collector | `otelcol_*` | pipeline/exporter |
| Edge SLI | `haproxy_frontend_http_responses_total{proxy="http_front"}` | code |
## Эксперименты и отказы
SLO-окно — 7 дней (совпадает с retention Prometheus): API availability 99.5%
(бюджет 50.4 мин), время до ready 99% ≤30 с (бюджет 100.8 мин).
Burn-rate: fast 14.4× на 1h+5m, slow 6× на 6h+30m.
TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения.
Полный live-прогон трека 2 выполнен `scripts/lab6_track2_full.py`:
70m warmup → 20m baseline → 2m burst → 15m sustained → 60m resolution →
15m TTR → 20m false-positive. Старт `19:28:25Z`, финиш `23:05:40Z`.
Warmup: 840 операций, 0 failed; burst не пейджил; sustained обнаружен
`SlowBurn` через **3m35s**, `FastBurn` через **5m15s**; worker-down
`JobsOverdue` — pending через 46s, firing через 2m46s, resolved через 17s
после restore. Детали и residual-окна: `track2/full/ttd-ttr.md`.
| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных |
| --- | --- | --- | --- |
| TODO | TODO | TODO | TODO |
## Доказательства
## Ограничения и следующие шаги
| Критерий | Команда/сценарий | Наблюдаемый результат | Файл |
|---|---|---|---|
| Публичный smoke | `make test` | PASS lab6 | `evidence/lab6/smoke.txt` |
| Три сигнала, Grafana provisioning | `make test-observability` | PASS, datasources/dashboard, route labels без UUID | `evidence/lab6/telemetry.txt` |
| Метрики всех уровней | PromQL из `queries/promql.txt` | непустые серии | `evidence/lab6/metrics.txt` |
| Trace upload → publish → worker, retry | Tempo trace | API span → `job.publish` → `job.process` → S3/DB; attempt 1/2 | `trace-pipeline.json`, `trace-retry.txt` |
| Лог и trace связаны | Loki query по `trace_id` | worker-запись найдена | `telemetry.txt` |
| Нет тел/токенов/filename | sentinel-запрос | 0 совпадений | `telemetry.txt` |
| Worker stop → backlog → drain | `stop-worker.sh`, controlled load, `start-worker.sh` | queue 3→0, oldest 15s→0; `JobsOverdue` fired/resolved | `worker-stop.txt`, `worker-stopped-load.json`, `track2/overdue-alert.txt` |
| Collector down | stop collector, smoke | API продолжает работать; TelemetryCollectorDown/CollectorDroppedTelemetry | `collector-down.txt` |
| Telemetry storage down | stop Loki+Tempo, load, RSS | API работает; collector queues bounded, затем 0 | `storage-down.txt` |
| DB unavailable | stop PostgreSQL | readiness 503, edge 5xx, recovery smoke PASS | `db-down.txt` |
| JobsOverdue firing→resolved | stop worker, one queued job, restart | metric 1 → alert firing → 0 → no alerts | `track2/overdue-alert.txt` |
| Регрессия lab5 | `make test-attachments`, `test-presign`, `test-idempotency`, `test-queue`, `test-faults`, `test-persistence`, `test-failover`, `test-lb-readiness`, `make integration-test`, `make lint`, `make load`, `make test-track2` | PASS | `evidence/lab6/regression/` |
| Track 2: TTD/TTR, burst, false-positive | `python3 scripts/lab6_track2_full.py` | warmup 840 ops/0 failed; burst без page; sustained TTD 3m35s (slow) / 5m15s (fast); TTR 15m17s; residual TTR page в FP-окне зафиксирован | `evidence/lab6/track2/full/` (summary, phases, alerts, snapshots, ttd-ttr) |
| Track 2: rules/openAPI guard | `make test-slo` | promtool rules validate; short alert smoke PASS | `evidence/lab6/track2/burst-alerts.csv` |
TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза.
## Ограничения
- Текущая Colima VM: **4 CPU / 8 ГиБ** (диск 100 ГиБ). Часть evidence M3/M4
снята до увеличения ресурсов (было 2 CPU / 2 ГиБ); после увеличения сборка
и strict-проверка проходят без остановки telemetry. Полный track 2 выполнен
на этой конфигурации; 70-минутный warmup прошёл без ошибок.
- Collector/Loki/Tempo/Grafana/Prometheus — single-node, без TLS/auth
(lab7); Grafana admin — локальный secret, остальные интерфейсы только loopback.
- SDK queue drops не имеют полного публичного счётчика в Go SDK; наблюдаются
Collector `otelcol_*` и app export failures, граница описана в runbook.
- Полный 6h slow-burn live-прогон не заявляется; 30-дневная политика не
является измеренным фактом. Slow-burn alert проверен на 30m/6h окнах в
полном прогоне, но не на 30-дневном retention.
- False-positive окно после TTR не было «чистым»: остаточный 1h TTR-бюджет
дал короткие `TTRErrorBudgetFastBurn` firing до `23:02:52Z`; это
зафиксировано как residual, а не как новый инцидент.
- Сессия загрузчика живёт 3600 s; harness обновляет её за 10 минут до TTL.
Ранний прогон без refresh упал на 401 после 60 минут — сохранён как
`track2/aborted-warmup-401/`.
+30 -2
View File
@@ -25,9 +25,12 @@ import (
"mtusi-messenger/internal/service/user"
"mtusi-messenger/internal/storage/postgres"
storageredis "mtusi-messenger/internal/storage/redis"
"mtusi-messenger/internal/telemetry"
"mtusi-messenger/internal/transport/rest"
)
var version = "dev"
func main() {
log := logger.New()
@@ -41,26 +44,49 @@ func main() {
logger.WithLevel(cfg.SlogLevel()),
logger.WithFormat(cfg.LoggerFormat()),
)
shutdown, telemetryErr := telemetry.Setup(context.Background(), "messenger-api", version)
if telemetryErr != nil {
log.Warn("telemetry setup failed; continuing without OTLP", slog.Any("error", telemetryErr))
shutdown = func(context.Context) error { return nil }
}
log = telemetry.WrapLogger(log, "messenger-api", cfg.SlogLevel())
slog.SetDefault(log)
if err := run(cfg, log); err != nil {
log.Error("shutdown with error", slog.Any("error", err))
shutdownCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
_ = shutdown(shutdownCtx)
cancel()
os.Exit(1)
}
shutdownCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
if err := shutdown(shutdownCtx); err != nil {
log.Warn("telemetry shutdown failed", slog.Any("error", err))
}
}
func run(cfg config.Config, log *slog.Logger) error {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
store, err := postgres.New(ctx, cfg.Postgres, time.Duration(cfg.Idempotency.TTLSeconds)*time.Second)
store, err := postgres.New(ctx, cfg.Postgres, time.Duration(cfg.Idempotency.TTLSeconds)*time.Second, postgres.WithQueryTracer(telemetry.NewPGXTracer()))
if err != nil {
return fmt.Errorf("connect database: %w", err)
}
defer store.Close()
objectStore, err := objectstore.New(objectstore.Config{
if err := telemetry.RegisterDBPool(store.PoolStats); err != nil {
log.Warn("register db pool metrics", slog.Any("error", err))
}
if err := telemetry.RegisterProcessMetrics(); err != nil {
log.Warn("register process metrics", slog.Any("error", err))
}
objectStoreConcrete, err := objectstore.New(objectstore.Config{
Endpoint: cfg.S3.Endpoint,
PublicEndpoint: cfg.S3.PublicEndpoint,
Region: cfg.S3.Region,
@@ -74,6 +100,8 @@ func run(cfg config.Config, log *slog.Logger) error {
return fmt.Errorf("connect object store: %w", err)
}
objectStore := telemetry.WrapStore(objectStoreConcrete)
pipelineRepository := store.Pipeline()
attachmentService := attachment.NewService(
pipelineRepository,
+33 -1
View File
@@ -19,10 +19,13 @@ import (
"mtusi-messenger/internal/logger"
"mtusi-messenger/internal/outbox"
"mtusi-messenger/internal/storage/postgres"
"mtusi-messenger/internal/telemetry"
)
const maxUnpublishedAge = 10 * time.Minute
var version = "dev"
func main() {
log := logger.New()
@@ -36,12 +39,28 @@ func main() {
logger.WithLevel(cfg.SlogLevel()),
logger.WithFormat(cfg.LoggerFormat()),
)
shutdown, telemetryErr := telemetry.Setup(context.Background(), "messenger-relay", version)
if telemetryErr != nil {
log.Warn("telemetry setup failed; continuing without OTLP", slog.Any("error", telemetryErr))
shutdown = func(context.Context) error { return nil }
}
log = telemetry.WrapLogger(log, "messenger-relay", cfg.SlogLevel())
slog.SetDefault(log)
if err := run(cfg, log); err != nil {
log.Error("shutdown with error", slog.Any("error", err))
shutdownCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
_ = shutdown(shutdownCtx)
cancel()
os.Exit(1)
}
shutdownCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
if err := shutdown(shutdownCtx); err != nil {
log.Warn("telemetry shutdown failed", slog.Any("error", err))
}
}
type publisher struct {
@@ -143,12 +162,19 @@ func run(cfg config.Config, log *slog.Logger) error {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
store, err := postgres.New(ctx, cfg.Postgres, time.Duration(cfg.Idempotency.TTLSeconds)*time.Second)
store, err := postgres.New(ctx, cfg.Postgres, time.Duration(cfg.Idempotency.TTLSeconds)*time.Second, postgres.WithQueryTracer(telemetry.NewPGXTracer()))
if err != nil {
return fmt.Errorf("connect database: %w", err)
}
defer store.Close()
if err := telemetry.RegisterDBPool(store.PoolStats); err != nil {
log.Warn("register db pool metrics", slog.Any("error", err))
}
if err := telemetry.RegisterProcessMetrics(); err != nil {
log.Warn("register process metrics", slog.Any("error", err))
}
pub := &publisher{cfg: brokerConfig(cfg), log: log}
defer pub.Close()
@@ -166,6 +192,12 @@ func run(cfg config.Config, log *slog.Logger) error {
Retention: cfg.Outbox.Retention,
}, log)
if err := telemetry.RegisterRelayMetrics(store.Pipeline().OldestActiveJobAge, relay.Health, func(ctx context.Context) (int64, error) {
return store.Pipeline().CountOverdueJobs(ctx, 30*time.Second)
}); err != nil {
log.Warn("register relay metrics", slog.Any("error", err))
}
relayCtx, cancelRelay := context.WithCancel(ctx)
defer cancelRelay()
+34 -2
View File
@@ -18,9 +18,12 @@ import (
"mtusi-messenger/internal/logger"
"mtusi-messenger/internal/platform/objectstore"
"mtusi-messenger/internal/storage/postgres"
"mtusi-messenger/internal/telemetry"
"mtusi-messenger/internal/worker"
)
var version = "dev"
func main() {
log := logger.New()
@@ -34,12 +37,28 @@ func main() {
logger.WithLevel(cfg.SlogLevel()),
logger.WithFormat(cfg.LoggerFormat()),
)
shutdown, telemetryErr := telemetry.Setup(context.Background(), "messenger-worker", version)
if telemetryErr != nil {
log.Warn("telemetry setup failed; continuing without OTLP", slog.Any("error", telemetryErr))
shutdown = func(context.Context) error { return nil }
}
log = telemetry.WrapLogger(log, "messenger-worker", cfg.SlogLevel())
slog.SetDefault(log)
if err := run(cfg, log); err != nil {
log.Error("shutdown with error", slog.Any("error", err))
shutdownCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
_ = shutdown(shutdownCtx)
cancel()
os.Exit(1)
}
shutdownCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
if err := shutdown(shutdownCtx); err != nil {
log.Warn("telemetry shutdown failed", slog.Any("error", err))
}
}
func run(cfg config.Config, log *slog.Logger) error {
@@ -50,13 +69,20 @@ func run(cfg config.Config, log *slog.Logger) error {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
store, err := postgres.New(ctx, cfg.Postgres, time.Duration(cfg.Idempotency.TTLSeconds)*time.Second)
store, err := postgres.New(ctx, cfg.Postgres, time.Duration(cfg.Idempotency.TTLSeconds)*time.Second, postgres.WithQueryTracer(telemetry.NewPGXTracer()))
if err != nil {
return fmt.Errorf("connect database: %w", err)
}
defer store.Close()
objectStore, err := objectstore.New(objectstore.Config{
if err := telemetry.RegisterDBPool(store.PoolStats); err != nil {
log.Warn("register db pool metrics", slog.Any("error", err))
}
if err := telemetry.RegisterProcessMetrics(); err != nil {
log.Warn("register process metrics", slog.Any("error", err))
}
objectStoreConcrete, err := objectstore.New(objectstore.Config{
Endpoint: cfg.S3.Endpoint,
PublicEndpoint: cfg.S3.PublicEndpoint,
Region: cfg.S3.Region,
@@ -70,6 +96,8 @@ func run(cfg config.Config, log *slog.Logger) error {
return fmt.Errorf("connect object store: %w", err)
}
objectStore := telemetry.WrapStore(objectStoreConcrete)
workerInstance := worker.New(store.Pipeline(), objectStore, worker.Config{
Concurrency: cfg.Worker.Concurrency,
LeaseTTL: cfg.Processing.LeaseTTL,
@@ -81,6 +109,10 @@ func run(cfg config.Config, log *slog.Logger) error {
MaxImagePixels: cfg.S3.MaxImagePixels,
}, log)
if err := telemetry.RegisterWorkerMetrics(workerInstance.Busy, int64(cfg.Worker.Concurrency)); err != nil {
log.Warn("register worker metrics", slog.Any("error", err))
}
server := healthServer(cfg.Worker.HealthAddr, store, objectStore, workerInstance)
var serverWait sync.WaitGroup
+222
View File
@@ -16,10 +16,21 @@ name: mtusi-messenger-lab6
# and OOMs Docker Desktop's default VM.
x-app: &app
image: mtusi-messenger:lab6
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
services:
postgres:
image: postgres:18-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
environment:
POSTGRES_USER: ${POSTGRES_USER:-messenger}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger}
@@ -44,6 +55,12 @@ services:
redis:
image: redis:7.4-alpine@sha256:858f009f9709ce576febc734aa78b8f6d624b82571f9ddb6bda4377c833b3499
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
command:
- redis-server
- --appendonly
@@ -73,6 +90,12 @@ services:
# host. master/volume/filer ports stay inside the compose network.
seaweedfs:
image: chrislusf/seaweedfs:3.80@sha256:1055999e08eed1789b0ae45d235126e4495e23d3fb9d6396293fd42539b1ae6a
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
command:
- server
- -s3
@@ -106,13 +129,21 @@ services:
# the broker; PostgreSQL's outbox remains the source of truth for intent.
broker:
image: rabbitmq:4.3.7-management-alpine@sha256:1528a88eebf2bc4d0ab7e9d5d9bc542e9bdf5e1b105e65848fcf8de5c2186528
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
hostname: broker
networks: [default, observability]
environment:
RABBITMQ_DEFAULT_USER: ${BROKER_USER:-messenger}
RABBITMQ_DEFAULT_PASS: ${BROKER_PASSWORD:-messenger}
RABBITMQ_DEFAULT_VHOST: ${BROKER_VHOST:-messenger}
volumes:
- rabbitmq-data:/var/lib/rabbitmq
- ./infra/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
ports:
# Management UI only on loopback, for operator evidence. AMQP stays internal.
- "127.0.0.1:${BROKER_MANAGEMENT_PORT:-15672}:15672"
@@ -180,6 +211,8 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
VERSION: ${VERSION:-dev}
# Общий сетевой alias: LB резолвит одно имя в адреса всех реплик, поэтому
# масштабирование и замена контейнеров не зависят от их номеров/ID.
networks:
@@ -192,6 +225,13 @@ services:
# Explicit values win over localhost defaults coming from .env (see .env.example).
environment:
APP_CONFIG: /etc/messenger/dev/config.yaml
OTEL_SERVICE_NAME: messenger-api
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=lab
OTEL_METRIC_EXPORT_INTERVAL: ${OTEL_METRIC_EXPORT_INTERVAL:-15000}
TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-1}
GOMEMLIMIT: ${API_GOMEMLIMIT:-192MiB}
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: ${POSTGRES_DB:-messenger}
@@ -271,6 +311,13 @@ services:
required: false
environment:
APP_CONFIG: /etc/messenger/dev/config.yaml
OTEL_SERVICE_NAME: messenger-worker
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=lab
OTEL_METRIC_EXPORT_INTERVAL: ${OTEL_METRIC_EXPORT_INTERVAL:-15000}
TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-1}
GOMEMLIMIT: ${WORKER_GOMEMLIMIT:-768MiB}
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: ${POSTGRES_DB:-messenger}
@@ -341,6 +388,13 @@ services:
required: false
environment:
APP_CONFIG: /etc/messenger/dev/config.yaml
OTEL_SERVICE_NAME: messenger-relay
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=lab
OTEL_METRIC_EXPORT_INTERVAL: ${OTEL_METRIC_EXPORT_INTERVAL:-15000}
TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-1}
GOMEMLIMIT: ${RELAY_GOMEMLIMIT:-96MiB}
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: ${POSTGRES_DB:-messenger}
@@ -387,6 +441,13 @@ services:
# rotation entirely; infra/lb/haproxy.cfg holds the upstream, checks and retries.
lb:
image: haproxy:3.2-alpine@sha256:254e6370f01cd654e0744edf607c67f33777c1b6a9dc0d4b28bcba7171460122
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks: [default, observability]
volumes:
- ./infra/lb/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
ports:
@@ -403,8 +464,169 @@ services:
memory: 48M
restart: unless-stopped
# --- Lab6 telemetry profile ------------------------------------------------
# Start with: docker compose --profile telemetry up -d --build
otel-collector:
# The manifest-list digest resolves to linux/386 on this Docker Desktop;
# pin the arm64 child digest and keep the platform explicit. On amd64 set
# OTEL_COLLECTOR_IMAGE/PLATFORM to the amd64 child digest.
image: ${OTEL_COLLECTOR_IMAGE:-otel/opentelemetry-collector-contrib:0.164.0@sha256:340c9ca6a36617084c6661bdc4f0fe92b7cda5a805d61673ec8db375fddc522b}
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
environment:
GOMEMLIMIT: 140MiB
profiles: [telemetry]
command: ["--config=/etc/otel/collector.yaml"]
volumes:
- ./infra/otel/collector.yaml:/etc/otel/collector.yaml:ro
networks: [default, observability]
deploy:
resources:
limits:
cpus: "${OTEL_COLLECTOR_CPU_LIMIT:-0.25}"
memory: ${OTEL_COLLECTOR_MEM_LIMIT:-192M}
restart: unless-stopped
prometheus:
image: ${PROMETHEUS_IMAGE:-prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2}
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
environment:
GOMEMLIMIT: 256MiB
profiles: [telemetry]
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=7d
- --storage.tsdb.retention.size=2GB
- --web.enable-lifecycle
volumes:
- ./infra/prometheus:/etc/prometheus:ro
- prometheus-data:/prometheus
ports:
- "127.0.0.1:${PROMETHEUS_PORT:-9090}:9090"
networks: [observability]
deploy:
resources:
limits:
cpus: "${PROMETHEUS_CPU_LIMIT:-0.50}"
memory: ${PROMETHEUS_MEM_LIMIT:-320M}
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:9090/-/healthy >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
restart: unless-stopped
loki:
image: ${LOKI_IMAGE:-grafana/loki:3.6.4@sha256:be31579ac047e9f78b81e48f3b69d3af709e7299b431d5aa78bcda43382f9511}
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
environment:
GOMEMLIMIT: 256MiB
profiles: [telemetry]
command: ["-config.file=/etc/loki/loki.yaml"]
volumes:
- ./infra/loki/loki.yaml:/etc/loki/loki.yaml:ro
- loki-data:/loki
ports:
- "127.0.0.1:${LOKI_PORT:-3100}:3100"
networks: [observability]
deploy:
resources:
limits:
cpus: "${LOKI_CPU_LIMIT:-0.50}"
memory: ${LOKI_MEM_LIMIT:-320M}
# Distroless image: no /bin/sh or wget. Readiness is checked through
# Prometheus `up` and the /ready endpoint from the host.
healthcheck:
disable: true
restart: unless-stopped
tempo:
image: ${TEMPO_IMAGE:-grafana/tempo:2.9.0@sha256:65a5789759435f1ef696f1953258b9bbdb18eb571d5ce711ff812d2e128288a4}
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
environment:
GOMEMLIMIT: 640MiB
profiles: [telemetry]
command: ["-config.file=/etc/tempo/tempo.yaml"]
volumes:
- ./infra/tempo/tempo.yaml:/etc/tempo/tempo.yaml:ro
- tempo-data:/var/tempo
ports:
- "127.0.0.1:${TEMPO_PORT:-3200}:3200"
networks: [observability]
deploy:
resources:
limits:
cpus: "${TEMPO_CPU_LIMIT:-0.25}"
memory: ${TEMPO_MEM_LIMIT:-768M}
# Distroless image: no /bin/sh or wget. Readiness is checked through
# Prometheus `up` and the /ready endpoint from the host.
healthcheck:
disable: true
restart: unless-stopped
grafana:
image: ${GRAFANA_IMAGE:-grafana/grafana:13.2.5@sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84}
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
profiles: [telemetry]
env_file:
- path: ./secrets/grafana.env
required: true
environment:
GOMEMLIMIT: 256MiB
GF_AUTH_ANONYMOUS_ENABLED: "false"
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
ports:
- "127.0.0.1:${GRAFANA_PORT:-3000}:3000"
networks: [observability]
deploy:
resources:
limits:
cpus: "${GRAFANA_CPU_LIMIT:-0.25}"
memory: ${GRAFANA_MEM_LIMIT:-512M}
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3000/api/health >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
restart: unless-stopped
networks:
default:
observability:
volumes:
postgres18-data:
redis7-data:
seaweedfs-data:
rabbitmq-data:
prometheus-data:
loki-data:
tempo-data:
grafana-data:
+25
View File
@@ -0,0 +1,25 @@
# Lab6 evidence
- `smoke.txt` — `make test` with the telemetry profile running.
- `telemetry.txt` — `make test-observability`: Prometheus/Loki/Tempo/Grafana
queries, route-label validation, forbidden-sentinel search.
- `unit-test.txt` — `make unit-test` (`go test -race -shuffle=on`).
- `stand.txt` — `docker compose --profile telemetry ps`.
- `metrics.txt` — actual sample counts from Prometheus for the required signal set.
- `queries/promql.txt` — PromQL used by dashboards and alerts.
- `tempo-search.json`, `trace-pipeline.json` — raw Tempo responses for an
upload trace; `trace-retry.txt` — attempt=2 trace after a transient fault;
traces include API, relay `job.publish`, worker `job.process`, S3 and DB
child spans.
- Track 2 evidence is generated by `scripts/lab6_track2.py`; raw CSV/JSON and
`plan.md` belong in `track2/`. The full run needs the documented 3-hour window;
short runs are explicitly not evidence of the 6h slow-burn window.
- `storage-down.txt`, `db-down.txt` — telemetry-storage and PostgreSQL
outage observations (API continues; bounded Collector queues).
- `track2/overdue-alert.txt` — JobsOverdue firing/resolved.
- `regression/` is for the lab5 regression commands (`test-queue`,
`test-faults`, `test-attachments`, `test-presign`, `test-idempotency`,
`test-lb-readiness`, persistence/failover).
No tokens, signed URLs, message bodies or images are stored here. The
`scripts/check_evidence.py` scanner is part of `make test-observability`.
+10
View File
@@ -0,0 +1,10 @@
Collector down scenario (local, 2026-11-04)
==========================================
$ docker compose --env-file .env stop otel-collector
$ curl up{job=otel-collector}
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","instance":"otel-collector:8889","job":"otel-collector"},"value":[1793801606.395,"0"]}]}}
$ curl /api/v1/alerts
{"status":"success","data":{"alerts":[{"labels":{"alertname":"CollectorDroppedTelemetry","severity":"warning"},"annotations":{"runbook":"infra/runbooks/telemetry-backend-down.md","summary":"Collector is dropping or refusing telemetry"},"state":"firing","activeAt":"2026-11-04T14:07:53.187213033Z","value":"1.380952380952381e-01"},{"labels":{"alertname":"TelemetryCollectorDown","component":"telemetry","instance":"otel-collector:8889","job":"otel-collector","severity":"warning"},"annotations":{"runbook":"infra/runbooks/telemetry-backend-down.md","summary":"OTel Collector is unavailable; application keeps running"},"state":"pending","activeAt":"2026-11-04T14:11:28.187213033Z","value":"0e+00"}]}}
$ make test
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
+16
View File
@@ -0,0 +1,16 @@
PostgreSQL unavailable (local, 2026-11-04)
===========================================
$ docker compose --env-file .env stop postgres
Container mtusi-messenger-lab6-postgres-1 Stopped
$ load during outage: bootstrap could not get a ready API through the LB
(readiness 503; HAProxy removed the DB-dependent replicas)
$ sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[1m]))
{"value":"0.017931433566648815"}
$ curl /health/ready
503
$ docker compose --env-file .env start postgres
$ make test after restore
PASS: lab6 public API scenario
Result: DB outage is visible as edge 5xx/readiness loss; after PostgreSQL
returns, the public smoke passes. No accepted upload is lost (queue/relay
evidence from the worker scenario remains zero-loss).
+13
View File
@@ -0,0 +1,13 @@
PostgreSQL pause (short burst) — local check
=============================================
$ docker compose --env-file .env pause postgres
$ python3 scripts/lab6_load.py --rate 1 --duration 8 --upload-ratio 0 --deadline 5
messages were attempted during a frozen DB; client deadline errors are bad.
$ sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[1m]))
-> 0.017002102915598543
$ slo:api_error_ratio:5m -> 0
$ docker compose --env-file .env unpause postgres
$ make test -> PASS lab6 public API scenario
$ Prometheus alerts -> []
Interpretation: a short sub-5m burst is below the multi-window page threshold;
this is the expected no-page control, not evidence of a sustained incident.
+25
View File
@@ -0,0 +1,25 @@
{
"base_url": "http://localhost:8080",
"rate": 0.5,
"duration_s": 8.36,
"scheduled": 5,
"counters": {
"accepted": 5,
"ready": 5,
"failed": 0,
"messages": 0,
"uploads": 5
},
"failures": 0,
"failure_samples": [],
"latency_ms": {
"p50": null,
"p95": null,
"p99": null
},
"ttr_ms": {
"p50": 349.0,
"p95": 359.9,
"p99": 359.9
}
}
+16
View File
@@ -0,0 +1,16 @@
messenger_http_server_requests_total: 33
http_server_request_duration_seconds_bucket: 396
messenger_jobs_accepted_total: 2
messenger_jobs_processed_total: 1
messenger_jobs_ready_within_budget_total: 1
messenger_job_duration_seconds_bucket: 11
messenger_job_time_to_ready_seconds_bucket: 10
messenger_jobs_overdue: 1
messenger_queue_oldest_job_age_seconds: 1
messenger_outbox_oldest_unpublished_age_seconds: 1
messenger_worker_busy: 1
messenger_db_pool_used: 4
messenger_process_cpu_seconds_total: 4
rabbitmq_queue_messages_ready: 2
otelcol_exporter_queue_size: 2
haproxy_frontend_http_responses_total: 12
+29
View File
@@ -0,0 +1,29 @@
# Actual PromQL used by the provisioned dashboards and alert rules.
sum(rate(messenger_http_server_requests_total[5m]))
slo:api_error_ratio:5m
histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))
histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))
histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))
sum(rate(messenger_jobs_processed_total{outcome="succeeded"}[5m]))
sum(rate(messenger_jobs_processed_total{outcome="failed"}[5m]))
sum(rate(messenger_jobs_processed_total{outcome="retried"}[5m]))
histogram_quantile(0.50, sum by (le) (rate(messenger_job_duration_seconds_bucket[5m])))
histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket[5m])))
histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket[5m])))
histogram_quantile(0.95, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))
slo:ttr_bad_ratio:5m
max(rabbitmq_queue_messages_ready{queue="attachment.process.v1"})
max(messenger_queue_oldest_job_age_seconds)
max(messenger_jobs_overdue)
max(messenger_outbox_oldest_unpublished_age_seconds)
sum(messenger_worker_busy)
sum(messenger_worker_capacity)
sum(messenger_db_pool_used)
sum(messenger_db_pool_idle)
sum(messenger_db_pool_max)
sum(rate(messenger_db_pool_empty_acquire_total[5m]))
max(messenger_process_cpu_seconds_total)
max(messenger_process_memory_usage_bytes)
otelcol_exporter_queue_size
otelcol_exporter_send_failed_spans
sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[5m]))
+24
View File
@@ -0,0 +1,24 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/attachments_negative.py --base-url "http://localhost:8080"
10 MiB + 1 body: 413
empty body: 415
corrupt PNG (IDAT CRC): 415
MIME spoof (PNG declared as JPEG): 415
structurally valid PNG with non-zlib IDAT: 415
valid zlib, empty PNG raster: 415
valid zlib, invalid PNG scanline filter: 415
invalid PNG color type/bit depth pair: 415
duplicate PNG IHDR: 415
trailing bytes after PNG zlib stream: 415
tRNS on RGBA PNG: 415
short tRNS on RGB PNG: 415
PLTE entries exceed palette bit depth: 415
palette tRNS exceeds PLTE entries: 415
dangerous filenames: 400
foreign attachment metadata/content: 404
empty text without attachments: 400
attachment from another chat: 404
11 attachment ids: 400
duplicate attachment ids: 400
attachment-only message: 201
anonymous direct S3 GET: 403
PASS: lab4 attachment negative scenarios
+4
View File
@@ -0,0 +1,4 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 97, "failed_attempts": 0, "first_recovery_seconds": 3.068}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+14
View File
@@ -0,0 +1,14 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/lab5_faults.py --base-url "http://localhost:8080"
permanent failure: failed/injected_failure, content 409, failed attachment not linkable, registry visible
replay: failed -> queued -> ready, one thumbnail
replay ready job: refused
replay older failed version while v2 queued: refused, state intact
v2 published after older replay refusal
replay of failed reprocess: queued projection restored, then ready at pipeline 2
transient exhaustion: attempts=5, retry_exhausted, four retries, DLQ message present
crash after first variant: redelivered, same three variants, attempts=2
crash after commit before ack: ready remains, redelivery is a no-op
crash after claim before side effect: requeued, attempts=2, ready
outbox gap: crash before publish recovered through the relay, outbox published, ready
lease expiry: paused worker, reaper requeued, stale attempt fenced, ready
PASS: lab5 level 4 fault injection
+3
View File
@@ -0,0 +1,3 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/idempotency_parallel.py --base-url "http://localhost:8080"
{"replay": {"workers": 12, "instances": ["8f0e5bdd7998", "e8d2415b9c96"], "message_id": "01a1a763-5b9b-7a27-994f-78248c9271aa"}, "conflict": {"workers": 12, "accepted": 1, "conflicts": 11}, "stable_body": {"message_id": "01a1a763-5bd8-778e-ba62-16240fa3ec36"}, "key_required": {"status": 400}}
PASS: параллельный повтор с одним Idempotency-Key создаёт ровно одно сообщение
+3
View File
@@ -0,0 +1,3 @@
go test -tags=integration -p 1 -count=1 -timeout=15m ./internal/storage/postgres ./internal/storage/redis
ok mtusi-messenger/internal/storage/postgres 8.003s
ok mtusi-messenger/internal/storage/redis 1.133s
+20
View File
@@ -0,0 +1,20 @@
/Users/vladislav/Projects/mtusi2026lab6/bin/golangci-lint run -v
level=info msg="golangci-lint has version 2.13.2 built with go1.27.1 from (unknown, modified: ?, mod sum: \"h1:bCyq3E4vo9qwzifjpzJqYndEt7Ncva80qkk8G2B4TXU=\") on (unknown)"
level=info msg="[config_reader] Config search paths: [./ /Users/vladislav/Projects/mtusi2026lab6 /Users/vladislav/Projects /Users/vladislav /Users /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[config_reader] Module name \"mtusi-messenger\""
level=info msg="[goenv] Read go env for 5.163584ms: map[string]string{\"GOCACHE\":\"/Users/vladislav/Library/Caches/go-build\", \"GOROOT\":\"/opt/homebrew/Cellar/go/1.27.1/libexec\"}"
level=info msg="[lintersdb] Active 50 linters: [asasalint bodyclose canonicalheader containedctx contextcheck copyloopvar depguard durationcheck errcheck errname errorlint exhaustive exptostd fatcontext forbidigo forcetypeassert gocheckcompilerdirectives gocritic gofumpt goimports gomoddirectives gosec govet ineffassign intrange makezero misspell musttag nilerr nilnil noctx nolintlint perfsprint prealloc reassign recvcheck revive rowserrcheck sloglint sqlclosecheck staticcheck testifylint thelper tparallel unconvert unparam unused usestdlibvars usetesting wastedassign]"
level=info msg="[loader] Using build tags: [integration]"
level=info msg="[loader] Go packages loading at mode 8767 (compiled_files|deps|files|imports|types_sizes|exports_file|name) took 363.317916ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 9.772458ms"
level=info msg="[linters_context/goanalysis] analyzers took 10.930463359s with top 10 stages: revive: 2.628586625s, goimports: 1.744804s, gosec: 899.898833ms, unparam: 692.242917ms, wastedassign: 325.500166ms, gocritic: 151.973916ms, buildir: 143.08475ms, gofumpt: 134.217041ms, forbidigo: 133.863209ms, buildssa: 114.559414ms"
level=info msg="[runner/exclusion_rules] Skipped 14 issues by rules: [Path: \"_test\\\\.go\", Linters: \"gosec, prealloc, forcetypeassert, unparam\"]"
level=info msg="[runner] Issues before processing: 893, after processing: 0"
level=info msg="[runner] Processors filtering stat (in/out): path_absoluter: 893/893, cgo: 893/893, exclusion_paths: 893/893, generated_file_filter: 893/304, filename_unadjuster: 893/893, invalid_issue: 893/893, path_relativity: 893/893, nolint_filter: 6/0, exclusion_rules: 304/6"
level=info msg="[runner] processing took 3.351875ms with stages: generated_file_filter: 2.096458ms, nolint_filter: 636.084µs, path_relativity: 291.167µs, exclusion_rules: 290.125µs, invalid_issue: 13.834µs, cgo: 11.916µs, path_absoluter: 6.458µs, filename_unadjuster: 2.75µs, sort_results: 791ns, max_same_issues: 584ns, fixer: 334ns, exclusion_paths: 292ns, max_from_linter: 167ns, diff: 166ns, uniq_by_line: 166ns, path_prettifier: 166ns, max_per_file_from_linter: 125ns, source_code: 125ns, path_shortener: 84ns, severity-rules: 83ns"
level=info msg="[runner] linters took 1.75139825s with stages: goanalysis_metalinter: 1.74801175s"
0 issues.
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 23 samples, avg is 358.6MB, max is 642.8MB"
level=info msg="Execution took 2.130137542s"
+15
View File
@@ -0,0 +1,15 @@
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 30,
"elapsed_seconds": 30.009,
"concurrency": 4,
"successful_requests": 30857,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 1028.26,
"successful_latency_ms": {
"p50": 2.846,
"p95": 9.485,
"p99": 17.614
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+3
View File
@@ -0,0 +1,3 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+10
View File
@@ -0,0 +1,10 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/presign_flow.py --base-url "http://localhost:8080"
happy path: direct PUT 200, complete queued, ready after worker
message with attachment downloaded as the second chat member
repeated complete is idempotent
foreign complete: 404
complete before PUT: 409
wrong completion checksum: 409
oversized direct PUT: 403 from S3; complete: 409 (nothing stored)
same-size overwrite: last PUT wins, checksum verified
PASS: lab4 presigned upload flow
+11
View File
@@ -0,0 +1,11 @@
$ make test-queue
worker down: 202 queued, content 409, queued attachment linked, API restarted
worker restarted: ready, thumbnail and original downloadable, staging cleared
broker down: upload accepted into outbox
broker + relay recovered: queued job reached ready
stack restart: ready attachment and original preserved
worker down: reprocess pipeline 2 accepted, v1 audit event recorded, upload still queued
worker up: reprocessed upload reached ready at pipeline 2, v1 superseded
worker down: reprocess pipeline 3 refused, v1 job untouched
worker up: preserved upload reached ready at pipeline 1
PASS: lab5 async worker/broker durability
+8
View File
@@ -0,0 +1,8 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 scripts/lab5_track2.py --base-url "http://localhost:8080"
Dduplicate_before_effect rep=1: PASS
Dstale_version_after_v2 rep=1: PASS
Dduplicate_before_effect rep=2: PASS
Dstale_version_after_v2 rep=2: PASS
Dduplicate_before_effect rep=3: PASS
Dstale_version_after_v2 rep=3: PASS
PASS: track2 6/6 scenarios
+2
View File
@@ -0,0 +1,2 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
+15
View File
@@ -0,0 +1,15 @@
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi-messenger-lab6-api-1 mtusi-messenger:lab6 "/usr/local/bin/mess…" api 59 seconds ago Up 57 seconds (healthy) 8080/tcp
mtusi-messenger-lab6-api-2 mtusi-messenger:lab6 "/usr/local/bin/mess…" api 59 seconds ago Up 57 seconds (healthy) 8080/tcp
mtusi-messenger-lab6-broker-1 rabbitmq:4.3.7-management-alpine@sha256:1528a88eebf2bc4d0ab7e9d5d9bc542e9bdf5e1b105e65848fcf8de5c2186528 "docker-entrypoint.s…" broker 3 hours ago Up 26 minutes (healthy) 4369/tcp, 5671-5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 127.0.0.1:15672->15672/tcp
mtusi-messenger-lab6-grafana-1 grafana/grafana:13.2.5@sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84 "/run.sh" grafana 3 hours ago Up 31 minutes (healthy) 127.0.0.1:3000->3000/tcp
mtusi-messenger-lab6-lb-1 haproxy:3.2-alpine@sha256:254e6370f01cd654e0744edf607c67f33777c1b6a9dc0d4b28bcba7171460122 "docker-entrypoint.s…" lb 3 hours ago Up 26 minutes 127.0.0.1:8404->8404/tcp, 127.0.0.1:8080->80/tcp
mtusi-messenger-lab6-loki-1 grafana/loki:3.6.4@sha256:be31579ac047e9f78b81e48f3b69d3af709e7299b431d5aa78bcda43382f9511 "/usr/bin/loki -conf…" loki 3 hours ago Up 7 minutes 127.0.0.1:3100->3100/tcp
mtusi-messenger-lab6-otel-collector-1 otel/opentelemetry-collector-contrib:0.164.0@sha256:340c9ca6a36617084c6661bdc4f0fe92b7cda5a805d61673ec8db375fddc522b "/otelcol-contrib --…" otel-collector 31 minutes ago Up 56 seconds 4317-4318/tcp, 55679/tcp
mtusi-messenger-lab6-postgres-1 postgres:18-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873 "docker-entrypoint.s…" postgres 3 hours ago Up 5 minutes (healthy) 5432/tcp
mtusi-messenger-lab6-prometheus-1 prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2 "/bin/prometheus --c…" prometheus 59 seconds ago Up 59 seconds (healthy) 127.0.0.1:9090->9090/tcp
mtusi-messenger-lab6-redis-1 redis:7.4-alpine@sha256:858f009f9709ce576febc734aa78b8f6d624b82571f9ddb6bda4377c833b3499 "docker-entrypoint.s…" redis 3 hours ago Up 26 minutes (healthy) 6379/tcp
mtusi-messenger-lab6-relay-1 mtusi-messenger:lab6 "/usr/local/bin/relay" relay 59 seconds ago Up 57 seconds (healthy) 8080/tcp, 127.0.0.1:8082->8082/tcp
mtusi-messenger-lab6-seaweedfs-1 chrislusf/seaweedfs:3.80@sha256:1055999e08eed1789b0ae45d235126e4495e23d3fb9d6396293fd42539b1ae6a "/entrypoint.sh serv…" seaweedfs 3 hours ago Up 26 minutes (healthy) 7333/tcp, 8080/tcp, 8888/tcp, 9333/tcp, 18080/tcp, 18888/tcp, 19333/tcp, 127.0.0.1:8333->8333/tcp
mtusi-messenger-lab6-tempo-1 grafana/tempo:2.9.0@sha256:65a5789759435f1ef696f1953258b9bbdb18eb571d5ce711ff812d2e128288a4 "/tempo -config.file…" tempo 28 minutes ago Up 7 minutes 127.0.0.1:3200->3200/tcp
mtusi-messenger-lab6-worker-1 mtusi-messenger:lab6 "/usr/local/bin/work…" worker 59 seconds ago Up 57 seconds (healthy) 8080/tcp, 127.0.0.1:8081->8081/tcp
+20
View File
@@ -0,0 +1,20 @@
Telemetry storage down (local, 2026-11-04)
==========================================
$ docker compose --env-file .env stop loki tempo
Container mtusi-messenger-lab6-loki-1 Stopping
Container mtusi-messenger-lab6-tempo-1 Stopped
Container mtusi-messenger-lab6-loki-1 Stopped
$ make test
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
$ collector queue after 20s
[{'metric': {'__name__': 'otelcol_exporter_queue_size', 'data_type': 'logs', 'exporter': 'otlp_http/loki', 'instance': 'otel-collector:8888', 'job': 'otel-collector-self'}, 'value': [1793810852.186, '21950']}, {'metric': {'__name__': 'otelcol_exporter_queue_size', 'data_type': 'traces', 'exporter': 'otlp_grpc/tempo', 'instance': 'otel-collector:8888', 'job': 'otel-collector-self'}, 'value': [1793810852.186, '47471']}]
$ RSS app/collector
mtusi-messenger-lab6-api-2 190.6MiB / 256MiB
mtusi-messenger-lab6-api-1 191.2MiB / 256MiB
mtusi-messenger-lab6-relay-1 15.76MiB / 128MiB
mtusi-messenger-lab6-worker-1 13.85MiB / 1GiB
mtusi-messenger-lab6-otel-collector-1 86.08MiB / 192MiB
$ docker compose start loki tempo
Container mtusi-messenger-lab6-loki-1 Started
Container mtusi-messenger-lab6-tempo-1 Started
+5
View File
@@ -0,0 +1,5 @@
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 scripts/check_evidence.py
PASS: evidence has no obvious secrets, signed URLs or bearer tokens
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 scripts/lab6_verify.py --base-url "http://localhost:8080"
NOTE: created request_id=lab6-verify-4bb0892c6612450eaaa6eef0fc44e854
PASS: lab6 strict telemetry gate (signals, trace/log correlation, labels, Grafana, rules, privacy sentinels)
+148
View File
@@ -0,0 +1,148 @@
{
"traces": [
{
"traceID": "ab5d63adca313645838a34fc3ad7f8ca",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802395453580634",
"durationMs": 331
},
{
"traceID": "5cf3ce94777116f51994548bcf747052",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802394113546330",
"durationMs": 684
},
{
"traceID": "280c2940aca363c6df3cdb2f96d49986",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.requeue",
"startTimeUnixNano": "1793802302815608431",
"durationMs": 10295
},
{
"traceID": "2baabe5633a1fdffc903471dbf0ad125",
"rootServiceName": "<root span not yet received>",
"startTimeUnixNano": "1793802286828434101",
"durationMs": 26284
},
{
"traceID": "82ccdbe9637df43f06ffe9395c93b2c0",
"rootServiceName": "<root span not yet received>",
"startTimeUnixNano": "1793802283997651340",
"durationMs": 66
},
{
"traceID": "8f101cc3cd1062641cd9eaa83c59c643",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.requeue",
"startTimeUnixNano": "1793802249508919589",
"durationMs": 1057
},
{
"traceID": "61b680a368c7eec86c2102ea3615e732",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802231049714535",
"durationMs": 6522
},
{
"traceID": "1767197f0752b7ebbfff4207d9ce968",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802229382459658",
"durationMs": 5632
},
{
"traceID": "3a1357d5589a82f6a6c0c39e705f3ecb",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.requeue",
"startTimeUnixNano": "1793802226689471392",
"durationMs": 1053
},
{
"traceID": "74f025e1b6e88b5d9cfdc4f99069efdf",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802208176199125",
"durationMs": 6582
},
{
"traceID": "b9167e578de7e82af6e6105d5ec0a2e9",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802200775289740",
"durationMs": 4342
},
{
"traceID": "14e39e95e83064c0adfcba0877b44c49",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.publish",
"startTimeUnixNano": "1793802200114468641",
"durationMs": 36
},
{
"traceID": "887eb29fbf7ad92e0c27c32e027f32b0",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.publish",
"startTimeUnixNano": "1793802197116311702",
"durationMs": 9
},
{
"traceID": "5672c6454888c536c5f006c8266522a4",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802194349063459",
"durationMs": 2399
},
{
"traceID": "40ef0be37efbba23776a3dc2b83bd7f5",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.publish",
"startTimeUnixNano": "1793802192116769803",
"durationMs": 1754
},
{
"traceID": "c16f04beae65b3b9f62855e8a7ea984e",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802188641651123",
"durationMs": 481
},
{
"traceID": "c7c01244d150f988c198e5b23767d8c2",
"rootServiceName": "messenger-relay",
"rootTraceName": "job.publish",
"startTimeUnixNano": "1793802186116479256",
"durationMs": 46
},
{
"traceID": "2abac52091c4e48c83f257b01c8b9afb",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802180136938542",
"durationMs": 987
},
{
"traceID": "c21959639cf799d78b3dd30fa8fb14cc",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802140038435535",
"durationMs": 108
},
{
"traceID": "b9e0d22c746e6dedefd32b6ea29682e0",
"rootServiceName": "messenger-api",
"rootTraceName": "POST /api/v1/chats/{chat_id}/attachments",
"startTimeUnixNano": "1793802138735163857",
"durationMs": 427
}
],
"metrics": {
"inspectedTraces": 3709,
"inspectedBytes": "595516",
"completedJobs": 1,
"totalJobs": 1
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
trace_id=280c2940aca363c6df3cdb2f96d49986
messenger-relay job.publish attempt=2 parent=BnhRFOI4G5c=
messenger-worker job.process attempt=2 parent=4J4JtxSlLP0=
@@ -0,0 +1,4 @@
{
"aborted_utc": "2026-11-04T19:13:03Z",
"error": "RuntimeError('warmup: load failed rc=1 failures=120')"
}
@@ -0,0 +1,37 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 4195.02,
"scheduled": 840,
"counters": {
"accepted": 145,
"ready": 145,
"failed": 120,
"messages": 672,
"uploads": 145,
"dropped": 0
},
"failures": 120,
"failure_samples": [
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/attachments: expected [202], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a7ba-a276-7cfc-8da8-7629b0bd07f2/messages: expected [201], received 401"
],
"latency_ms": {
"p50": 9.7,
"p95": 13.9,
"p99": 27.2
},
"ttr_ms": {
"p50": 661.2,
"p95": 1278.4,
"p99": 1288.2
}
}
+4
View File
@@ -0,0 +1,4 @@
observed_utc,alert,state,active_at,value,injection_utc
2026-11-04T23:06:11Z,DBPoolSaturated,pending,2026-11-04T23:02:48.187213033Z,"""3.3898419994644047e-03""",
2026-11-04T23:06:56Z,APIErrorBudgetSlowBurn,firing,2026-11-04T23:06:53.187213033Z,"""4.4048551292090836e-02""",
2026-11-04T23:07:46Z,DBPoolSaturated,resolved,,,
1 observed_utc alert state active_at value injection_utc
2 2026-11-04T23:06:11Z DBPoolSaturated pending 2026-11-04T23:02:48.187213033Z "3.3898419994644047e-03"
3 2026-11-04T23:06:56Z APIErrorBudgetSlowBurn firing 2026-11-04T23:06:53.187213033Z "4.4048551292090836e-02"
4 2026-11-04T23:07:46Z DBPoolSaturated resolved
+37
View File
@@ -0,0 +1,37 @@
{
"base_url": "http://localhost:8080",
"rate": 0.5,
"duration_s": 138.01,
"scheduled": 70,
"counters": {
"accepted": 3,
"ready": 3,
"failed": 62,
"messages": 56,
"uploads": 3,
"dropped": 0
},
"failures": 62,
"failure_samples": [
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a8d0-15a4-7499-8666-676db3cf53c8/messages: expected [201], received 503"
],
"latency_ms": {
"p50": 6.2,
"p95": 10.7,
"p99": 10.7
},
"ttr_ms": {
"p50": 327.8,
"p95": 329.0,
"p99": 329.0
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"scenario": "burst",
"injection_utc": "2026-11-04T23:06:16Z",
"restore_utc": "2026-11-04T23:08:16Z",
"duration_seconds": 120
}
+52
View File
@@ -0,0 +1,52 @@
observed_utc,alert,state,active_at,value,injection_utc
2026-11-04T19:28:22Z,QueueMetricsStale,pending,2026-11-04T19:27:48.187213033Z,1e+00,
2026-11-04T19:28:32Z,QueueMetricsStale,resolved,,,
2026-11-04T19:28:52Z,TTRErrorBudgetFastBurn,firing,2026-11-04T19:28:38.187213033Z,3.3333333333333326e-01,
2026-11-04T19:29:22Z,TTRErrorBudgetFastBurn,resolved,,,
2026-11-04T20:28:04Z,DBPoolSaturated,pending,2026-11-04T20:27:58.187213033Z,1.3601139775513188e-02,
2026-11-04T20:33:05Z,DBPoolSaturated,firing,2026-11-04T20:27:58.187213033Z,3.3969814422903804e-03,
2026-11-04T20:33:05Z,DBPoolSaturated,resolved,,,
2026-11-04T20:36:05Z,DBPoolSaturated,resolved,,,
2026-11-04T21:00:36Z,DBPoolSaturated,pending,2026-11-04T21:00:33.187213033Z,2.0338983050847456e-02,2026-11-04T20:58:26Z
2026-11-04T21:05:36Z,DBPoolSaturated,resolved,,,2026-11-04T20:58:26Z
2026-11-04T21:13:56Z,APIErrorBudgetSlowBurn,firing,2026-11-04T21:13:53.187213033Z,3.044280442804428e-02,2026-11-04T21:10:21Z
2026-11-04T21:15:26Z,QueueMetricsStale,pending,2026-11-04T21:15:18.187213033Z,1e+00,2026-11-04T21:10:21Z
2026-11-04T21:15:36Z,APIErrorBudgetFastBurn,firing,2026-11-04T21:15:28.187213033Z,7.369323050556983e-02,2026-11-04T21:10:21Z
2026-11-04T21:17:26Z,QueueMetricsStale,firing,2026-11-04T21:15:18.187213033Z,1e+00,2026-11-04T21:10:21Z
2026-11-04T21:17:26Z,QueueMetricsStale,resolved,,,2026-11-04T21:10:21Z
2026-11-04T21:25:37Z,DBPoolSaturated,pending,2026-11-04T21:25:33.187213033Z,1.0169457052687956e-02,2026-11-04T21:10:21Z
2026-11-04T21:25:37Z,QueueMetricsStale,resolved,,,2026-11-04T21:10:21Z
2026-11-04T21:30:07Z,APIErrorBudgetFastBurn,resolved,,,2026-11-04T21:10:21Z
2026-11-04T21:30:37Z,DBPoolSaturated,firing,2026-11-04T21:25:33.187213033Z,3.389807526728633e-03,2026-11-04T21:10:21Z
2026-11-04T21:30:37Z,DBPoolSaturated,resolved,,,2026-11-04T21:10:21Z
2026-11-04T21:30:47Z,DBPoolSaturated,resolved,,,2026-11-04T21:10:21Z
2026-11-04T21:54:08Z,APIErrorBudgetSlowBurn,resolved,,,2026-11-04T21:10:21Z
2026-11-04T22:01:58Z,DBPoolSaturated,pending,2026-11-04T22:01:48.187213033Z,3.389853490532139e-03,2026-11-04T21:10:21Z
2026-11-04T22:06:49Z,DBPoolSaturated,resolved,,,2026-11-04T21:10:21Z
2026-11-04T22:25:40Z,DBPoolSaturated,pending,2026-11-04T22:25:33.187213033Z,6.779638035125306e-03,2026-11-04T21:10:21Z
2026-11-04T22:30:40Z,DBPoolSaturated,firing,2026-11-04T22:25:33.187213033Z,3.3897845452943018e-03,2026-11-04T22:30:24Z
2026-11-04T22:30:40Z,DBPoolSaturated,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:30:50Z,DBPoolSaturated,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:31:10Z,JobsOverdue,pending,2026-11-04T22:31:03.187213033Z,3e+00,2026-11-04T22:30:24Z
2026-11-04T22:32:10Z,DBPoolSaturated,pending,2026-11-04T22:32:03.187213033Z,3.3898649816777792e-03,2026-11-04T22:30:24Z
2026-11-04T22:32:40Z,QueueOldestJobAgeHigh,pending,2026-11-04T22:32:33.187213033Z,1.32959697e+02,2026-11-04T22:30:24Z
2026-11-04T22:33:10Z,JobsOverdue,firing,2026-11-04T22:31:03.187213033Z,2e+01,2026-11-04T22:30:24Z
2026-11-04T22:33:10Z,JobsOverdue,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:37:00Z,DBPoolSaturated,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:40:40Z,QueueOldestJobAgeCritical,pending,2026-11-04T22:40:33.187213033Z,6.12958759e+02,2026-11-04T22:30:24Z
2026-11-04T22:42:40Z,QueueOldestJobAgeHigh,firing,2026-11-04T22:32:33.187213033Z,7.32958909e+02,2026-11-04T22:30:24Z
2026-11-04T22:42:40Z,QueueOldestJobAgeHigh,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:45:41Z,JobsOverdue,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:45:41Z,QueueOldestJobAgeCritical,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:45:41Z,QueueOldestJobAgeHigh,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:46:21Z,TTRErrorBudgetFastBurn,firing,2026-11-04T22:46:18.187213033Z,1.5503875968992242e-01,2026-11-04T22:30:24Z
2026-11-04T22:47:31Z,TTRErrorBudgetFastBurn,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:47:41Z,TTRErrorBudgetFastBurn,firing,2026-11-04T22:47:33.187213033Z,1.5625e-01,2026-11-04T22:30:24Z
2026-11-04T22:48:31Z,TTRErrorBudgetFastBurn,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:49:11Z,TTRErrorBudgetFastBurn,firing,2026-11-04T22:49:03.187213033Z,1.6535433070866146e-01,2026-11-04T22:30:24Z
2026-11-04T22:49:31Z,TTRErrorBudgetFastBurn,resolved,,,2026-11-04T22:30:24Z
2026-11-04T22:58:11Z,TTRErrorBudgetFastBurn,firing,2026-11-04T22:58:08.187213033Z,1.640625e-01,2026-11-04T22:30:24Z
2026-11-04T22:58:21Z,TTRErrorBudgetFastBurn,resolved,,,2026-11-04T22:30:24Z
2026-11-04T23:02:42Z,TTRErrorBudgetFastBurn,firing,2026-11-04T23:02:38.187213033Z,1.6279069767441856e-01,2026-11-04T22:30:24Z
2026-11-04T23:02:52Z,DBPoolSaturated,pending,2026-11-04T23:02:48.187213033Z,3.389830508474576e-03,2026-11-04T22:30:24Z
2026-11-04T23:02:52Z,TTRErrorBudgetFastBurn,resolved,,,2026-11-04T22:30:24Z
1 observed_utc alert state active_at value injection_utc
2 2026-11-04T19:28:22Z QueueMetricsStale pending 2026-11-04T19:27:48.187213033Z 1e+00
3 2026-11-04T19:28:32Z QueueMetricsStale resolved
4 2026-11-04T19:28:52Z TTRErrorBudgetFastBurn firing 2026-11-04T19:28:38.187213033Z 3.3333333333333326e-01
5 2026-11-04T19:29:22Z TTRErrorBudgetFastBurn resolved
6 2026-11-04T20:28:04Z DBPoolSaturated pending 2026-11-04T20:27:58.187213033Z 1.3601139775513188e-02
7 2026-11-04T20:33:05Z DBPoolSaturated firing 2026-11-04T20:27:58.187213033Z 3.3969814422903804e-03
8 2026-11-04T20:33:05Z DBPoolSaturated resolved
9 2026-11-04T20:36:05Z DBPoolSaturated resolved
10 2026-11-04T21:00:36Z DBPoolSaturated pending 2026-11-04T21:00:33.187213033Z 2.0338983050847456e-02 2026-11-04T20:58:26Z
11 2026-11-04T21:05:36Z DBPoolSaturated resolved 2026-11-04T20:58:26Z
12 2026-11-04T21:13:56Z APIErrorBudgetSlowBurn firing 2026-11-04T21:13:53.187213033Z 3.044280442804428e-02 2026-11-04T21:10:21Z
13 2026-11-04T21:15:26Z QueueMetricsStale pending 2026-11-04T21:15:18.187213033Z 1e+00 2026-11-04T21:10:21Z
14 2026-11-04T21:15:36Z APIErrorBudgetFastBurn firing 2026-11-04T21:15:28.187213033Z 7.369323050556983e-02 2026-11-04T21:10:21Z
15 2026-11-04T21:17:26Z QueueMetricsStale firing 2026-11-04T21:15:18.187213033Z 1e+00 2026-11-04T21:10:21Z
16 2026-11-04T21:17:26Z QueueMetricsStale resolved 2026-11-04T21:10:21Z
17 2026-11-04T21:25:37Z DBPoolSaturated pending 2026-11-04T21:25:33.187213033Z 1.0169457052687956e-02 2026-11-04T21:10:21Z
18 2026-11-04T21:25:37Z QueueMetricsStale resolved 2026-11-04T21:10:21Z
19 2026-11-04T21:30:07Z APIErrorBudgetFastBurn resolved 2026-11-04T21:10:21Z
20 2026-11-04T21:30:37Z DBPoolSaturated firing 2026-11-04T21:25:33.187213033Z 3.389807526728633e-03 2026-11-04T21:10:21Z
21 2026-11-04T21:30:37Z DBPoolSaturated resolved 2026-11-04T21:10:21Z
22 2026-11-04T21:30:47Z DBPoolSaturated resolved 2026-11-04T21:10:21Z
23 2026-11-04T21:54:08Z APIErrorBudgetSlowBurn resolved 2026-11-04T21:10:21Z
24 2026-11-04T22:01:58Z DBPoolSaturated pending 2026-11-04T22:01:48.187213033Z 3.389853490532139e-03 2026-11-04T21:10:21Z
25 2026-11-04T22:06:49Z DBPoolSaturated resolved 2026-11-04T21:10:21Z
26 2026-11-04T22:25:40Z DBPoolSaturated pending 2026-11-04T22:25:33.187213033Z 6.779638035125306e-03 2026-11-04T21:10:21Z
27 2026-11-04T22:30:40Z DBPoolSaturated firing 2026-11-04T22:25:33.187213033Z 3.3897845452943018e-03 2026-11-04T22:30:24Z
28 2026-11-04T22:30:40Z DBPoolSaturated resolved 2026-11-04T22:30:24Z
29 2026-11-04T22:30:50Z DBPoolSaturated resolved 2026-11-04T22:30:24Z
30 2026-11-04T22:31:10Z JobsOverdue pending 2026-11-04T22:31:03.187213033Z 3e+00 2026-11-04T22:30:24Z
31 2026-11-04T22:32:10Z DBPoolSaturated pending 2026-11-04T22:32:03.187213033Z 3.3898649816777792e-03 2026-11-04T22:30:24Z
32 2026-11-04T22:32:40Z QueueOldestJobAgeHigh pending 2026-11-04T22:32:33.187213033Z 1.32959697e+02 2026-11-04T22:30:24Z
33 2026-11-04T22:33:10Z JobsOverdue firing 2026-11-04T22:31:03.187213033Z 2e+01 2026-11-04T22:30:24Z
34 2026-11-04T22:33:10Z JobsOverdue resolved 2026-11-04T22:30:24Z
35 2026-11-04T22:37:00Z DBPoolSaturated resolved 2026-11-04T22:30:24Z
36 2026-11-04T22:40:40Z QueueOldestJobAgeCritical pending 2026-11-04T22:40:33.187213033Z 6.12958759e+02 2026-11-04T22:30:24Z
37 2026-11-04T22:42:40Z QueueOldestJobAgeHigh firing 2026-11-04T22:32:33.187213033Z 7.32958909e+02 2026-11-04T22:30:24Z
38 2026-11-04T22:42:40Z QueueOldestJobAgeHigh resolved 2026-11-04T22:30:24Z
39 2026-11-04T22:45:41Z JobsOverdue resolved 2026-11-04T22:30:24Z
40 2026-11-04T22:45:41Z QueueOldestJobAgeCritical resolved 2026-11-04T22:30:24Z
41 2026-11-04T22:45:41Z QueueOldestJobAgeHigh resolved 2026-11-04T22:30:24Z
42 2026-11-04T22:46:21Z TTRErrorBudgetFastBurn firing 2026-11-04T22:46:18.187213033Z 1.5503875968992242e-01 2026-11-04T22:30:24Z
43 2026-11-04T22:47:31Z TTRErrorBudgetFastBurn resolved 2026-11-04T22:30:24Z
44 2026-11-04T22:47:41Z TTRErrorBudgetFastBurn firing 2026-11-04T22:47:33.187213033Z 1.5625e-01 2026-11-04T22:30:24Z
45 2026-11-04T22:48:31Z TTRErrorBudgetFastBurn resolved 2026-11-04T22:30:24Z
46 2026-11-04T22:49:11Z TTRErrorBudgetFastBurn firing 2026-11-04T22:49:03.187213033Z 1.6535433070866146e-01 2026-11-04T22:30:24Z
47 2026-11-04T22:49:31Z TTRErrorBudgetFastBurn resolved 2026-11-04T22:30:24Z
48 2026-11-04T22:58:11Z TTRErrorBudgetFastBurn firing 2026-11-04T22:58:08.187213033Z 1.640625e-01 2026-11-04T22:30:24Z
49 2026-11-04T22:58:21Z TTRErrorBudgetFastBurn resolved 2026-11-04T22:30:24Z
50 2026-11-04T23:02:42Z TTRErrorBudgetFastBurn firing 2026-11-04T23:02:38.187213033Z 1.6279069767441856e-01 2026-11-04T22:30:24Z
51 2026-11-04T23:02:52Z DBPoolSaturated pending 2026-11-04T23:02:48.187213033Z 3.389830508474576e-03 2026-11-04T22:30:24Z
52 2026-11-04T23:02:52Z TTRErrorBudgetFastBurn resolved 2026-11-04T22:30:24Z
+410
View File
@@ -0,0 +1,410 @@
[
[
"2026-11-04T19:28:22Z",
"QueueMetricsStale",
"pending",
"2026-11-04T19:27:48.187213033Z",
"1e+00",
""
],
[
"2026-11-04T19:28:32Z",
"QueueMetricsStale",
"resolved",
"",
"",
""
],
[
"2026-11-04T19:28:52Z",
"TTRErrorBudgetFastBurn",
"firing",
"2026-11-04T19:28:38.187213033Z",
"3.3333333333333326e-01",
""
],
[
"2026-11-04T19:29:22Z",
"TTRErrorBudgetFastBurn",
"resolved",
"",
"",
""
],
[
"2026-11-04T20:28:04Z",
"DBPoolSaturated",
"pending",
"2026-11-04T20:27:58.187213033Z",
"1.3601139775513188e-02",
""
],
[
"2026-11-04T20:33:05Z",
"DBPoolSaturated",
"firing",
"2026-11-04T20:27:58.187213033Z",
"3.3969814422903804e-03",
""
],
[
"2026-11-04T20:33:05Z",
"DBPoolSaturated",
"resolved",
"",
"",
""
],
[
"2026-11-04T20:36:05Z",
"DBPoolSaturated",
"resolved",
"",
"",
""
],
[
"2026-11-04T21:00:36Z",
"DBPoolSaturated",
"pending",
"2026-11-04T21:00:33.187213033Z",
"2.0338983050847456e-02",
"2026-11-04T20:58:26Z"
],
[
"2026-11-04T21:05:36Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T20:58:26Z"
],
[
"2026-11-04T21:13:56Z",
"APIErrorBudgetSlowBurn",
"firing",
"2026-11-04T21:13:53.187213033Z",
"3.044280442804428e-02",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:15:26Z",
"QueueMetricsStale",
"pending",
"2026-11-04T21:15:18.187213033Z",
"1e+00",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:15:36Z",
"APIErrorBudgetFastBurn",
"firing",
"2026-11-04T21:15:28.187213033Z",
"7.369323050556983e-02",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:17:26Z",
"QueueMetricsStale",
"firing",
"2026-11-04T21:15:18.187213033Z",
"1e+00",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:17:26Z",
"QueueMetricsStale",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:25:37Z",
"DBPoolSaturated",
"pending",
"2026-11-04T21:25:33.187213033Z",
"1.0169457052687956e-02",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:25:37Z",
"QueueMetricsStale",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:30:07Z",
"APIErrorBudgetFastBurn",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:30:37Z",
"DBPoolSaturated",
"firing",
"2026-11-04T21:25:33.187213033Z",
"3.389807526728633e-03",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:30:37Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:30:47Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T21:54:08Z",
"APIErrorBudgetSlowBurn",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T22:01:58Z",
"DBPoolSaturated",
"pending",
"2026-11-04T22:01:48.187213033Z",
"3.389853490532139e-03",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T22:06:49Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T22:25:40Z",
"DBPoolSaturated",
"pending",
"2026-11-04T22:25:33.187213033Z",
"6.779638035125306e-03",
"2026-11-04T21:10:21Z"
],
[
"2026-11-04T22:30:40Z",
"DBPoolSaturated",
"firing",
"2026-11-04T22:25:33.187213033Z",
"3.3897845452943018e-03",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:30:40Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:30:50Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:31:10Z",
"JobsOverdue",
"pending",
"2026-11-04T22:31:03.187213033Z",
"3e+00",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:32:10Z",
"DBPoolSaturated",
"pending",
"2026-11-04T22:32:03.187213033Z",
"3.3898649816777792e-03",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:32:40Z",
"QueueOldestJobAgeHigh",
"pending",
"2026-11-04T22:32:33.187213033Z",
"1.32959697e+02",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:33:10Z",
"JobsOverdue",
"firing",
"2026-11-04T22:31:03.187213033Z",
"2e+01",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:33:10Z",
"JobsOverdue",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:37:00Z",
"DBPoolSaturated",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:40:40Z",
"QueueOldestJobAgeCritical",
"pending",
"2026-11-04T22:40:33.187213033Z",
"6.12958759e+02",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:42:40Z",
"QueueOldestJobAgeHigh",
"firing",
"2026-11-04T22:32:33.187213033Z",
"7.32958909e+02",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:42:40Z",
"QueueOldestJobAgeHigh",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:45:41Z",
"JobsOverdue",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:45:41Z",
"QueueOldestJobAgeCritical",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:45:41Z",
"QueueOldestJobAgeHigh",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:46:21Z",
"TTRErrorBudgetFastBurn",
"firing",
"2026-11-04T22:46:18.187213033Z",
"1.5503875968992242e-01",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:47:31Z",
"TTRErrorBudgetFastBurn",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:47:41Z",
"TTRErrorBudgetFastBurn",
"firing",
"2026-11-04T22:47:33.187213033Z",
"1.5625e-01",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:48:31Z",
"TTRErrorBudgetFastBurn",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:49:11Z",
"TTRErrorBudgetFastBurn",
"firing",
"2026-11-04T22:49:03.187213033Z",
"1.6535433070866146e-01",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:49:31Z",
"TTRErrorBudgetFastBurn",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:58:11Z",
"TTRErrorBudgetFastBurn",
"firing",
"2026-11-04T22:58:08.187213033Z",
"1.640625e-01",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T22:58:21Z",
"TTRErrorBudgetFastBurn",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T23:02:42Z",
"TTRErrorBudgetFastBurn",
"firing",
"2026-11-04T23:02:38.187213033Z",
"1.6279069767441856e-01",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T23:02:52Z",
"DBPoolSaturated",
"pending",
"2026-11-04T23:02:48.187213033Z",
"3.389830508474576e-03",
"2026-11-04T22:30:24Z"
],
[
"2026-11-04T23:02:52Z",
"TTRErrorBudgetFastBurn",
"resolved",
"",
"",
"2026-11-04T22:30:24Z"
]
]
@@ -0,0 +1,26 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 1195.01,
"scheduled": 240,
"counters": {
"accepted": 48,
"ready": 48,
"failed": 0,
"messages": 192,
"uploads": 48,
"dropped": 0
},
"failures": 0,
"failure_samples": [],
"latency_ms": {
"p50": 4.7,
"p95": 7.0,
"p99": 21.0
},
"ttr_ms": {
"p50": 326.5,
"p95": 942.1,
"p99": 1247.4
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0",
"ttr_bad_5m": "0.08333333333333326",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
+37
View File
@@ -0,0 +1,37 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 715.01,
"scheduled": 144,
"counters": {
"accepted": 24,
"ready": 24,
"failed": 25,
"messages": 115,
"uploads": 24,
"dropped": 0
},
"failures": 25,
"failure_samples": [
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a85a-f8ac-7968-951c-0d94a6468bd7/attachments: expected [202], received 503"
],
"latency_ms": {
"p50": 5.0,
"p95": 7.7,
"p99": 27.8
},
"ttr_ms": {
"p50": 632.0,
"p95": 649.5,
"p99": 661.3
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"active": {
"api_error_5m": "0.06521739130434782",
"api_error_1h": "0.005059021922428331",
"api_error_30m": "0.010489510489510488",
"api_error_6h": "0.003196590303676079",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
},
"after": {
"api_error_5m": "0",
"api_error_1h": "0.021496130696474637",
"api_error_30m": "0.04504504504504504",
"api_error_6h": "0.012013455069678039",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
}
@@ -0,0 +1,26 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 1195.02,
"scheduled": 240,
"counters": {
"accepted": 48,
"ready": 48,
"failed": 0,
"messages": 192,
"uploads": 48,
"dropped": 0
},
"failures": 0,
"failure_samples": [],
"latency_ms": {
"p50": 4.8,
"p95": 7.0,
"p99": 8.2
},
"ttr_ms": {
"p50": 638.4,
"p95": 945.7,
"p99": 954.5
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0.04090909090909091",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0.15748031496062986",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
+58
View File
@@ -0,0 +1,58 @@
[
{
"phase": "warmup",
"started_utc": "2026-11-04T19:28:25Z",
"finished_utc": "2026-11-04T20:38:20Z",
"duration_s": 4195.3,
"injection_utc": "",
"restore_utc": ""
},
{
"phase": "baseline",
"started_utc": "2026-11-04T20:38:20Z",
"finished_utc": "2026-11-04T20:58:15Z",
"duration_s": 1195.6,
"injection_utc": "",
"restore_utc": ""
},
{
"phase": "burst",
"started_utc": "2026-11-04T20:58:16Z",
"finished_utc": "2026-11-04T21:10:11Z",
"duration_s": 715.6,
"injection_utc": "2026-11-04T20:58:26Z",
"restore_utc": "2026-11-04T21:00:26Z"
},
{
"phase": "sustained",
"started_utc": "2026-11-04T21:10:11Z",
"finished_utc": "2026-11-04T21:30:17Z",
"duration_s": 1206.0,
"injection_utc": "2026-11-04T21:10:21Z",
"restore_utc": "2026-11-04T21:25:27Z"
},
{
"phase": "resolution_wait",
"started_utc": "2026-11-04T21:30:17Z",
"finished_utc": "2026-11-04T22:30:14Z",
"duration_s": 3596.5,
"injection_utc": "",
"restore_utc": ""
},
{
"phase": "ttr",
"started_utc": "2026-11-04T22:30:14Z",
"finished_utc": "2026-11-04T22:45:44Z",
"duration_s": 930.8,
"injection_utc": "2026-11-04T22:30:24Z",
"restore_utc": "2026-11-04T22:45:24Z"
},
{
"phase": "false-positive",
"started_utc": "2026-11-04T22:45:44Z",
"finished_utc": "2026-11-04T23:05:40Z",
"duration_s": 1195.4,
"injection_utc": "",
"restore_utc": ""
}
]
@@ -0,0 +1,26 @@
{
"base_url": "http://localhost:8080",
"rate": 1.0,
"duration_s": 2.26,
"scheduled": 3,
"counters": {
"accepted": 2,
"ready": 2,
"failed": 0,
"messages": 1,
"uploads": 2,
"dropped": 0
},
"failures": 0,
"failure_samples": [],
"latency_ms": {
"p50": 4.7,
"p95": 4.7,
"p99": 4.7
},
"ttr_ms": {
"p50": 1240.4,
"p95": 1246.1,
"p99": 1246.1
}
}
@@ -0,0 +1,26 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 3595.96,
"scheduled": 720,
"counters": {
"accepted": 145,
"ready": 145,
"failed": 0,
"messages": 575,
"uploads": 145,
"dropped": 0
},
"failures": 0,
"failure_samples": [],
"latency_ms": {
"p50": 4.5,
"p95": 7.6,
"p99": 13.1
},
"ttr_ms": {
"p50": 1243.8,
"p95": 1268.5,
"p99": 1274.7
}
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0",
"ttr_bad_5m": "0.08333333333333326",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0.06521739130434782",
"api_error_1h": "0.005059021922428331",
"api_error_30m": "0.010489510489510488",
"api_error_6h": "0.003196590303676079",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0.021496130696474637",
"api_error_30m": "0.04504504504504504",
"api_error_6h": "0.012013455069678039",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0.04090909090909091",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0.15748031496062986",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0.04090909090909091",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0.15748031496062986",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0.054344972433709636",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0.029850746268656716",
"api_error_1h": "0.024126455906821963",
"api_error_30m": "0.048739495798319335",
"api_error_6h": "0.01360863444392304",
"ttr_bad_5m": "0.08333333333333326",
"ttr_bad_1h": "0.007194244604316502",
"queue_oldest": "0.443175",
"queue_depth": "1",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0.04081632653061224",
"api_error_1h": "0.19291705498602052",
"api_error_30m": "0.3614931237721022",
"api_error_6h": "0.08614232209737828",
"ttr_bad_5m": "0.09341449406517988",
"ttr_bad_1h": "0.009615384615384581",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0.04438250428816467",
"ttr_bad_5m": null,
"ttr_bad_1h": "0.15564521484105343",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
@@ -0,0 +1,12 @@
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
+82
View File
@@ -0,0 +1,82 @@
# Full Track 2 run
Phases:
```json
[
{
"phase": "warmup",
"started_utc": "2026-11-04T19:28:25Z",
"finished_utc": "2026-11-04T20:38:20Z",
"duration_s": 4195.3,
"injection_utc": "",
"restore_utc": ""
},
{
"phase": "baseline",
"started_utc": "2026-11-04T20:38:20Z",
"finished_utc": "2026-11-04T20:58:15Z",
"duration_s": 1195.6,
"injection_utc": "",
"restore_utc": ""
},
{
"phase": "burst",
"started_utc": "2026-11-04T20:58:16Z",
"finished_utc": "2026-11-04T21:10:11Z",
"duration_s": 715.6,
"injection_utc": "2026-11-04T20:58:26Z",
"restore_utc": "2026-11-04T21:00:26Z"
},
{
"phase": "sustained",
"started_utc": "2026-11-04T21:10:11Z",
"finished_utc": "2026-11-04T21:30:17Z",
"duration_s": 1206.0,
"injection_utc": "2026-11-04T21:10:21Z",
"restore_utc": "2026-11-04T21:25:27Z"
},
{
"phase": "resolution_wait",
"started_utc": "2026-11-04T21:30:17Z",
"finished_utc": "2026-11-04T22:30:14Z",
"duration_s": 3596.5,
"injection_utc": "",
"restore_utc": ""
},
{
"phase": "ttr",
"started_utc": "2026-11-04T22:30:14Z",
"finished_utc": "2026-11-04T22:45:44Z",
"duration_s": 930.8,
"injection_utc": "2026-11-04T22:30:24Z",
"restore_utc": "2026-11-04T22:45:24Z"
},
{
"phase": "false-positive",
"started_utc": "2026-11-04T22:45:44Z",
"finished_utc": "2026-11-04T23:05:40Z",
"duration_s": 1195.4,
"injection_utc": "",
"restore_utc": ""
}
]
```
Final snapshot:
```json
{
"api_error_5m": "0",
"api_error_1h": "0",
"api_error_30m": "0",
"api_error_6h": "0.04090909090909091",
"ttr_bad_5m": "0",
"ttr_bad_1h": "0.15748031496062986",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
}
```
Aborted: False
Restored: True
@@ -0,0 +1,37 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 1195.02,
"scheduled": 240,
"counters": {
"accepted": 13,
"ready": 12,
"failed": 182,
"messages": 192,
"uploads": 13,
"dropped": 0
},
"failures": 182,
"failure_samples": [
"ready: Failure: GET /api/v1/attachments/01a1a865-e530-7199-bfbb-f394966c5da1: expected [200], received 401",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 401",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503",
"Failure: POST /api/v1/chats/01a1a865-e526-7aba-ba9d-ec6d99010c13/messages: expected [201], received 503"
],
"latency_ms": {
"p50": 4.8,
"p95": 7.0,
"p99": 22.0
},
"ttr_ms": {
"p50": 630.2,
"p95": 644.2,
"p99": 644.2
}
}
+27
View File
@@ -0,0 +1,27 @@
{
"active": {
"api_error_5m": "0.029850746268656716",
"api_error_1h": "0.024126455906821963",
"api_error_30m": "0.048739495798319335",
"api_error_6h": "0.01360863444392304",
"ttr_bad_5m": "0.08333333333333326",
"ttr_bad_1h": "0.007194244604316502",
"queue_oldest": "0.443175",
"queue_depth": "1",
"jobs_overdue": "0",
"worker_busy": "0"
},
"after": {
"api_error_5m": "0.04081632653061224",
"api_error_1h": "0.19291705498602052",
"api_error_30m": "0.3614931237721022",
"api_error_6h": "0.08614232209737828",
"ttr_bad_5m": "0.09341449406517988",
"ttr_bad_1h": "0.009615384615384581",
"queue_oldest": "0",
"queue_depth": "0",
"jobs_overdue": "0",
"worker_busy": "0"
},
"queue_drained": true
}
+79
View File
@@ -0,0 +1,79 @@
# Track 2: полный прогон — TTD/TTR
Прогон: `scripts/lab6_track2_full.py`
Старт: `2026-11-04T19:28:25Z`; завершение: `2026-11-04T23:05:40Z`.
Стенд: 2 API, relay, worker, PostgreSQL, S3, RabbitMQ, OTel Collector,
Prometheus/Loki/Tempo/Grafana. Нагрузка: open-loop 0.2 req/s, 20% uploads,
базовый набор — 2 API-реплики.
## Warmup
- 70 минут, 840 запланированных операций: 672 сообщения, 168 uploads.
- `failed=0`, `dropped=0`; все 168 uploads дошли до `ready`.
- HTTP latency p50/p95/p99 = 5.3 / 10.1 / 15.1 ms.
- TTR p50/p95/p99 = 640.9 / 1246.4 / 1251.9 ms.
- Токен сессии обновлялся за 10 минут до TTL (иначе 70-минутный warmup
получал 401 после 60 минут; этот дефект harness исправлен).
## Burst: 2 минуты PostgreSQL pause
- Инъекция: `20:58:26Z`, восстановление: `21:00:26Z`.
- `DBPoolSaturated` дошёл только до `pending` в `21:00:36Z` (+2m10s),
`resolved` в `21:05:36Z`; **firing/page не было**.
- `APIErrorBudgetFastBurn`/`SlowBurn` не сработали.
- Снимок во время инъекции: `api_error_5m=6.52%`, `api_error_1h=0.51%`,
`api_error_30m=1.05%`; после восстановления `api_error_5m=0`,
`api_error_1h=2.15%`, `api_error_30m=4.50%`.
## Sustained: 15 минут PostgreSQL stop
- Инъекция: `21:10:21Z`; восстановление: `21:25:27Z`;
восстановление readiness/worker подтверждено.
- `APIErrorBudgetSlowBurn`: `firing` в `21:13:56Z` — **TTD 3m35s**
(215 s; alert `active_at=21:13:53Z`).
- `APIErrorBudgetFastBurn`: `firing` в `21:15:36Z` — **TTD 5m15s**
(315 s).
- `QueueMetricsStale`: pending `21:15:26Z`, firing `21:17:26Z`; это
следствие недоступности relay, не отдельный инцидент.
- Снимок во время инъекции: `api_error_5m=2.99%`, `api_error_1h=2.41%`,
`api_error_30m=4.87%`, `queue_oldest=0.44 s`, `queue_depth=1`.
- После восстановления: `api_error_5m=4.08%`, `api_error_1h=19.29%`,
`api_error_30m=36.15%`; `queue_drained=true`.
- `APIErrorBudgetSlowBurn` `resolved` в `21:54:08Z` — **TTR 43m47s**
от инъекции. Это время жизни 6h/30m burn-rate окон, а не время
восстановления процесса; фактическое readiness восстановлено в
`21:25:27Z` (+15m06s).
## TTR: worker остановлен на 15 минут
- Инъекция: `22:30:24Z`; worker восстановлен: `22:45:24Z`.
- `JobsOverdue`: pending `22:31:10Z` (+46 s), firing `22:33:10Z`
(+2m46s); resolved `22:45:41Z` (+17 s после восстановления worker,
+15m17s от инъекции).
- `QueueOldestJobAgeHigh`: pending `22:32:40Z` (+2m16s), firing
`22:42:40Z` (+12m16s); resolved `22:45:41Z`.
- `QueueOldestJobAgeCritical`: pending `22:40:40Z` (+10m16s); до restore
firing не успел; resolved `22:45:41Z`.
- `ttr-load.json`: 180 операций, 20 uploads accepted, 0 ready, 180 failed.
Это ожидаемо: worker остановлен, а клиент ждёт ready только 10 s;
фаза проверяет алерты и восстановление, а не перцентиль TTR.
## False-positive control
- Нормальная нагрузка: `22:45:44Z–23:05:40Z`, новых инъекций нет.
- `TTRErrorBudgetFastBurn` ещё срабатывал в `22:46:21Z–23:02:52Z`
(5 коротких firing/resolved) — это остаточный 1h TTR-бюджет от
предыдущей TTR-фазы, а не новый инцидент. Чистого «нулевого» окна
после TTR не было; ограничение зафиксировано в отчёте.
- Финальный снимок: `api_error_5m=0`, `api_error_30m=0`,
`api_error_1h=0`; `ttr_bad_5m=0`, `ttr_bad_1h=15.75%`;
`queue_oldest=0`, `queue_depth=0`, `jobs_overdue=0`, `worker_busy=0`.
## Ограничения измерений
- Burst и sustained используют один и тот же 1h/6h burn-rate ряд;
остаточные ошибки burst видны в 1h-окне (2.15% после burst), поэтому
sustained TTD — это обнаружение на уже частично израсходованном бюджете.
- `APIErrorBudgetSlowBurn` использует 6h+30m окна; его TTR не равен
времени восстановления сервиса.
- Все компоненты single-node; HA-поведение не заявляется.
+37
View File
@@ -0,0 +1,37 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 895.02,
"scheduled": 180,
"counters": {
"accepted": 20,
"ready": 0,
"failed": 180,
"messages": 0,
"uploads": 20,
"dropped": 0
},
"failures": 180,
"failure_samples": [
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline"
],
"latency_ms": {
"p50": null,
"p95": null,
"p99": null
},
"ttr_ms": {
"p50": null,
"p95": null,
"p99": null
}
}
@@ -0,0 +1,26 @@
{
"base_url": "http://localhost:8080",
"rate": 0.2,
"duration_s": 4195.02,
"scheduled": 840,
"counters": {
"accepted": 168,
"ready": 168,
"failed": 0,
"messages": 672,
"uploads": 168,
"dropped": 0
},
"failures": 0,
"failure_samples": [],
"latency_ms": {
"p50": 5.3,
"p95": 10.1,
"p99": 15.1
},
"ttr_ms": {
"p50": 640.9,
"p95": 1246.4,
"p99": 1251.9
}
}
+9
View File
@@ -0,0 +1,9 @@
Overdue alert evidence (local, 2026-11-04)
=========================================
Worker stopped, one upload accepted as queued.
At +30s: messenger_jobs_overdue = 0
At +150s: messenger_jobs_overdue = 1
At +180s: JobsOverdue = firing (for: 2m); QueueOldestJobAgeHigh = pending
Worker restarted; queue drained.
After drain: messenger_jobs_overdue = 0; Prometheus alerts = [].
This proves a firing -> resolved transition for the time-to-ready incident.
+26
View File
@@ -0,0 +1,26 @@
# Track 2 preregistered plan
Hypothesis: the multi-window fast burn (1h + 5m, 14.4×) stays silent for a
2-minute PostgreSQL burst and fires for a sustained 15-minute outage; the
slow-burn pair (6h + 30m, 6×) is validated synthetically because this stand
cannot accumulate six hours of live data in one run.
SLO windows: 7 days (Prometheus retention). API availability target 99.5%
(budget 50.4 min); time-to-ready target 99% ≤30s (budget 100.8 min).
Phases:
1. Calibrate open-loop upload/message rate; use ≤50% of measured capacity.
2. Warmup ≥70 min so the 1h burn window is full; baseline 20 min.
3. Burst: pause PostgreSQL 2 min. Expected: no fast page; a counterfactual
5m-only alert would have fired. Record edge SLI and per-route diagnostics.
4. Sustained: stop worker, stop PostgreSQL 15 min, restore both. Expected fast
page around 4m19s after injection; measure TTD and TTR_service separately
from TTR_alert (the 1h window clears later).
5. False-positive controls: 4xx traffic, 1% 5xx for 10 min, a 60–90s blip,
then normal load; count evaluations and firing events.
6. Runbook held-out check: another person gets only the alert name/time and uses
Grafana/Prometheus/Loki/Tempo; record transcript and time-to-cause.
Evidence files: `*-load.json`, `*-alerts.csv`, `*-phases.json`,
`runbook-check.md`, `summary.md`. `promtool test rules` covers slow-burn with
synthetic 6h series; no live slow-burn claim is made.
@@ -0,0 +1,6 @@
Debug burst only — not Track 2 evidence
======================================
This 20-second pause was run without the required ≥70-minute warmup. The 1h/6h
burn windows were therefore unfilled, so fast/slow alerts can appear early.
It proves the harness and CSV wiring, not the preregistered hypothesis. Use the
full `plan.md` sequence for an actual Track 2 result.
@@ -0,0 +1,5 @@
observed_utc,alert,state,active_at,value,injection_utc
2026-11-04T13:37:38Z,TTRErrorBudgetFastBurn,firing,2026-11-04T13:37:38.187213033Z,"""1e+00""",
2026-11-04T13:37:38Z,TTRErrorBudgetSlowBurn,firing,2026-11-04T13:37:38.187213033Z,"""1e+00""",
2026-11-04T13:37:43Z,APIErrorBudgetSlowBurn,firing,2026-11-04T13:37:43.187213033Z,"""3.896103896103897e-02""",
2026-11-04T13:37:48Z,APIErrorBudgetFastBurn,firing,2026-11-04T13:37:48.187213033Z,"""8.641975308641976e-02""",
1 observed_utc alert state active_at value injection_utc
2 2026-11-04T13:37:38Z TTRErrorBudgetFastBurn firing 2026-11-04T13:37:38.187213033Z "1e+00"
3 2026-11-04T13:37:38Z TTRErrorBudgetSlowBurn firing 2026-11-04T13:37:38.187213033Z "1e+00"
4 2026-11-04T13:37:43Z APIErrorBudgetSlowBurn firing 2026-11-04T13:37:43.187213033Z "3.896103896103897e-02"
5 2026-11-04T13:37:48Z APIErrorBudgetFastBurn firing 2026-11-04T13:37:48.187213033Z "8.641975308641976e-02"
@@ -0,0 +1,36 @@
{
"base_url": "http://localhost:8080",
"rate": 0.5,
"duration_s": 39.27,
"scheduled": 20,
"counters": {
"accepted": 8,
"ready": 8,
"failed": 12,
"messages": 0,
"uploads": 20
},
"failures": 12,
"failure_samples": [
"Failure: GET /api/v1/attachments/01a1a6c7-7870-7dcc-8438-627d4ec8d291: expected [200], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503",
"Failure: POST /api/v1/chats/01a1a6c7-68b6-783e-89fb-eb78cfc4f8de/attachments: expected [202], received 503"
],
"latency_ms": {
"p50": null,
"p95": null,
"p99": null
},
"ttr_ms": {
"p50": 1264.4,
"p95": 1281.0,
"p99": 1281.0
}
}
@@ -0,0 +1,6 @@
{
"scenario": "burst",
"injection_utc": "2026-11-04T13:37:33Z",
"restore_utc": "2026-11-04T13:37:53Z",
"duration_seconds": 20
}
+43
View File
@@ -0,0 +1,43 @@
env -u APP_ENV -u SERVER_HOST -u SERVER_PORT -u SERVER_READ_HEADER_TIMEOUT -u SERVER_READ_TIMEOUT -u SERVER_SHUTDOWN_TIMEOUT -u SERVER_MAX_BODY_BYTES -u LOG_LEVEL -u LOG_FORMAT -u POSTGRES_HOST -u POSTGRES_PORT -u POSTGRES_DATABASE -u POSTGRES_USER -u POSTGRES_PASSWORD -u POSTGRES_SSL_MODE -u POSTGRES_MAX_CONNS -u POSTGRES_MIN_CONNS -u POSTGRES_MAX_CONN_LIFETIME -u POSTGRES_MAX_CONN_IDLE_TIME -u POSTGRES_CONNECT_TIMEOUT -u POSTGRES_QUERY_TIMEOUT -u REDIS_ENABLED -u REDIS_HOST -u REDIS_PORT -u REDIS_PASSWORD -u REDIS_DB -u REDIS_MAX_RETRIES -u REDIS_DIAL_TIMEOUT -u REDIS_READ_TIMEOUT -u REDIS_WRITE_TIMEOUT -u REDIS_POOL_SIZE -u CACHE_ENABLED -u CACHE_CHAT_LIST_TTL -u CACHE_LOCK_TTL -u CACHE_LOCK_WAIT_TIMEOUT -u SESSION_TTL_SECONDS -u IDEMPOTENCY_TTL_SECONDS -u API_REPLICAS -u API_CPU_LIMIT -u API_MEM_LIMIT -u POSTGRES_MAX_CONNS -u POSTGRES_CPU_LIMIT -u POSTGRES_MEM_LIMIT -u LB_STATS_PORT -u S3_ENDPOINT -u S3_PUBLIC_ENDPOINT -u S3_PORT -u S3_REGION -u S3_BUCKET -u S3_ACCESS_KEY_ID -u S3_SECRET_ACCESS_KEY -u MAX_UPLOAD_BYTES -u MAX_IMAGE_PIXELS -u S3_PRESIGN_TTL -u S3_SWEEP_INTERVAL -u S3_SWEEP_GRACE -u BROKER_USER -u BROKER_PASSWORD -u BROKER_VHOST -u BROKER_URL -u BROKER_EXCHANGE -u BROKER_QUEUE -u BROKER_DLX -u BROKER_DLQ -u BROKER_MANAGEMENT_PORT -u BROKER_CPU_LIMIT -u BROKER_MEM_LIMIT -u WORKER_CONCURRENCY -u WORKER_PREFETCH -u WORKER_CPU_LIMIT -u WORKER_MEM_LIMIT -u WORKER_SHUTDOWN_TIMEOUT -u WORKER_HEALTH_PORT -u PROCESSING_PIPELINE_VERSION -u PROCESSING_MAX_ATTEMPTS -u PROCESSING_JOB_TIMEOUT -u PROCESSING_LEASE_TTL -u PROCESSING_HEARTBEAT -u PROCESSING_RETRY_BASE -u PROCESSING_RETRY_CAP -u OUTBOX_POLL_INTERVAL -u OUTBOX_CLAIM_TTL -u OUTBOX_BATCH -u OUTBOX_REAPER_INTERVAL -u OUTBOX_RECONCILE_AFTER -u OUTBOX_RETENTION -u RELAY_CPU_LIMIT -u RELAY_MEM_LIMIT -u RELAY_HEALTH_PORT -u STAGING_ORPHAN_GRACE -u STAGING_FAILED_RETENTION -u ADMISSION_MAX_PENDING_PER_USER -u ADMISSION_MAX_PENDING -u ADMISSION_MAX_STAGED_BYTES -u ADMISSION_MAX_CONCURRENT_UPLOADS -u OTEL_EXPORTER_OTLP_ENDPOINT -u OTEL_EXPORTER_OTLP_PROTOCOL -u OTEL_RESOURCE_ATTRIBUTES -u OTEL_METRIC_EXPORT_INTERVAL -u TELEMETRY_ENABLED -u PROMETHEUS_PORT -u LOKI_PORT -u TEMPO_PORT -u GRAFANA_PORT -u OTEL_COLLECTOR_CPU_LIMIT -u OTEL_COLLECTOR_MEM_LIMIT -u PROMETHEUS_CPU_LIMIT -u PROMETHEUS_MEM_LIMIT -u LOKI_CPU_LIMIT -u LOKI_MEM_LIMIT -u TEMPO_CPU_LIMIT -u TEMPO_MEM_LIMIT -u GRAFANA_CPU_LIMIT -u GRAFANA_MEM_LIMIT go test -race -shuffle=on -count=1 -timeout=5m ./...
? mtusi-messenger/cmd/jobctl [no test files]
? mtusi-messenger/cmd/messenger [no test files]
? mtusi-messenger/cmd/migrate [no test files]
? mtusi-messenger/cmd/relay [no test files]
? mtusi-messenger/cmd/s3init [no test files]
? mtusi-messenger/cmd/worker [no test files]
? mtusi-messenger/internal/broker [no test files]
ok mtusi-messenger/internal/config 3.198s
ok mtusi-messenger/internal/domain 5.063s
? mtusi-messenger/internal/failpoint [no test files]
ok mtusi-messenger/internal/health 9.434s
ok mtusi-messenger/internal/imagecheck 2.795s
ok mtusi-messenger/internal/imageproc 8.860s
ok mtusi-messenger/internal/logger 5.419s
? mtusi-messenger/internal/outbox [no test files]
ok mtusi-messenger/internal/platform/cache 7.191s
? mtusi-messenger/internal/platform/cache/mocks [no test files]
? mtusi-messenger/internal/platform/instanceid [no test files]
ok mtusi-messenger/internal/platform/objectstore 7.683s
ok mtusi-messenger/internal/platform/password 2.131s
ok mtusi-messenger/internal/platform/token 2.099s
ok mtusi-messenger/internal/service/attachment 9.423s
? mtusi-messenger/internal/service/attachment/mocks [no test files]
ok mtusi-messenger/internal/service/chat 9.939s
? mtusi-messenger/internal/service/chat/mocks [no test files]
ok mtusi-messenger/internal/service/message 10.300s
? mtusi-messenger/internal/service/message/mocks [no test files]
ok mtusi-messenger/internal/service/session 11.441s
? mtusi-messenger/internal/service/session/mocks [no test files]
ok mtusi-messenger/internal/service/user 10.787s
? mtusi-messenger/internal/service/user/mocks [no test files]
ok mtusi-messenger/internal/storage/postgres 11.786s
? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files]
? mtusi-messenger/internal/storage/postgres/migrations [no test files]
? mtusi-messenger/internal/storage/redis [no test files]
? mtusi-messenger/internal/storage/redis/mocks [no test files]
ok mtusi-messenger/internal/telemetry 12.820s
ok mtusi-messenger/internal/transport/rest 14.628s
? mtusi-messenger/internal/transport/rest/internal/oas [no test files]
? mtusi-messenger/internal/transport/rest/mocks [no test files]
? mtusi-messenger/internal/worker [no test files]
? mtusi-messenger/tools/specgen [no test files]
+18
View File
@@ -0,0 +1,18 @@
Worker stop scenario (local, 2026-11-04)
==========================================
$ ./scripts/stop-worker.sh
Container mtusi-messenger-lab6-worker-1 Stopped
$ python3 scripts/lab6_load.py --rate 1 --duration 3 --upload-ratio 1 --deadline 3
(three upload requests were accepted as 202; wait_ready timed out because no worker)
$ max(messenger_queue_oldest_job_age_seconds) after 20s
{"value":"15.218417"} (seconds)
$ max(rabbitmq_queue_messages_ready{queue="attachment.process.v1"})
{"value":"3"}
$ ./scripts/start-worker.sh
Container mtusi-messenger-lab6-worker-1 Healthy
$ max(messenger_queue_oldest_job_age_seconds) after drain
{"value":"0"}
$ max(rabbitmq_queue_messages_ready{queue="attachment.process.v1"}) after drain
{"value":"0"}
Business result: accepted jobs were not lost; worker drain made them ready.
Logs: `job claimed`/`attachment ready` include trace_id; job_id is redacted; bodies and filenames are absent.
+30
View File
@@ -0,0 +1,30 @@
{
"base_url": "http://localhost:8080",
"rate": 1.0,
"duration_s": 5.12,
"scheduled": 3,
"counters": {
"accepted": 3,
"ready": 0,
"failed": 3,
"messages": 0,
"uploads": 3,
"dropped": 0
},
"failures": 3,
"failure_samples": [
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline",
"ready: Failure: attachment did not become ready within test deadline"
],
"latency_ms": {
"p50": null,
"p95": null,
"p99": null
},
"ttr_ms": {
"p50": null,
"p95": null,
"p99": null
}
}
+21 -2
View File
@@ -7,6 +7,7 @@ require (
github.com/aws/aws-sdk-go-v2/credentials v1.20.9
github.com/aws/aws-sdk-go-v2/service/s3 v1.114.4
github.com/aws/smithy-go v1.28.6
github.com/exaring/otelpgx v0.13.0
github.com/gen2brain/webp v0.6.4
github.com/go-faster/errors v0.8.0
github.com/go-faster/jx v1.2.0
@@ -19,6 +20,16 @@ require (
github.com/redis/go-redis/v9 v9.22.0
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.12.1
go.opentelemetry.io/contrib/bridges/otelslog v0.21.0
go.opentelemetry.io/otel v1.47.0
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0
go.opentelemetry.io/otel/metric v1.47.0
go.opentelemetry.io/otel/sdk v1.47.0
go.opentelemetry.io/otel/sdk/log v1.47.0
go.opentelemetry.io/otel/sdk/metric v1.47.0
go.opentelemetry.io/otel/trace v1.47.0
go.uber.org/zap v1.28.0
go.uber.org/zap/exp v0.3.0
golang.org/x/crypto v0.57.0
@@ -39,6 +50,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.6 // indirect
github.com/brunoga/deep v1.3.1 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
@@ -53,11 +65,14 @@ require (
github.com/gabriel-vasile/mimetype v1.4.15 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-faster/yaml v0.4.6 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-sql-driver/mysql v1.10.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/google/cel-go v0.28.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
@@ -110,6 +125,10 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yuin/goldmark v1.8.2 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 // indirect
go.opentelemetry.io/otel/log v1.47.0 // indirect
go.opentelemetry.io/proto/otlp v1.11.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
@@ -120,8 +139,8 @@ require (
golang.org/x/term v0.46.0 // indirect
golang.org/x/text v0.43.0 // indirect
golang.org/x/tools v0.51.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260831171406-18b4a7587f8a // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260928230214-8a89bd6388cc // indirect
google.golang.org/grpc v1.83.2 // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
+41 -14
View File
@@ -36,6 +36,8 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY=
@@ -56,6 +58,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/ebitengine/purego v0.10.1 h1:dewVBCBT2GaMu1SrNTYxQhgQBethzfhiwvZiLGP/qyY=
github.com/ebitengine/purego v0.10.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/exaring/otelpgx v0.13.0 h1:Vi0I2GWRS3nnVzgr73L/XbSLqthR0h6A1rm4Wt3W4aA=
github.com/exaring/otelpgx v0.13.0/go.mod h1:3OojrUKhhy3lTbYIMBijP3YjMey/jo14eHAW5cXcUdk=
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
@@ -78,6 +82,7 @@ github.com/go-faster/jx v1.2.0 h1:T2YHJPrFaYu21fJtUxC9GzmluKu8rVIFDwwGBKTDseI=
github.com/go-faster/jx v1.2.0/go.mod h1:UWLOVDmMG597a5tBFPLIWJdUxz5/2emOpfsj9Neg0PE=
github.com/go-faster/yaml v0.4.6 h1:lOK/EhI04gCpPgPhgt0bChS6bvw7G3WwI8xxVe0sw9I=
github.com/go-faster/yaml v0.4.6/go.mod h1:390dRIvV4zbnO7qC9FGo6YYutc+wyyUSHBgbXL52eXk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -103,6 +108,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY=
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
@@ -255,16 +262,36 @@ github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.46.0 h1:FHt5/CDyVxi/8IM1CH7VE/rRgq3kLHa2mSTVMO8AWyc=
go.opentelemetry.io/otel v1.46.0/go.mod h1:Gj3SEScelsNC45tp4nSxRYlS+f5iez7W8XPMCt905kE=
go.opentelemetry.io/otel/metric v1.46.0 h1:yBnkXvgV7AXFILZc5K6IZe/CBFF3OS7BJ8ov6/lj0K8=
go.opentelemetry.io/otel/metric v1.46.0/go.mod h1:iPmdWqifKUdzziPkvvzIJXITl56fQx2mGM/DHLB3/2o=
go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw=
go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA=
go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o=
go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA=
go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu60qs1c=
go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI=
go.opentelemetry.io/contrib/bridges/otelslog v0.21.0 h1:/CdgE52i1OEPHhsGUqrggYNRaZy4v4YgVenGd52dRBI=
go.opentelemetry.io/contrib/bridges/otelslog v0.21.0/go.mod h1:9pBdbVbuehIDzxN4accnzzxEUPT8Nq7grbZMo+J1VN4=
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0 h1:5WVp40k2fJHuc5BtNTgKk+EugKFT8Eg3lywFfCPI/nE=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0/go.mod h1:59nH0RYCGHRlwt15WyioeSYINBbuObeBpTowPhEKWHY=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0 h1:7kszRN4Ze5GeAkUnBjBSUIunVBMA+mZIG04auueqguM=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0/go.mod h1:CLzakYy8jOdkBfcveCWYkeKJxujcF4xPhh2Z7IfE98U=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 h1:aXZXsZ012wOgVkqaiQv+Z/d8V0xKjmg70F6m4CE94lc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0/go.mod h1:ziu1gUIJhAaxM3EV1e3Ralk5AAyL1UOYz3lJJ4VSI38=
go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI=
go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw=
go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY=
go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU=
go.opentelemetry.io/otel/metric/x v0.69.0 h1:DjRLr15H83v+hCW7JA9NoJvOkYTtmq5YoDRbe9deYpM=
go.opentelemetry.io/otel/metric/x v0.69.0/go.mod h1:uVvsMPMFFyj/HUQfrUnH3JjnOQ1dwFDorgFLRBasM0k=
go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I=
go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0=
go.opentelemetry.io/otel/sdk/log v1.47.0 h1:W4N/ZfgpkRRnmARnqYoQ6BrWA0mrj8IzVDNLlpmUJZY=
go.opentelemetry.io/otel/sdk/log v1.47.0/go.mod h1:Wu74Z2EmOKXi2FleSNAb0Hyau2G+r5kubSEMJw5aAMs=
go.opentelemetry.io/otel/sdk/log/logtest v0.23.0 h1:j3pm42QCrKYYLLkI6OrV1QHFkUfDA6/4EP+Y1PzggLg=
go.opentelemetry.io/otel/sdk/log/logtest v0.23.0/go.mod h1:zt0gEnuTZgDvqvczHwYswz93eqMaIr6upTTsdV/HUlU=
go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw=
go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw=
go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM=
go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0=
go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk=
go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
@@ -321,10 +348,10 @@ golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8=
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260831171406-18b4a7587f8a h1:3Dnd1cDaZlB68lziofO+bJXpjOy8UfRv8Unt+yH8tQ4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260831171406-18b4a7587f8a/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA=
google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc h1:rZHRz0ogq4Pid1IKtA/ivHi8XONVF5tqUQXA2TtgpkE=
google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc/go.mod h1:K/n0XLazCJHjD73YuMyNJsN38BPPy1kfFnKxUXaThFU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260928230214-8a89bd6388cc h1:4bNTbnb44EqGVy9HaQxSY2jnafSUdgV3qHtedvNpDKg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260928230214-8a89bd6388cc/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
+17 -6
View File
@@ -1,7 +1,18 @@
# Инфраструктура студента
# Инфраструктура lab6
Здесь разместите конфигурации выбранных сервисов; основную топологию — в корневом compose.yaml/stack.yaml. `compose.example.yaml` — только worksheet ролей и намеренно не запускается. `contracts/infrastructure.json` задаёт минимальные роли, не готовые образы/пароли.
В REPORT.md сопоставьте роль → service name → версия/digest → health/readiness → volume → сеть/порт → способ передачи credentials. Приведите bootstrap (schema, bucket, broker topology, а с lab6 provisioning) и безопасное повторение этих команд.
Приложение строится из исходников. Не используйте заранее существующий образ преподавательского сервера вместо своей реализации. Restart hook перезапускает все соответствующие stores с volumes; failover hook останавливает только заданную API-реплику.
- `otel/collector.yaml` — OTLP receivers, memory_limiter (140 MiB), batch,
bounded Loki/Tempo exporter queues (`sizer: bytes`), Prometheus exporter
`:8889`, self-metrics `:8888`, health `:13133`.
- `prometheus/` — scrape config (collector, collector-self, HAProxy, RabbitMQ),
7d/2GB retention, SLO recording rules and alerts.
- `loki/loki.yaml` — filesystem, schema v13, 168h retention, OTLP mapping with
only `service.name`/`deployment.environment.name` as index labels.
- `tempo/tempo.yaml` — local storage, OTLP, 72h block retention.
- `grafana/` — provisioned datasources (Prometheus/Loki/Tempo), dashboard
provider and JSON dashboards; admin password only in gitignored
`secrets/grafana.env`.
- `rabbitmq/rabbitmq.conf` — per-object Prometheus metrics so `queue` is a
real label for depth/age panels.
- `runbooks/` — DB availability, queue lag, API errors, telemetry backend down.
- cAdvisor не используется: контейнерные CPU/RAM приложения снимаются из
cgroup v2, брокер — из `rabbitmq_prometheus`; Docker socket не монтируется.
+582
View File
@@ -0,0 +1,582 @@
{
"annotations": {
"list": []
},
"editable": false,
"graphTooltip": 1,
"panels": [
{
"id": 1,
"title": "API RPS",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 0
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_http_server_requests_total[5m]))",
"legendFormat": "rps",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps"
},
"overrides": []
},
"options": {}
},
{
"id": 2,
"title": "API error ratio (edge SLI)",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 0
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:5m",
"legendFormat": "5xx ratio",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:api_error_ratio:1h",
"legendFormat": "1h",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {}
},
{
"id": 3,
"title": "API latency p50/p95/p99",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 7
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))",
"legendFormat": "p50",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))",
"legendFormat": "p95",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))",
"legendFormat": "p99",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 4,
"title": "Jobs processed / failed / retried",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 7
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_jobs_processed_total{outcome=\"succeeded\"}[5m]))",
"legendFormat": "succeeded",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_jobs_processed_total{outcome=\"failed\"}[5m]))",
"legendFormat": "failed",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_jobs_processed_total{outcome=\"retried\"}[5m]))",
"legendFormat": "retried",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "ops"
},
"overrides": []
},
"options": {}
},
{
"id": 5,
"title": "Time-to-ready p50/p95/p99",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 14
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
"legendFormat": "p50",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
"legendFormat": "p95",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
"legendFormat": "p99",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 6,
"title": "TTR bad ratio (1 - within 30s / accepted)",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 14
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ttr_bad_ratio:5m",
"legendFormat": "5m",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ttr_bad_ratio:1h",
"legendFormat": "1h",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {}
},
{
"id": 7,
"title": "Queue depth",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 21
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(rabbitmq_queue_messages_ready{queue=\"attachment.process.v1\"})",
"legendFormat": "ready",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 8,
"title": "Oldest job age",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 21
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(messenger_queue_oldest_job_age_seconds)",
"legendFormat": "oldest job seconds",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 9,
"title": "Worker saturation",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 8,
"x": 16,
"y": 21
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_worker_busy)",
"legendFormat": "busy",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_worker_capacity)",
"legendFormat": "capacity",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 10,
"title": "DB pool used / idle / max",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_used)",
"legendFormat": "used",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_idle)",
"legendFormat": "idle",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_max)",
"legendFormat": "max",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 11,
"title": "DB empty acquire / wait",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_db_pool_empty_acquire_total[5m]))",
"legendFormat": "empty acquire/s",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_db_pool_empty_acquire_wait_seconds_total[5m]))",
"legendFormat": "wait seconds/s",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 12,
"title": "API logs",
"type": "logs",
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 35
},
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{service_name=\"messenger-api\"}",
"refId": "A",
"queryType": "range"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {}
},
{
"id": 13,
"title": "Traces: job.process",
"type": "traces",
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 35
},
"datasource": {
"type": "tempo",
"uid": "tempo"
},
"targets": [
{
"datasource": {
"type": "tempo",
"uid": "tempo"
},
"query": "{ name = \"job.process\" }",
"refId": "A",
"queryType": "traceql"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {}
}
],
"refresh": "5s",
"schemaVersion": 39,
"tags": [
"lab6",
"messenger"
],
"templating": {
"list": []
},
"time": {
"from": "now-30m",
"to": "now"
},
"timezone": "browser",
"title": "Lab6 — messenger observability",
"uid": "lab6-overview",
"version": 1
}
@@ -0,0 +1,343 @@
{
"annotations": {
"list": []
},
"editable": false,
"panels": [
{
"id": 1,
"title": "API RPS",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 0
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_http_server_requests_total[5m]))",
"legendFormat": "rps",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps"
},
"overrides": []
},
"options": {}
},
{
"id": 3,
"title": "API latency p50/p95/p99",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 7
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))",
"legendFormat": "p50",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))",
"legendFormat": "p95",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket[5m])))",
"legendFormat": "p99",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 10,
"title": "DB pool used / idle / max",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_used)",
"legendFormat": "used",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_idle)",
"legendFormat": "idle",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_max)",
"legendFormat": "max",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 11,
"title": "DB empty acquire / wait",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_db_pool_empty_acquire_total[5m]))",
"legendFormat": "empty acquire/s",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_db_pool_empty_acquire_wait_seconds_total[5m]))",
"legendFormat": "wait seconds/s",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 12,
"title": "API logs",
"type": "logs",
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 35
},
"datasource": {
"type": "loki",
"uid": "loki"
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{service_name=\"messenger-api\"}",
"refId": "A",
"queryType": "range"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {}
},
{
"id": 30,
"title": "Process memory usage",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (service_name) (messenger_process_memory_usage_bytes)",
"legendFormat": "{{service_name}}",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "bytes"
},
"overrides": []
},
"options": {}
},
{
"id": 31,
"title": "Collector exporter queue",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(otelcol_exporter_queue_size)",
"legendFormat": "queue",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 32,
"title": "Scrape targets up",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 35
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "up",
"legendFormat": "{{job}}",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
}
],
"refresh": "5s",
"schemaVersion": 39,
"tags": [
"lab6",
"infra"
],
"templating": {
"list": []
},
"time": {
"from": "now-30m",
"to": "now"
},
"title": "Lab6 — infrastructure saturation",
"uid": "lab6-infra",
"version": 1
}
+430
View File
@@ -0,0 +1,430 @@
{
"annotations": {
"list": []
},
"editable": false,
"panels": [
{
"id": 4,
"title": "Jobs processed / failed / retried",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 7
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_jobs_processed_total{outcome=\"succeeded\"}[5m]))",
"legendFormat": "succeeded",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_jobs_processed_total{outcome=\"failed\"}[5m]))",
"legendFormat": "failed",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_jobs_processed_total{outcome=\"retried\"}[5m]))",
"legendFormat": "retried",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "ops"
},
"overrides": []
},
"options": {}
},
{
"id": 5,
"title": "Time-to-ready p50/p95/p99",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 14
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
"legendFormat": "p50",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
"legendFormat": "p95",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
"legendFormat": "p99",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 6,
"title": "TTR bad ratio (1 - within 30s / accepted)",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 14
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ttr_bad_ratio:5m",
"legendFormat": "5m",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "slo:ttr_bad_ratio:1h",
"legendFormat": "1h",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {}
},
{
"id": 7,
"title": "Queue depth",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 8,
"x": 0,
"y": 21
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(rabbitmq_queue_messages_ready{queue=\"attachment.process.v1\"})",
"legendFormat": "ready",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 8,
"title": "Oldest job age",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 21
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(messenger_queue_oldest_job_age_seconds)",
"legendFormat": "oldest job seconds",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 9,
"title": "Worker saturation",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 8,
"x": 16,
"y": 21
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_worker_busy)",
"legendFormat": "busy",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_worker_capacity)",
"legendFormat": "capacity",
"refId": "B",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 10,
"title": "DB pool used / idle / max",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 28
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_used)",
"legendFormat": "used",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_idle)",
"legendFormat": "idle",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_db_pool_max)",
"legendFormat": "max",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
},
{
"id": 20,
"title": "Job duration p50/p95/p99",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 42
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.50, sum by (le) (rate(messenger_job_duration_seconds_bucket[5m])))",
"legendFormat": "p50",
"refId": "A",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket[5m])))",
"legendFormat": "p95",
"refId": "B",
"range": true
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket[5m])))",
"legendFormat": "p99",
"refId": "C",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {}
},
{
"id": 21,
"title": "Overdue jobs (>30s)",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 42
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(messenger_jobs_overdue)",
"legendFormat": "overdue",
"refId": "A",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {}
}
],
"refresh": "5s",
"schemaVersion": 39,
"tags": [
"lab6",
"jobs"
],
"templating": {
"list": []
},
"time": {
"from": "now-30m",
"to": "now"
},
"title": "Lab6 — jobs and queue",
"uid": "lab6-jobs",
"version": 1
}
@@ -0,0 +1,10 @@
apiVersion: 1
providers:
- name: lab6
orgId: 1
folder: Lab6
type: file
disableDeletion: false
updateIntervalSeconds: 10
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,36 @@
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: false
- name: Loki
uid: loki
type: loki
access: proxy
url: http://loki:3100
editable: false
jsonData:
derivedFields:
- datasourceUid: tempo
matcherType: label
matcherRegex: trace_id
url: "$${__value.raw}"
urlDisplayLabel: Open trace
- name: Tempo
uid: tempo
type: tempo
access: proxy
url: http://tempo:3200
editable: false
jsonData:
tracesToLogs:
datasourceUid: loki
tags:
- key: service.name
value: service_name
- key: trace_id
value: trace_id
+5 -1
View File
@@ -18,7 +18,7 @@ global
defaults
mode http
log global
option httplog
log-format "%ST %Tt %b"
option dontlognull
timeout connect 1s
timeout client 70s
@@ -70,7 +70,11 @@ frontend http_front
frontend stats_front
# Только для оператора и доказательств: видно, какие реплики UP/DOWN и почему.
bind *:8404
# Built-in Prometheus exporter (HAProxy built with USE_PROMEX). The edge SLI
# uses frontend response codes; health checks are not counted here.
http-request use-service prometheus-exporter if { path /metrics }
stats enable
stats uri /stats
stats refresh 2s
monitor-uri /healthz
no log
+65
View File
@@ -0,0 +1,65 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
path_prefix: /loki
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
schema_config:
configs:
- from: 2024-01-01
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
storage_config:
filesystem:
directory: /loki/storage
tsdb_shipper:
active_index_directory: /loki/tsdb-index
cache_location: /loki/tsdb-cache
limits_config:
retention_period: 168h
allow_structured_metadata: true
max_line_size: 32KB
max_line_size_truncate: true
otlp_config:
resource_attributes:
ignore_defaults: true
attributes_config:
- action: index_label
attributes:
- service.name
- deployment.environment.name
- action: structured_metadata
attributes:
- service.instance.id
- service.version
log_attributes:
- action: structured_metadata
regex: .*
compactor:
working_directory: /loki/compactor
retention_enabled: true
delete_request_store: filesystem
ruler:
storage:
type: local
local:
directory: /loki/rules
+11 -5
View File
@@ -1,7 +1,13 @@
# Конфигурация наблюдаемости — реализовать
# OTel Collector
Добавьте `collector.yaml` с OTLP receivers, processors и exporters выбранной версии Collector. Укажите явные bind endpoints, внутренние сети, memory limits/batch и поведение при backpressure по уровню. Сопоставьте все три pipeline с реально развёрнутыми backend.
`collector.yaml` — единственный OTLP-приёмник стенда. API/worker/relay шлют
traces/metrics/logs по HTTP `:4318`; Collector экспортирует:
- метрики — pull-exporter Prometheus `:8889` (Prometheus scrape);
- логи — OTLP HTTP в Loki `/otlp`;
- трассы — OTLP gRPC в Tempo `:4317`.
Добавьте конфигурации storage, Grafana provisioning/datasources, provisioning/dashboards и импортируемые dashboard JSON. На 4 — alert rules и runbooks. Пустой dashboard или debug exporter, который только печатает данные в stdout, не заменяют хранилища/доказательства из `contracts/observability.md`.
Не публикуйте OTLP/metrics/административные ports в общую сеть без необходимости. В lab7 реализуйте TLS/mTLS по trust matrix; экспорт Authorization и message bodies запрещён.
`memory_limiter` ограничивает 140 MiB, batch — 5 с/1024, очереди Loki/Tempo
ограничены 10 MiB (`sizer: bytes`) и retry не дольше 30 с. Self-metrics
Collector отдаются на `:8888` отдельным scrape-job. OTLP-порты не публикуются
на host; Collector подключён к `default` и `observability`, backend'ы — только
к `observability`. TLS/auth относятся к lab7.
+86
View File
@@ -0,0 +1,86 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
# limit_mib, not limit_percentage: Docker Desktop cgroup limits are easy to
# misread and a percentage would fall back to the VM total.
limit_mib: 140
spike_limit_mib: 40
batch:
timeout: 5s
send_batch_size: 1024
exporters:
# Pull-based: no sending_queue/retry for this exporter.
prometheus:
endpoint: 0.0.0.0:8889
translation_strategy: UnderscoreEscapingWithSuffixes
resource_constant_labels:
included:
- service.name
- service.instance.id
- deployment.environment.name
- service.version
otlp_http/loki:
endpoint: http://loki:3100/otlp
sending_queue:
enabled: true
sizer: bytes
queue_size: 10485760
num_consumers: 2
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
timeout: 5s
otlp_grpc/tempo:
endpoint: tempo:4317
tls:
insecure: true
sending_queue:
enabled: true
sizer: bytes
queue_size: 10485760
num_consumers: 2
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
timeout: 5s
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
extensions: [health_check]
telemetry:
metrics:
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp_grpc/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp_http/loki]
+24
View File
@@ -0,0 +1,24 @@
global:
scrape_interval: 5s
evaluation_interval: 5s
rule_files:
- /etc/prometheus/rules/*.yml
scrape_configs:
- job_name: otel-collector
static_configs:
- targets: ["otel-collector:8889"]
- job_name: otel-collector-self
static_configs:
- targets: ["otel-collector:8888"]
- job_name: haproxy
metrics_path: /metrics
static_configs:
- targets: ["lb:8404"]
- job_name: rabbitmq
static_configs:
- targets: ["broker:15692"]
- job_name: loki
static_configs:
- targets: ["loki:3100"]
+142
View File
@@ -0,0 +1,142 @@
groups:
- name: lab6-alerts
interval: 5s
rules:
- alert: APIErrorBudgetFastBurn
expr: slo:api_error_ratio:1h > 0.072 and slo:api_error_ratio:5m > 0.072 and on() sum(increase(haproxy_frontend_http_responses_total{proxy="http_front"}[5m])) >= 20
for: 0s
labels:
severity: page
slo: api-availability
annotations:
summary: API 5xx burn rate is above 14.4x
runbook: infra/runbooks/slo-burn.md
- alert: APIErrorBudgetSlowBurn
expr: slo:api_error_ratio:6h > 0.03 and slo:api_error_ratio:30m > 0.03 and on() sum(increase(haproxy_frontend_http_responses_total{proxy="http_front"}[30m])) >= 100
for: 0s
labels:
severity: ticket
slo: api-availability
annotations:
summary: API 5xx burn rate is above 6x
runbook: infra/runbooks/slo-burn.md
- alert: TTRErrorBudgetFastBurn
expr: slo:ttr_bad_ratio:1h > 0.144 and slo:ttr_bad_ratio:5m > 0.144 and on() sum(increase(messenger_jobs_accepted_total[5m])) >= 2
for: 0s
labels:
severity: page
slo: time-to-ready
annotations:
summary: Jobs are missing the 30s time-to-ready objective
runbook: infra/runbooks/queue-lag.md
- alert: TTRErrorBudgetSlowBurn
expr: slo:ttr_bad_ratio:6h > 0.06 and slo:ttr_bad_ratio:30m > 0.06 and on() sum(increase(messenger_jobs_accepted_total[30m])) >= 10
for: 0s
labels:
severity: ticket
slo: time-to-ready
annotations:
summary: Time-to-ready budget is burning slowly
runbook: infra/runbooks/queue-lag.md
- alert: QueueOldestJobAgeHigh
expr: max(messenger_queue_oldest_job_age_seconds) > 120
for: 10m
labels:
severity: warning
annotations:
summary: The oldest queued/processing job is older than 2 minutes
runbook: infra/runbooks/queue-lag.md
- alert: QueueOldestJobAgeCritical
expr: max(messenger_queue_oldest_job_age_seconds) > 600
for: 5m
labels:
severity: page
annotations:
summary: The oldest queued/processing job is older than 10 minutes
runbook: infra/runbooks/queue-lag.md
- alert: QueueDepthGrowing
expr: |
max(rabbitmq_queue_messages_ready{queue="attachment.process.v1"}) > 20
and on() max(deriv(rabbitmq_queue_messages_ready{queue="attachment.process.v1"}[10m])) > 0
for: 10m
labels:
severity: warning
annotations:
summary: RabbitMQ ready depth is growing
runbook: infra/runbooks/queue-lag.md
- alert: JobsOverdue
expr: max(messenger_jobs_overdue) > 0
for: 2m
labels:
severity: warning
slo: time-to-ready
annotations:
summary: Jobs have been queued/processing for more than 30 seconds
runbook: infra/runbooks/queue-lag.md
- alert: WorkerSaturated
expr: |
(sum(messenger_worker_busy) / clamp_min(sum(messenger_worker_capacity), 1) > 0.8)
and (max(messenger_queue_oldest_job_age_seconds) > 120)
for: 10m
labels:
severity: warning
annotations:
summary: Worker slots are saturated while the queue is aging
runbook: infra/runbooks/queue-lag.md
- alert: DBPoolSaturated
expr: |
(sum(rate(messenger_db_pool_empty_acquire_total[5m])) > 0)
or (sum(messenger_db_pool_used) / clamp_min(sum(messenger_db_pool_max), 1) > 0.8)
for: 5m
labels:
severity: warning
annotations:
summary: PostgreSQL pool is waiting or nearly exhausted
runbook: infra/runbooks/db-availability.md
- alert: CollectorDroppedTelemetry
expr: |
sum(rate(otelcol_exporter_send_failed_spans[5m])) > 0
or sum(rate(otelcol_processor_refused_spans[5m])) > 0
or sum(rate(otelcol_exporter_send_failed_log_records[5m])) > 0
for: 5m
labels:
severity: warning
annotations:
summary: Collector is dropping or refusing telemetry
runbook: infra/runbooks/telemetry-backend-down.md
- alert: TelemetryStorageDown
expr: up{job="loki"} == 0
for: 2m
labels:
severity: warning
component: telemetry
annotations:
summary: Loki or Tempo is unavailable; Collector queues are bounded
runbook: infra/runbooks/telemetry-backend-down.md
- alert: TelemetryCollectorDown
expr: up{job="otel-collector"} == 0
for: 2m
labels:
severity: warning
component: telemetry
annotations:
summary: OTel Collector is unavailable; application keeps running
runbook: infra/runbooks/telemetry-backend-down.md
- alert: APISLIMissing
expr: absent(slo:api_error_ratio:5m) or up{job="haproxy"} == 0
for: 2m
labels:
severity: page
annotations:
summary: Edge availability data is missing
runbook: infra/runbooks/api-errors.md
- alert: QueueMetricsStale
expr: |
(absent(messenger_queue_oldest_job_age_seconds) or absent(messenger_jobs_accepted_total))
and on() (up{job="otel-collector"} == 1)
for: 2m
labels:
severity: warning
annotations:
summary: Queue/backlog metrics are missing
runbook: infra/runbooks/queue-lag.md
+68
View File
@@ -0,0 +1,68 @@
groups:
- name: slo
interval: 5s
rules:
- record: slo:api_error_ratio:5m
expr: |
sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[5m]))
/
clamp_min(sum(rate(haproxy_frontend_http_responses_total{proxy="http_front"}[5m])), 0.001)
- record: slo:api_error_ratio:1h
expr: |
sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[1h]))
/
clamp_min(sum(rate(haproxy_frontend_http_responses_total{proxy="http_front"}[1h])), 0.001)
- record: slo:api_error_ratio:6h
expr: |
sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[6h]))
/
clamp_min(sum(rate(haproxy_frontend_http_responses_total{proxy="http_front"}[6h])), 0.001)
- record: slo:api_error_ratio:30m
expr: |
sum(rate(haproxy_frontend_http_responses_total{proxy="http_front",code=~"5.."}[30m]))
/
clamp_min(sum(rate(haproxy_frontend_http_responses_total{proxy="http_front"}[30m])), 0.001)
- record: slo:ttr_bad_ratio:5m
expr: |
clamp(
1 - (
sum(rate(messenger_jobs_ready_within_budget_total[5m]))
/
clamp_min(sum(rate(messenger_jobs_accepted_total[5m])), 0.001)
),
0, 1
)
and (sum(rate(messenger_jobs_accepted_total[5m])) > 0)
- record: slo:ttr_bad_ratio:1h
expr: |
clamp(
1 - (
sum(rate(messenger_jobs_ready_within_budget_total[1h]))
/
clamp_min(sum(rate(messenger_jobs_accepted_total[1h])), 0.001)
),
0, 1
)
and (sum(rate(messenger_jobs_accepted_total[1h])) > 0)
- record: slo:ttr_bad_ratio:6h
expr: |
clamp(
1 - (
sum(rate(messenger_jobs_ready_within_budget_total[6h]))
/
clamp_min(sum(rate(messenger_jobs_accepted_total[6h])), 0.001)
),
0, 1
)
and (sum(rate(messenger_jobs_accepted_total[6h])) > 0)
- record: slo:ttr_bad_ratio:30m
expr: |
clamp(
1 - (
sum(rate(messenger_jobs_ready_within_budget_total[30m]))
/
clamp_min(sum(rate(messenger_jobs_accepted_total[30m])), 0.001)
),
0, 1
)
and (sum(rate(messenger_jobs_accepted_total[30m])) > 0)
+3
View File
@@ -0,0 +1,3 @@
# Per-queue Prometheus series: the default exporter aggregates queues, but the
# lab dashboard and oldest/queue-depth alert need the queue label.
prometheus.return_per_object_metrics = true
+8
View File
@@ -0,0 +1,8 @@
# API error / availability SLI
1. Grafana → Lab6 → API overview. Check `slo:api_error_ratio:5m` and the edge panel; 5xx at HAProxy is the SLI, API-side 5xx is diagnostic.
2. Prometheus → Status → Targets: `haproxy`, `otel-collector`, `rabbitmq` must be UP. If HAProxy is DOWN, no edge SLI exists; inspect `docker compose ps lb`.
3. HAProxy stats `http://127.0.0.1:8404/stats`: look for DOWN replicas and `check` errors. A stale `X-Instance-Id` is the stopped replica.
4. If all replicas are DOWN, check `/health/ready` of one replica (5xx means DB/S3 dependency) and PostgreSQL logs.
5. For a slow handler, open a Tempo trace from the error panel; DB child span (`SELECT`/`INSERT`/`UPDATE`/`BEGIN`/`COMMIT`) duration vs HTTP span shows whether PostgreSQL or the handler is slow. Correlate `trace_id` in Loki.
6. Recover DB/S3, wait for HAProxy `rise 2`, then verify a 2xx through the LB and resolved alert.
+8
View File
@@ -0,0 +1,8 @@
# PostgreSQL slow/unavailable
1. Edge SLI first: HAProxy may return 503/504 while API replicas are removed by `/health/ready`; API-side 5xx can therefore be near zero. Use the HAProxy panel and `up{job="haproxy"}`.
2. `docker compose ps postgres`; `docker compose logs --tail=100 postgres`; `pg_isready` from a replica.
3. Prometheus: `messenger_db_pool_used/idle/max`, `messenger_db_pool_empty_acquire_total`, `rate(...wait_seconds)`; API/worker DB spans in Tempo (`SELECT`/`INSERT`/`UPDATE`/`BEGIN`/`COMMIT`, `pool.acquire`) show failures/latency.
4. Loki: `{service_name=~"messenger-api|messenger-worker"} | severity_text="error" | trace_id="<id>"`. A handler span with a long DB child span is a DB problem; a long handler without a DB child is an application problem.
5. If PostgreSQL was stopped, start it, wait for health, then let the pool reconnect. Worker deliveries are requeued; verify no accepted job is lost (jobs accepted/ready/failed counts).
6. Confirm the alert resolved; record injection/restore and first successful request timestamps.
+8
View File
@@ -0,0 +1,8 @@
# Queue lag / time-to-ready
1. Grafana → Lab6 → Jobs and queue: `messenger_queue_oldest_job_age_seconds`, `rabbitmq_queue_messages_ready`, `messenger_worker_busy/capacity`, TTR p95.
2. If oldest age grows and `worker_busy == capacity`, the worker is saturated: inspect `worker` logs (`job claimed`, `job retry scheduled`) and `WORKER_CONCURRENCY`.
3. If queue depth grows but `worker_busy == 0`, the worker is stopped or cannot connect to the broker: `docker compose ps worker`, worker `/health/ready`, broker `rabbitmqctl list_queues`.
4. If retries grow, filter Loki `{service_name="messenger-worker"} | severity_text="error"` and trace `job.process` attempts; check `error_code`.
5. For a lost delivery, relay logs `outbox publish cycle` / `lost queued jobs reconciled` and `jobctl failed`.
6. Restore worker/broker, verify queue depth < 5 and oldest age < 5s for two scrapes, then confirm the alert resolved.
+15
View File
@@ -0,0 +1,15 @@
# SLO burn-rate
1. Open Grafana → Lab6 → API overview and Jobs and queue.
2. Check `slo:api_error_ratio:1h` + `5m` for fast burn, `6h` + `30m`
for slow burn; TTR uses `slo:ttr_bad_ratio:*`.
3. Fast page means the current hour is consuming the 7-day error budget at
≥14.4×. Confirm edge traffic in HAProxy (`proxy="http_front"`), then inspect
API traces for 5xx and DB spans (`SELECT`/`INSERT`/`UPDATE`/`BEGIN`/`COMMIT`)
or missing worker `job.process` spans.
4. Slow ticket means a sustained 6-hour burn. It can fire with a low current
rate; do not suppress it until the 30m window is below 3% (API) or 6% (TTR).
5. Resolve only after the SLO ratio stays below the fast/slow thresholds and
the underlying dependency (worker, PostgreSQL, broker) is healthy.
6. Record injection/restore UTC and the first firing/resolved timestamps in
`evidence/lab6/track2/`.
+8
View File
@@ -0,0 +1,8 @@
# Telemetry backend down
1. This is an observability incident, not a business outage. First verify API: `curl -fsS http://127.0.0.1:8080/health/ready` and a smoke request.
2. `docker compose ps otel-collector prometheus loki tempo grafana`.
3. If Tempo/Loki is down, Collector exporter queues fill; inspect `otelcol_exporter_queue_size`, `otelcol_exporter_send_failed_*`, `otelcol_processor_refused_*`. Queues are bounded by `sizer: bytes`; the Collector does not grow without limit.
4. If the Collector is down, Prometheus `up{job="otel-collector"}=0`; the application continues to accept work. Application OTLP export failures are best-effort and do not affect `/health/ready`.
5. Restart the failed backend/collector; confirm `up`, queue drains, and no new refused records. Lost telemetry is bounded and documented; business data in PostgreSQL/S3 is unaffected.
6. Do not stop Prometheus while diagnosing another alert: without Prometheus there is no rule evaluation. Use HAProxy stats and container logs as fallback.
+27
View File
@@ -0,0 +1,27 @@
server:
http_listen_port: 3200
grpc_listen_port: 9095
distributor:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
storage:
trace:
backend: local
local:
path: /var/tempo/traces
wal:
path: /var/tempo/wal
compactor:
compaction:
block_retention: 72h
usage_report:
reporting_enabled: false
+10
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"regexp"
"time"
"github.com/google/uuid"
@@ -120,9 +121,18 @@ func (m JobMessage) Validate() error {
return errors.New("created_at is required")
}
if m.Traceparent != "" && !traceparentPattern.MatchString(m.Traceparent) {
return errors.New("traceparent does not match W3C format")
}
if len(m.Tracestate) > 512 {
return errors.New("tracestate is too long")
}
return nil
}
var traceparentPattern = regexp.MustCompile(`^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$`)
func (m JobMessage) MarshalPayload() ([]byte, error) {
return json.Marshal(m)
}
+21 -3
View File
@@ -4,11 +4,15 @@ package outbox
import (
"context"
"errors"
"log/slog"
"time"
"go.opentelemetry.io/otel/codes"
"mtusi-messenger/internal/domain"
"mtusi-messenger/internal/failpoint"
"mtusi-messenger/internal/telemetry"
)
type Repository interface {
@@ -17,7 +21,9 @@ type Repository interface {
ReleaseOutbox(ctx context.Context, id int64, reason string) error
ReapOutboxClaims(ctx context.Context) error
ReapExpiredLeases(ctx context.Context, limit int) (int, error)
ReconcileQueuedJobs(ctx context.Context, olderThan time.Duration, limit int) (int, error)
ReconcileQueuedJobs(ctx context.Context, olderThan time.Duration, limit int, traceparent, tracestate string) (int, error)
OldestActiveJobAge(ctx context.Context) (float64, error)
CountOverdueJobs(ctx context.Context, olderThan time.Duration) (int64, error)
PruneOutbox(ctx context.Context, retention time.Duration) error
OldestUnpublished(ctx context.Context) (time.Time, error)
}
@@ -103,7 +109,15 @@ func (r *Relay) RunOnce(ctx context.Context) (int, error) {
failpoint.Check("OUTBOX_AFTER_COMMIT", job.JobID)
if err := r.publisher.PublishConfirmed(ctx, message.RoutingKey, job); err != nil {
publishCtx, span := telemetry.StartPublishSpan(ctx, job)
job.Traceparent, job.Tracestate = telemetry.Inject(publishCtx)
err = r.publisher.PublishConfirmed(publishCtx, message.RoutingKey, job)
if err != nil {
span.RecordError(errors.New(telemetry.Redact(err.Error())))
span.SetStatus(codes.Error, telemetry.Redact(err.Error()))
}
span.End()
if err != nil {
_ = r.repo.ReleaseOutbox(ctx, message.ID, err.Error())
continue
@@ -121,6 +135,9 @@ func (r *Relay) RunOnce(ctx context.Context) (int, error) {
}
func (r *Relay) reap(ctx context.Context) {
ctx, span := telemetry.StartRequeueSpan(ctx, "requeue")
defer span.End()
if err := r.repo.ReapOutboxClaims(ctx); err != nil {
r.log.WarnContext(ctx, "outbox claim reaper failed", slog.Any("error", err))
}
@@ -135,7 +152,8 @@ func (r *Relay) reap(ctx context.Context) {
// The broker is not the source of truth. If a delivery was dead-lettered
// or lost, the queued job has no unpublished outbox row; republish it.
if r.config.ReconcileAfter > 0 {
reconciled, err := r.repo.ReconcileQueuedJobs(ctx, r.config.ReconcileAfter, 100)
traceparent, tracestate := telemetry.Inject(ctx)
reconciled, err := r.repo.ReconcileQueuedJobs(ctx, r.config.ReconcileAfter, 100, traceparent, tracestate)
if err != nil {
r.log.WarnContext(ctx, "queued-job reconciliation failed", slog.Any("error", err))
} else if reconciled > 0 {

Some files were not shown because too many files have changed in this diff Show More