diff --git a/.dockerignore b/.dockerignore index bc16e556..8a8cc9df 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,3 +18,7 @@ __pycache__ node_modules evidence .DS_Store +bin +coverage.out +coverage.out.tmp +*.log diff --git a/.env.example b/.env.example index d32b9be0..fa98c793 100644 --- a/.env.example +++ b/.env.example @@ -1,13 +1,84 @@ # Copy to .env for your LOCAL synthetic test environment; never commit .env. -# These are logical interface suggestions; map actual framework names in REPORT.md. -APP_HOST=0.0.0.0 -APP_PORT=8080 -APP_ENV=lab +# Values below are the variables this implementation actually reads +# (viper: section.name -> SECTION_NAME, see internal/config/config.go). +# +# Mapping to the logical names suggested by the skeleton: +# APP_HOST / APP_PORT -> SERVER_HOST / SERVER_PORT +# SESSION_STORE=postgres -> server-side sessions live in PostgreSQL (SESSION_TTL_SECONDS) +# DATABASE_URL_FILE -> unused: POSTGRES_* below pass no secret files +# CACHE_URL_FILE -> unused: REDIS_* below pass no secret files +# API_REPLICAS -> number of API replicas of the stand (compose.yaml) +# +# APP_ENV selects config//config.yaml; the implementation supports only `dev`. +APP_ENV=dev + +SERVER_HOST=0.0.0.0 +SERVER_PORT=8080 +SERVER_READ_HEADER_TIMEOUT=10s +SERVER_SHUTDOWN_TIMEOUT=10s +# Предел размера тела запроса (байт): защищает реплику от чтения огромного тела +# до валидации. Для вложений LAB4 (до 10 MiB) значение нужно поднять. +SERVER_MAX_BODY_BYTES=262144 + +LOG_LEVEL=info +LOG_FORMAT=json + +# Synthetic credentials for the local stand only; override in .env for anything else. +POSTGRES_HOST=localhost +POSTGRES_PORT=5432 +POSTGRES_DATABASE=messenger +POSTGRES_USER=messenger +POSTGRES_PASSWORD=messenger +POSTGRES_SSL_MODE=disable +POSTGRES_MAX_CONNS=10 +POSTGRES_MIN_CONNS=1 +POSTGRES_MAX_CONN_LIFETIME=1h +POSTGRES_MAX_CONN_IDLE_TIME=30m +POSTGRES_CONNECT_TIMEOUT=5s +POSTGRES_QUERY_TIMEOUT=5s + +REDIS_ENABLED=true +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_PASSWORD= +REDIS_DB=0 +# -1 disables go-redis retries; 0 keeps the library default (3 retries). +REDIS_MAX_RETRIES=-1 +REDIS_DIAL_TIMEOUT=300ms +REDIS_READ_TIMEOUT=200ms +REDIS_WRITE_TIMEOUT=200ms +REDIS_POOL_SIZE=10 + +CACHE_ENABLED=true +CACHE_CHAT_LIST_TTL=5m +CACHE_LOCK_TTL=10s +CACHE_LOCK_WAIT_TIMEOUT=2s + SESSION_TTL_SECONDS=3600 -# Choose credentials locally. File paths contain no secret values. -DATABASE_URL_FILE=/run/secrets/database_url -# Optional on 3, required use on 4 in lab2; Redis OR Valkey: -SESSION_STORE=postgres -CACHE_URL_FILE=/run/secrets/cache_url -API_REPLICAS=2 + +# Retention of a message Idempotency-Key in the shared store; contract 1.3.0 +# requires at least 24 h. IDEMPOTENCY_TTL_SECONDS=86400 + +# Lab3 stand (compose.yaml): number of API replicas behind the LB and per-replica +# CPU/RAM limits. Track 1 varies them to compare 1/2/4 replicas at a fixed total +# budget, e.g. API_REPLICAS=4 API_CPU_LIMIT=0.25 API_MEM_LIMIT=192M. +API_REPLICAS=2 +API_CPU_LIMIT=0.50 +API_MEM_LIMIT=256M + +# Connections of ONE API replica to PostgreSQL; the total is replicas × value. +# Track 1 checks whether the shared connection budget becomes the saturation +# point: at 4 replicas the default 10 means 40 connections against one database. +POSTGRES_MAX_CONNS=10 + +# CPU quota of the shared database. Track 1 shows it is the stand's saturation +# point: the API uses a fraction of its budget while PostgreSQL sits at its own. +POSTGRES_CPU_LIMIT=0.50 + +# Memory quota of the shared database. The track 1 series r/g/pool were measured +# with 512M, the db1cpu control — with 384M (see evidence/track1/profile-*.json). +POSTGRES_MEM_LIMIT=384M + +# Loopback port of the HAProxy operator page (UP/DOWN of every replica). +LB_STATS_PORT=8404 diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml new file mode 100644 index 00000000..fed44ada --- /dev/null +++ b/.github/workflows/app.yml @@ -0,0 +1,77 @@ +name: Application + +on: [push, pull_request] + +permissions: + contents: read + +env: + GO_VERSION: "1.27.0" + GOLANGCI_LINT_VERSION: v2.13.2 + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + - run: make lint + + unit-test: + name: Unit tests + needs: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + - run: make unit-test + + build: + name: Docker build + needs: unit-test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: docker/build-push-action@v6 + with: + context: . + push: false + tags: mtusi-messenger:ci + + stand: + name: Lab3 stand scenario + needs: build + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - run: cp .env.example .env + - 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 + 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 through the LB + run: make test + - name: Parallel idempotency through the LB + run: python3 student-tests/idempotency_parallel.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 + - if: always() + run: docker compose --env-file .env down -v diff --git a/.gitignore b/.gitignore index b5a71896..35d6aca3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,8 @@ target/ bin/ obj/ coverage/ +coverage.out +coverage.out.tmp *.log .DS_Store .idea/ diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..a2014d8b --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,139 @@ +# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.v2.13.jsonschema.json + +version: "2" + +run: + timeout: 5m + tests: true + build-tags: + - integration + +linters: + default: standard + enable: + - bodyclose + - contextcheck + - containedctx + - noctx + - rowserrcheck + - sqlclosecheck + - fatcontext + - errorlint + - errname + - nilerr + - nilnil + - asasalint + - durationcheck + - exhaustive + - forcetypeassert + - gocheckcompilerdirectives + - gocritic + - makezero + - musttag + - reassign + - recvcheck + - unparam + - wastedassign + - gosec + - canonicalheader + - copyloopvar + - exptostd + - intrange + - perfsprint + - unconvert + - usestdlibvars + - usetesting + - prealloc + - revive + - misspell + - nolintlint + - gomoddirectives + - sloglint + - depguard + - forbidigo + - testifylint + - thelper + - tparallel + + settings: + govet: + enable-all: true + disable: + - fieldalignment + - shadow + + gosec: + excludes: + - G404 + + exhaustive: + default-signifies-exhaustive: true + + nolintlint: + require-explanation: true + require-specific: true + + sloglint: + attr-only: true + no-global: default + context: scope + + testifylint: + enable-all: true + + depguard: + rules: + main: + deny: + - pkg: math/rand$ + desc: use math/rand/v2 + - pkg: github.com/pkg/errors + desc: use stdlib errors and fmt.Errorf with %w + - pkg: io/ioutil + desc: deprecated + domain: + files: + - "**/internal/domain/**" + deny: + - pkg: database/sql + desc: domain must not depend on infrastructure + - pkg: net/http + desc: domain must not depend on transport + + forbidigo: + forbid: + - pattern: ^fmt\.Print(f|ln)?$ + msg: use slog + - pattern: ^log\.(Print|Fatal|Panic).*$ + msg: use slog + + exclusions: + generated: lax + presets: + - comments + - std-error-handling + - common-false-positives + rules: + - path: _test\.go + linters: + - gosec + - prealloc + - forcetypeassert + - unparam + +formatters: + enable: + - gofumpt + - goimports + settings: + gofumpt: + module-path: mtusi-messenger + goimports: + local-prefixes: + - mtusi-messenger + exclusions: + generated: lax + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 \ No newline at end of file diff --git a/.mockery.yml b/.mockery.yml new file mode 100644 index 00000000..eecf98a8 --- /dev/null +++ b/.mockery.yml @@ -0,0 +1,35 @@ +#https://vektra.github.io/mockery/latest/configuration/ + +all: false +dir: "{{.InterfaceDir}}/mocks" +pkgname: mocks +filename: "{{.InterfaceName}}.go" +structname: "Mock{{.InterfaceName}}" +template: testify +formatter: goimports +force-file-write: true +include-auto-generated: false +log-level: info + +packages: + mtusi-messenger/internal/platform/cache: + config: + all: true + mtusi-messenger/internal/storage/redis: + config: + all: true + mtusi-messenger/internal/service/user: + config: + all: true + mtusi-messenger/internal/service/chat: + config: + all: true + mtusi-messenger/internal/service/message: + config: + all: true + mtusi-messenger/internal/service/session: + config: + all: true + mtusi-messenger/internal/transport/rest: + config: + all: true diff --git a/.ogen.yml b/.ogen.yml new file mode 100644 index 00000000..8995023f --- /dev/null +++ b/.ogen.yml @@ -0,0 +1,10 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/ogen-go/ogen/v1.24.0/schemas/ogen.jsonschema.json + +# https://ogen.dev/docs/config/ +generator: + features: + disable: + - paths/client + - webhooks/client + - webhooks/server + - ogen/otel diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b43fae52 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +# syntax=docker/dockerfile:1.7 + +ARG GO_VERSION=1.27.1 +ARG ALPINE_VERSION=3.22 + +FROM golang:${GO_VERSION}-alpine AS build +# Platform of the produced binaries. Left empty on purpose: the classic builder +# does not supply these args, and the previous hardcoded `amd64` default silently +# produced x86-64 binaries inside an arm64 image. Those ran under emulation and +# the Go runtime crashed under load (fatals like "found pointer to free object"). +# Empty means "build for the builder's own platform"; cross-compile explicitly: +# docker build --build-arg TARGETARCH=amd64 ... +ARG TARGETOS +ARG TARGETARCH +ARG VERSION=dev +ENV GOTOOLCHAIN=local +WORKDIR /opt + +COPY go.mod go.sum ./ +RUN go mod download + +# The Go compiler spikes well above 1 GiB per package on large dependencies, so +# an unbounded parallel build OOMs small Docker VMs and CI runners. Cap +# parallelism; override with --build-arg GOFLAGS=-p=$(nproc) on a bigger host. +ARG GOFLAGS="-p=2" +ENV GOFLAGS=$GOFLAGS + +COPY . . +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ + go build -trimpath -buildvcs=false -tags timetzdata \ + -ldflags="-s -w -X main.version=${VERSION}" \ + -o /out/messenger ./cmd/messenger \ + && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ + go build -trimpath -buildvcs=false -tags timetzdata \ + -ldflags="-s -w -X main.version=${VERSION}" \ + -o /out/migrate ./cmd/migrate + +FROM alpine:${ALPINE_VERSION} AS runtime +RUN apk add --no-cache ca-certificates wget \ + && addgroup -S -g 10001 app \ + && adduser -S -D -H -u 10001 -G app app + +COPY --from=build --chown=10001:10001 /out/messenger /usr/local/bin/messenger +COPY --from=build --chown=10001:10001 /out/migrate /usr/local/bin/migrate +COPY --chown=10001:10001 config/dev/config.yaml /etc/messenger/dev/config.yaml + +USER 10001:10001 +EXPOSE 8080 +STOPSIGNAL SIGTERM +HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \ + CMD wget -q -O /dev/null "http://127.0.0.1:${SERVER_PORT:-8080}/health/live" || exit 1 + +ENTRYPOINT ["/usr/local/bin/messenger"] diff --git a/Makefile b/Makefile index 5d86d171..edc73ca9 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,13 @@ BASE_URL ?= http://localhost:8080 CA_FILE ?= ACTION_SCRIPT ?= 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 load test-persistence test-failover +.PHONY: help check validate test load test-persistence test-failover smoke-local load-local test-idempotency test-lb-readiness up 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)" check: $(PYTHON) scripts/check_contract.py @@ -16,15 +18,130 @@ validate: $(PYTHON) scripts/validate_openapi.py test: - $(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS) + $(PYTHON_LOCAL) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS) load: - $(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS) + $(PYTHON_LOCAL) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS) test-persistence: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook"; exit 2) - $(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) + $(PYTHON_LOCAL) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) test-failover: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2) - $(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) + $(PYTHON_LOCAL) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) + +# Локальный запуск без прокси: в окружении автора HTTP(S)_PROXY ломает localhost. +smoke-local: + $(PYTHON_LOCAL) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS) + +load-local: + $(PYTHON_LOCAL) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS) + +# Собственная проверка уровня 4: параллельные повторы одного Idempotency-Key +# через LB обязаны создать ровно одно сообщение. +test-idempotency: + $(PYTHON_LOCAL) student-tests/idempotency_parallel.py --base-url "$(BASE_URL)" $(TLS_ARGS) + +# Собственная проверка уровня 4: LB обязан убрать из ротации реплику, которая +# осталась доступной, но потеряла БД (readiness 503). +test-lb-readiness: + scripts/lb_readiness_check.sh + +COMPOSE_BIN ?= docker compose +COMPOSE_FILE ?= compose.yaml +ENV_FILE ?= .env + +up: + $(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) up -d --build + +down: + $(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) down + +ps: + $(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) ps + +logs: + $(COMPOSE_BIN) --env-file $(ENV_FILE) -f $(COMPOSE_FILE) logs -f --tail 100 + +.DEFAULT_GOAL := help +GO ?= go +APP_NAME ?= messenger +CMD_PKG := ./cmd/$(APP_NAME) +LOCAL_BIN := $(CURDIR)/bin +GOLANGCI_LINT_VERSION ?= v2.13.2 +GOLANGCI_LINT := $(LOCAL_BIN)/golangci-lint +OPENAPI_SPEC := contracts/openapi.json +OGEN_CONFIG := .ogen.yml +OAS_DIR := internal/transport/rest/internal/oas + +-include .env +export + +# .env feeds local tooling, but its application variables must not leak into the +# Go test process: the config tests assert defaults and the dev YAML, so an +# ambient REDIS_ENABLED/CACHE_ENABLED would fail them. +ENV_KEYS := $(shell sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p' .env 2>/dev/null) +CLEAN_ENV = env $(addprefix -u ,$(ENV_KEYS)) + +.PHONY: unit-test +unit-test: + $(CLEAN_ENV) $(GO) test -race -shuffle=on -count=1 -timeout=5m ./... + +.PHONY: integration-test +integration-test: + $(GO) test -tags=integration -p 1 -count=1 -timeout=15m ./internal/storage/postgres ./internal/storage/redis + +.PHONY: test-db-up test-db-down +test-db-up: + @docker-compose -f docker-compose.local.yaml up -d --wait postgres redis + +test-db-down: + @docker-compose -f docker-compose.local.yaml down + +# не учитываем генеренные файлы, также cmd в подсчете покрытия +COVER_EXCLUDE ?= /(mocks|oas)/|/cmd/ + +.PHONY: cover +cover: + $(CLEAN_ENV) $(GO) test -race -shuffle=on -count=1 -timeout=5m \ + -covermode=atomic -coverprofile=coverage.out.tmp ./... + @grep -Ev '$(COVER_EXCLUDE)' coverage.out.tmp > coverage.out + @rm coverage.out.tmp + $(GO) tool cover -func=coverage.out | tail -n 1 + $(GO) tool cover -html=coverage.out + +.PHONY: generate +generate: generate-api generate-mocks sqlc + +.PHONY: generate-api +generate-api: + $(GO) tool ogen --config $(OGEN_CONFIG) --target $(OAS_DIR) --package oas --clean $(OPENAPI_SPEC) + +.PHONY: generate-mocks +generate-mocks: + $(GO) tool mockery + +.PHONY: sqlc +sqlc: + $(GO) tool sqlc generate + +.PHONY: dev-up dev-down dev-reload +dev-up: + @docker-compose -f docker-compose.local.yaml up -d --build + +dev-down: + @docker-compose -f docker-compose.local.yaml down + +dev-reload: + @docker-compose -f docker-compose.local.yaml up -d --build --force-recreate + +.PHONY: migrate +migrate: + $(GO) run ./cmd/migrate up + +$(GOLANGCI_LINT): + GOBIN=$(LOCAL_BIN) $(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) + +lint: $(GOLANGCI_LINT) + $(GOLANGCI_LINT) run -v diff --git a/REPORT.md b/REPORT.md index c2679005..90e9a32b 100644 --- a/REPORT.md +++ b/REPORT.md @@ -1,37 +1,238 @@ # Отчёт — лабораторная 3 -- Автор, группа: TODO -- Целевая оценка; выбранный трек 5, если нужен: TODO -- Commit/PR: TODO после публикации -- Использованные источники, библиотеки и помощь ИИ: TODO +- Автор, группа: Владислав Кунецкий, БВT2303 +- Целевая оценка; выбранный трек 5, если нужен: 5; трек 1 «Цена масштабирования» +- Commit/PR: solution/bvt2303-kunetsky (fork репозитория лабораторной 3) +- Использованные источники, библиотеки и помощь ИИ: ogen (HTTP-транспорт из `contracts/openapi.json`), sqlc (SQL-слой), goose (миграции), pgx/v5, go-redis/v9, viper + validator (конфигурация), mockery/v3 + testify (тесты), zap через `log/slog`. Помощь ИИ использовалась для обсуждения архитектуры, ревью и подготовки кода; решение проверено и изменено автором. База перенесена из лабораторной 2. ## Запуск из чистого clone -TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных. +Требования: Docker Engine с Compose v2 (`docker compose`), `make`; Python 3.9+ (только стандартная библиотека) для проверок; Go 1.27 — для локальной сборки и unit/integration-тестов. + +Проверено на: macOS 25.5.0, Apple M5 Pro, 48 GiB RAM, Docker Engine 29.5.2 (Colima, macOS Virtualization.framework), Docker Compose 5.5.1, Go 1.27.1. Docker VM: **2 vCPU и ≈1.9 GiB RAM** — лимиты контейнеров в `compose.yaml` подобраны под этот бюджет (API 0.5 CPU / 256 MiB на реплику, PostgreSQL 0.5 CPU / 384 MiB, Redis 0.25 / 192 MiB, LB 0.25 / 64 MiB), суммарно меньше доступного. Образы зафиксированы по версии: `haproxy:3.2-alpine`, `redis:7.4-alpine`, `postgres:18-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873`; приложение собирается из `Dockerfile` (`golang:1.27.1-alpine` → `alpine:3.22`), сборка ограничена `GOFLAGS=-p=2`, чтобы компилятор Go не выбил память небольшой VM. + +```sh +cp .env.example .env # синтетические креды локального стенда, реальных секретов нет +make up # docker compose --env-file .env up -d --build +make ps # контейнеры и health +curl -fsS http://localhost:8080/health/ready + +make test # публичный smoke (профиль lab3) через LB +make test-idempotency # параллельные повторы одного Idempotency-Key +make test-persistence ACTION_SCRIPT=scripts/restart.sh +make test-failover ACTION_SCRIPT=scripts/stop-one.sh +python3 student-tests/replica_failover.py --action-script scripts/stop-one.sh +make test-lb-readiness # LB и реплика, потерявшая БД (readiness 503) +scripts/rolling_update.sh # поочерёдная замена реплик под нагрузкой + +make down # остановка стенда; named volumes остаются +``` + +Намеренное удаление учебных данных (удаляет volumes и сессии): + +```sh +docker compose --env-file .env down -v +``` + +Оператору достаточно `cp .env.example .env` и `make up`: миграции выполняет отдельный сервис `migrate` (`goose up`), он завершается успешно до старта API-реплик (`depends_on: service_completed_successfully`), поэтому реплики не гоняют схему наперегонки. Приложение принимает SIGTERM и дренирует сервер в пределах `SERVER_SHUTDOWN_TIMEOUT=10s`; у контейнера API `stop_grace_period: 15s`, чтобы Docker не убил запрос в полёте. + +### Соответствие переменных `.env.example` реальной конфигурации + +| Логическое имя из задания | Реальная переменная | Смысл | +| --- | --- | --- | +| `APP_HOST` / `APP_PORT` | `SERVER_HOST` / `SERVER_PORT` | адрес и порт HTTP-сервера API | +| `APP_ENV` | `APP_ENV` | выбор `config//config.yaml`; реализован только `dev` | +| `SESSION_STORE=postgres` | — | сессии лежат в PostgreSQL (`sessions.token_hash`), параметр не нужен | +| `DATABASE_URL_FILE` | `POSTGRES_*` | параметры подключения к общей БД без файлов секретов | +| `CACHE_URL_FILE` | `REDIS_*`, `CACHE_*` | общий кэш списка чатов и его блокировки | +| `IDEMPOTENCY_TTL_SECONDS` | `IDEMPOTENCY_TTL_SECONDS` | срок хранения записи идемпотентности (по умолчанию 86400 с) | +| `API_REPLICAS` | `API_REPLICAS` | число API-реплик стенда (`deploy.replicas`) | +| — | `API_CPU_LIMIT` / `API_MEM_LIMIT` | лимиты CPU/RAM одной реплики (для профилей трека 1) | +| — | `POSTGRES_CPU_LIMIT` / `POSTGRES_MEM_LIMIT` / `POSTGRES_MAX_CONNS` | бюджет общего PostgreSQL и пул соединений одной реплики (трек 1) | +| — | `SERVER_MAX_BODY_BYTES` | предел размера тела запроса (413 при превышении) | +| — | `LB_STATS_PORT` | loopback-порт страницы оператора HAProxy | ## Архитектура и решения -TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab2, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации. +Схема: клиент → LB (HAProxy с активными проверками `/health/ready`) → 2+ API-реплики → общие PostgreSQL и Redis. Единая точка входа — только LB: `127.0.0.1:8080`; порты API и хранилищ наружу не публикуются. + +| Роль | Сервис в compose | Образ / версия | Проверка готовности | Сеть и порт | Данные | +| --- | --- | --- | --- | --- | --- | +| Единая точка входа | `lb` | `haproxy:3.2-alpine` | активный `httpchk GET /health/ready`, период 2 с, `fall 2 rise 2` | публикует `127.0.0.1:8080`; страница оператора `127.0.0.1:8404` | — | +| API-реплики | `api`, `deploy.replicas=${API_REPLICAS:-2}` | сборка из `Dockerfile` → `mtusi-messenger:lab3` | Docker healthcheck `/health/ready`, интервал 10 с | только внутренняя сеть, alias `api-replica` | — | +| Миграции схемы | `migrate` | тот же образ, one-shot `goose up` | завершение с кодом 0 до старта реплик | только внутренняя сеть | — | +| Источник истины | `postgres` | `postgres:18-alpine@sha256:77f5…1873` | `pg_isready`, 5 с | только внутренняя сеть | volume `postgres18-data` | +| Кэш и блокировки | `redis` | `redis:7.4-alpine` (AOF everysec) | `redis-cli ping`, 5 с | только внутренняя сеть | volume `redis7-data` | +| Credentials | — | — | — | `.env` (вне git, синтетические значения для локального стенда), в контейнеры передаются явными переменными | — | + +- **Источник истины — PostgreSQL**: пользователи, чаты, участники, сообщения, серверные сессии (`sha256(token)`), записи идемпотентности. Транзакционные границы: создание чата вместе с участниками; отправка сообщения вместе с записью идемпотентности. +- **Redis/Valkey** — кэш списка чатов с распределённой блокировкой от stampede и версиями (`user_chat_versions`); не хранит ничего, что нужно для корректности ответа. +- **Общие сессии**: сессия создаётся одной репликой, любые другие её читают из БД, поэтому логин не привязан к реплике (sticky-сессии не используются). +- **`X-Instance-Id`**: значение стабильно в пределах процесса (`INSTANCE_ID` или hostname = короткий ID контейнера) и проставляется middleware на **каждый** ответ, включая ошибки 400/404/405, которые формирует транспорт, а не handler. +- **Идемпотентность отправки** (`Idempotency-Key` обязателен, `[A-Za-z0-9._:-]{1,128}`): + - таблица `message_idempotency (actor_id, chat_id, key, request_hash, message_id, expires_at)`, PK `(actor_id, chat_id, key)` — область уникальности «пользователь + чат + ключ»; + - claim — один `INSERT ... ON CONFLICT (actor_id, chat_id, key) DO UPDATE ... WHERE expires_at <= now() RETURNING`: живая запись не перезаписывается, истёкшая занимается заново; + - вставка сообщения и запись `message_id` идут в **одной транзакции с claim**, поэтому не бывает ключа без сообщения и наоборот; при откате (например, отправитель не участник) ключ не занимается; + - конкурентный повтор через разные реплики блокируется на строке и после коммита победителя возвращает его сообщение → ровно один INSERT в `messages`; + - повтор с тем же ключом и другим payload — `409`, для этого хранится `request_hash` (sha256 канонического payload `{"text":...}`; порядок ключей и пробелы в JSON не влияют). +- **LB**: HAProxy 3.2 (образ зафиксирован), `server-template api 4 api-replica:8080` + `resolvers docker` (Docker DNS 127.0.0.11, `hold valid 5s`) — адреса берутся из общего сетевого alias, выданного всем репликам, и переразрешаются каждые 5 с, поэтому масштабирование (1/2/4), замена контейнеров и смена IP не требуют правки конфига. Балансировка `leastconn`. Aктивные проверки готовности: `option httpchk GET /health/ready` + `http-check expect status 200`, `inter 2s fall 2 rise 2` — неготовая реплика исключается из ротации за ≤4 с и возвращается за ≤4 с. Это принципиально: пассивные проверки (nginx OSS, прежний вариант) не умели убирать реплику, которая остаётся доступной по сети, но теряет БД — она продолжала получать трафик и отвечать 503 (зафиксировано в ревью: 20 из 40 запросов `/health/live`). После перехода на активные проверки такая реплика получает **0 из 40** запросов, её статус `DOWN` (`evidence/lb-readiness.txt`), а запись через LB не прерывается (1 247 RPS, ноль ошибок в том же сценарии). +- **Повторы и идемпотентность**: HAProxy настроен на `retry-on conn-failure` + `retries 2` — повтор происходит только когда соединение не установилось и запрос не ушёл. Уже отправленный POST не повторяется, поэтому прозрачного дублирования создания чата нет (прежний вариант с `proxy_next_upstream ... non_idempotent` этим страдал). Неопределённый результат повтора остаётся за клиентом, а отправка сообщения защищена обязательным `Idempotency-Key`. +- **Страница оператора**: `127.0.0.1:8404/stats` (только loopback) показывает, какие реплики `UP`/`DOWN` и почему — именно по ней сняты доказательства выше. +- **Предел размера тела**: `SERVER_MAX_BODY_BYTES` (по умолчанию 256 КиБ). Тело больше лимита отклоняется с `413` до чтения и декодирования, поэтому публичный `POST /api/v1/users` не может выбить память реплики (раньше JSON-декодер читал тело целиком до любой валидации и до аутентификации). Для вложений ЛР4 (до 10 MiB) значение поднимается явно — это объявленный переход. +- **Логи**: заголовочные параметры (в том числе `Idempotency-Key`) попадают в лог как `redacted`, тела запросов — только своим размером; пароли, токены и содержимое сообщений не логируются. +- **Миграции**: одна последовательность для всего стенда (`migrate`), совместимость с работающей версией — новая таблица добавляется отдельной миграцией, старый код её не читает. Новая миграция пронумерована `00003`, а не `00002`: в базе, перенесённой из ЛР2, goose уже содержит применённую версию 2 (другая миграция того же репозитория), и совпадающий номер был бы молча пропущен при обновлении существующего стенда — это проверено на dev-базе (`goose: no migrations to run. current version: 2` при отсутствующей таблице). + +### Что перенесено из lab2 + +Перенос: ветки `lab1` + `lab2` репозитория `mtusi-messenger`, перенесены только исходники, миграции, собственные тесты, Dockerfile и конфигурации (по правилам CONTRIBUTING.md; README/COURSE/contracts/публичные tests остались от skeleton ЛР3). + +- Транспорт: HTTP-слой, сгенерированный ogen из `contracts/openapi.json`, REST-адаптер поверх него, middleware X-Request-Id и структурного логирования. +- Домен и сервисы: user / chat / message / session с валидацией и keyset-пагинацией. +- PostgreSQL — источник истины: pgx + sqlc, миграции goose, транзакции на создание чата. +- Сессии: Basic только при создании сессии, далее Bearer; в БД `sha256(token)`, TTL, переживают перезапуск процесса. +- Redis/Valkey: кэш списка чатов с распределённой блокировкой от stampede (`user_chat_versions`). +- Наблюдаемость: `/health/live`, `/health/ready`, структурированные логи (log/slog + zap). +- Инструменты: multi-stage `Dockerfile`, `docker-compose.local.yaml` для локального запуска, Makefile-таргеты, `.github/workflows/app.yml`. + +### Изменения в этой работе (лаб. 3) + +- Контракт 1.3.0: транспорт перегенерирован, `X-Instance-Id` во всех ответах, обязательный `Idempotency-Key` для отправки сообщения. +- Общая идемпотентность в PostgreSQL (миграция `00003_message_idempotency.sql`, sqlc-запросы, транзакция в `MessageRepository.Create`), 409 на конфликт payload. +- `IDEMPOTENCY_TTL_SECONDS` в конфиге (по умолчанию 24 ч), `.env.example` приведён к реальным переменным. +- Стенд ЛР3: `compose.yaml` (LB + `API_REPLICAS` реплик + PostgreSQL + Redis + одноразовый `migrate`), конфигурация LB `infra/lb/haproxy.cfg` (активные проверки готовности, ограниченные повторы, страница оператора), action-скрипты `scripts/stop-one.sh` и `scripts/restart.sh`, Makefile-таргеты `up/down/ps/logs`. +- Собственные проверки: `make test-idempotency` (параллельные повторы через LB), `student-tests/replica_failover.py` (поочерёдная остановка каждой реплики с метриками), `scripts/lb_readiness_check.sh` (неготовая реплика и LB), `scripts/rolling_update.sh`, эксперименты трека 1. +- Исправления по итогам аудита: отправка в несуществующий чат больше не даёт `500` из-за нарушения внешнего ключа от claim'а ключа идемпотентности (`23503` → `404`); добавлен предел размера тела (`413`, см. выше); заголовочные параметры не пишутся в лог; у проверок LB задан `timeout check 1s`, чтобы «залипшая» реплика исключалась за ограниченное время; у собственного сценария rolling update появился настоящий «наплыв» (новая реплика поднимается до снятия старой) и корректный счётчик 5xx (в HAProxy статус в логе печатается без кавычки, прежний шаблон молча давал нули). +- `Dockerfile`: убран жёстко заданный `TARGETARCH=amd64` — на Apple Silicon он давал x86-64 бинарник внутри arm64-образа, тот исполнялся через эмуляцию и падал по runtime-фаталам под нагрузкой (см. «Ограничения»); сборка ограничена `GOFLAGS=-p=2`, чтобы компилятор не выбил память небольшой Colima VM. +- Удалён осиротевший `scripts/track1_benchmark.py` (бенчмарк in-memory хранилища ЛР1: сам in-memory store удалён ещё в ЛР2, скрипт ссылался на несуществующий файл). ## Доказательства критериев +Артефакты ЛР1/ЛР2 перенесены в `evidence/lab1-2/` (там же пояснение, почему они не относятся к этой работе); в `evidence/` — только доказательства ЛР3. + | Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства | | --- | --- | --- | --- | -| Публичный smoke | make test | TODO | TODO | -| Остальные пункты уровня 3 | TODO | TODO | TODO | -| Все пункты уровня 4, если заявлен | TODO | TODO | TODO | -| Выбранный трек 5, если заявлен | TODO | TODO | TODO | +| Публичный smoke | `make test` | `PASS: lab3 public API scenario` через LB с двумя репликами | `evidence/smoke.txt` | +| Разные запросы одного пользователя обслуживают разные реплики | 40× `GET /users/me` через LB одной сессией (и 40× `/health/live`) | два разных `X-Instance-Id`, распределение видно по репликам | `evidence/failover/sequential.txt` (одна сессия), `evidence/lb-readiness.txt` (счётчики по репликам) | +| Идемпотентность: повтор, конкурентный повтор, смена реплики | `make test-idempotency` | 12 параллельных повторов одного ключа → одно сообщение; 12 разных payload → один 201 и одиннадцать 409; без ключа и с недопустимым ключом → 400 | `evidence/idempotency.txt` | +| Остановка одной реплики при работающей другой | `make test-failover ACTION_SCRIPT=scripts/stop-one.sh` (два прогона) | 127 и 100 подтверждённых записей, 0 ошибок, первое восстановление 0.21 с и 2.24 с | `evidence/failover/run1.txt`, `evidence/failover/run2.txt` | +| Последовательно остановлена каждая реплика, с измерениями (RPS, ошибки, время) | `python3 student-tests/replica_failover.py --action-script scripts/stop-one.sh` | реплика A: 91 запись (6.06 RPS), 0 ошибок, восстановление 1.66 с; реплика B: 100 записей (6.66 RPS), 0 ошибок, 1.66 с; после отказа обслуживает только вторая реплика; восстановление обеих 0.18–0.20 с; дублей нет (191 сообщение) | `evidence/failover/sequential.txt` | +| LB исключает неготовую реплику | `scripts/lb_readiness_check.sh` | реплика с потерянной БД (осталась доступной, readiness 503): **0 из 40** запросов, статус `DOWN` **через 2 с** (проверка `inter 2s fall 2 timeout check 1s`), при этом запись через LB не прервалась (1 163 RPS, 0 ошибок) | `evidence/lb-readiness.txt` | +| Предел размера тела | `python3`-проверка публичного `POST /api/v1/users` | тело 400 КиБ (сверх лимита 256 КиБ) → `413`, тело 100 КиБ → `400` (схема); реплика не выбита | `evidence/body-limit.txt` | +| Отказ БД не превращается в 500 | `python3`-проверка: `POST` сообщения напрямую в реплику (в обход LB) при остановленном PostgreSQL | напрямую к реплике — `503`, через LB — `503` с `X-Instance-Id` (ответ приложения), после возврата БД — `201` | `evidence/db-outage.txt` | +| Сохранность при перезапуске API и хранилищ | `make test-persistence ACTION_SCRIPT=scripts/restart.sh` | `PASS`: подтверждённые сообщения и прежний токен после перезапуска, volumes не удалялись | `evidence/persistence.txt` | +| Лимиты CPU/RAM, отсутствие публичных портов API, отсутствие `container_name` | `docker compose --env-file .env config`, `docker ps` | лимиты у каждого сервиса, публикуется только `127.0.0.1:8080` (LB) | `evidence/stand.txt` | +| Поочерёдная замена реплик под нагрузкой | `scripts/rolling_update.sh` (60 с, 8 клиентов; наплыв по одной реплике) | 97 359 подтверждённых записей, 3 переходные ошибки (0.003 %), **3 ответа 5xx от LB** за окно обновления, `restarts=0`; каждый шаг подтверждён сменой образа новых реплик и числом UP-слотов | `evidence/rolling-update/after/` | +| Контроль: тот же код вне Docker | `student-tests/rolling_update_load.py` против нативного процесса (90 с, 32 клиента) | 220 781 запрос, 0 ошибок, 2 452 RPS, p50 12.5 мс, p95 17.5 мс, p99 22.4 мс | `evidence/native-load.txt` | +| Проверки качества | `make check`, `make validate`, `make unit-test` (`-race`), `make integration-test` | все PASS, включая интеграционный тест «отправка в несуществующий чат → 404» | `evidence/quality.txt` | +| Трек 1: цена масштабирования | `scripts/track1_series.sh` + `scripts/track1_controls.sh` + `scripts/track1_report.py` | потолок ≈1 300–1 550 RPS: 1/2/4 реплики → −3 %/−5 %; бюджет API ×3, бюджет БД ×2 и бюджет LB ×4 не меняют RPS (перемежающий контроль: ±0.05 %), пул соединений не исчерпан; дрейф серии измерен | `evidence/track1/summary.md`, `evidence/track1/scaling-*.png` | -TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены. +`make check`, `make validate` (полная OpenAPI-валидация в venv) и `make unit-test` (`-race`) проходят; интеграционные тесты PostgreSQL (`-tags=integration`, включая конкурентный повтор одного ключа) — тоже. ## Эксперименты и отказы -TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения. - | Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных | | --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | +| `docker stop` одной API-реплики (прогон 1) | записи продолжаются, остановленная реплика исчезает из ответов | 127 успешных записей, 0 ошибок | 0.21 с | +| `docker stop` другой API-реплики (прогон 2) | то же | 100 записей, 0 ошибок | 2.24 с | +| Поочерёдно остановлены обе реплики (свой скрипт) | после каждой остановки пишет только вторая реплика, дублей нет | 91 и 100 записей (6.06 и 6.66 RPS), 0 ошибок, повторы с тем же ключом дубля не создали | 1.66 с и 1.66 с | +| Одной реплике закрыт доступ к БД (она остаётся доступной, readiness 503) | LB исключает её из ротации | 0 из 40 запросов ей, статус `DOWN` через 2 с, запись через LB не прервалась | — | +| Поочерёдная замена каждой реплики под нагрузкой (наплыв) | потери только на время остановки, дублей нет | 97 359 записей, 3 переходные ошибки, 3 ответа 5xx от LB, `restarts=0`, смена образа подтверждена по шагам | окно замены 5–6 с на реплику | +| Перезапуск API и всех хранилищ с сохранением volumes | сессия и данные живут | `PASS`, прежний токен работает | потери нет | +| Эмуляция x86-64 бинарника в arm64-образе (`--build-arg TARGETARCH=amd64`) | реплики замедляются и падают | в контроле (45 с, 8 клиентов) падений **не воспроизведено**: 89 560 запросов, 0 ошибок, 0 ответов 5xx; crash-loop наблюдались в других условиях | эффект не измерен (`evidence/rolling-update/emulated/`) | +| Удвоенный CPU БД, четырёхкратный CPU LB, пул 5 вместо 10, 32 клиента | пропускная способность вырастет, если узкое место — БД, LB или пул | бюджеты БД и LB не меняют RPS (перемежающий контроль: +0.04 % и −0.02 % при лимитах, проверенных по `docker inspect`); меньший пул хуже (−7 %); 32 клиента снижают RPS до 1 284 и растят p95 до 52.8 мс | `evidence/track1/summary.md`, `evidence/load-32clients.txt` | + +## Трек 1. Цена масштабирования + +Методика: один и тот же профиль `tests/load.py` (closed loop, `concurrency=8`, `duration=60` с, прогрев 15 с) против стенда на 1, 2 и 4 API-репликах при **фиксированном суммарном бюджете** 1.0 CPU / 768 MiB на API; затем серия с ростом бюджета — 2 реплики и суммарно 0.5, 1.0 и 1.5 CPU. Бюджеты общих хранилищ между профилями не меняются: PostgreSQL 0.50 CPU / 384 MiB, Redis 0.25 / 192, LB 0.25 / 64. В контрольных профилях меняется ровно одна ручка: пул соединений реплики 10 → 5, бюджет CPU PostgreSQL 0.50 → 1.00, бюджет CPU балансировщика 0.25 → 1.00. + +Бюджеты хранилищ compose применяет при **создании** контейнера, поэтому скрипт пересоздаёт PostgreSQL и LB, когда бюджет профиля отличается от действующего, и проверяет применение по `docker inspect`: в `profile-*.json` и в строке `=== applied … ===` сводки попадают значения, снятые с работающих контейнеров, а не переменные запуска. Без этой проверки профиль описывал бы намерение, а измерение шло бы на прежнем лимите — на этом и провалился первый контроль удвоения CPU БД; тот прогон вместе с прогоном, где нагрузку подавал клиент хоста, лежит в `evidence/track1/superseded/`. Генератор работает **внутри VM** (`CLIENT=vm`, контейнер в сети стенда): клиент на хосте через проброс порта под шквалом новых соединений получает отказы самого проброса, не относящиеся к стенду (разбор — `evidence/path-overhead/`). Вся серия снимается одной командой `scripts/track1_series.sh` (~15 минут); профили с уже снятыми артефактами при повторном запуске пропускаются. + +Бюджеты выбраны под Colima VM (2 vCPU, ≈1.9 GiB), чтобы измерения шли в её пределах, а не за счёт хоста. Ресурсы реплик считаются суммированием по одному timestamp: в первой версии сводки несколько реплик усреднялись как одна выборка, что занижало CPU и память вдвое — исправлено, сырые CSV не менялись. Сводка учитывает только контейнеры своего проекта (`--prefix`): параллельно поднятый стенд другой лаборатории иначе попадал в те же колонки (`…-lab2-postgres-1` → `postgres`). Сырые артефакты — `evidence/track1/` (`load-*.json`, `stats-*.csv`, `profile-*.json`), сводка — `evidence/track1/summary.md`, графики — `scaling-fixed-budget.png` и `scaling-growth.png`. + +### Профили и результаты + +Серия 1 — фиксированный суммарный бюджет 1.0 CPU / 768 MiB на API (PostgreSQL 0.50 CPU / 384 MiB, Redis 0.25, LB 0.25), нагрузка `tests/load.py` (closed loop, 8 клиентов, 60 с, прогрев 15 с, клиент внутри VM): + +| реплик | CPU на реплику | успешный RPS | p50, мс | p95, мс | p99, мс | ошибки | API CPU (сумма) | PG CPU | LB CPU | строк в `messages` | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| 1 | 1.00 | 1 542.9 | 5.05 | 8.01 | 10.24 | 0 | 0.24 | 0.39 | 0.10 | 3.60 млн | +| 2 | 0.50 | 1 491.3 | 5.25 | 8.23 | 10.30 | 0 | 0.28 | 0.36 | 0.10 | 3.71 млн | +| 4 | 0.25 | 1 415.7 | 5.54 | 8.61 | 10.75 | 0 | 0.31 | 0.35 | 0.10 | 3.82 млн | + +Серия 2 — рост бюджета API при 2 репликах: + +| суммарный CPU API | CPU на реплику | успешный RPS | p95, мс | ошибки | API CPU (сумма) | PG CPU | +| --- | --- | --- | --- | --- | --- | --- | +| 0.5 | 0.25 | 1 489.9 | 8.25 | 0 | 0.28 | 0.36 | +| 1.0 | 0.50 | 1 496.3 | 8.22 | 0 | 0.27 | 0.37 | +| 1.5 | 0.75 | 1 491.3 | 8.18 | 0 | 0.27 | 0.36 | + +Трехкратный бюджет API не сдвигает пропускную способность (1 490 → 1 496 → 1 491), а лишние реплики при неизменном суммарном бюджете её снижают: каждая реплика — ещё один процесс, соединения и копия кэша, а суммарный CPU фиксирован. + +Отказов в чистой серии почти нет: 13 профилей из 15 без единого отказа, в двух профилях `pool` — по 4 обрыва в момент пересоздания реплики. Прежние прогоны показывали до 26 % отказов, но это были отказы соединений **у клиента на хосте**, а не у стенда: в контроле `evidence/path-overhead/` балансировщик отдал все запросы без 5xx, логи API не содержат ошибок, а клиент внутри VM не отказал ни разу. Подтверждённых записей не потеряно: повтор с тем же ключом дубля не создаёт (см. проверку идемпотентности). + +Контроль снят попарно с эталоном, чтобы дрейф серии не выдавался за эффект бюджета (`scripts/track1_controls.sh`; лимиты применены к контейнерам и проверены по `docker inspect`): + +| профиль | что изменено | успешный RPS | отличие от соседнего эталона | +| --- | --- | --- | --- | +| `ctl1base` / `ctl3base` | эталон (2 реплики, PostgreSQL 0.50, LB 0.25) | 1 391.1 / 1 360.1 | −2.2 % за два профиля — масштаб дрейфа | +| `ctl2pg` | бюджет CPU PostgreSQL 0.50 → 1.00 | 1 391.6 | **+0.04 %** | +| `ctl4lb` | бюджет CPU балансировщика 0.25 → 1.00 | 1 359.8 | **−0.02 %** | +| `pool10` / `pool5` | пул соединений реплики 10 → 5 (4 реплики) | 1 399.0 / 1 299.6 | −7 % (меньший пул хуже) | +| 32 клиента вместо 8 | — | 1 284 | p95 52.8 мс вместо ≈8-9 мс (`evidence/load-32clients.txt`) | + +Профили серии `db1cpu` (PostgreSQL 1.00) и `lb1cpu` (LB 1.00) показывают на 15 % и 8 % меньше, чем `r2`, но сняты позже, и разница объясняется дрейфом: тот же профиль `r2`, повторённый в конце серии (`d2`), даёт 1 389 RPS вместо 1 491 (−6.9 %). Поэтому вопрос «помогает ли бюджет БД» решают именно перемежающие профили, а не сравнение через полчаса. + +Стенд дрейфует по ходу серии: таблица `messages` растёт (≈95 тыс. строк на профиль, 3.6 → 5.1 млн за серию), и эталон `r2`, снятый в начале и в конце, даёт 1 491 и 1 389 RPS (−6.9 %, ≈0.9 % на профиль); независимая оценка дрейфа по двум эталонам перемежающего контроля — 2.2 % за два профиля. Повторы одной конфигурации внутри сессии расходятся до ~2 %. Поэтому профили сравнимы только внутри одной серии и рядом по времени, а влияние каждой ручки проверяется попарно с эталоном. Качественный вывод устойчив: **три независимые серии** дали одно и то же — рост числа реплик при фиксированном бюджете не помогает (первая: +3 % на двух, −9 % на четырёх; вторая: −7 % и −8 %; третья, чистая: −3.3 % и −5.1 %). + +### Где насыщение + +Потолок закрытого цикла на этой машине — **≈1 300–1 550 RPS подтверждённых записей**, и ни одна ручка стенда его не двигает: + +| что меняли | как проверено | результат | +| --- | --- | --- | +| число API-реплик 1 → 2 → 4 при неизменном суммарном бюджете | серия 1 | −3.3 % и −5.1 % | +| суммарный бюджет API 0.5 → 1.0 → 1.5 CPU | серия 2 | +0.1 % (плоско) | +| бюджет CPU PostgreSQL 0.50 → 1.00 | перемежающий контроль | +0.04 % | +| бюджет CPU балансировщика 0.25 → 1.00 | перемежающий контроль | −0.02 % | +| пул соединений реплики 10 → 5 | пара профилей при 4 репликах | −7 % (хуже) | +| клиент на хосте вместо клиента внутри VM | `evidence/path-overhead/` | тот же RPS (1 539 против 1 475) | +| 32 клиента вместо 8 | `evidence/load-32clients.txt` | 1 284 RPS, p95 растёт до 52.8 мс | + +Измерениями исключены: **клиент** (тот же закрытый цикл по тривиальному серверу на хосте даёт 4 469 RPS без отказов), **путь «хост → проброс порта → VM»** (клиент внутри VM даёт ту же пропускную способность), **квоты CPU PostgreSQL и LB** (перемежающий контроль: ±0.05 % при лимитах, проверенных по `docker inspect`), **размер пула** (19–22 соединения из 100; меньший пул только вредит). Сами сервисы при этом недогружены: реплики вместе берут 0.24–0.31 ядра из бюджета 1.0, PostgreSQL — 0.35–0.39 из 0.50, LB — 0.10 из 0.25 (в `docker stats` 100 % = одно ядро, проверено отдельным экспериментом: `evidence/quota-semantics.txt`). + +Значит упор не в бюджет и не в число процессов, а в стоимость одной записи: сообщение — это транзакция из трёх обращений к БД (claim ключа идемпотентности, вставка сообщения, запись `message_id`), плюс проверка участников чата и работа с кэшем списка чатов, и всё это на 2 vCPU. Гипотеза следующего шага: сократить путь записи до двух обращений (вставка сообщения и upsert ключа в одной транзакции, конфликт — откат и повторное чтение) и перемерить перемежающим контролем. Числа сняты на одной конфигурации одиночными прогонами закрытого цикла, поэтому это не «предельная ёмкость системы»: на другом Docker-host потолок будет иным (см. «Ограничения»). + +### Подтверждённое улучшение и проверенные гипотезы + +**Подтверждено (измерено до/после):** балансировщик перестал отправлять трафик неготовой реплике. `scripts/lb_readiness_check.sh` поднимает рядом с рабочими репликами третью с тем же сетевым alias, но её доступ к БД идёт через временный TCP-прокси; после остановки прокси реплика остаётся доступной по сети, её `/health/ready` отвечает 503. + +| Вариант LB | запросов неготовой реплике из 40 | статус в LB | запись через LB | +| --- | --- | --- | --- | +| пассивные проверки (nginx OSS, до правки) | 20 из 40 `/health/live` и бизнес-запросы (зафиксировано в ревью) | продолжает обслуживать | 503 и 200 вперемешку | +| активные проверки (HAProxy, `httpchk /health/ready`, `inter 2s fall 2 rise 2`, `timeout check 1s`) | **0 из 40** | `DOWN` **через 2 с** (измерено) | 1 163 RPS, 0 ошибок (`evidence/lb-readiness.txt`) | + +Вместе с этим убраны две связанные проблемы: прозрачный повтор POST (`proxy_next_upstream ... non_idempotent` мог повторить создание чата) заменён на `retry-on conn-failure`, а недоступная реплика убирается из ротации полностью, а не «на 3 секунды». Сценарий rolling update проходит под нагрузкой: 97 359 подтверждённых записей, 3 переходные ошибки (0.003 %), `restarts=0` (`evidence/rolling-update/after/`, где каждый шаг подтверждён сменой образа новой реплики и числом UP-слотов). + +**Дефект доказан, эффект его устранения — нет.** Архитектурная ошибка унаследованного `Dockerfile` (`ARG TARGETARCH=amd64`, а классический builder платформу не подставляет → x86-64 бинарник в arm64-образе) подтверждена ELF-заголовками (`evidence/arch.txt`): `e_machine=0x3e` против `0xb7`. Но контролируемое сравнение **не подтвердило**, что именно она вызывала прежние runtime-фаталы: прогон rolling update на эмулируемом образе завершился без ошибок — 89 560 успешных запросов за 45 с, 0 ошибок, 0 ответов 5xx (`evidence/rolling-update/emulated/load.json`). Падения (`fatal error: found pointer to free object`, `sync: inconsistent mutex state`, crash-loop реплик) наблюдались в других условиях и в приложенный A/B не попали. Корректная формулировка: эмуляция x86-64 на arm64 — доказанный дефект сборки, который устранён, но его вклад в те падения не измерен. + +**Проверено измерениями (перемежающий контроль, лимиты подтверждены по `docker inspect`):** ни бюджет CPU PostgreSQL (0.50 → 1.00), ни бюджет CPU балансировщика (0.25 → 1.00) не меняют пропускную способность (+0.04 % и −0.02 %), поэтому потолок закрытого цикла на этой машине задаёт не нехватка ресурсов у БД или LB. Пул соединений 10 → 5 при четырёх репликах оказался хуже на 7 % — меньший пул не улучшение, а потеря. + +**Следующий шаг для измерения:** сократить число обращений к БД на одно сообщение — сейчас их три (claim ключа, вставка сообщения, запись `message_id`), нужно два (вставка сообщения + upsert ключа в той же транзакции, конфликт — через откат и повторное чтение). Гипотеза: меньше round-trip и меньше версий строк. Эффект измеряется тем же способом, что и бюджеты, — перемежающим контролем (`scripts/track1_controls.sh`: эталон → изменение → эталон), потому что собственный дрейф серии сопоставим с ожидаемым выигрышем. ## Ограничения и следующие шаги -TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза. +- **Архитектура образа (главная находка этапа отладки).** Унаследованный `Dockerfile` содержал `ARG TARGETARCH=amd64`, а классический builder платформу не подставляет — в arm64-образ попадал x86-64 бинарник (`e_machine=0x3e` против `0xb7` у busybox базового образа; в стеке паники видно `runtime/asm_amd64.s`). Пока нагрузка была низкой, эмуляция справлялась; под нагрузкой Go runtime падал с `fatal error: found pointer to free object`, `sync: inconsistent mutex state`, `bad pointer in Go heap`, `runtime: name offset base pointer out of range` — и это выглядело как проблема приложения. Контрольный эксперимент снял подозрения с кода: тот же исходник, собранный нативно (вне Docker, против локальной БД), выдержал 90 с при 32 клиентах — 220 781 запрос, 0 ошибок, p50 12.5 мс, p95 17.5 мс, p99 22.4 мс, 2 452 успешных RPS (`evidence/native-load.txt`), тогда как контейнерный стенд через LB даёт ≈1 300–1 700 RPS. После исправления (`ARG TARGETARCH` без значения по умолчанию, кросс-сборка — явным `--build-arg`) стенд стабилен, однако строгий A/B связь с прежними падениями не подтвердил (см. «Подтверждённое улучшение»). Если вы собираете под другую платформу, задавайте `TARGETOS`/`TARGETARCH` явно. +- **Ресурсы VM.** Colima (macOS Virtualization.framework) даёт 2 vCPU и ≈1.9 GiB RAM: сборка образа была один раз убита OOM, поэтому компилятор ограничен `GOFLAGS=-p=2`, а бюджеты экспериментов трека 1 подобраны под VM (1.0 CPU суммарно на API), иначе измеряется не масштабирование, а нехватка ресурсов. +- **Измерения трека 1 не переносятся на другую машину.** Все числа получены на одной конфигурации (Docker VM: 2 vCPU, ≈1.9 GiB; хост: 18 ядер) одиночными прогонами закрытого цикла, поэтому это не «пропускная способность системы», а точки одного профиля на конкретном стенде: на другом Docker-host и потолок, и точка насыщения будут иными, а сравнивать между собой можно только профили одной серии. +- **Что означает CPU% в `docker stats`.** Проверено экспериментом: контейнер, упёртый в `--cpus 0.5` (`cpu.max = 50000 100000`), показывает 49.49 %, то есть процент считается от одного ядра и 50 % = полная квота 0.5 CPU (`evidence/quota-semantics.txt`). Прежняя оговорка отчёта о «заниженных» значениях снята: колонки читаются однозначно. +- **Проброс порта хоста не выдерживает нагрузку генератора.** `tests/load.py` ходит без keep-alive (новое TCP-соединение на запрос). Клиент на хосте получает отказы соединения от проброса порта: в контроле `evidence/path-overhead/` тот же профиль дал 26 % отказов при клиенте на хосте и 0 % при клиенте внутри VM и тот же RPS. Точечный пробник из 40 000 быстрых подключений подряд получил 38 706 `ECONNREFUSED`, а прогон на ~4 500 соединений/с оставил проброс порта (вместе с доступом к Docker-эндпоинту Colima) неработоспособным до `colima restart`. Стенд при этом не падал: в прогонах с клиентскими отказами балансировщик отдал все запросы без 5xx, а логи API не содержат ни одной ошибки (сценарии отказа, персистентности и rolling update снимались клиентом на хосте раньше и прошли с 0-3 отказами — там темп новых соединений был ниже, чем в серии трека 1). Поэтому серия трека 1 снимается клиентом внутри VM. +- **«Потолок задаёт проброс порта» — опровергнуто измерением.** Прежняя формулировка объясняла потолок ≈1 500 RPS виртуализацией и пробросом порта. Контроль с клиентом внутри VM даёт ту же пропускную способность (1 475 против 1 539 RPS, различия в пределах разброса) вообще без проброса, значит этот путь потолок не задаёт; клиент тоже не потолок — тот же закрытый цикл по тривиальному локальному серверу даёт 4 469 RPS. Нативная оценка 2 452 RPS снята другим генератором, на хосте с 18 ядрами и против локальной БД, поэтому она не изолирует причину: отличается и доступный CPU, и способ подачи нагрузки. Корректная формулировка: узкое место — внутри стенда (путь записи сообщения), а не в виртуализации. +- **Окно обнаружения отказа.** Готовность проверяется активно (`httpchk /health/ready`, период 2 с, `fall 2`, `timeout check 1s`) — измеренное время перехода реплики в `DOWN` после потери БД: **2 с** (`evidence/lb-readiness.txt`); теоретическая верхняя граница ~4 с. Между фактическим отказом и первой неудачной проверкой реплика ещё получает трафик, поэтому клиент может увидеть 503 от неё или ошибку соединения — в измеренных сценариях это единичные переходные ошибки (0–2 %), они учтены в таблицах отказа. +- **Строгая проверка «до/после» по архитектуре не удалась.** Исходный дефект сборки доказан (ELF-заголовки), но воспроизвести падения в контролируемом A/B не удалось: эмулируемый образ в коротком прогоне тоже прошёл без ошибок. Считать эффект устранения измеренным нельзя. +- **Переходные ошибки при смене состава реплик.** HAProxy не повторяет уже отправленный POST (осознанно: прозрачный повтор неидемпотентной операции запрещён контрактом), а переиспользуемые соединения к снятому контейнеру рвутся — поэтому в момент замены или масштабирования клиент может увидеть единичный 502: ≤0.25 % в сериях трека 1 и 0.003 % в rolling update. Неопределённый результат клиент повторяет сам, и для сообщений это безопасно благодаря `Idempotency-Key`. +- Один Docker-host: эксперименты показывают отказ **процесса** API, но не отказ узла. Потеря хоста, а также LB, PostgreSQL и Redis остаются единичными точками отказа; выживание узла БД не заявлено. +- PostgreSQL не реплицирована, Redis не кластеризован — при их отказе стенд недоступен, это честное учебное упрощение. +- Генератор нагрузки `tests/load.py` — closed-loop: он ограничен клиентом и страдает coordinated omission, поэтому измеренный RPS — это пропускная способность HTTP-подтверждений, а не предельная ёмкость системы. Для серьёзных выводов нужен k6/Locust или свой open-loop генератор. +- **Принятые риски (осознанно, вне объёма ЛР3).** Пароли хешируются Argon2id с 64 МиБ памяти на хеш, а ограничителя частоты нет: 4–5 одновременных регистраций на реплику с бюджетом 256 МиБ могут её выбить, а перебор паролей не throttled. Контракт делает `429` факультативным, защита вынесена в ЛР7 по карте курса; предел размера тела при этом закрыт (см. выше). Страница оператора HAProxy доступна без аутентификации, но только на loopback. `docker-compose.local.yaml` (локальная разработка из ЛР2) публикует PostgreSQL и Redis на 127.0.0.1 с синтетическим паролем — для стенда ЛР3 не используется. `X-Request-ID` принимается от клиента как есть: это нужно для сквозной корреляции, подделка значения искажает только аудит, инъекция в лог невозможна (Go запрещает переводы строк в заголовках, лог пишется JSON). `Makefile` экспортирует `-include .env` в окружение рецептов — при синтетических значениях это безопасно. +- Записи идемпотентности не удаляются фоновым процессом: истёкшие строки занимаются лениво при повторном использовании ключа, остальные ждут будущей уборки (индекс `expires_at` уже есть). diff --git a/cmd/messenger/main.go b/cmd/messenger/main.go new file mode 100644 index 00000000..6179863a --- /dev/null +++ b/cmd/messenger/main.go @@ -0,0 +1,175 @@ +package main + +import ( + "context" + "errors" + "fmt" + "log/slog" + "net/http" + "os" + "os/signal" + "syscall" + "time" + + "mtusi-messenger/internal/config" + "mtusi-messenger/internal/health" + "mtusi-messenger/internal/logger" + "mtusi-messenger/internal/platform/cache" + "mtusi-messenger/internal/platform/token" + "mtusi-messenger/internal/service/chat" + "mtusi-messenger/internal/service/message" + "mtusi-messenger/internal/service/session" + "mtusi-messenger/internal/service/user" + "mtusi-messenger/internal/storage/postgres" + storageredis "mtusi-messenger/internal/storage/redis" + "mtusi-messenger/internal/transport/rest" +) + +func main() { + log := logger.New() + + cfg, err := config.Load() + if err != nil { + log.Error("load config", slog.Any("error", err)) + os.Exit(1) + } + + log = logger.New( + logger.WithLevel(cfg.SlogLevel()), + logger.WithFormat(cfg.LoggerFormat()), + ) + slog.SetDefault(log) + + if err := run(cfg, log); err != nil { + log.Error("shutdown with error", slog.Any("error", err)) + os.Exit(1) + } +} + +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) + if err != nil { + return fmt.Errorf("connect database: %w", err) + } + + defer store.Close() + + redisCache, err := connectRedis(cfg.Redis) + if err != nil { + return err + } + + defer func() { _ = redisCache.Close() }() + + sessionRepo := session.Repository(store.Sessions()) + chatRepo := chat.Repository(store.Chats()) + + pingers := []health.Pinger{store} + + if cfg.Redis.Enabled { + if cfg.Cache.Enabled { + distributed, err := cache.NewDistributed(redisCache, cache.DistributedConfig{ + LockTTL: cfg.Cache.LockTTL, + WaitTimeout: cfg.Cache.LockWaitTimeout, + }, log) + if err != nil { + return fmt.Errorf("build distributed cache: %w", err) + } + + chatRepo = storageredis.NewChatRepository( + store.Chats(), + distributed, + cfg.Cache.ChatListTTL, + log, + ) + } + + log.Info("redis cache enabled", slog.String("host", cfg.Redis.Host), slog.Int("port", cfg.Redis.Port)) + } + + ttl := time.Duration(cfg.Session.TTLSeconds) * time.Second + sessionService := session.NewService(sessionRepo, token.New(), ttl) + + router, err := rest.NewRouter( + rest.NewHandler( + user.NewService(store.Users()), + chat.NewService(chatRepo), + message.NewService(store.Messages()), + health.New(pingers...), + sessionService, + ), + rest.NewSecurityHandler(sessionService), + log, + cfg.Server.MaxBodyBytes, + ) + if err != nil { + return fmt.Errorf("build router: %w", err) + } + + server := &http.Server{ + Addr: cfg.Addr(), + Handler: router, + ReadHeaderTimeout: cfg.Server.ReadHeaderTimeout, + } + + errc := make(chan error, 1) + + go func() { + log.Info("server started", slog.String("addr", cfg.Addr())) + + if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { + errc <- err + } + + close(errc) + }() + + select { + case err, ok := <-errc: + if ok && err != nil { + return fmt.Errorf("listen: %w", err) + } + + return nil + case <-ctx.Done(): + } + + log.Info("shutdown signal received", slog.Duration("timeout", cfg.Server.ShutdownTimeout)) + + shutdownCtx, cancel := context.WithTimeout(context.Background(), cfg.Server.ShutdownTimeout) + defer cancel() + + if err := server.Shutdown(shutdownCtx); err != nil { + return fmt.Errorf("shutdown: %w", err) + } + + log.Info("server stopped") + + return nil +} + +func connectRedis(cfg config.Redis) (cache.LockStore, error) { + if !cfg.Enabled { + return cache.NoOpCache{}, nil + } + + client, err := cache.NewRedis(cache.RedisConfig{ + Host: cfg.Host, + Port: cfg.Port, + Password: cfg.Password, + DB: cfg.DB, + MaxRetries: cfg.MaxRetries, + DialTimeout: cfg.DialTimeout, + ReadTimeout: cfg.ReadTimeout, + WriteTimeout: cfg.WriteTimeout, + PoolSize: cfg.PoolSize, + }) + if err != nil { + return nil, fmt.Errorf("connect redis: %w", err) + } + + return client, nil +} diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go new file mode 100644 index 00000000..d980b523 --- /dev/null +++ b/cmd/migrate/main.go @@ -0,0 +1,89 @@ +package main + +import ( + "context" + "database/sql" + "errors" + "fmt" + "log/slog" + "os" + + "github.com/pressly/goose/v3" + + "mtusi-messenger/internal/config" + "mtusi-messenger/internal/logger" + "mtusi-messenger/internal/storage/postgres/migrations" + + _ "github.com/jackc/pgx/v5/stdlib" +) + +func main() { + log := logger.New() + + if err := run(os.Args[1:]); err != nil { + log.Error("migrate failed", slog.Any("error", err)) + os.Exit(1) + } +} + +func run(args []string) error { + cfg, err := config.Load() + if err != nil { + return fmt.Errorf("load config: %w", err) + } + + slog.SetDefault(logger.New( + logger.WithLevel(cfg.SlogLevel()), + logger.WithFormat(cfg.LoggerFormat()), + )) + + command := "up" + if len(args) > 0 { + command = args[0] + } + + db, err := sql.Open("pgx", cfg.Postgres.DSN()) + if err != nil { + return fmt.Errorf("open database: %w", err) + } + + defer func() { _ = db.Close() }() + + pingCtx, cancel := context.WithTimeout(context.Background(), cfg.Postgres.ConnectTimeout) + defer cancel() + + if err := db.PingContext(pingCtx); err != nil { + return fmt.Errorf("ping database: %w", err) + } + + goose.SetBaseFS(migrations.FS) + + if err := goose.SetDialect("postgres"); err != nil { + return fmt.Errorf("set dialect: %w", err) + } + + if err := goCommand(db, command); err != nil { + return err + } + + return nil +} + +func goCommand(db *sql.DB, command string) error { + switch command { + case "up": + return goose.Up(db, ".") + case "up-by-one": + return goose.UpByOne(db, ".") + case "down": + return goose.Down(db, ".") + case "status": + return goose.Status(db, ".") + case "version": + return goose.Version(db, ".") + case "redo": + return goose.Redo(db, ".") + default: + return errors.New("unknown command: " + command + " (up, up-by-one, down, status, version, redo)") + } +} diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..03b59d92 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,173 @@ +# Lab3 stand: two API replicas behind a HAProxy load balancer. +# +# cp -n .env.example .env +# docker compose --env-file .env up -d --build +# curl http://localhost:8080/health/ready +# +# Only the load balancer is published (127.0.0.1). Stores and API replicas are +# reachable from the host via `docker compose exec` / `docker compose logs`. +# No container_name anywhere: replica hostnames stay the short container IDs, +# which the application reports back as X-Instance-Id. +name: mtusi-messenger-lab3 + +x-app: &app + build: + context: . + dockerfile: Dockerfile + image: mtusi-messenger:lab3 + +services: + postgres: + image: postgres:18-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873 + environment: + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger} + POSTGRES_DB: ${POSTGRES_DB:-messenger} + volumes: + - postgres18-data:/var/lib/postgresql + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 5s + deploy: + resources: + limits: + # Saturation point of the stand (see REPORT.md, track 1): the database + # runs at its quota while API replicas idle. Raise this knob to give the + # shared dependency more of the host CPU. + cpus: "${POSTGRES_CPU_LIMIT:-0.50}" + memory: ${POSTGRES_MEM_LIMIT:-384M} + restart: unless-stopped + + redis: + image: redis:7.4-alpine + command: + - redis-server + - --appendonly + - "yes" + - --appendfsync + - everysec + - --save + - "60" + - "1" + volumes: + - redis7-data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 3s + retries: 10 + start_period: 3s + deploy: + resources: + limits: + cpus: "0.25" + memory: 192M + restart: unless-stopped + + # One-shot schema bootstrap; runs once to completion before any API replica. + migrate: + <<: *app + entrypoint: ["/usr/local/bin/migrate"] + command: ["up"] + environment: + APP_CONFIG: /etc/messenger/dev/config.yaml + POSTGRES_HOST: postgres + POSTGRES_PORT: "5432" + POSTGRES_DATABASE: ${POSTGRES_DB:-messenger} + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger} + POSTGRES_SSL_MODE: disable + depends_on: + postgres: + condition: service_healthy + deploy: + resources: + limits: + cpus: "0.50" + memory: 256M + # One-shot: healthcheck из образа (проверка /health/live) для него бессмыслен. + healthcheck: + disable: true + restart: "no" + + api: + <<: *app + # Общий сетевой alias: LB резолвит одно имя в адреса всех реплик, поэтому + # масштабирование и замена контейнеров не зависят от их номеров/ID. + networks: + default: + aliases: + - api-replica + env_file: + - path: .env + required: false + # Explicit values win over localhost defaults coming from .env (see .env.example). + environment: + APP_CONFIG: /etc/messenger/dev/config.yaml + POSTGRES_HOST: postgres + POSTGRES_PORT: "5432" + POSTGRES_DATABASE: ${POSTGRES_DB:-messenger} + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger} + POSTGRES_SSL_MODE: disable + REDIS_ENABLED: "true" + REDIS_HOST: redis + REDIS_PORT: "6379" + CACHE_ENABLED: "true" + # Размер пула соединений ОДНОЙ реплики; общий расход = реплики × значение. + # Это один из общих ресурсов, который масштабирование расходует первым. + POSTGRES_MAX_CONNS: "${POSTGRES_MAX_CONNS:-10}" + deploy: + replicas: ${API_REPLICAS:-2} + resources: + limits: + cpus: "${API_CPU_LIMIT:-0.50}" + memory: ${API_MEM_LIMIT:-256M} + # The app drains on SIGTERM within SERVER_SHUTDOWN_TIMEOUT; keep the grace + # period above it so Docker does not SIGKILL an in-flight request. + stop_grace_period: 15s + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + migrate: + condition: service_completed_successfully + healthcheck: + test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/health/ready"] + interval: 10s + # Готовность проверяет PostgreSQL (критичную зависимость; кэш деградирует + # безопасно): под насыщающей нагрузкой ответ может подойти к секундам, и + # слишком строгий таймаут помечает занятую, но работающую реплику как + # unhealthy. + timeout: 5s + retries: 6 + start_period: 5s + restart: unless-stopped + + # Public entry point. Active /health/ready probes remove a not-ready replica from + # rotation entirely; infra/lb/haproxy.cfg holds the upstream, checks and retries. + lb: + image: haproxy:3.2-alpine + volumes: + - ./infra/lb/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro + ports: + - "127.0.0.1:${SERVER_PORT:-8080}:80" + # Operator-only stats page on loopback: shows which replica is UP/DOWN and why. + - "127.0.0.1:${LB_STATS_PORT:-8404}:8404" + depends_on: + api: + condition: service_healthy + deploy: + resources: + limits: + cpus: "${LB_CPU_LIMIT:-0.25}" + memory: 64M + restart: unless-stopped + +volumes: + postgres18-data: + redis7-data: diff --git a/config/dev/config.yaml b/config/dev/config.yaml new file mode 100644 index 00000000..5e6cd560 --- /dev/null +++ b/config/dev/config.yaml @@ -0,0 +1,54 @@ +env: dev + +server: + host: 0.0.0.0 + port: 8080 + read_header_timeout: 10s + shutdown_timeout: 10s + # Предел размера тела запроса; JSON API ЛР3 укладывается в сотни килобайт, + # а загрузка вложений ЛР4 (до 10 MiB) поднимает это значение явно. + max_body_bytes: 262144 + +log: + level: info + format: json + +postgres: + host: localhost + port: 5432 + database: messenger + user: messenger + # Dev default for a local run without environment overrides; POSTGRES_PASSWORD wins. + password: messenger + ssl_mode: disable + max_conns: 10 + min_conns: 1 + max_conn_lifetime: 1h + max_conn_idle_time: 30m + connect_timeout: 5s + query_timeout: 5s + +redis: + enabled: true + host: localhost + port: 6379 + db: 0 + # -1 disables go-redis retries; 0 keeps the library default (3 retries). + max_retries: -1 + dial_timeout: 300ms + read_timeout: 200ms + write_timeout: 200ms + pool_size: 10 + +cache: + enabled: true + chat_list_ttl: 5m + lock_ttl: 10s + lock_wait_timeout: 2s + +session: + ttl_seconds: 3600 + +# Retention of a message Idempotency-Key; contract 1.3.0 requires ≥ 24 h. +idempotency: + ttl_seconds: 86400 diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml new file mode 100644 index 00000000..0cdc50fc --- /dev/null +++ b/docker-compose.local.yaml @@ -0,0 +1,104 @@ +name: mtusi-messenger-lab2 + +x-app: &app + build: + context: . + dockerfile: Dockerfile + image: mtusi-messenger:lab2 + +services: + postgres: + image: postgres:18-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873 + environment: + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger} + POSTGRES_DB: ${POSTGRES_DB:-messenger} + ports: + - "127.0.0.1:${POSTGRES_PORT:-5432}:5432" + volumes: + - postgres18-data:/var/lib/postgresql + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 5s + restart: unless-stopped + redis: + image: redis:7.4-alpine + command: + - redis-server + - --appendonly + - "yes" + - --appendfsync + - everysec + - --save + - "60" + - "1" + ports: + - "127.0.0.1:${REDIS_PORT:-6379}:6379" + volumes: + - redis7-data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 3s + retries: 10 + start_period: 3s + restart: unless-stopped + migrate: + <<: *app + entrypoint: ["/usr/local/bin/migrate"] + command: ["up"] + environment: + APP_CONFIG: /etc/messenger/dev/config.yaml + POSTGRES_HOST: postgres + POSTGRES_PORT: "5432" + POSTGRES_DATABASE: ${POSTGRES_DB:-messenger} + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger} + POSTGRES_SSL_MODE: disable + depends_on: + postgres: + condition: service_healthy + restart: "no" + + api: + <<: *app + env_file: + - path: .env + required: false + environment: + APP_CONFIG: /etc/messenger/dev/config.yaml + POSTGRES_HOST: postgres + POSTGRES_PORT: "5432" + POSTGRES_DATABASE: ${POSTGRES_DB:-messenger} + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger} + POSTGRES_SSL_MODE: disable + REDIS_ENABLED: "${REDIS_ENABLED:-true}" + REDIS_HOST: redis + REDIS_PORT: "6379" + CACHE_ENABLED: "${CACHE_ENABLED:-true}" + ports: + - "127.0.0.1:${SERVER_PORT:-8080}:8080" + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + migrate: + condition: service_completed_successfully + healthcheck: + test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/health/ready"] + interval: 10s + timeout: 3s + retries: 5 + start_period: 5s + restart: unless-stopped + +volumes: + postgres18-data: + name: mtusi-messenger-lab2-postgres18-data + redis7-data: + name: mtusi-messenger-lab2-redis7-data diff --git a/evidence/arch.txt b/evidence/arch.txt new file mode 100644 index 00000000..99650330 --- /dev/null +++ b/evidence/arch.txt @@ -0,0 +1,7 @@ +# Architecture of the app binary inside the image +# generated: 2026-10-15T19:03:01Z + +## emulated build (--build-arg TARGETARCH=amd64): e_machine 3e = x86-64 + 02 00 3e 00 +## fixed build (no TARGETARCH default): e_machine b7 = aarch64 + 02 00 b7 00 diff --git a/evidence/body-limit.txt b/evidence/body-limit.txt new file mode 100644 index 00000000..b5f56f9a --- /dev/null +++ b/evidence/body-limit.txt @@ -0,0 +1,3 @@ +# body limit check — 2026-10-16T14:02:25Z (limit 256 KiB from SERVER_MAX_BODY_BYTES) +тело 400 КиБ (сверх лимита): 413 +тело 100 КиБ (в пределах): в„– 400 diff --git a/evidence/db-outage.txt b/evidence/db-outage.txt new file mode 100644 index 00000000..7018ae66 --- /dev/null +++ b/evidence/db-outage.txt @@ -0,0 +1,7 @@ +# Отказ PostgreSQL на пути отправки сообщения — 2026-10-16T14:10:06Z +до остановки БД, через LB : 201 (instance=828f6451261b) +до остановки БД, напрямую : 201 +при остановленной БД, напрямую (ожидается 503): 503 +при остановленной БД, через LB : 503 (instance=828f6451261b) +готовность после возврата БД: True +после возврата БД, через LB : 201 (instance=828f6451261b) diff --git a/evidence/failover/run1.txt b/evidence/failover/run1.txt new file mode 100644 index 00000000..57cc4cf8 --- /dev/null +++ b/evidence/failover/run1.txt @@ -0,0 +1,5 @@ +# make test-failover (прогон 1) — 2026-10-16T13:59:43Z +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": 127, "failed_attempts": 0, "first_recovery_seconds": 0.214} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/failover/run2.txt b/evidence/failover/run2.txt new file mode 100644 index 00000000..641f781f --- /dev/null +++ b/evidence/failover/run2.txt @@ -0,0 +1,5 @@ +# make test-failover (прогон 2) — 2026-10-16T13:59:43Z +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": 100, "failed_attempts": 0, "first_recovery_seconds": 2.237} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/failover/sequential.txt b/evidence/failover/sequential.txt new file mode 100644 index 00000000..96e5f49e --- /dev/null +++ b/evidence/failover/sequential.txt @@ -0,0 +1,54 @@ +# student-tests/replica_failover.py — 2026-10-16T13:59:43Z +{ + "before": { + "instances": [ + "52861386fddb", + "8587b4251b72" + ] + }, + "replicas": [ + { + "stopped": "52861386fddb", + "stopped_container": "stop-one.sh: stopped api replica(s): mtusi-messenger-lab3-api-5", + "hook_returncode": 0, + "hook_seconds": 0.151, + "hook_error": "", + "successful_writes": 91, + "successful_rps": 6.06, + "failed_attempts": 0, + "uncertain_retries": 0, + "first_recovery_seconds": 1.659, + "instances_after_recovery": [ + "8587b4251b72" + ], + "messages_in_history": 91, + "restored_seconds": 0.201, + "instances_restored": [ + "52861386fddb", + "8587b4251b72" + ] + }, + { + "stopped": "8587b4251b72", + "stopped_container": "stop-one.sh: stopped api replica(s): mtusi-messenger-lab3-api-6", + "hook_returncode": 0, + "hook_seconds": 0.154, + "hook_error": "", + "successful_writes": 100, + "successful_rps": 6.66, + "failed_attempts": 0, + "uncertain_retries": 0, + "first_recovery_seconds": 1.656, + "instances_after_recovery": [ + "52861386fddb" + ], + "messages_in_history": 191, + "restored_seconds": 0.182, + "instances_restored": [ + "52861386fddb", + "8587b4251b72" + ] + } + ] +} +PASS: каждая реплика остановлена по очереди; записи продолжились, дублей и потерь нет diff --git a/evidence/idempotency.txt b/evidence/idempotency.txt new file mode 100644 index 00000000..d1287d32 --- /dev/null +++ b/evidence/idempotency.txt @@ -0,0 +1,4 @@ +# make test-idempotency — 2026-10-16T13:59:43Z +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": ["52861386fddb", "8587b4251b72"], "message_id": "01a14502-f747-7fa8-bbad-84fa27f0ce80"}, "conflict": {"workers": 12, "accepted": 1, "conflicts": 11}, "stable_body": {"message_id": "01a14502-f771-7ea3-a03a-4d559e466ac8"}, "key_required": {"status": 400}} +PASS: параллельный повтор с одним Idempotency-Key создаёт ровно одно сообщение diff --git a/evidence/lab1-2/README.md b/evidence/lab1-2/README.md new file mode 100644 index 00000000..052da1ed --- /dev/null +++ b/evidence/lab1-2/README.md @@ -0,0 +1,17 @@ +# Артефакты предыдущих лабораторных (ЛР1 и ЛР2) + +Файлы перенесены сюда из `evidence/`, потому что относятся к **прежним** конфигурациям +стенда и не являются доказательствами ЛР3: они сняты в ЛР1/ЛР2 в репозитории +`mtusi-messenger` и попали сюда вместе с переносом кода. Часть из них ссылается на +образ `mtusi2026lab1-messenger` и на in-memory хранилище, которое удалено ещё в ЛР2, +поэтому их нельзя читать как проверки текущего решения. + +- `check.txt`, `quality.txt`, `concurrency.txt`, `docker.txt`, `health.txt`, `restart.txt`, `sigterm.txt` — ЛР1: офлайн-проверка структуры, линт и тесты, конкурентные чтения, запуск контейнера и обработка SIGTERM. +- `memory-experiment.*` — ЛР1: сравнение in-memory хранилища и PostgreSQL. +- `track1-benchmark/` — ЛР1, трек 1: бенчмарк append-оптимизации in-memory хранилища (скрипт `scripts/track1_benchmark.py` удалён в ЛР3 как осиротевший: он ссылался на удалённый файл хранилища). +- `cache/` — ЛР2: эксперименты с кэшем списка чатов, согласованность и поведение при отказе Redis. +- `postgres/explain-analyze.txt` — ЛР2: план запроса истории сообщений. + +Доказательства ЛР3 лежат рядом, в `evidence/` (`smoke.txt`, `idempotency.txt`, +`persistence.txt`, `failover/`, `lb-readiness.txt`, `rolling-update/`, +`stand.txt`, `arch.txt`, `track1/`), и собраны в `REPORT.md`. diff --git a/evidence/lab1-2/cache/api-performance.txt b/evidence/lab1-2/cache/api-performance.txt new file mode 100644 index 00000000..eee86ccd --- /dev/null +++ b/evidence/lab1-2/cache/api-performance.txt @@ -0,0 +1,11 @@ +# API cache performance experiment +# generated: 2026-10-09T21:41:31Z +running trial 1, cache=False, requests=1000 +{"requests": 1000, "workers": 8, "duration_seconds": 0.455918375053443, "rps": 2193.375074831716, "p50_ms": 3.3378750667907298, "p95_ms": 5.237665958702564, "p99_ms": 7.377958972938359, "trial": 1, "cache_enabled": false} +running trial 1, cache=True, requests=1000 +{"requests": 1000, "workers": 8, "duration_seconds": 0.424924207967706, "rps": 2353.360861182094, "p50_ms": 3.075250016991049, "p95_ms": 5.355541012249887, "p99_ms": 6.619499996304512, "trial": 1, "cache_enabled": true} +running trial 2, cache=False, requests=1000 +{"requests": 1000, "workers": 8, "duration_seconds": 0.5072490000165999, "rps": 1971.4183763147382, "p50_ms": 3.680104040540755, "p95_ms": 6.2174160266295075, "p99_ms": 8.554207975976169, "trial": 2, "cache_enabled": false} +running trial 2, cache=True, requests=1000 +{"requests": 1000, "workers": 8, "duration_seconds": 0.4116047500865534, "rps": 2429.51520795063, "p50_ms": 2.9188335174694657, "p95_ms": 5.480541964061558, "p99_ms": 7.245125016197562, "trial": 2, "cache_enabled": true} +{"results": [{"requests": 1000, "workers": 8, "duration_seconds": 0.455918375053443, "rps": 2193.375074831716, "p50_ms": 3.3378750667907298, "p95_ms": 5.237665958702564, "p99_ms": 7.377958972938359, "trial": 1, "cache_enabled": false}, {"requests": 1000, "workers": 8, "duration_seconds": 0.424924207967706, "rps": 2353.360861182094, "p50_ms": 3.075250016991049, "p95_ms": 5.355541012249887, "p99_ms": 6.619499996304512, "trial": 1, "cache_enabled": true}, {"requests": 1000, "workers": 8, "duration_seconds": 0.5072490000165999, "rps": 1971.4183763147382, "p50_ms": 3.680104040540755, "p95_ms": 6.2174160266295075, "p99_ms": 8.554207975976169, "trial": 2, "cache_enabled": false}, {"requests": 1000, "workers": 8, "duration_seconds": 0.4116047500865534, "rps": 2429.51520795063, "p50_ms": 2.9188335174694657, "p95_ms": 5.480541964061558, "p99_ms": 7.245125016197562, "trial": 2, "cache_enabled": true}], "users": 4, "chats": 60, "sessions_cached_in_both_modes": true} diff --git a/evidence/lab1-2/cache/consistency.txt b/evidence/lab1-2/cache/consistency.txt new file mode 100644 index 00000000..7c1c7f61 --- /dev/null +++ b/evidence/lab1-2/cache/consistency.txt @@ -0,0 +1,36 @@ +# Cache consistency evidence (track 1) +# generated: 2026-10-09T21:38:43Z +# redis: localhost:6379 db=1 + +=== RUN TestChatRepositorySuite +=== RUN TestChatRepositorySuite/TestBrokenCacheEntryIsDroppedAndRepopulated +=== RUN TestChatRepositorySuite/TestCacheUnavailableFallsBackToSource +=== RUN TestChatRepositorySuite/TestConcurrentColdReadsAreDeduplicated + chat_repository_test.go:226: distributed lock: 100 concurrent cold reads -> 1 source load +=== RUN TestChatRepositorySuite/TestConcurrentColdReadsWithoutProtectionStampede + chat_repository_test.go:427: stampede demonstration: 100 concurrent reads -> 100 source loads +=== RUN TestChatRepositorySuite/TestCreateInvalidatesMemberCaches +=== RUN TestChatRepositorySuite/TestDeeperPagesBypassCache +=== RUN TestChatRepositorySuite/TestEvictedCacheEntryReloadsFromSource +=== RUN TestChatRepositorySuite/TestFirstPageIsCached +=== RUN TestChatRepositorySuite/TestLimitIsPartOfCacheKey +=== RUN TestChatRepositorySuite/TestMultipleInstancesShareDistributedLock + chat_repository_test.go:276: multi-instance distributed lock: 3 instances x 30 reads -> 1 source load +=== RUN TestChatRepositorySuite/TestSlowLoaderBeyondCacheBudgetReturnsData +=== RUN TestChatRepositorySuite/TestSourceErrorIsNotRetried +--- PASS: TestChatRepositorySuite (0.83s) + --- PASS: TestChatRepositorySuite/TestBrokenCacheEntryIsDroppedAndRepopulated (0.00s) + --- PASS: TestChatRepositorySuite/TestCacheUnavailableFallsBackToSource (0.00s) + --- PASS: TestChatRepositorySuite/TestConcurrentColdReadsAreDeduplicated (0.03s) + --- PASS: TestChatRepositorySuite/TestConcurrentColdReadsWithoutProtectionStampede (0.02s) + --- PASS: TestChatRepositorySuite/TestCreateInvalidatesMemberCaches (0.01s) + --- PASS: TestChatRepositorySuite/TestDeeperPagesBypassCache (0.00s) + --- PASS: TestChatRepositorySuite/TestEvictedCacheEntryReloadsFromSource (0.00s) + --- PASS: TestChatRepositorySuite/TestFirstPageIsCached (0.00s) + --- PASS: TestChatRepositorySuite/TestLimitIsPartOfCacheKey (0.00s) + --- PASS: TestChatRepositorySuite/TestMultipleInstancesShareDistributedLock (0.05s) + --- PASS: TestChatRepositorySuite/TestSlowLoaderBeyondCacheBudgetReturnsData (0.70s) + --- PASS: TestChatRepositorySuite/TestSourceErrorIsNotRetried (0.00s) +PASS +ok mtusi-messenger/internal/storage/redis 1.338s +? mtusi-messenger/internal/storage/redis/mocks [no test files] diff --git a/evidence/lab1-2/cache/latency.txt b/evidence/lab1-2/cache/latency.txt new file mode 100644 index 00000000..f84b1ec3 --- /dev/null +++ b/evidence/lab1-2/cache/latency.txt @@ -0,0 +1,22 @@ +# Cache latency experiment +# generated: 2026-10-06T15:53:09Z +go version go1.27.1 darwin/arm64 +Darwin arm64 +2026/10/06 18:53:10 OK 00001_init.sql (10.27ms) +2026/10/06 18:53:10 goose: successfully migrated database to version: 1 +=== RUN TestCacheLatencyExperiment + cache_latency_experiment_test.go:83: baseline: requests=1000 source_loads=1000 p50=317.209µs p95=343.542µs p99=377.625µs + cache_latency_experiment_test.go:84: redis cache: requests=1000 source_loads=1 p50=411.791µs p95=527.709µs p99=565.625µs +--- PASS: TestCacheLatencyExperiment (0.97s) +=== RUN TestCacheLatencyExperiment + cache_latency_experiment_test.go:83: baseline: requests=1000 source_loads=1000 p50=271.125µs p95=330.584µs p99=389.209µs + cache_latency_experiment_test.go:84: redis cache: requests=1000 source_loads=1 p50=388µs p95=453.959µs p99=512.625µs +--- PASS: TestCacheLatencyExperiment (0.86s) +=== RUN TestCacheLatencyExperiment + cache_latency_experiment_test.go:83: baseline: requests=1000 source_loads=1000 p50=268.541µs p95=318.417µs p99=367.083µs + cache_latency_experiment_test.go:84: redis cache: requests=1000 source_loads=1 p50=408.833µs p95=473.125µs p99=541.042µs +--- PASS: TestCacheLatencyExperiment (0.88s) +PASS +ok mtusi-messenger/internal/storage/postgres 3.097s +? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files] +? mtusi-messenger/internal/storage/postgres/migrations [no test files] diff --git a/evidence/lab1-2/cache/performance.txt b/evidence/lab1-2/cache/performance.txt new file mode 100644 index 00000000..54412f9a --- /dev/null +++ b/evidence/lab1-2/cache/performance.txt @@ -0,0 +1,26 @@ +# Cache performance experiment +# generated: 2026-10-09T21:41:14Z +go version go1.27.1 darwin/arm64 +Darwin arm64 +2026/10/10 00:41:15 OK 00001_init.sql (10.03ms) +2026/10/10 00:41:15 OK 00002_user_chat_versions.sql (2.17ms) +2026/10/10 00:41:15 goose: successfully migrated database to version: 2 +=== RUN TestCachePerformanceExperiment + cache_performance_experiment_test.go:115: baseline (no cache): requests=10000 concurrency=50 sql=10000 duration=1.528s rps=6542 p50=7.490875ms p95=9.302792ms p99=10.779ms + cache_performance_experiment_test.go:116: redis cache (cold): requests=10000 concurrency=50 sql=1 duration=851ms rps=11749 p50=4.192709ms p95=5.318916ms p99=5.905625ms + cache_performance_experiment_test.go:117: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=751ms rps=13320 p50=3.670958ms p95=4.644958ms p99=5.21475ms +--- PASS: TestCachePerformanceExperiment (3.50s) +=== RUN TestCachePerformanceExperiment + cache_performance_experiment_test.go:115: baseline (no cache): requests=10000 concurrency=50 sql=10000 duration=1.415s rps=7066 p50=6.901958ms p95=8.697666ms p99=10.560416ms + cache_performance_experiment_test.go:116: redis cache (cold): requests=10000 concurrency=50 sql=1 duration=846ms rps=11815 p50=4.033083ms p95=6.0305ms p99=6.963417ms + cache_performance_experiment_test.go:117: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=817ms rps=12234 p50=3.999959ms p95=5.060959ms p99=5.802042ms +--- PASS: TestCachePerformanceExperiment (3.39s) +=== RUN TestCachePerformanceExperiment + cache_performance_experiment_test.go:115: baseline (no cache): requests=10000 concurrency=50 sql=10000 duration=1.511s rps=6618 p50=7.302667ms p95=9.420708ms p99=12.437917ms + cache_performance_experiment_test.go:116: redis cache (cold): requests=10000 concurrency=50 sql=1 duration=827ms rps=12093 p50=3.984125ms p95=5.655167ms p99=6.8085ms + cache_performance_experiment_test.go:117: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=817ms rps=12247 p50=3.946959ms p95=5.363208ms p99=6.508458ms +--- PASS: TestCachePerformanceExperiment (3.55s) +PASS +ok mtusi-messenger/internal/storage/postgres 10.978s +? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files] +? mtusi-messenger/internal/storage/postgres/migrations [no test files] diff --git a/evidence/lab1-2/cache/redis-outage.txt b/evidence/lab1-2/cache/redis-outage.txt new file mode 100644 index 00000000..38ea2c43 --- /dev/null +++ b/evidence/lab1-2/cache/redis-outage.txt @@ -0,0 +1,8 @@ +baseline: 6ms +after stop: 476ms + stop: n=1 max=476ms p95=476ms budget=2000ms + pause parallel: n=30 max=215ms p95=214ms budget=2000ms +create during pause: 201 +after recovery: new chat visible, 5ms +lock keys without TTL: 0 +PASS: redis outage handled within budget diff --git a/evidence/lab1-2/check.txt b/evidence/lab1-2/check.txt new file mode 100644 index 00000000..16782521 --- /dev/null +++ b/evidence/lab1-2/check.txt @@ -0,0 +1,3 @@ +$ make check +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_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. diff --git a/evidence/lab1-2/concurrency.txt b/evidence/lab1-2/concurrency.txt new file mode 100644 index 00000000..58dbcb62 --- /dev/null +++ b/evidence/lab1-2/concurrency.txt @@ -0,0 +1,2 @@ +command: docker run + Python ThreadPoolExecutor(10), 100 POST messages +{"sent": 100, "read": 100, "unique": 100} diff --git a/evidence/lab1-2/docker.txt b/evidence/lab1-2/docker.txt new file mode 100644 index 00000000..22b35293 --- /dev/null +++ b/evidence/lab1-2/docker.txt @@ -0,0 +1,11 @@ +$ docker inspect --format ... +status=running health=healthy user=10001:10001 +$ curl -i http://127.0.0.1:8080/health/live +HTTP/1.1 200 OK +Access-Control-Expose-Headers: X-Request-Id +Content-Type: application/json; charset=utf-8 +X-Request-Id: 3d145e7d-423a-4510-9d6b-6f45b7cf552d +Date: Thu, 24 Sep 2026 20:13:14 GMT +Content-Length: 15 + +{"status":"ok"} \ No newline at end of file diff --git a/evidence/lab1-2/health.txt b/evidence/lab1-2/health.txt new file mode 100644 index 00000000..1a36cf5f --- /dev/null +++ b/evidence/lab1-2/health.txt @@ -0,0 +1 @@ +{"status":"ok"} \ No newline at end of file diff --git a/evidence/lab1-2/memory-experiment.json b/evidence/lab1-2/memory-experiment.json new file mode 100644 index 00000000..1068e429 --- /dev/null +++ b/evidence/lab1-2/memory-experiment.json @@ -0,0 +1,17279 @@ +{ + "image": "mtusi2026lab1-messenger:arm64", + "memory_limit": "64m", + "memory_limit_mib": 64.0, + "successful_messages": 8610, + "failed_requests": 0, + "oom_killed": true, + "last_error": null, + "fatal_error": "IncompleteRead: IncompleteRead(0 bytes read)", + "container_state": { + "Status": "exited", + "Running": false, + "Paused": false, + "Restarting": false, + "OOMKilled": true, + "Dead": false, + "Pid": 0, + "ExitCode": 137, + "Error": "", + "StartedAt": "2026-09-24T20:55:58.307994245Z", + "FinishedAt": "2026-09-24T20:56:04.29060562Z", + "Health": { + "Status": "unhealthy", + "FailingStreak": 0, + "Log": [ + { + "Start": "2026-09-24T23:56:03.357136035+03:00", + "End": "2026-09-24T23:56:03.371812177+03:00", + "ExitCode": 0, + "Output": "" + } + ] + } + }, + "container_logs_tail": "", + "failure_time_seconds": 5.931530750000093, + "memory_samples": [ + { + "time_seconds": 41378.968726375, + "memory": "10.11MiB", + "memory_mib": 10.11 + }, + { + "time_seconds": 41380.971784666, + "memory": "33.5MiB", + "memory_mib": 33.5 + }, + { + "time_seconds": 41382.973903625, + "memory": "52.24MiB", + "memory_mib": 52.24 + } + ], + "message_points_x": [ + 0.5184139170014532, + 0.5204068339953665, + 0.5219206670008134, + 0.5230430000010529, + 0.5242924999984098, + 0.5255186249996768, + 0.526668749997043, + 0.5277829589977046, + 0.5289297089984757, + 0.5299583749947487, + 0.5310334589958075, + 0.5322612499949173, + 0.5332877499968163, + 0.5342921249975916, + 0.535259500000393, + 0.5361602499979199, + 0.5370337089989334, + 0.5380593750014668, + 0.5389899169967975, + 0.5398404169973219, + 0.540663041996595, + 0.5415193750013714, + 0.5423362090004957, + 0.5431351250008447, + 0.5439704999953392, + 0.544804249999288, + 0.5456645419981214, + 0.5464134590001777, + 0.54733141700126, + 0.548126499998034, + 0.5489054999998189, + 0.549695541994879, + 0.5504482920005103, + 0.5512134589953348, + 0.5520517920012935, + 0.5529058749962132, + 0.553739625000162, + 0.5545109169979696, + 0.5552669589960715, + 0.5560028749969206, + 0.5567628339995281, + 0.5575472089985851, + 0.5583592920011142, + 0.5591555840001092, + 0.5599456669951905, + 0.5607333750012913, + 0.5614233749947743, + 0.562186124996515, + 0.5629096670018043, + 0.5636121669958811, + 0.5643381249974482, + 0.5650693749994389, + 0.5657560839972575, + 0.5664414999992005, + 0.5671678340004291, + 0.5678588340015267, + 0.5690906249947147, + 0.5698721669978113, + 0.5706161669950234, + 0.5713675000006333, + 0.5721129169978667, + 0.5728685419962858, + 0.5735694169998169, + 0.5742667090016766, + 0.5749773749994347, + 0.5756967919951421, + 0.5764001669958816, + 0.5770828339955187, + 0.5777844589974848, + 0.5785861249969457, + 0.5792511670006206, + 0.5799325839980156, + 0.5806418749998556, + 0.5813412919960683, + 0.581995583997923, + 0.5827191669959575, + 0.5834124589964631, + 0.5841665839980124, + 0.5849062089982908, + 0.5856551670003682, + 0.5863690839978517, + 0.5871183339986601, + 0.5877875840014894, + 0.5884722089977004, + 0.5892090419947635, + 0.5899365419973037, + 0.5906328339988249, + 0.5912689589968068, + 0.5920083339951816, + 0.592761125000834, + 0.593522249997477, + 0.5942453339957865, + 0.5949209169993992, + 0.5955799169969396, + 0.5963211669950397, + 0.5970629590010503, + 0.5978052499995101, + 0.5984491249982966, + 0.5991153340000892, + 0.5997544999991078, + 0.600359459000174, + 0.6009986669960199, + 0.6016269169995212, + 0.6022871249952004, + 0.6029002919967752, + 0.6035444590015686, + 0.6043039169962867, + 0.6048937919986201, + 0.6055339589947835, + 0.6061541669987491, + 0.6067552499953308, + 0.6073647919984069, + 0.6079727089963853, + 0.6085505839946563, + 0.6092511249953532, + 0.6099042089990689, + 0.6104623339997488, + 0.6110740840013023, + 0.6117397919952055, + 0.6124364999996033, + 0.6132009169959929, + 0.6139017499954207, + 0.6145433339988813, + 0.6151680420007324, + 0.615861499994935, + 0.6164850419954746, + 0.6171578339999542, + 0.6178212919985526, + 0.618482749996474, + 0.6191684169971268, + 0.6197867500013672, + 0.620482667000033, + 0.6211232919959002, + 0.6217566669947701, + 0.6223663749988191, + 0.6230042499955744, + 0.6236522499966668, + 0.6243039589971886, + 0.6249877500013099, + 0.6257640839976375, + 0.6264105000009295, + 0.6270391250000102, + 0.6277013340004487, + 0.6283780419980758, + 0.6290188749990193, + 0.62966216699715, + 0.6303317919955589, + 0.6310257919976721, + 0.6317227499966975, + 0.6324197089998052, + 0.6330538339971099, + 0.6336742919957032, + 0.6343468339982792, + 0.6350101669959258, + 0.6356489999961923, + 0.6363151670011575, + 0.6369789589953143, + 0.6376079589972505, + 0.6382454999984475, + 0.6388775000013993, + 0.639548166996974, + 0.6401784999980009, + 0.6408622499948251, + 0.6414877919960418, + 0.6421079589999863, + 0.6427445000008447, + 0.6433672089988249, + 0.643976624996867, + 0.6446119999964139, + 0.6452468749994296, + 0.6458980419993168, + 0.6465418340012548, + 0.6471705000003567, + 0.6478516249990207, + 0.648482459000661, + 0.6492391249994398, + 0.6498975840004277, + 0.6505527499975869, + 0.6512256669957424, + 0.6519522499947925, + 0.6526021249956102, + 0.6532350839988794, + 0.6538310420000926, + 0.6544814169974416, + 0.6551320840007975, + 0.655773209000472, + 0.6564397089969134, + 0.6570341249971534, + 0.6576618339968263, + 0.6582876249958645, + 0.6589354999960051, + 0.6596007499974803, + 0.6602243339948473, + 0.6608792499973788, + 0.6615296249947278, + 0.6621900419995654, + 0.6628199999977369, + 0.6634553339972626, + 0.6641407499992056, + 0.6647986249954556, + 0.6654613339997013, + 0.6661163339958875, + 0.6667379589998745, + 0.667355208999652, + 0.6679822500009323, + 0.6686080419967766, + 0.6692318339992198, + 0.6699011669988977, + 0.6705691249953816, + 0.6712787090000347, + 0.6720528750010999, + 0.6726831249980023, + 0.673339417000534, + 0.6739381669976865, + 0.6747349590004887, + 0.6753525839958456, + 0.6761363749974407, + 0.6768189590002294, + 0.6775881249996019, + 0.6782003749976866, + 0.6788513749997946, + 0.6794713339986629, + 0.6801543339970522, + 0.6807948339992436, + 0.6814544169974397, + 0.6821445419991505, + 0.6827979590016184, + 0.6834393339959206, + 0.6841052919990034, + 0.6847229170016362, + 0.6853701250001905, + 0.6859554589973413, + 0.6865738749984303, + 0.6871685000005527, + 0.6878155000013066, + 0.6885477499963599, + 0.6892197089982801, + 0.6899046670005191, + 0.6905384999990929, + 0.6912058339948999, + 0.6918827920017065, + 0.6925021249990095, + 0.6931414169957861, + 0.6938070420001168, + 0.6944683339970652, + 0.6950644589960575, + 0.6958125839955756, + 0.696425417001592, + 0.6970299589956994, + 0.6977391670006909, + 0.6984105839947006, + 0.6990365419987938, + 0.6996563339998829, + 0.7003364999982296, + 0.7009742919981363, + 0.7016083339985926, + 0.7022284589984338, + 0.7028550839968375, + 0.7035207919980166, + 0.704159583998262, + 0.7047847919966443, + 0.7054155840014573, + 0.7060796669975389, + 0.7066871249990072, + 0.7073193339965655, + 0.7080209170017042, + 0.7086323749972507, + 0.7092991249955958, + 0.7100246670015622, + 0.7107215419964632, + 0.7113945839955704, + 0.7120392500000889, + 0.7127007499948377, + 0.7133515419991454, + 0.714004624998779, + 0.7146291669996572, + 0.7152715420015738, + 0.7159206669966807, + 0.7165268339958857, + 0.7172255420009606, + 0.7179105839968543, + 0.718550833997142, + 0.7191538339975523, + 0.7197732089989586, + 0.7204269169960753, + 0.7210396250011399, + 0.7216524169998593, + 0.7222911669960013, + 0.7229739999966114, + 0.7236452090000967, + 0.7243870839956799, + 0.7250047499983339, + 0.7256294999970123, + 0.7262228749968926, + 0.7268766249981127, + 0.7275339170009829, + 0.7281923749978887, + 0.7288876669990714, + 0.7295797920014593, + 0.7302502089951304, + 0.7309008750016801, + 0.7315497499948833, + 0.7322054169999319, + 0.732817708994844, + 0.7334464589948766, + 0.7340894590015523, + 0.734732917000656, + 0.7353822500008391, + 0.7360126669955207, + 0.736632959000417, + 0.737248624995118, + 0.7378862089972245, + 0.7385313339982531, + 0.7391983339985018, + 0.7398598750005476, + 0.7405030839945539, + 0.7411182089999784, + 0.7417897089981125, + 0.7425152919968241, + 0.7431825419989764, + 0.7438407090012333, + 0.7444735839962959, + 0.7452394169959007, + 0.7459312499995576, + 0.7466316249992815, + 0.7473506669994094, + 0.7480540420001489, + 0.7487243340001442, + 0.7494109999970533, + 0.750112417001219, + 0.7508354999954463, + 0.7514743339997949, + 0.7521295839978848, + 0.752903291999246, + 0.7535692919991561, + 0.7542105839966098, + 0.7549755000000005, + 0.7556059589987854, + 0.7562496669997927, + 0.7569001250012661, + 0.7575037089991383, + 0.7581601249985397, + 0.75880687499739, + 0.7595177089970093, + 0.7601517090006382, + 0.7608166669961065, + 0.7614688339963323, + 0.7621040000012727, + 0.7627385000014328, + 0.7633910840013414, + 0.7640176669956418, + 0.7646791250008391, + 0.765362958998594, + 0.7659789999961504, + 0.7666380839946214, + 0.7673123749991646, + 0.7679994169957354, + 0.7687116669985699, + 0.7694159589955234, + 0.7700839169992832, + 0.7707527499951539, + 0.7714205000011134, + 0.7721213339973474, + 0.7727749589976156, + 0.7734382089984138, + 0.7740348750012345, + 0.7747124999950756, + 0.7753627089987276, + 0.7759780839987798, + 0.7766068749988335, + 0.7772285419996479, + 0.7778938339979504, + 0.7785501249964, + 0.7792036669998197, + 0.7798726670007454, + 0.780483374997857, + 0.7812164589995518, + 0.7818722919982974, + 0.7825164999958361, + 0.7831692499967176, + 0.7837751670012949, + 0.784428624996508, + 0.7851038340013474, + 0.7857498340017628, + 0.7864819589958643, + 0.7871889589951024, + 0.7879917919999571, + 0.7886484589980682, + 0.789309667001362, + 0.7899667089950526, + 0.7906144169974141, + 0.7912849999993341, + 0.7919452499991166, + 0.7925789169967175, + 0.7932271669997135, + 0.7938613750011427, + 0.7945078749980894, + 0.795150541998737, + 0.7957939999978407, + 0.7964372499991441, + 0.7970954170014011, + 0.7978748749956139, + 0.798495584000193, + 0.7991426669977955, + 0.799797416999354, + 0.8004426670013345, + 0.8010637499974109, + 0.8017242919959244, + 0.802363583999977, + 0.8030040839948924, + 0.8036244169998099, + 0.8042551249964163, + 0.8048780419994728, + 0.8055318749975413, + 0.806319874995097, + 0.807023458997719, + 0.8076849999997648, + 0.8083500419961638, + 0.8090357499968377, + 0.809666291999747, + 0.8102953339985106, + 0.8109624999997322, + 0.8116052920013317, + 0.812248834001366, + 0.8129138340009376, + 0.813640583997767, + 0.8142274169949815, + 0.8148451250017388, + 0.8154416249963106, + 0.8160943749971921, + 0.8167397090001032, + 0.81733545899624, + 0.8179709169999114, + 0.8186304999981076, + 0.8192848749968107, + 0.8199278749962104, + 0.8206395839952165, + 0.8213106249968405, + 0.8219412499965983, + 0.82259662499564, + 0.8232428339979379, + 0.8239938339975197, + 0.8246624999956111, + 0.8254516669985605, + 0.8261809589967015, + 0.8269463749966235, + 0.8276099590002559, + 0.8282552499949816, + 0.8288460839976324, + 0.8294932919961866, + 0.830184708996967, + 0.8308255839947378, + 0.8314710420017946, + 0.8321482499959529, + 0.832775999995647, + 0.8333912089947262, + 0.8340397089996259, + 0.8347864169991226, + 0.8354329590001726, + 0.8360665000000154, + 0.8367241669984651, + 0.8373906249980791, + 0.8380332919987268, + 0.8386750419958844, + 0.8393355000007432, + 0.8399785840010736, + 0.8405962499964517, + 0.841255250001268, + 0.8418895419963519, + 0.8425385419977829, + 0.843199791997904, + 0.8438477499948931, + 0.8445081669997307, + 0.8453110839982401, + 0.8461466250009835, + 0.8469648339960258, + 0.8476910839963239, + 0.8483675839961506, + 0.849066374998074, + 0.8497066669951892, + 0.8503576669972972, + 0.851029749996087, + 0.8516163749955012, + 0.8522922499978449, + 0.8529543339973316, + 0.8536197089997586, + 0.8543839170015417, + 0.855086042000039, + 0.8557201250005164, + 0.8563566250013537, + 0.8569952499965439, + 0.857611542000086, + 0.8582464169958257, + 0.8589438749986584, + 0.8595557500011637, + 0.8601860419948935, + 0.8608362500017392, + 0.8614728339962312, + 0.8621068749998813, + 0.8627197919995524, + 0.8633281669972348, + 0.8639666249946458, + 0.8647587919986108, + 0.8655055419949349, + 0.8662219589969027, + 0.8670333749978454, + 0.8677367089985637, + 0.8684091249961057, + 0.8690514170011738, + 0.869709458995203, + 0.8703985839965753, + 0.8710700839947094, + 0.8717131250014063, + 0.8723584589970415, + 0.8729618340003071, + 0.8735761669959174, + 0.8742086669954006, + 0.8749006250000093, + 0.8755362919982872, + 0.8761877500000992, + 0.8768401669949526, + 0.8775060839980142, + 0.878146041999571, + 0.878774249998969, + 0.8794192919958732, + 0.8800274589957553, + 0.8806592089968035, + 0.8813103339998634, + 0.881968166999286, + 0.882607374995132, + 0.8832825419958681, + 0.8839514589999453, + 0.8846694169988041, + 0.8853855419947649, + 0.8860094999981811, + 0.8866541669995058, + 0.8872888339974452, + 0.8879539999979897, + 0.8885634999969625, + 0.8891755840013502, + 0.8899544999949285, + 0.8905842089952785, + 0.891262666998955, + 0.891945791998296, + 0.8926495839987183, + 0.8934294169957866, + 0.8941153749983641, + 0.8947504589959863, + 0.8953652089985553, + 0.8960499169988907, + 0.8967349999948055, + 0.8973554170006537, + 0.8979747089979355, + 0.8986264999984996, + 0.8994230419993983, + 0.9001743339977111, + 0.9008518749978975, + 0.9014402920001885, + 0.9020516669988865, + 0.9026657499998691, + 0.9035271669999929, + 0.9041936669964343, + 0.9048791249952046, + 0.9055280839966144, + 0.90635308399942, + 0.9069974169979105, + 0.9076066249981523, + 0.9082304589974228, + 0.9088969590011402, + 0.9096225839966792, + 0.9103182499966351, + 0.9110378749974188, + 0.9117287920016679, + 0.9124074999999721, + 0.913077749995864, + 0.9137640420012758, + 0.9144117089963402, + 0.9150587920012185, + 0.9156509999957052, + 0.9162714999984019, + 0.9169459999975516, + 0.9175595839988091, + 0.9181948339974042, + 0.9188264170006732, + 0.9194585419973009, + 0.920213083998533, + 0.9208639589996892, + 0.9215036669993424, + 0.9221212499978719, + 0.9227599169971654, + 0.9234288340012426, + 0.924195374995179, + 0.9248040419988683, + 0.9255241669961833, + 0.9262475840005209, + 0.9269639589983854, + 0.9276114999956917, + 0.9282501669949852, + 0.9288867499999469, + 0.9295096669957275, + 0.9301811670011375, + 0.9308597499984899, + 0.9315007499972126, + 0.9321670419958537, + 0.9328095839955495, + 0.9335401669959538, + 0.9341952920003678, + 0.9348547499976121, + 0.9354881249964819, + 0.936140041994804, + 0.9367534999983036, + 0.9373239999986254, + 0.9379705419996753, + 0.9387245420002728, + 0.9393779169986374, + 0.9400345839967486, + 0.9406466250002268, + 0.941258792001463, + 0.9419276670014369, + 0.9425713749951683, + 0.9432124999948428, + 0.9439115839995793, + 0.9445392499983427, + 0.9452093750005588, + 0.945886541994696, + 0.9466038339960505, + 0.9472448749947944, + 0.947914167001727, + 0.9485807919991203, + 0.9492278339967015, + 0.9498565419999068, + 0.9504921670013573, + 0.9511350839966326, + 0.9517600839972147, + 0.9523709999994026, + 0.95301516699692, + 0.9536602090011002, + 0.9544291669953964, + 0.9550380000000587, + 0.9557272089950857, + 0.9563425839951378, + 0.9570088339969516, + 0.9576826249976875, + 0.9583507499992265, + 0.959175874995708, + 0.9598374589986634, + 0.960445416996663, + 0.9610509589983849, + 0.9616812089952873, + 0.9623031669980264, + 0.9629518340007053, + 0.9635810839972692, + 0.9642740419949405, + 0.9649308750013006, + 0.96557779199793, + 0.9662873339984799, + 0.966925959000946, + 0.9676125420010067, + 0.9682907089954824, + 0.9689473749967874, + 0.9695922499959124, + 0.9702262499995413, + 0.9708932919966173, + 0.9715289169980679, + 0.9721750839962624, + 0.9727999169990653, + 0.9733816250009113, + 0.9739998750010272, + 0.9746099999974831, + 0.9752227499993751, + 0.9758687499997905, + 0.976501459001156, + 0.9771456669986947, + 0.9777957499973127, + 0.978430874994956, + 0.9790849999990314, + 0.9796767500010901, + 0.9803068749970407, + 0.9809831669990672, + 0.9816053339964128, + 0.9822397499956423, + 0.9829100839997409, + 0.9836085839997395, + 0.9842744169945945, + 0.9849862919945735, + 0.9857524170001852, + 0.9864109999980428, + 0.9870339589979267, + 0.9876529589964775, + 0.9883029170014197, + 0.988948291997076, + 0.9895976249972591, + 0.9902442499951576, + 0.9909775419946527, + 0.9916536249947967, + 0.9923237499970128, + 0.9931110420002369, + 0.9937628339976072, + 0.994470833997184, + 0.9952084589967853, + 0.9959592090017395, + 0.9966284999973141, + 0.9972522089956328, + 0.9979131669970229, + 0.9985563340014778, + 0.9992098750008154, + 0.9998549589945469, + 1.0005754999947385, + 1.00126787499903, + 1.001965958996152, + 1.0026574169969535, + 1.003385124997294, + 1.0041443750014878, + 1.0048771250003483, + 1.0055522499969811, + 1.0061402919964166, + 1.0067452090006554, + 1.0073526669948478, + 1.0079100419970928, + 1.0084815839945804, + 1.0090810420006164, + 1.0097314169979654, + 1.0104347499946016, + 1.01099479199911, + 1.0120392499957234, + 1.0125666249950882, + 1.0131089169954066, + 1.013674916997843, + 1.0142782920011086, + 1.0147718340012943, + 1.015302416999475, + 1.015901999999187, + 1.0163944169980823, + 1.016919458998018, + 1.0174603749983362, + 1.0181480839964934, + 1.0186908749965369, + 1.0193297090008855, + 1.0199160420015687, + 1.0204759999978705, + 1.021009708994825, + 1.021566333998635, + 1.0220730000000913, + 1.0226067089970456, + 1.0232385839990457, + 1.023805374999938, + 1.024681791997864, + 1.0254696249976405, + 1.0264432089970796, + 1.027052042001742, + 1.0292267089971574, + 1.0301007919988479, + 1.030809459000011, + 1.0314735419960925, + 1.0321328339996398, + 1.0327611669999897, + 1.0333527920010965, + 1.034026333996735, + 1.0346310839959187, + 1.0351884999981849, + 1.0357489589951, + 1.0365015839997795, + 1.0371517919993494, + 1.037764791995869, + 1.0384526249981718, + 1.039085749995138, + 1.0397126669995487, + 1.0403384999954142, + 1.0410054169988143, + 1.0417437919968506, + 1.042436625000846, + 1.0430662090002443, + 1.0437082499993267, + 1.0443229169977712, + 1.0449623339954996, + 1.045554333999462, + 1.046089999996184, + 1.046664959001646, + 1.0471924589946866, + 1.0477484169969102, + 1.0483179590009968, + 1.048864374999539, + 1.0494218749954598, + 1.0500030839975807, + 1.0505608749954263, + 1.0512694169956376, + 1.0518768339970848, + 1.0524612919980427, + 1.052992249999079, + 1.0535431669995887, + 1.0540903750006692, + 1.0546270420018118, + 1.0551473749947036, + 1.055688624997856, + 1.0562536669967812, + 1.0567766669992125, + 1.0573037089998252, + 1.0578541669965489, + 1.0583732500017504, + 1.0588856249960372, + 1.0593769589977455, + 1.0599361669956124, + 1.0605024589967798, + 1.061050541997247, + 1.061669416994846, + 1.0622421669977484, + 1.062860958998499, + 1.0634130420003203, + 1.0639289589962573, + 1.0645133340003667, + 1.0650230839964934, + 1.0655662919962197, + 1.066138083995611, + 1.0666802919949987, + 1.0675097089988412, + 1.0682048339949688, + 1.0687223749991972, + 1.0692450419956003, + 1.0697723749981378, + 1.0703094999989844, + 1.0708216249986435, + 1.0713662499983911, + 1.071929874997295, + 1.072510375001002, + 1.0730040419948637, + 1.073525250001694, + 1.0740366669997456, + 1.0745768749984563, + 1.0751352090010187, + 1.0757110420017852, + 1.0762119589999202, + 1.0767149589955807, + 1.077301459001319, + 1.077868499996839, + 1.0784016249963315, + 1.0789064169948688, + 1.0794087499962188, + 1.0799710840001353, + 1.0805361249949783, + 1.081285708998621, + 1.08191179199639, + 1.0825124999973923, + 1.0831066669998108, + 1.083684083998378, + 1.0842169999959879, + 1.0847625419992255, + 1.0852947919993312, + 1.0858834169994225, + 1.086421749998408, + 1.0869749589983257, + 1.0875259169988567, + 1.0881064169952879, + 1.0887584589945618, + 1.0892919589969097, + 1.0898059999963152, + 1.0903907920001075, + 1.0909389590015053, + 1.0914699589993688, + 1.0920477920008125, + 1.0926581249950686, + 1.0931880839998485, + 1.0937153339982615, + 1.094273874994542, + 1.0949134999973467, + 1.0955134169998928, + 1.0960293339958298, + 1.096698124994873, + 1.09730383400165, + 1.097892124998907, + 1.0984669999961625, + 1.0989948749993346, + 1.09951970900147, + 1.1001259589975234, + 1.100764666996838, + 1.101309666999441, + 1.1019402089950745, + 1.1025378749982337, + 1.1030917089956347, + 1.1036804589966778, + 1.1041996249987278, + 1.1047873749994324, + 1.1053276249949704, + 1.1058982089962228, + 1.1064176669970038, + 1.106990959000541, + 1.1075256670010276, + 1.1080436670017662, + 1.1085778339984245, + 1.1091003339970484, + 1.1096655419969466, + 1.1102050420013256, + 1.1107321669987869, + 1.111317416995007, + 1.111890874999517, + 1.1124504170002183, + 1.113070458995935, + 1.1136314589966787, + 1.114196249996894, + 1.11480729199684, + 1.1153992089966778, + 1.1159892499999842, + 1.11656524999853, + 1.1171345420007128, + 1.117655999994895, + 1.1182114999974146, + 1.1187260000006063, + 1.1192700419996982, + 1.1199199589973432, + 1.1205497089977143, + 1.1211885000011534, + 1.1217852089976077, + 1.1223544589956873, + 1.1228776669959188, + 1.1233915839984547, + 1.12395375000051, + 1.1245373749989085, + 1.1250873749959283, + 1.1256345000001602, + 1.126189875001728, + 1.1268126249997295, + 1.1273469169973396, + 1.127911874995334, + 1.1284755419983412, + 1.1291950839950005, + 1.1297516249978798, + 1.130276916999719, + 1.1308600839984138, + 1.131461083998147, + 1.1320317499994417, + 1.132629874999111, + 1.1332253750006203, + 1.1337393750000047, + 1.1343286670016823, + 1.1348775419974118, + 1.1354403340010322, + 1.1360011249998934, + 1.1365471669996623, + 1.1371186249962193, + 1.1377009999996517, + 1.138224916998297, + 1.1387960419961018, + 1.13933937499678, + 1.1399445419956464, + 1.140536708997388, + 1.1411257500003558, + 1.1417397089971928, + 1.1439872499977355, + 1.1446458749996964, + 1.1453561249945778, + 1.1459464590006974, + 1.1465122919980786, + 1.1470558340006392, + 1.1476045419985894, + 1.148188458995719, + 1.1487490419967799, + 1.14936258400121, + 1.1499830419998034, + 1.1507948750004289, + 1.1514159590005875, + 1.1520009999949252, + 1.1526694589992985, + 1.1533417089958675, + 1.1539486670008046, + 1.1545580419988255, + 1.1551428339953418, + 1.1557589590011048, + 1.1562982089963043, + 1.1568622089980636, + 1.1573674169994774, + 1.157925791994785, + 1.1585051669972017, + 1.15911262499867, + 1.159770166996168, + 1.1603392920005717, + 1.1609600839947234, + 1.1615598749995115, + 1.1621290420007426, + 1.1626607500002137, + 1.1632087920006597, + 1.1638326249958482, + 1.1643509169953177, + 1.1648976249998668, + 1.1654338750013267, + 1.1659819999986212, + 1.1665207920013927, + 1.1670617089985171, + 1.1676194169995142, + 1.1681647090008482, + 1.1687184170004912, + 1.169463916994573, + 1.1700420419947477, + 1.1706013750008424, + 1.171165125000698, + 1.171705959000974, + 1.1722813749947818, + 1.1728908340010094, + 1.1734494170013932, + 1.1739917500017327, + 1.1745444999978645, + 1.1751195839970023, + 1.1757114169959095, + 1.1762874170017312, + 1.1768331249986659, + 1.1773625419955351, + 1.1778906670006108, + 1.1784412089982652, + 1.1789981670008274, + 1.1795850419948692, + 1.1802739999984624, + 1.180961499994737, + 1.1815203340011067, + 1.182097500000964, + 1.1826672089955537, + 1.183229834001395, + 1.1837891249961103, + 1.184359916995163, + 1.1849379999985103, + 1.1855029169964837, + 1.1860879999949248, + 1.1866134589945432, + 1.1871429169987096, + 1.1876381670008413, + 1.1881753339985153, + 1.1886626669947873, + 1.1892299169994658, + 1.1897754589954275, + 1.1903368339990266, + 1.1909092499990948, + 1.1914107919947128, + 1.1919586669973796, + 1.1924948749947362, + 1.1930197089968715, + 1.1935656249988824, + 1.1942643750007846, + 1.1948198749960284, + 1.1953805839948473, + 1.1959066249983152, + 1.1964327089954168, + 1.1970223339958466, + 1.1977087919949554, + 1.1983517089975066, + 1.199038083999767, + 1.1996357499956503, + 1.2001783749947208, + 1.2007560839992948, + 1.2013118339964421, + 1.2018805839979905, + 1.2024307499959832, + 1.2030039589953958, + 1.2035433749988442, + 1.2042269589946955, + 1.2047806670016143, + 1.2053085840016138, + 1.205881624999165, + 1.2064111250001588, + 1.2069525839979178, + 1.2074880840009428, + 1.2080535419954685, + 1.2086104999980307, + 1.2091438339994056, + 1.209690416995727, + 1.210262791995774, + 1.2107685000009951, + 1.2112948750000214, + 1.2118502090015681, + 1.2123852919976343, + 1.2129334589990322, + 1.2134774590012967, + 1.214062708997517, + 1.2146135000002687, + 1.2151681249961257, + 1.2156863749987679, + 1.2162019589959527, + 1.216731833999802, + 1.2173628749951604, + 1.21797770899866, + 1.218726749997586, + 1.2192582919960842, + 1.2197892089970992, + 1.2203325419977773, + 1.2208810419979272, + 1.2214017090009293, + 1.2219607090009958, + 1.2225066669998341, + 1.223014916999091, + 1.223530541996297, + 1.2240562500010128, + 1.224571416998515, + 1.2251042499992764, + 1.2257145839976147, + 1.2262891249993118, + 1.2268263750011101, + 1.2273387919995002, + 1.2278850419970695, + 1.2284440840012394, + 1.2289902089978568, + 1.2295190000004368, + 1.2300813339970773, + 1.230660875000467, + 1.2312042089979514, + 1.2317340840018005, + 1.2322549589953269, + 1.232788374996744, + 1.2333582499995828, + 1.2338847089995397, + 1.234444749999966, + 1.2349394999982906, + 1.2354755839987774, + 1.2361722089990508, + 1.236838249998982, + 1.237512166997476, + 1.238084999997227, + 1.2386970840016147, + 1.2392868749957415, + 1.239853041995957, + 1.2403489999996964, + 1.2408968749950873, + 1.2413957499957178, + 1.2419174169990583, + 1.2424838340011775, + 1.2430452089975006, + 1.2435925839963602, + 1.244196291998378, + 1.2447140000003856, + 1.2452579999953741, + 1.2458249170013005, + 1.2463522089965409, + 1.2469877499970607, + 1.2475545419947593, + 1.2480898750000051, + 1.2486241669976152, + 1.249147541995626, + 1.2497158749974915, + 1.250263083995378, + 1.2509375000008731, + 1.2517601250001462, + 1.2522921249983483, + 1.2528333340014797, + 1.2533933339946088, + 1.253952583996579, + 1.254462999997486, + 1.255041042000812, + 1.2555824169976404, + 1.2562071249994915, + 1.2567601249975269, + 1.2574656249998952, + 1.258211708998715, + 1.2588265419981326, + 1.2593897499973536, + 1.2599688339978456, + 1.2605404169953545, + 1.2611021249977057, + 1.261623916994722, + 1.262161250000645, + 1.2627002090011956, + 1.2632633749963134, + 1.2638412499945844, + 1.2644394589951844, + 1.2649982500006445, + 1.2655590840004152, + 1.2660696249949979, + 1.2666381249946426, + 1.2672137499976088, + 1.2677488339977572, + 1.2682942920000642, + 1.2688080840016482, + 1.2693546250011423, + 1.269945583997469, + 1.2705009589990368, + 1.271045666995633, + 1.2715517920005368, + 1.2720452499997918, + 1.2725888339991798, + 1.2731730839950615, + 1.273701666999841, + 1.2742105840006843, + 1.2748616249955376, + 1.275460208998993, + 1.2760816250010976, + 1.2766827500017826, + 1.2772770839947043, + 1.2778212919947691, + 1.2783620420013904, + 1.27890437500173, + 1.2794675839977572, + 1.2799927499945625, + 1.2805184169992572, + 1.281110042000364, + 1.2816771249999874, + 1.282263791996229, + 1.2828171250002924, + 1.283364041999448, + 1.283922458998859, + 1.2844860420009354, + 1.2850113339954987, + 1.2855362920017797, + 1.2860728749947157, + 1.28661424999882, + 1.2871689999956288, + 1.2877010839947616, + 1.2882391669991193, + 1.288868999996339, + 1.2895046669946169, + 1.2901279590005288, + 1.2907888339977944, + 1.2914427089999663, + 1.292051917000208, + 1.292658541999117, + 1.293282624996209, + 1.2939027499960503, + 1.2945543749956414, + 1.295273208997969, + 1.2959952919991338, + 1.2966428340005223, + 1.2972460419987328, + 1.2978759999969043, + 1.2984653339954093, + 1.2990772499979357, + 1.2996862500003772, + 1.3003092919971095, + 1.30096920899814, + 1.3015712089982117, + 1.3022590839973418, + 1.3029081669956213, + 1.3035324589945958, + 1.3042123339982936, + 1.3048429589980515, + 1.3054583339981036, + 1.3061065419969964, + 1.3066964999961783, + 1.3073108339958708, + 1.3079190839998773, + 1.3085466670017922, + 1.3091453339948202, + 1.3097836669985554, + 1.31041974999971, + 1.3111912089952966, + 1.3118039999972098, + 1.3124182920000749, + 1.312981374998344, + 1.3136109999977634, + 1.3142689169981168, + 1.3148822919974918, + 1.3155675000016345, + 1.316334333998384, + 1.316997124995396, + 1.3177425419999054, + 1.3184458339965204, + 1.319090334000066, + 1.3197287090006284, + 1.3204170419994625, + 1.3210571249946952, + 1.3216874589998042, + 1.3223166669995408, + 1.3229537919978611, + 1.3235865839960752, + 1.3242300839992822, + 1.3248337920013, + 1.3254365419998066, + 1.326085583998065, + 1.3268137919949368, + 1.3273964589971001, + 1.328028791998804, + 1.3286529589968268, + 1.329278583994892, + 1.3299015419979696, + 1.330610708995664, + 1.331286499997077, + 1.3320259169995552, + 1.3326614589968813, + 1.3333040419965982, + 1.3340343339950778, + 1.3347014999962994, + 1.3353991670010146, + 1.3361687090000487, + 1.3368448749970412, + 1.3374528749991441, + 1.3381050839961972, + 1.3387304589996347, + 1.3393878339993535, + 1.3400031669953023, + 1.3406193749979138, + 1.3412325419994886, + 1.341954083996825, + 1.3425796250012354, + 1.3431827919994248, + 1.343796333996579, + 1.3444541669960017, + 1.3450788339978317, + 1.3456730420002714, + 1.3462752919949708, + 1.3469537499986473, + 1.3476839590002783, + 1.3483969169974444, + 1.3490780419961084, + 1.3498173339976347, + 1.3505214999968302, + 1.3511727090008208, + 1.352095083995664, + 1.3527846669967403, + 1.3534679590011365, + 1.3541255839954829, + 1.3548870000013267, + 1.3554712920013117, + 1.3561424169965903, + 1.3567780419980409, + 1.3574068339949008, + 1.3580665420013247, + 1.358687749998353, + 1.3593352919997415, + 1.3599750840003253, + 1.3606123749996186, + 1.361250249996374, + 1.3618863340016105, + 1.3624794999996084, + 1.3631446250001318, + 1.363798874997883, + 1.3644549169985112, + 1.365073916997062, + 1.3657244169953628, + 1.3663469169987366, + 1.3669885419949424, + 1.3676328340006876, + 1.3682174589994247, + 1.3688217499948223, + 1.369476333995408, + 1.3700511249990086, + 1.3706658750015777, + 1.3712894169948413, + 1.3719071250015986, + 1.372679916996276, + 1.3733152499989956, + 1.373964624996006, + 1.3746581669984153, + 1.3754292500016163, + 1.3760935839964077, + 1.3767667499996605, + 1.3774053339948296, + 1.378130124998279, + 1.3788422500001616, + 1.3794454999951995, + 1.3800793749978766, + 1.3807607499984442, + 1.381429583998397, + 1.38207170899841, + 1.3826693750015693, + 1.3832749590001185, + 1.3838771669979906, + 1.384402042000147, + 1.3849677089965553, + 1.3855049589983537, + 1.38616304199968, + 1.386702374999004, + 1.3872478749981383, + 1.387820666997868, + 1.388354458998947, + 1.3889157919984427, + 1.3894269169977633, + 1.3899692089980817, + 1.3904647499948624, + 1.3909984589990927, + 1.3915656669996679, + 1.3922748749973834, + 1.392858333994809, + 1.3934668340007192, + 1.3940584169977228, + 1.3946189999987837, + 1.3951474589994177, + 1.3957025419949787, + 1.3961985419955454, + 1.3967372499973862, + 1.3972735839997767, + 1.397849208995467, + 1.398436416995537, + 1.3990186250011902, + 1.3995663339956081, + 1.4000689999957103, + 1.4005768339993665, + 1.4011260839979514, + 1.4017101249992265, + 1.4022688339973683, + 1.4028213749988936, + 1.40335999999661, + 1.4038968339955318, + 1.4044361669948557, + 1.4049958339965087, + 1.405526791997545, + 1.406044709001435, + 1.406573959000525, + 1.407132416999957, + 1.407591750001302, + 1.4081838749989402, + 1.4088826669976697, + 1.4094666249948204, + 1.4099940419982886, + 1.410538167001505, + 1.4110924589986098, + 1.4116490000014892, + 1.4123321250008303, + 1.4136496249993797, + 1.4144407919957303, + 1.4150045839996892, + 1.415583041998616, + 1.4161643339975853, + 1.4167001669993624, + 1.4172748749988386, + 1.417976999997336, + 1.4185413339946535, + 1.4191200839995872, + 1.4196129170013592, + 1.4201409589950345, + 1.420702709001489, + 1.4212284169989289, + 1.4217647499972372, + 1.422286916997109, + 1.4229365419960232, + 1.4235004169968306, + 1.424080500000855, + 1.4247054169973126, + 1.4252419589975034, + 1.4257924999983516, + 1.4263814169971738, + 1.4269428339976002, + 1.427514874994813, + 1.42807133399765, + 1.4286194169981172, + 1.4291549589979695, + 1.4296813339969958, + 1.4302062499991735, + 1.4309234169995761, + 1.4315840839990415, + 1.432223083997087, + 1.4329272089962615, + 1.433550916997774, + 1.4341135840004426, + 1.4347067919952678, + 1.4352171669961535, + 1.4357566670005326, + 1.4363316669987398, + 1.4369185420000576, + 1.437523084001441, + 1.4380882499972358, + 1.4386299170000711, + 1.4391875419969438, + 1.4398365419983747, + 1.4403710839978885, + 1.4409528339965618, + 1.4415049589952105, + 1.441968209001061, + 1.4424924999984796, + 1.44306904199766, + 1.4436022919981042, + 1.4441512919947854, + 1.4446509589979541, + 1.445224083996436, + 1.44573649999802, + 1.4462700840012985, + 1.4468518339999719, + 1.4474241249990882, + 1.4479812089994084, + 1.4485511669990956, + 1.4491365419962676, + 1.4496899169971584, + 1.4503064589953283, + 1.450908624996373, + 1.4515173339968896, + 1.4521191669991822, + 1.452692708997347, + 1.453289874996699, + 1.4538309589988785, + 1.4544241670009797, + 1.4550381669978378, + 1.455581958995026, + 1.4561701249986072, + 1.4567216249997728, + 1.4572209589969134, + 1.4580174169968814, + 1.4586678339983337, + 1.4592330000014044, + 1.4597894170001382, + 1.460292458999902, + 1.4608042920008302, + 1.4613101249997271, + 1.4618813339984627, + 1.4623908749999828, + 1.4629336250000051, + 1.4634487090006587, + 1.463983791996725, + 1.4645037919981405, + 1.4650150000015856, + 1.4655564589993446, + 1.4661307919959654, + 1.4666817499964964, + 1.4672365419974085, + 1.4677664999981062, + 1.468296792001638, + 1.4688962919972255, + 1.4694374169994262, + 1.4700377920016763, + 1.4706266669963952, + 1.4712653339956887, + 1.4718628749978961, + 1.47245433399803, + 1.4729963749996386, + 1.4735315840007388, + 1.4740762090004864, + 1.4746179590001702, + 1.475139374997525, + 1.4756670419956208, + 1.4762113339966163, + 1.4767735419954988, + 1.4773392499992042, + 1.4778850000002421, + 1.478550166997593, + 1.4792337920007412, + 1.4798789999986184, + 1.4804977089952445, + 1.4811552920000395, + 1.4818036669967114, + 1.48243562499556, + 1.4830682920000982, + 1.4836341670015827, + 1.4842722920002416, + 1.4849206669969135, + 1.485530124999059, + 1.486187249996874, + 1.4868179999975837, + 1.4874400839980808, + 1.4880873750007595, + 1.4886964170000283, + 1.489344624998921, + 1.490006583997456, + 1.4907569999995758, + 1.491376041994954, + 1.491992625000421, + 1.4926253340017865, + 1.4932702090009116, + 1.4939670419989852, + 1.4946176669982378, + 1.4952702500013402, + 1.4958862919957028, + 1.4965148749979562, + 1.4971455839986447, + 1.497758833997068, + 1.4984235419979086, + 1.4990987919954932, + 1.4997608749981737, + 1.5003867089981213, + 1.5010199999960605, + 1.5017268340016017, + 1.5023719589953544, + 1.5029653749952558, + 1.5036237919994164, + 1.5042584589973558, + 1.5049054999981308, + 1.5055233749953914, + 1.5061589589968207, + 1.5069078339947737, + 1.5075689169971156, + 1.508227458994952, + 1.508996833996207, + 1.5096572920010658, + 1.5103570419960306, + 1.5110185839948826, + 1.5116251669969643, + 1.5122630839978228, + 1.5129090420014109, + 1.513551791998907, + 1.514241459000914, + 1.5148874590013293, + 1.515533375000814, + 1.5161280839965912, + 1.5167648749993532, + 1.517357833996357, + 1.5179984999995213, + 1.518634749998455, + 1.519407333995332, + 1.520032499996887, + 1.5206613749978715, + 1.5212584589971812, + 1.5218913339995197, + 1.5225181249988964, + 1.5231273749959655, + 1.5237440839991905, + 1.5243762499958393, + 1.5249969590004184, + 1.5256462920006015, + 1.526277917000698, + 1.5269249589982792, + 1.5275383339976543, + 1.5281886250013486, + 1.5289419170003384, + 1.5296259999959148, + 1.5303376669980935, + 1.5309977919969242, + 1.5316295839947998, + 1.5322360840000329, + 1.5328986249951413, + 1.5335609999965527, + 1.534160333998443, + 1.534772792001604, + 1.5354358749973471, + 1.5360400839999784, + 1.5366694999975152, + 1.5373150000013993, + 1.5379704590013716, + 1.5385813339962624, + 1.5392007499976899, + 1.5399261249986012, + 1.5405664589998196, + 1.5412045420016511, + 1.5418714589977753, + 1.5425397919971147, + 1.5431624999982887, + 1.5437725000010687, + 1.5444048749996, + 1.5450314999980037, + 1.5456554999982473, + 1.5462667920000968, + 1.5469007919964497, + 1.5476044169990928, + 1.5482715420002933, + 1.5489810419967398, + 1.5497316249966389, + 1.5503614170011133, + 1.550990042000194, + 1.5516207089967793, + 1.552245958999265, + 1.5529106670001056, + 1.5535424999980023, + 1.5541901249962393, + 1.5548218749972875, + 1.555560125001648, + 1.5562088340011542, + 1.5568271669981186, + 1.557510792001267, + 1.5581467500014696, + 1.5587555839956622, + 1.5593844999966677, + 1.5600651669956278, + 1.5606865000008838, + 1.5612854589999188, + 1.5619313749994035, + 1.562565000000177, + 1.5631894170001033, + 1.5638282500003697, + 1.5644296249956824, + 1.5650728339969646, + 1.565700333994755, + 1.5663188749967958, + 1.5670308339977055, + 1.5677264999976614, + 1.5683723339971039, + 1.5690344999966328, + 1.569673291996878, + 1.5702907500017318, + 1.5709480840014294, + 1.5716179169976385, + 1.5722472089983057, + 1.5729307090005022, + 1.5735405419982271, + 1.5742111250001471, + 1.5751691249970463, + 1.5758283749964903, + 1.57651249999617, + 1.5771892499979003, + 1.5778638339979807, + 1.578496208996512, + 1.5791265840016422, + 1.5797319170014816, + 1.5803650839952752, + 1.581007041997509, + 1.5816650839988142, + 1.582286374999967, + 1.5829112499995972, + 1.5835321249978733, + 1.5841806669996004, + 1.5849832089952542, + 1.5856165000004694, + 1.5863114999956451, + 1.5869520419946639, + 1.5875692920017173, + 1.588313084001129, + 1.5890724999990198, + 1.5897353749969625, + 1.5904859169968404, + 1.5912000419994001, + 1.5918447090007248, + 1.592480125000293, + 1.593090124995797, + 1.593729333995725, + 1.5943348340006196, + 1.5950199169965344, + 1.5956645839978592, + 1.596281583995733, + 1.5969766669950332, + 1.5976107919996139, + 1.5982325000004494, + 1.598857749995659, + 1.5995154170013848, + 1.600152667000657, + 1.600785916998575, + 1.6014334999999846, + 1.60206725000171, + 1.6027029589968151, + 1.6034129170002416, + 1.6040367919995333, + 1.604654083996138, + 1.6052982499968493, + 1.605910458994913, + 1.6065525000012713, + 1.6071908340018126, + 1.6078023340014624, + 1.6084409589966526, + 1.6090889170009177, + 1.6097667499998352, + 1.6104555839992827, + 1.6111679999958142, + 1.6118268339996575, + 1.6124749590017018, + 1.6131329589989036, + 1.613785875000758, + 1.614454416994704, + 1.6152504999990924, + 1.6159151249958086, + 1.6165919999984908, + 1.6172299169993494, + 1.6179111669989652, + 1.6185699589987053, + 1.6191961669974262, + 1.6198548749962356, + 1.6205087089983863, + 1.621192083999631, + 1.621801624998625, + 1.6224010000005364, + 1.6230613750012708, + 1.6236969589954242, + 1.6243226669976139, + 1.624979499996698, + 1.62563691700052, + 1.6263237089951872, + 1.6269888749957317, + 1.6276494170015212, + 1.6283483750012238, + 1.6289936249959283, + 1.6296795000016573, + 1.6303297089980333, + 1.6309868749958696, + 1.6316130839986727, + 1.6322312919946853, + 1.632926583995868, + 1.633619333995739, + 1.6342510419999599, + 1.634894541995891, + 1.63553208400117, + 1.636174209001183, + 1.6368004999967525, + 1.637413500000548, + 1.6380069169972558, + 1.638679208997928, + 1.6392991249958868, + 1.6399425839990727, + 1.640580458995828, + 1.6412566250000964, + 1.6418880839992198, + 1.6425312089995714, + 1.6432087919965852, + 1.643834958995285, + 1.6444832919951295, + 1.6452472919991123, + 1.6458418339971104, + 1.646473374996276, + 1.6471246669971151, + 1.6478015839966247, + 1.6484606669982895, + 1.64925137499813, + 1.6499578750008368, + 1.6505722500005504, + 1.6511867090011947, + 1.6518306669968297, + 1.65247833399917, + 1.6530996250003227, + 1.65372433399898, + 1.6543572500013397, + 1.6549952089990256, + 1.6556665419993806, + 1.6563658749946626, + 1.6570087500003865, + 1.6576704170001904, + 1.6582964999979595, + 1.6589588339993497, + 1.6596261669983505, + 1.6602825419977307, + 1.660918417001085, + 1.661540666995279, + 1.6621902089973446, + 1.6629301669963752, + 1.6636615419993177, + 1.6643233340000734, + 1.664957916997082, + 1.6655765839968808, + 1.6661944590014173, + 1.6668715839987271, + 1.6675576669949805, + 1.6682629999995697, + 1.6689447919998202, + 1.6696356249958626, + 1.6702604999954929, + 1.6709267499973066, + 1.6715401249966817, + 1.672224499998265, + 1.6729037089971825, + 1.6735405840008752, + 1.6742134169981, + 1.6748559589977958, + 1.675454958996852, + 1.67608316699625, + 1.6767048339970643, + 1.6773298339976463, + 1.6779608340002596, + 1.6785796670010313, + 1.6791727499949047, + 1.6798542499964242, + 1.680560417000379, + 1.6811930420008139, + 1.6818483749957522, + 1.682451583998045, + 1.6830419589969097, + 1.6835939999946277, + 1.6842428749951068, + 1.684873250000237, + 1.685515042001498, + 1.6861189589981223, + 1.6868562499948894, + 1.6875933749979595, + 1.6883165839972207, + 1.6889672499964945, + 1.6896122089965502, + 1.6902113749965793, + 1.6908601249961066, + 1.6915023339970503, + 1.692137999998522, + 1.6928047920009703, + 1.6934226669982309, + 1.694010667000839, + 1.6946137089980766, + 1.6952499589970103, + 1.6958955419977428, + 1.6965394169965293, + 1.6972162919992115, + 1.6978512499990757, + 1.6985184590012068, + 1.6991562499970314, + 1.6997785839994322, + 1.7003837500014924, + 1.7010051249962999, + 1.7016757499950472, + 1.7022978749955655, + 1.7029546669946285, + 1.7036315419973107, + 1.704288084001746, + 1.7049497089974466, + 1.705566208998789, + 1.706216583996138, + 1.7068482089962345, + 1.7075399169989396, + 1.7082680839957902, + 1.7089494589963579, + 1.7096124589952524, + 1.7102394999965327, + 1.7110218749949127, + 1.7116449589957483, + 1.7122797499978333, + 1.7129070419978234, + 1.713622208997549, + 1.7142510839985334, + 1.7149217089972808, + 1.7155402089993004, + 1.716168041995843, + 1.7168052499982878, + 1.7174305000007735, + 1.7180724169957102, + 1.7188415839991649, + 1.7195056669952464, + 1.720166999999492, + 1.720821041999443, + 1.7214531669960706, + 1.722070416995848, + 1.7226659169973573, + 1.7233117499999935, + 1.723937709000893, + 1.72459162499581, + 1.7253572920017177, + 1.7261682089956594, + 1.7268398749947664, + 1.7275527089950629, + 1.7282505839975784, + 1.72891558399715, + 1.7295460419991286, + 1.7301421250012936, + 1.7307670839945786, + 1.7314268339978298, + 1.732052916995599, + 1.7326703340004315, + 1.733309791998181, + 1.7339829999982612, + 1.7345662500010803, + 1.735192084001028, + 1.7358399590011686, + 1.7364688749948982, + 1.7371367500018096, + 1.7377769589948002, + 1.7384155839972664, + 1.7390496250009164, + 1.7397578339950996, + 1.7404340419961954, + 1.7410581250005635, + 1.7417002090005553, + 1.7422979999973904, + 1.7429970000011963, + 1.7436507919992437, + 1.7442617089982377, + 1.7450012499975855, + 1.7456698749956558, + 1.7462487500015413, + 1.746932083995489, + 1.7475612919952255, + 1.748214499995811, + 1.748924084000464, + 1.7495565419958439, + 1.7501748750000843, + 1.7507732919984846, + 1.7513673749999725, + 1.7520100839974475, + 1.7527947089984082, + 1.7534503339993535, + 1.7540851669982658, + 1.7547313749964815, + 1.755334417000995, + 1.7559890839984291, + 1.7567474999959813, + 1.757394583997666, + 1.758008124998014, + 1.7586565419987892, + 1.759316541996668, + 1.7600302919963724, + 1.7606821669978672, + 1.761327791995427, + 1.7619243750013993, + 1.7625729999999749, + 1.7632357089969446, + 1.763817166996887, + 1.764621124995756, + 1.7653024999963236, + 1.7660375839986955, + 1.7667097919984371, + 1.767314874996373, + 1.767958999997063, + 1.7685916670016013, + 1.7693399999989197, + 1.769950958994741, + 1.7705614590013283, + 1.7711794999995618, + 1.7718285839946475, + 1.7724723339997581, + 1.77314808400115, + 1.773834416999307, + 1.7745019590001903, + 1.7751577919989359, + 1.7757846669992432, + 1.776398292000522, + 1.777001416994608, + 1.777619833999779, + 1.778229958996235, + 1.7788464999975986, + 1.7795333749963902, + 1.7801951669971459, + 1.7808357089961646, + 1.7814741670008516, + 1.782084833997942, + 1.7826824169969768, + 1.7832797090013628, + 1.7839740419949521, + 1.7846388749967446, + 1.7853442919949885, + 1.7860407089974615, + 1.7866710419984884, + 1.7872852919972502, + 1.7879169590014499, + 1.7885577919951174, + 1.7891942089991062, + 1.7897803339947131, + 1.7903538339960505, + 1.791020374999789, + 1.7916487920010695, + 1.792317291998188, + 1.7929872919994523, + 1.7936172499976237, + 1.794249916994886, + 1.7948514169984264, + 1.7954929170009564, + 1.7961029169964604, + 1.796714833995793, + 1.7973910840009921, + 1.7979805840004701, + 1.7985746249978547, + 1.79917379199469, + 1.7997988339993753, + 1.8004158339972491, + 1.8010309999954188, + 1.8016410419950262, + 1.8022555419956916, + 1.80286150000029, + 1.803517959000601, + 1.8041715419967659, + 1.8049115839967271, + 1.805572334000317, + 1.806217208999442, + 1.8068080000011832, + 1.8074158339950372, + 1.8080439589975867, + 1.8086898339970503, + 1.8093114590010373, + 1.8099464589977288, + 1.8105217089978396, + 1.811170791996119, + 1.8117486249975627, + 1.812382999996771, + 1.813003833995026, + 1.8136042499972973, + 1.8142093749993364, + 1.814818541999557, + 1.815405583998654, + 1.8160379999972065, + 1.8166410839985474, + 1.8172732499951962, + 1.8178796669963049, + 1.8185024999984307, + 1.8190970419964287, + 1.8197242919995915, + 1.8203339999963646, + 1.82099316699896, + 1.8215848749969155, + 1.82235049999872, + 1.8230836250004359, + 1.8237330420015496, + 1.8244178339955397, + 1.8250224590010475, + 1.825705499999458, + 1.8263762919959845, + 1.8270402919952176, + 1.8276505839967285, + 1.8282931249996182, + 1.8289365419987007, + 1.8295690419981838, + 1.830227541999193, + 1.8308611669999664, + 1.831544833999942, + 1.832175333998748, + 1.8327829589979956, + 1.8333796250008163, + 1.8340094169980148, + 1.8346163339956547, + 1.835294459000579, + 1.8359068749996368, + 1.8365175840008305, + 1.8371220839981106, + 1.8377323339955183, + 1.8383314589955262, + 1.8389366670016898, + 1.8395683749986347, + 1.8401958749964251, + 1.840871166998113, + 1.8414869170010206, + 1.8420716249966063, + 1.8428492499951972, + 1.843561541994859, + 1.8442801669953042, + 1.84493233399553, + 1.8455616669962183, + 1.846171459001198, + 1.8468012500015902, + 1.8474052919991664, + 1.848150291996717, + 1.8487552919978043, + 1.849433458999556, + 1.8500257499981672, + 1.8506568750017323, + 1.85124937499495, + 1.8518174169948907, + 1.8524277499964228, + 1.8530664999998407, + 1.8536962500002119, + 1.8543125840005814, + 1.854988916995353, + 1.8556246669977554, + 1.8562284169966006, + 1.856850874995871, + 1.857476791999943, + 1.858112458998221, + 1.8587266249960521, + 1.8593478749971837, + 1.8600172919977922, + 1.8605852499968023, + 1.8611777089972747, + 1.8618673749951995, + 1.8625584589972277, + 1.8632084589989972, + 1.863905166996119, + 1.8645202499974403, + 1.8651836249991902, + 1.8658127089947811, + 1.8664314589987043, + 1.8671035840015975, + 1.8677640839960077, + 1.868420166996657, + 1.8690359589963919, + 1.8696510000008857, + 1.8703827089993865, + 1.871035167001537, + 1.8716392499991343, + 1.8722252500010654, + 1.8728453750009066, + 1.873440124996705, + 1.8740464590009651, + 1.874698499996157, + 1.875336791999871, + 1.8760366249989602, + 1.8766574589972151, + 1.8772564589962712, + 1.8779169589979574, + 1.878550458997779, + 1.879191374995571, + 1.8798369590003858, + 1.8804563749945373, + 1.8812369590013986, + 1.8819140839987085, + 1.8825759999963338, + 1.8831919169970206, + 1.883840666996548, + 1.8844881249970058, + 1.8851414589953492, + 1.8858052499999758, + 1.8864776670016, + 1.8870725839951774, + 1.8876717919993098, + 1.8883539169983123, + 1.8889737089994014, + 1.8895941250011674, + 1.8902161250007339, + 1.890851208998356, + 1.8914716669969494, + 1.8920582919963636, + 1.8926806249946821, + 1.893313249995117, + 1.8939072919965838, + 1.894505083997501, + 1.8951264589995844, + 1.89574724999693, + 1.8964810839970596, + 1.8970944589964347, + 1.8977076250012033, + 1.8982501669961493, + 1.8989468750005472, + 1.8995346250012517, + 1.9002181249961723, + 1.900826541997958, + 1.9015068340013386, + 1.9023311249984545, + 1.9031094589954591, + 1.903777416999219, + 1.9044828339974629, + 1.905194416998711, + 1.9058069169986993, + 1.9064652499946533, + 1.9070947500003967, + 1.9076864999951795, + 1.9082953749966691, + 1.9089764169984846, + 1.909610041999258, + 1.910260083997855, + 1.910933416998887, + 1.9116074589983327, + 1.9122369589968002, + 1.9129247499949997, + 1.913721833996533, + 1.9144234170016716, + 1.915077833997202, + 1.915669166999578, + 1.9162553339992883, + 1.9168577089949395, + 1.9173674999983632, + 1.9179421669978183, + 1.918551666996791, + 1.919086541995057, + 1.919605874994886, + 1.9202367089965264, + 1.9209106669950415, + 1.921459249999316, + 1.9220155000002705, + 1.9225694999986445, + 1.9232027089965413, + 1.923776874995383, + 1.9243974999990314, + 1.9249607919991831, + 1.9255580839962931, + 1.9261448339966591, + 1.926708166996832, + 1.9272678749985062, + 1.9278271669973037, + 1.9283839169947896, + 1.9289506249988335, + 1.929482667001139, + 1.9300097500017728, + 1.9305909589966177, + 1.9311452920010197, + 1.9317005839984631, + 1.9322635839998838, + 1.932813791994704, + 1.9334004999982426, + 1.9339611249961308, + 1.934489624996786, + 1.9350347090003197, + 1.9356454590015346, + 1.936203666999063, + 1.93686904200149, + 1.9374227919979603, + 1.9379681669961428, + 1.938504792000458, + 1.939044874998217, + 1.9395697500003735, + 1.9400838340006885, + 1.940613624996331, + 1.9411819589950028, + 1.9417456250012037, + 1.9423319999987143, + 1.9429950420017121, + 1.9436475839975174, + 1.9442004169977736, + 1.944765208994795, + 1.945326875000319, + 1.9459266669946373, + 1.9464639169964357, + 1.9470173340014298, + 1.9475764999951934, + 1.94813137500023, + 1.9487183749952237, + 1.9492961669966462, + 1.9498457919980865, + 1.950407541997265, + 1.950998708998668, + 1.9516152500000317, + 1.952281416997721, + 1.95295674999943, + 1.9536393339949427, + 1.9542450000008103, + 1.9548603340008412, + 1.955497958995693, + 1.9561323339949013, + 1.956741249996412, + 1.9574487089994363, + 1.9581409169986728, + 1.958747124997899, + 1.9593903749992023, + 1.9600151249978808, + 1.960636167001212, + 1.9613014169954113, + 1.9620383750007022, + 1.9627291249998962, + 1.9634468750009546, + 1.9640757919987664, + 1.9647646250014077, + 1.965372375001607, + 1.9660365839954466, + 1.9666655839973828, + 1.967315834001056, + 1.9679787499990198, + 1.9686404999956721, + 1.9692725839995546, + 1.9699262919966714, + 1.9705489170009969, + 1.9712230840013945, + 1.971842333994573, + 1.9724850419952418, + 1.973160875000758, + 1.9737916250014678, + 1.9744091669999762, + 1.9750515839987202, + 1.9756633340002736, + 1.976278292000643, + 1.976925625000149, + 1.977575999997498, + 1.9781925419956679, + 1.978781291996711, + 1.9793703749965061, + 1.9800065839954186, + 1.9806049170001643, + 1.9813431669972488, + 1.9820435000001453, + 1.982761125000252, + 1.9835258339953725, + 1.984196500001417, + 1.984819500001322, + 1.985501833994931, + 1.9861968339973828, + 1.9868640419954318, + 1.9876318339956924, + 1.9883305420007673, + 1.9890279169994756, + 1.9897307919964078, + 1.9903988750011194, + 1.9910915840009693, + 1.9918024169965065, + 1.9924927089959965, + 1.9931942089970107, + 1.9938921249995474, + 1.994519959000172, + 1.9950598340001306, + 1.9956069999971078, + 1.9963096669962397, + 1.9968762499993318, + 1.9974873749961262, + 1.9980406670001685, + 1.9986212919975515, + 1.9991899999949965, + 1.999735666999186, + 2.0003397920008865, + 2.0009733339975355, + 2.0015636249954696, + 2.0021650419948855, + 2.0028221249958733, + 2.003454541998508, + 2.00410383399867, + 2.0046651250013383, + 2.005193208999117, + 2.0058184169974993, + 2.006396416996722, + 2.0069337919994723, + 2.007513584001572, + 2.008081542000582, + 2.0085585419947165, + 2.0090853750007227, + 2.0096080000002985, + 2.01014129199757, + 2.0106543340007192, + 2.0112516669978504, + 2.01179904199671, + 2.013785541996185, + 2.0143562500015832, + 2.0148572089965455, + 2.0153884169994853, + 2.015895124997769, + 2.0163846249997732, + 2.016907999997784, + 2.0174160839960678, + 2.0179705420014216, + 2.018484374995751, + 2.0191675839960226, + 2.0200431249977555, + 2.0207736250013113, + 2.021395374998974, + 2.022030000000086, + 2.022591291999561, + 2.0231362499980605, + 2.0236199169958127, + 2.024146916999598, + 2.024816583994834, + 2.025440459001402, + 2.0260013340011938, + 2.0265279589948477, + 2.0272515839969856, + 2.0278208749950863, + 2.0283937499989406, + 2.028926083999977, + 2.0295043750011246, + 2.030135708999296, + 2.030729624995729, + 2.0313045000002603, + 2.0318943339952966, + 2.032488042001205, + 2.033016041998053, + 2.033555875001184, + 2.0341558340005577, + 2.03469524999673, + 2.0352377089948277, + 2.0358087919958052, + 2.0363926669961074, + 2.0370092500015744, + 2.037530292000156, + 2.0380306669976562, + 2.0385915000006207, + 2.039142458997958, + 2.039778458994988, + 2.040440500000841, + 2.0410783749975963, + 2.04178470899933, + 2.042392709001433, + 2.0429833339949255, + 2.0435610419954173, + 2.0441462919989135, + 2.044698999998218, + 2.045296791999135, + 2.0458168749973993, + 2.0463481249971665, + 2.0468557919957675, + 2.04737870900135, + 2.0479297089987085, + 2.048506916995393, + 2.0490304170016316, + 2.0495709169990732, + 2.0500880839972524, + 2.050686875001702, + 2.0512426249988494, + 2.051769166995655, + 2.052300292001746, + 2.052869084000122, + 2.0534252500001458, + 2.0540105420004693, + 2.0545604169965372, + 2.0551122920005582, + 2.055687333995593, + 2.056235124997329, + 2.0567707090012846, + 2.057311208998726, + 2.0578221670002677, + 2.0583356249990175, + 2.0588818339965655, + 2.059503666998353, + 2.060066708996601, + 2.0606757499990636, + 2.0612223749994882, + 2.0617930840016925, + 2.0623267919945647, + 2.0629228339967085, + 2.0635012919956353, + 2.064029749999463, + 2.0645887089995085, + 2.065159792000486, + 2.065732916998968, + 2.0662699169988628, + 2.0668197919949307, + 2.067357041996729, + 2.0679012089967728, + 2.0684259589979774, + 2.0689786250004545, + 2.0695248339980026, + 2.070103250000102, + 2.0706971249965136, + 2.0712577090016566, + 2.07180245899508, + 2.0723764169961214, + 2.0729004589957185, + 2.073450708994642, + 2.073990541997773, + 2.0745090839991462, + 2.0750440420015366, + 2.075668334000511, + 2.0762243749995832, + 2.0767777919973014, + 2.077343042001303, + 2.0779707089968724, + 2.0788299170017126, + 2.0795127499950468, + 2.0801436249967082, + 2.080700667000201, + 2.0812552499992307, + 2.0818168339974363, + 2.082369625000865, + 2.0829255419957917, + 2.08343587499985, + 2.0839829169999575, + 2.0845240419948823, + 2.0850624589947984, + 2.0856222919974243, + 2.0861580839991802, + 2.086720791994594, + 2.0872295840017614, + 2.087732583997422, + 2.088305291996221, + 2.088864375000412, + 2.0894325420013047, + 2.089996834001795, + 2.0905434169981163, + 2.0910797089964035, + 2.091618541999196, + 2.0922435839966056, + 2.0928162089985562, + 2.0933883339966997, + 2.0939302089973353, + 2.094468416995369, + 2.094985874995473, + 2.0955185419952613, + 2.0960540839951136, + 2.0966631249975762, + 2.097327541996492, + 2.098019334000128, + 2.098652000000584, + 2.099254666994966, + 2.099795374997484, + 2.100343749996682, + 2.1009138750014245, + 2.1014847499973257, + 2.102051208996272, + 2.1025475839996943, + 2.1031256249989383, + 2.1036252499980037, + 2.1041888749969075, + 2.104755208994902, + 2.1053065000014612, + 2.1058275420000427, + 2.1063417089972063, + 2.106925667001633, + 2.107522209000308, + 2.1080692499963334, + 2.108613416996377, + 2.1091971249989, + 2.1096967499979655, + 2.1102189169978374, + 2.11079933399742, + 2.111370958999032, + 2.1119528339986573, + 2.112504791999527, + 2.1130284999962896, + 2.1135916669954895, + 2.1141692089950084, + 2.114904124995519, + 2.115570417001436, + 2.1163805420001154, + 2.1170147090015234, + 2.1176259589992696, + 2.118269999999029, + 2.118896959000267, + 2.119473749997269, + 2.1200656250002794, + 2.120613166996918, + 2.121160083996074, + 2.121679749994655, + 2.1222287919954397, + 2.1228419999970356, + 2.123413499997696, + 2.123943499995221, + 2.124538833995757, + 2.1251274589958484, + 2.1256642090011155, + 2.126185749999422, + 2.126775833996362, + 2.127285167000082, + 2.1278729589976138, + 2.1284264589994564, + 2.128961624999647, + 2.1295041249977658, + 2.1300441669955035, + 2.1305696249983157, + 2.1310804589957115, + 2.1316156670000055, + 2.132160417000705, + 2.1327406669952325, + 2.1332661249980447, + 2.1338462499988964, + 2.134384749995661, + 2.134917167000822, + 2.1354838749975897, + 2.136075416994572, + 2.136727791999874, + 2.1373045000000275, + 2.137902666996524, + 2.13846754199767, + 2.1390515839957516, + 2.139585958997486, + 2.1401186250004685, + 2.1406444999956875, + 2.1411576669997885, + 2.14171387499664, + 2.1422618750002584, + 2.1427791669993894, + 2.143286583996087, + 2.1438738750002813, + 2.1444231669956935, + 2.1449629589988035, + 2.14565058399603, + 2.1461864999946556, + 2.1467602089978755, + 2.147301500001049, + 2.1478489590008394, + 2.148394999996526, + 2.148950666996825, + 2.149498999999196, + 2.1500735000008717, + 2.150623417001043, + 2.1511589590008953, + 2.1517082919963286, + 2.1522522090017446, + 2.152767125000537, + 2.153303209001024, + 2.1538535419967957, + 2.1543809169961605, + 2.1549869590016897, + 2.155509833995893, + 2.156156249999185, + 2.1566959589981707, + 2.157300833998306, + 2.15792504199635, + 2.1584777919997578, + 2.15901483399648, + 2.1595390840011532, + 2.1600332089947187, + 2.1605763749976177, + 2.161125416998402, + 2.161632124996686, + 2.1622039590001805, + 2.162753791999421, + 2.1632942919968627, + 2.1639452089948463, + 2.1645498750003753, + 2.1650852089951513, + 2.165628791997733, + 2.166124374998617, + 2.166680208996695, + 2.1671900000001187, + 2.16775216699898, + 2.168267166998703, + 2.1688145000007353, + 2.169365124995238, + 2.169888042000821, + 2.1704295839954284, + 2.1710026250002556, + 2.1715622919946327, + 2.1721548339992296, + 2.172687166996184, + 2.17323370899976, + 2.1738084999960847, + 2.174341291996825, + 2.1748992499997257, + 2.1754740420001326, + 2.1761724589960068, + 2.1767455419976613, + 2.177329666999867, + 2.1778832919953857, + 2.1784556669954327, + 2.1790007499948842, + 2.179603999997198, + 2.180159666997497, + 2.180715083995892, + 2.1812428339981125, + 2.181759916995361, + 2.18228408399591, + 2.1828164589969674, + 2.183351916995889, + 2.183914041997923, + 2.1844627919999766, + 2.1851557920017513, + 2.1856772499959334, + 2.1862225840013707, + 2.186849166995671, + 2.1873873340009595, + 2.187944666999101, + 2.1884844589949353, + 2.189072542001668, + 2.1896113749971846, + 2.190190333996725, + 2.1907068750006147, + 2.1912388339987956, + 2.191799041997001, + 2.192352749996644, + 2.192913499995484, + 2.1935030839958927, + 2.194046584001626, + 2.194632708997233, + 2.1953052499957266, + 2.195978291994834, + 2.196548416999576, + 2.1971489589996054, + 2.197699083997577, + 2.1982855839960393, + 2.1988362499978393, + 2.199393292001332, + 2.1999551249973592, + 2.2005108340017614, + 2.2010833749955054, + 2.2016535000002477, + 2.202203084001667, + 2.2027412919997005, + 2.2033583750016987, + 2.2038874169957126, + 2.204479624997475, + 2.2050480420002714, + 2.2056007089995546, + 2.2061594999977387, + 2.206694874999812, + 2.207273084000917, + 2.2078849999961676, + 2.2084855840003, + 2.2090112500009127, + 2.209573125001043, + 2.2101485839957604, + 2.2107009589963127, + 2.2113095419990714, + 2.2118559169975924, + 2.2123549999960233, + 2.2129881669970928, + 2.2135478339987458, + 2.2141490419962793, + 2.21473483400041, + 2.2153330000001006, + 2.2159547089977423, + 2.216502541996306, + 2.2170642919954844, + 2.2175962920009624, + 2.2181299590010894, + 2.2186991249982384, + 2.2192204169987235, + 2.2197253749982337, + 2.220266584001365, + 2.2207714169999235, + 2.221292458998505, + 2.2218184169978485, + 2.222378624996054, + 2.222935416997643, + 2.2234654999992927, + 2.223997083994618, + 2.2245136669953354, + 2.2250406249950174, + 2.2255992499995045, + 2.2261095419962658, + 2.226637874999142, + 2.2272121669957414, + 2.2277424589992734, + 2.2282322499959264, + 2.2287573749999865, + 2.229267541995796, + 2.2298601669972413, + 2.230400499996904, + 2.2309483339995495, + 2.2314622919948306, + 2.2320317499979865, + 2.232533208996756, + 2.233121459001268, + 2.2337394999995013, + 2.234358791996783, + 2.2349688749964116, + 2.235527374999947, + 2.236169042000256, + 2.236745541995333, + 2.237385208994965, + 2.237953916999686, + 2.238490499999898, + 2.2390749999976833, + 2.239620125001238, + 2.2401967920013703, + 2.240738041997247, + 2.241302624999662, + 2.2418203339984757, + 2.2423612919956213, + 2.2429147090006154, + 2.2435152499965625, + 2.244083874997159, + 2.244629624998197, + 2.2451549589968636, + 2.245686083995679, + 2.246214749997307, + 2.2468056669968064, + 2.247490124995238, + 2.2480822919969796, + 2.248598624995793, + 2.2491341669956455, + 2.2496855839999625, + 2.250203541996598, + 2.2507321250013774, + 2.251295999994909, + 2.251880291994894, + 2.252444083998853, + 2.253012041997863, + 2.2536065419990337, + 2.254171583997959, + 2.2547087499988265, + 2.255368499994802, + 2.2563105419976637, + 2.2569960839973646, + 2.2576301250010147, + 2.2582147089997306, + 2.2587887920017238, + 2.2593742919998476, + 2.259942124997906, + 2.2604784590002964, + 2.2610272919991985, + 2.2615783750006813, + 2.2621215420003864, + 2.2627009169955272, + 2.263247750001028, + 2.2638230839947937, + 2.2643844170015655, + 2.264929166994989, + 2.2654315839972696, + 2.2659967090003192, + 2.2665576250001322, + 2.2671329169970704, + 2.267643125000177, + 2.268178291997174, + 2.268722208995314, + 2.269255624996731, + 2.2697970419976627, + 2.2704369999992196, + 2.2710783750007977, + 2.27171562500007, + 2.2723620839969954, + 2.272991334000835, + 2.273604541995155, + 2.275007459000335, + 2.2759231669988367, + 2.276816208999662, + 2.277512624998053, + 2.278118041998823, + 2.278742541995598, + 2.27944520899473, + 2.280026041997189, + 2.2806763339976897, + 2.2813496669987217, + 2.28199870899698, + 2.282658708994859, + 2.283334499996272, + 2.2839502089991583, + 2.284560291998787, + 2.285183916996175, + 2.285836167000525, + 2.286490041995421, + 2.287108917000296, + 2.287698084001022, + 2.2882970419959747, + 2.288950541995291, + 2.2895512499962933, + 2.2901517919963226, + 2.2907975419948343, + 2.291439291999268, + 2.2920773750010994, + 2.2928276249949704, + 2.293504249995749, + 2.2941461250011344, + 2.2948257089956314, + 2.295536166995589, + 2.2962075839968747, + 2.296895333995053, + 2.297557499994582, + 2.298212749999948, + 2.298850125000172, + 2.299468833996798, + 2.3001324590004515, + 2.300792249996448, + 2.301402874996711, + 2.302040834001673, + 2.3027884170005564, + 2.3033840839998447, + 2.304005416997825, + 2.304605500001344, + 2.3052455419965554, + 2.305825041999924, + 2.3064555839955574, + 2.307082958999672, + 2.307708291999006, + 2.308309249994636, + 2.3089742090014624, + 2.3095808340003714, + 2.310191833996214, + 2.3109454169971286, + 2.3115646250007558, + 2.3122022919997107, + 2.3128033749962924, + 2.3134297500000685, + 2.3141116249971674, + 2.314762541995151, + 2.3154201669967733, + 2.3161042499996256, + 2.3167560840010992, + 2.3173852920008358, + 2.318018874997506, + 2.3186081249950803, + 2.3192406249945634, + 2.319869541999651, + 2.320491624996066, + 2.321151500000269, + 2.3217623339951388, + 2.322373124996375, + 2.3230312500018044, + 2.3236744589958107, + 2.3242977499976405, + 2.324967166998249, + 2.325654583997675, + 2.326315334001265, + 2.3269324590000906, + 2.3275627920011175, + 2.328169333995902, + 2.328772166998533, + 2.3293788340015453, + 2.3300173339957837, + 2.3306733339995844, + 2.3313650419950136, + 2.332003249997797, + 2.3326414589973865, + 2.333283208994544, + 2.333954083995195, + 2.3346550419955747, + 2.335370791995956, + 2.3360312090007938, + 2.336689625000872, + 2.337325000000419, + 2.3379465420002816, + 2.338627874996746, + 2.339265416994749, + 2.3399172499994165, + 2.3405301249949844, + 2.341161291995377, + 2.3418024169950513, + 2.3424460839960375, + 2.34305295899685, + 2.3436950420000358, + 2.3443299999999, + 2.3449547919954057, + 2.3455812920001335, + 2.3462704999983544, + 2.346986124997784, + 2.347641708998708, + 2.3482946250005625, + 2.3489638339960948, + 2.3496068339954945, + 2.3502087089946144, + 2.350903124999604, + 2.3515414590001456, + 2.3521550000004936, + 2.3528001250015222, + 2.353552916996705, + 2.354292459000135, + 2.3550279999981285, + 2.355662709000171, + 2.356274375000794, + 2.356911709000997, + 2.357511208996584, + 2.3581639589974657, + 2.358732417000283, + 2.359381834001397, + 2.3599793749963283, + 2.3606147919999785, + 2.3612382919964148, + 2.3619556249977904, + 2.362623374996474, + 2.3633353339973837, + 2.3639929999990272, + 2.3646381669968832, + 2.3652634999962174, + 2.3658801249985117, + 2.3665230839978904, + 2.3671552919986425, + 2.3678353750001406, + 2.3684912499957136, + 2.3691087499973946, + 2.369757458996901, + 2.3703632920005475, + 2.3709705419969396, + 2.3715985839953646, + 2.3722009170014644, + 2.373023291998834, + 2.3736687089985935, + 2.3743789169966476, + 2.3750944169951254, + 2.375710916996468, + 2.3763337499985937, + 2.3769752090011025, + 2.3775894589998643, + 2.378202791995136, + 2.378843209000479, + 2.379480625000724, + 2.3801003339976887, + 2.380747833994974, + 2.381388750000042, + 2.3821119169952, + 2.382765958995151, + 2.38340829200024, + 2.384032624999236, + 2.3846648749968153, + 2.3853002920004656, + 2.3859347499965224, + 2.3865745840012096, + 2.3871902089958894, + 2.387839333998272, + 2.388433833999443, + 2.3890254169964464, + 2.389632708996942, + 2.3902560839997022, + 2.390852459000598, + 2.3914942089977558, + 2.3921593749983003, + 2.392794125000364, + 2.3934772499997052, + 2.3941268749986193, + 2.3947607500012964, + 2.395383041999594, + 2.3960327089953353, + 2.3966759169998113, + 2.3973279999991064, + 2.3979393749978044, + 2.398582499998156, + 2.3992000419966644, + 2.3997974999947473, + 2.400376833997143, + 2.4009626249971916, + 2.401593499998853, + 2.402223500001128, + 2.4030231249998906, + 2.4036493339954177, + 2.4043249589958577, + 2.404948791998322, + 2.405566292000003, + 2.4061674589975155, + 2.4067536250004196, + 2.4073709169970243, + 2.4080161249949015, + 2.4086261249976815, + 2.409265417001734, + 2.4099132499977713, + 2.4105148749949876, + 2.411132000001089, + 2.4117602499973145, + 2.412432749995787, + 2.41306962499948, + 2.413782083996921, + 2.4144929999965825, + 2.415140375000192, + 2.415812499995809, + 2.4164445839996915, + 2.4170940420008264, + 2.4177181249979185, + 2.4183689169949503, + 2.4189970000006724, + 2.4196397499981686, + 2.4202817089972086, + 2.420899249998911, + 2.4215241669953684, + 2.4221398750014487, + 2.4227750840000226, + 2.4235378750017844, + 2.424186374999408, + 2.4248008750000736, + 2.4254247919961927, + 2.426090333996399, + 2.4267099169956055, + 2.427339000001666, + 2.427932916994905, + 2.4285662089969264, + 2.4291728339958354, + 2.4298475420000614, + 2.430473874999734, + 2.4312317090007127, + 2.4319414169949596, + 2.4326600419954048, + 2.4332854999956908, + 2.433894292000332, + 2.434501249997993, + 2.435114291998616, + 2.4357708749957965, + 2.436391374998493, + 2.437043583995546, + 2.4378533749986673, + 2.4385098749989993, + 2.439221666994854, + 2.439836083998671, + 2.4404682499953196, + 2.441089499996451, + 2.441719666996505, + 2.442303791998711, + 2.4429279589967337, + 2.4435801669969806, + 2.4441913339978782, + 2.4448393339989707, + 2.445446041994728, + 2.44613450000179, + 2.4468230419952306, + 2.447479166999983, + 2.448133334000886, + 2.4488086249984917, + 2.4494495839971933, + 2.4500902500003576, + 2.450857874995563, + 2.451526416996785, + 2.4522557919990504, + 2.4529161669997848, + 2.4535542500016163, + 2.4542113339994103, + 2.4548691249947296, + 2.455515249996097, + 2.456125749995408, + 2.4567880839967984, + 2.4574664999963716, + 2.458096709000529, + 2.458733250001387, + 2.459286749995954, + 2.4599201249948237, + 2.460597291996237, + 2.4611728749951, + 2.4617262499959907, + 2.462214708997635, + 2.4627311669974006, + 2.463250333996257, + 2.4637630419965717, + 2.464255458995467, + 2.4647647089950624, + 2.4652830839986564, + 2.465850833999866, + 2.4663793340005213, + 2.466923499996483, + 2.4674645839986624, + 2.4680025839988957, + 2.468543208997289, + 2.469067999998515, + 2.469687459000852, + 2.4703353340009926, + 2.4709404169989284, + 2.4715115840008366, + 2.4720495419969666, + 2.4726039589950233, + 2.473123541996756, + 2.4736510000002454, + 2.4741789999970933, + 2.4747617920002085, + 2.4754288339972845, + 2.4760055000006105, + 2.476625041999796, + 2.477213458994811, + 2.4778691669998807, + 2.4785144999987097, + 2.479144291995908, + 2.47978395899554, + 2.480517833995691, + 2.4811294589962927, + 2.4817606669967063, + 2.482363584000268, + 2.483006583999668, + 2.4836208749984507, + 2.484222792001674, + 2.4848062089949963, + 2.485451791995729, + 2.486066124998615, + 2.486687874996278, + 2.4872855840003467, + 2.487948834001145, + 2.488565125000605, + 2.489239666996582, + 2.489923834000365, + 2.4909611670009326, + 2.491624124995724, + 2.4922632919988246, + 2.4928825839961064, + 2.493532125001366, + 2.4941503340014606, + 2.4947832920006476, + 2.4954010840010596, + 2.4960190419951687, + 2.496783875001711, + 2.4974042089961586, + 2.49808079200011, + 2.498698041999887, + 2.499331708997488, + 2.4999615419947077, + 2.5005719589971704, + 2.5011755419982364, + 2.501915458997246, + 2.502542166999774, + 2.503173291996063, + 2.5037984590017004, + 2.5044154999995953, + 2.5050215419978485, + 2.505668459001754, + 2.5062910419947, + 2.5069062920010765, + 2.5075363750001998, + 2.508181874996808, + 2.5088490419948357, + 2.5095423749953625, + 2.5102150839957176, + 2.5110275839979295, + 2.511689250000927, + 2.5123150419967715, + 2.512903999995615, + 2.51357737500075, + 2.5142128340012277, + 2.514850833998935, + 2.515464541997062, + 2.516139250001288, + 2.5167925839996315, + 2.5175234169946634, + 2.518174166994868, + 2.5187919169984525, + 2.5194104589972994, + 2.5200582920006127, + 2.52065366700117, + 2.521291334000125, + 2.5219309169988264, + 2.5225511669996195, + 2.523180666998087, + 2.5237635000012233, + 2.524371166997298, + 2.524976249995234, + 2.525593874997867, + 2.526348166997195, + 2.5269681249992573, + 2.527626124996459, + 2.5282031669994467, + 2.5290113750015735, + 2.5297168339966447, + 2.53040966700064, + 2.53114279199508, + 2.5317842090007616, + 2.532414166998933, + 2.5330269999976736, + 2.53364899999724, + 2.5342717499952414, + 2.5348555839955225, + 2.535486624998157, + 2.5360778749964084, + 2.5366949169983855, + 2.5372943339971243, + 2.537867125000048, + 2.538519916997757, + 2.539082083996618, + 2.5395934589978424, + 2.5401649170016753, + 2.540724083999521, + 2.5412702499961597, + 2.541877083996951, + 2.542381958999613, + 2.542944084001647, + 2.5435177499966812, + 2.544031666999217, + 2.544632334000198, + 2.5452077919981093, + 2.545800791995134, + 2.5464305839996086, + 2.5469451249955455, + 2.5475433339961455, + 2.548149458998523, + 2.548752083996078, + 2.549347583997587, + 2.549932916997932, + 2.550452541996492, + 2.5509809590002988, + 2.551494624996849, + 2.5520060839990037, + 2.5525310000011814, + 2.5530547089947504, + 2.5535908749952796, + 2.554105958995933, + 2.554642374998366, + 2.555231874997844, + 2.555770708997443, + 2.556283291996806, + 2.556823209000868, + 2.5573472499963827, + 2.5579204999958165, + 2.5584484589999192, + 2.55896483399556, + 2.5595438749951427, + 2.560086166995461, + 2.560633458997472, + 2.561195249996672, + 2.5617137500012177, + 2.5622280839961604, + 2.5627764589953586, + 2.5633111669958453, + 2.5638741250004387, + 2.5643858749972424, + 2.5649534999975003, + 2.5655022919963812, + 2.5659650419984246, + 2.5664707499963697, + 2.567066416995658, + 2.5676743750009337, + 2.5682501249975758, + 2.5688122089995886, + 2.56941458399524, + 2.570113374997163, + 2.570705708996684, + 2.5712630839989288, + 2.571840833996248, + 2.572401917001116, + 2.5729707089994918, + 2.573576583999966, + 2.5741290419973666, + 2.574633833995904, + 2.5752175839952542, + 2.5758320419990923, + 2.576407583997934, + 2.5769870840013027, + 2.577573750000738, + 2.5782483750008396, + 2.578823416995874, + 2.5793542499959585, + 2.5798897499989835, + 2.5804220419959165, + 2.5809537089953665, + 2.581481791996339, + 2.5820412920002127, + 2.5826068749956903, + 2.5831281669961754, + 2.5836730419978267, + 2.5841702920006355, + 2.5846793339951546, + 2.5852059999961057, + 2.5857541669975035, + 2.5862607499948354, + 2.5868277920017135, + 2.587389208994864, + 2.587952875001065, + 2.588471709001169, + 2.5890287500005797, + 2.5895640839953558, + 2.590119833999779, + 2.590775999997277, + 2.5913775000008172, + 2.591988374995708, + 2.592556584000704, + 2.593115666997619, + 2.593628958995396, + 2.594289791995834, + 2.594873333997384, + 2.59537362500123, + 2.5959168749977835, + 2.5964316249956028, + 2.5969904999947175, + 2.5975847500012605, + 2.5981087499967543, + 2.5987002499969094, + 2.5992744999966817, + 2.599814499997592, + 2.6003283749960246, + 2.6009251669966034, + 2.601444708998315, + 2.601957083999878, + 2.6024794170007226, + 2.6030255000005127, + 2.603610291997029, + 2.604173916995933, + 2.604682833996776, + 2.6054798339973786, + 2.606011416995898, + 2.60656987499533, + 2.6070912089999183, + 2.607661541995185, + 2.608230999998341, + 2.6088709169998765, + 2.6095149999964633, + 2.6101254589957534, + 2.6106977089948487, + 2.611264792001748, + 2.6118332089972682, + 2.6123939999961294, + 2.612925583998731, + 2.613519708997046, + 2.6140789999990375, + 2.6146882089960855, + 2.6152376249956433, + 2.615799209001125, + 2.6163218750007218, + 2.616889083998103, + 2.617402999996557, + 2.6179228339969995, + 2.618461458994716, + 2.6191021669947077, + 2.6196344169948134, + 2.6201797089961474, + 2.6207178749973536, + 2.6212316669989377, + 2.621765249998134, + 2.6222662090003723, + 2.6228074169994215, + 2.623358459000883, + 2.623898041994835, + 2.6244353750007576, + 2.625023417000193, + 2.6255470420001075, + 2.6260829589955392, + 2.626602083997568, + 2.6274367090009036, + 2.6282505419949302, + 2.6288870419957675, + 2.6295105419994798, + 2.630135583996889, + 2.630685124997399, + 2.6312329590000445, + 2.631757541996194, + 2.632359083996562, + 2.632934208995721, + 2.6334918339998694, + 2.634047166997334, + 2.6345965000000433, + 2.635139624995645, + 2.6357117090010433, + 2.6362582500005374, + 2.636788625000918, + 2.6374843750018044, + 2.6380238339988864, + 2.6385725419968367, + 2.6391337499953806, + 2.6396950839989586, + 2.6401805839996086, + 2.640686792001361, + 2.6412402919959277, + 2.641769249996287, + 2.6423077919971547, + 2.6428920420003124, + 2.6434112499991897, + 2.6439655419962946, + 2.6444824999998673, + 2.645016541995574, + 2.6455754169946886, + 2.6461343339979067, + 2.646670374997484, + 2.647227916997508, + 2.6478026249969844, + 2.6484332499967422, + 2.6490499999999884, + 2.6496318749996135, + 2.650211667001713, + 2.650760333999642, + 2.651289083994925, + 2.6518448749993695, + 2.6524145000003045, + 2.6530166669981554, + 2.65358254199964, + 2.6541529589958373, + 2.6546774589951383, + 2.655239209001593, + 2.6558023339966894, + 2.6563614170008805, + 2.6568964589969255, + 2.657437083995319, + 2.657965583995974, + 2.6584781669953372, + 2.659046834000037, + 2.6597202499979176, + 2.660337624998647, + 2.660915666994697, + 2.661510666999675, + 2.662080624999362, + 2.6625949169974774, + 2.6631225839955732, + 2.663660792000883, + 2.6642138339957455, + 2.664776958998118, + 2.665360166996834, + 2.6659044999978505, + 2.6664508339963504, + 2.6670646669954294, + 2.6676619589998154, + 2.668414916995971, + 2.6690489999964484, + 2.669620374996157, + 2.670176874999015, + 2.67072874999576, + 2.6712659999975585, + 2.671836749999784, + 2.672410374994797, + 2.672977333997551, + 2.673520249998546, + 2.674068416999944, + 2.67463329200109, + 2.6751851250010077, + 2.675712708994979, + 2.676260458996694, + 2.6768108749965904, + 2.677392666999367, + 2.677967791998526, + 2.6785457090009004, + 2.679087749995233, + 2.6796473340000375, + 2.6801926249972894, + 2.6807827090015053, + 2.68134570899565, + 2.681897583999671, + 2.6825013749985374, + 2.683058875001734, + 2.6836296249966836, + 2.6841594169964083, + 2.684700124998926, + 2.685325083999487, + 2.685897416995431, + 2.6865326249971986, + 2.687147708995326, + 2.687731874997553, + 2.6883483339988743, + 2.6889623749957536, + 2.689560624996375, + 2.69014995899488, + 2.6907299169979524, + 2.6913656670003547, + 2.692028792000201, + 2.692660959000932, + 2.6932820419970085, + 2.6939314589981223, + 2.6945952089954517, + 2.695223499998974, + 2.696027541998774, + 2.696721208994859, + 2.6973914170011994, + 2.698048749996815, + 2.698713958998269, + 2.699389166999026, + 2.700058791997435, + 2.700714999999036, + 2.7013759999972535, + 2.7020301669981563, + 2.702677291999862, + 2.7032968749990687, + 2.7039629999999306, + 2.7046105839981465, + 2.705397958998219, + 2.7061224589997437, + 2.7067410419986118, + 2.707340208995447, + 2.7080830419945414, + 2.708750375000818, + 2.7094110420002835, + 2.710063667000213, + 2.7106901250008377, + 2.711303500000213, + 2.712076124997111, + 2.712700666997989, + 2.7133564169998863, + 2.7140092499976163, + 2.7146400839992566, + 2.715263583995693, + 2.7159076669995557, + 2.716544499999145, + 2.7172281249950174, + 2.7178667089974624, + 2.7185684590003802, + 2.719185458998254, + 2.7198137500017765, + 2.720451791996311, + 2.721078041999135, + 2.721705416995974, + 2.72233087499626, + 2.722979917001794, + 2.7235994169968762, + 2.7242585839994717, + 2.7248976249975385, + 2.7255404999959865, + 2.7261585839951294, + 2.7268077920016367, + 2.7275549999976647, + 2.728229708998697, + 2.728912209000555, + 2.729526958995848, + 2.730256709000969, + 2.730912499995611, + 2.731531375000486, + 2.7321828749991255, + 2.7328370839968557, + 2.7335487499949522, + 2.7341889169983915, + 2.7347926250004093, + 2.7355040420006844, + 2.7361323750010342, + 2.736761916996329, + 2.737532667000778, + 2.7382585419982206, + 2.738877791998675, + 2.7394956249991083, + 2.7400977090001106, + 2.7407370840010117, + 2.74146354199911, + 2.742081042000791, + 2.742737542001123, + 2.7433564589955495, + 2.7439624999969965, + 2.744643375001033, + 2.7453183339966927, + 2.7460272499956773, + 2.7467483750006068, + 2.74737629199808, + 2.747999166997033, + 2.748622749997594, + 2.7492510000010952, + 2.7499115419996087, + 2.750549124997633, + 2.751236999996763, + 2.751877999995486, + 2.7524911250002333, + 2.753105167001195, + 2.7537167920017964, + 2.754382250001072, + 2.755039833995397, + 2.7557511669947417, + 2.756380958999216, + 2.7570083339960547, + 2.757622208999237, + 2.758357667000382, + 2.759004374995129, + 2.7596234589946107, + 2.7602570000017295, + 2.760878208995564, + 2.761485499999253, + 2.762126374997024, + 2.762721833998512, + 2.7633430419955403, + 2.76403266700072, + 2.7648445419981726, + 2.7655062089979765, + 2.7661822919981205, + 2.7668574589988566, + 2.7675050839970936, + 2.768142208995414, + 2.768787249995512, + 2.7694020419949084, + 2.770240833997377, + 2.7709665000002133, + 2.7716262089961674, + 2.7722752499976195, + 2.7728809999971418, + 2.7734782920015277, + 2.77409366700158, + 2.7747485840009176, + 2.7754027919945656, + 2.776006291998783, + 2.776607374995365, + 2.777215541995247, + 2.7778528339986224, + 2.778513874996861, + 2.779145000000426, + 2.7797939169977326, + 2.7804123339956277, + 2.781021458999021, + 2.7816546249960084, + 2.782277541999065, + 2.7830292500002543, + 2.783707083995978, + 2.7843421249999665, + 2.7851402499945834, + 2.785840541997459, + 2.786534999999276, + 2.7871720420007478, + 2.787836083996808, + 2.788491333994898, + 2.7891204170009587, + 2.7897479589955765, + 2.7904856669993023, + 2.7911843749971013, + 2.791811292001512, + 2.792426667001564, + 2.793028416999732, + 2.7937089999977616, + 2.7943228340009227, + 2.794956624995393, + 2.795611249996, + 2.796222459001001, + 2.796872209000867, + 2.797512833996734, + 2.798122542000783, + 2.798746708998806, + 2.799484167000628, + 2.800091708995751, + 2.800732124997012, + 2.8013729999947827, + 2.8020167499998934, + 2.8026392920000944, + 2.803273999998055, + 2.803895291996014, + 2.804660541994963, + 2.8053429999999935, + 2.8059666249973816, + 2.8066084169986425, + 2.807222791998356, + 2.8078625419948366, + 2.808498916994722, + 2.8091162919954513, + 2.8096946669975296, + 2.8103505420003785, + 2.8109941669972613, + 2.811626458998944, + 2.812251083996671, + 2.812848292000126, + 2.8134821249987, + 2.814081416996487, + 2.8146884169982513, + 2.815322834001563, + 2.8159251249962836, + 2.816558874998009, + 2.817203583996161, + 2.8178260839995346, + 2.818538041996362, + 2.8191440839946154, + 2.819761667000421, + 2.820455834000313, + 2.8210657089948654, + 2.821661000001768, + 2.8222465840008226, + 2.8229625419990043, + 2.823651083999721, + 2.824464708995947, + 2.8251145419999375, + 2.8257947089950903, + 2.8264263339951867, + 2.8270641669951146, + 2.8276979590009432, + 2.8283558339971933, + 2.82899075000023, + 2.8297647919971496, + 2.8304897919952055, + 2.8311400419988786, + 2.8318097919982392, + 2.832458166994911, + 2.8330989999958547, + 2.8337586669949815, + 2.8343954589945497, + 2.8350064999976894, + 2.8356802919952315, + 2.836275041998306, + 2.836923458999081, + 2.8375572500008275, + 2.838193333998788, + 2.8388584169952082, + 2.8395233339979313, + 2.840143417000945, + 2.840757209000003, + 2.8414162499975646, + 2.8420652499989956, + 2.8429011670014006, + 2.8436191250002594, + 2.84448049999628, + 2.8451175000009243, + 2.8457280000002356, + 2.846349209001346, + 2.8470276669977466, + 2.8476477090007393, + 2.8482594589950168, + 2.8489074999961304, + 2.8495863749994896, + 2.85019795900007, + 2.8508283339979243, + 2.851489542001218, + 2.852156749999267, + 2.8527992089948384, + 2.853437624995422, + 2.854044833999069, + 2.85466383399762, + 2.855322208997677, + 2.8559530839993386, + 2.8565857499997946, + 2.857222749997163, + 2.857864249999693, + 2.85850008399575, + 2.859120916997199, + 2.8597493749985006, + 2.8603399169951444, + 2.8609570839980734, + 2.861618750001071, + 2.8624445839959662, + 2.863130124998861, + 2.8638047499989625, + 2.864484416997584, + 2.865108917001635, + 2.865744624999934, + 2.8663867919967743, + 2.8670177919993876, + 2.8676861669955542, + 2.8683105839954806, + 2.8689663339973777, + 2.8696378339955118, + 2.8702634169967496, + 2.8709007919969736, + 2.8715133340010652, + 2.8721388749981998, + 2.8727607089967933, + 2.8733722920005675, + 2.8740559590005432, + 2.8747206249972805, + 2.8753496249992168, + 2.8759670840008766, + 2.8766169590016943, + 2.877257374995679, + 2.8779414589953376, + 2.87857570900087, + 2.879323834000388, + 2.87993108399678, + 2.880640958996082, + 2.8814119169983314, + 2.882117166998796, + 2.8828277089996845, + 2.883451374997094, + 2.8841122500016354, + 2.884733958999277, + 2.8853700420004316, + 2.8860461250005756, + 2.886715833999915, + 2.887330124998698, + 2.887983374996111, + 2.8886559999955352, + 2.8893184999978985, + 2.8899782500011497, + 2.890600999999151, + 2.8913000419997843, + 2.8919388340000296, + 2.8925529589978396, + 2.893203833998996, + 2.8938471669971477, + 2.8944595840002876, + 2.895107917000132, + 2.8957366670001647, + 2.8963530420005554, + 2.8969853339949623, + 2.8976481669960776, + 2.898270459001651, + 2.898936124998727, + 2.8995615419989917, + 2.900222999996913, + 2.900883624999551, + 2.90156137500162, + 2.902232208994974, + 2.902864249997947, + 2.9034969999993336, + 2.9042176669972832, + 2.9048688339971704, + 2.9055144589947304, + 2.9061782919961843, + 2.906821708995267, + 2.9074381249956787, + 2.9081673749969923, + 2.9088244999948074, + 2.909487375000026, + 2.9101260419993196, + 2.9107510419999016, + 2.911411708999367, + 2.9120524169993587, + 2.912692583995522, + 2.913326791996951, + 2.9139787089952733, + 2.914607166996575, + 2.9152287499964586, + 2.9158394589976524, + 2.9164404170005582, + 2.917074999997567, + 2.9177020419956534, + 2.918357709000702, + 2.9190239169984125, + 2.9196473749980214, + 2.920276583994564, + 2.9209192089983844, + 2.9215667089956696, + 2.9222005839983467, + 2.922890624999127, + 2.923592416998872, + 2.9243477919953875, + 2.925035084001138, + 2.9256609169970034, + 2.9263513749974663, + 2.926986874997965, + 2.92763679199561, + 2.9282819169966388, + 2.928848499999731, + 2.9294722089980496, + 2.93027162499493, + 2.930967125001189, + 2.931638041998667, + 2.9323023749966524, + 2.9329495839992887, + 2.9335846670001047, + 2.9342178750011954, + 2.9348436669970397, + 2.9354765839962056, + 2.9360948339963215, + 2.936715791998722, + 2.937292916998558, + 2.937925250000262, + 2.938534125001752, + 2.939170459001616, + 2.9398143340004026, + 2.9404322920017876, + 2.9410748340014834, + 2.9417412920010975, + 2.9425112919998355, + 2.9432269999961136, + 2.943928333996155, + 2.944566499994835, + 2.9452204999979585, + 2.9459222500008764, + 2.9465817919990513, + 2.947232874998008, + 2.9478623339964543, + 2.9485035839970806, + 2.9491398749960354, + 2.949772916996153, + 2.950421624998853, + 2.951058250000642, + 2.9518526249958086, + 2.9525179999982356, + 2.953130333997251, + 2.953738833995885, + 2.9544557920016814, + 2.9550826249978854, + 2.955705833999673, + 2.9563371670010383, + 2.956999916998029, + 2.9576537089960766, + 2.958357709001575, + 2.9589954589973786, + 2.959627708994958, + 2.9602764590017614, + 2.960865749999357, + 2.9615081250012736, + 2.9621480839996366, + 2.9628731249977136, + 2.9635291669983417, + 2.964215208994574, + 2.9648604999965755, + 2.9654573340012575, + 2.9660787920001894, + 2.9667255419990397, + 2.9673999169972376, + 2.968028499999491, + 2.9686271249956917, + 2.9692742089973763, + 2.9698868749983376, + 2.970506749996275, + 2.971163834001345, + 2.971802249994653, + 2.972478333998879, + 2.9730706670015934, + 2.9737096249955357, + 2.974330833996646, + 2.9750397499956307, + 2.9756639589977567, + 2.9763395839981968, + 2.976981749998231, + 2.977780041997903, + 2.9784445839977707, + 2.979071750000003, + 2.9796745419953368, + 2.980307334000827, + 2.980967374998727, + 2.9816799589971197, + 2.9823916669993196, + 2.983073584000522, + 2.983697874995414, + 2.984349416998157, + 2.9850150419952115, + 2.985646542001632, + 2.9862564169961843, + 2.986853333997715, + 2.9876137920000474, + 2.9882745419963612, + 2.988925334000669, + 2.989576166997722, + 2.990248292000615, + 2.99086774999887, + 2.991503166995244, + 2.9921492919966113, + 2.992809584000497, + 2.9935522919986397, + 2.9942622919988935, + 2.9949156250004307, + 2.9955497499977355, + 2.9962109589978354, + 2.9968579999986105, + 2.9974886249983683, + 2.9981694589951076, + 2.998747083998751, + 2.9993179999946733, + 2.9998669999986305, + 3.0007026249950286, + 3.0013829999952577, + 3.0020688340009656, + 3.002752959000645, + 3.0033182089973707, + 3.00391829200089, + 3.004559834000247, + 3.005155583996384, + 3.005756250000559, + 3.00642608400085, + 3.0069830419961363, + 3.007524333996116, + 3.008087999995041, + 3.008642583998153, + 3.009197333994962, + 3.009755084000062, + 3.0103012089966796, + 3.0108299999992596, + 3.0113304999977117, + 3.011834999997518, + 3.012349666998489, + 3.012879083995358, + 3.0134201670007315, + 3.0139564589990187, + 3.016509875000338, + 3.0170960839968757, + 3.017672499998298, + 3.018217042001197, + 3.018770541995764, + 3.019340499995451, + 3.0200519999998505, + 3.0206707499964978, + 3.0212478339963127, + 3.0218328749979264, + 3.0224268339952687, + 3.0229643339989707, + 3.0234959590015933, + 3.0240657499962253, + 3.0248271669988753, + 3.025426833999518, + 3.0259908750012983, + 3.0265586669993354, + 3.027113666998048, + 3.027676917001372, + 3.0283099169973866, + 3.028878334000183, + 3.0296154169991496, + 3.0322401669982355, + 3.033234791997529, + 3.0338321249946603, + 3.034469792000891, + 3.0350795420017675, + 3.035782749997452, + 3.0364859999972396, + 3.037096667001606, + 3.03767608400085, + 3.0382912089989986, + 3.0389313749983557, + 3.0395792499984964, + 3.0404022919974523, + 3.0411411249951925, + 3.042086041998118, + 3.0429220000005444, + 3.0435335419970215, + 3.044169166998472, + 3.0448133339959895, + 3.0453909169955296, + 3.0460097499963013, + 3.046565124997869, + 3.0471899589974782, + 3.0477493340004003, + 3.048453958996106, + 3.049035208998248, + 3.04956674999994, + 3.050134375000198, + 3.050697083999694, + 3.0513012500014156, + 3.051906874999986, + 3.0524182919980376, + 3.0529653749981662, + 3.053559416999633, + 3.0541087919991696, + 3.0547274999989895, + 3.0554101250017993, + 3.0559714589981013, + 3.056514291994972, + 3.057060667000769, + 3.0575879589960095, + 3.0581105839955853, + 3.0586442919957335, + 3.059204334000242, + 3.059767250000732, + 3.060379333997844, + 3.06102208399534, + 3.0616251669998746, + 3.062183541995182, + 3.062706042001082, + 3.063289249999798, + 3.0638750419966527, + 3.0644485000011628, + 3.0650262919953093, + 3.065610833997198, + 3.0661679589975392, + 3.0667107089975616, + 3.067255292000482, + 3.067807166997227, + 3.0683461669977987, + 3.0688866669952404, + 3.069441374995222, + 3.0700277500000084, + 3.0705889589953586, + 3.0711965000009513, + 3.0717569170010393, + 3.072281208995264, + 3.0728234999987762, + 3.0734051249964978, + 3.073904083998059, + 3.0744404590004706, + 3.0749837920011487, + 3.0755754169949796, + 3.0761367919985787, + 3.076687624998158, + 3.077243166997505, + 3.0778144169962616, + 3.0783878750007716, + 3.079038916999707, + 3.0796561669994844, + 3.080303249997087, + 3.0809318339961465, + 3.081475833998411, + 3.082029708995833, + 3.082566124998266, + 3.0831275839955197, + 3.083691291998548, + 3.0842585419959505, + 3.084849041995767, + 3.085435916997085, + 3.0859508749999804, + 3.0865125419950346, + 3.0872028749945457, + 3.087796374995378, + 3.088351458995021, + 3.088954916995135, + 3.089492084000085, + 3.090050083999813, + 3.090599958995881, + 3.091138666997722, + 3.0917002499991213, + 3.092337709000276, + 3.0929552919988055, + 3.0934915420002653, + 3.0940639589971397, + 3.0946584999983315, + 3.0952451249977457, + 3.0957486249972135, + 3.096325209000497, + 3.096871875000943, + 3.0975045419982052, + 3.098093666994828, + 3.0986794999989797, + 3.09926304200053, + 3.099854249994678, + 3.100372959001106, + 3.1009541249950416, + 3.1014635839965194, + 3.1020035420006025, + 3.1025599589993362, + 3.103144417000294, + 3.1037408339980175, + 3.1043034589965828, + 3.1048826670012204, + 3.105439083999954, + 3.1061505839970778, + 3.1066896249976708, + 3.107256791998225, + 3.10778679199575, + 3.1083500839959015, + 3.108890416995564, + 3.109436166996602, + 3.109952083999815, + 3.110508874997322, + 3.111023541998293, + 3.1115658749986324, + 3.1121401249984046, + 3.1127055839970126, + 3.1132710839956417, + 3.113814917000127, + 3.114511959000083, + 3.1151069999978063, + 3.1156681249995017, + 3.1161715839989483, + 3.1167404590014485, + 3.117376541995327, + 3.117975959001342, + 3.1186025839997455, + 3.1191934589951416, + 3.119722333998652, + 3.1202927499980433, + 3.120842708995042, + 3.121383708996291, + 3.1219075839981087, + 3.1224395419994835, + 3.122979874999146, + 3.1235466250000172, + 3.1240594999981113, + 3.124641583999619, + 3.125237374995777, + 3.1257757089988445, + 3.126343416995951, + 3.1269067089961027, + 3.127446708997013, + 3.128023958997801, + 3.128618833994551, + 3.129139042001043, + 3.129827166994801, + 3.1303840420005145, + 3.1309493750013644, + 3.1314870419955696, + 3.1320130419990164, + 3.1325933749976684, + 3.13316537499486, + 3.133702416998858, + 3.134216041995387, + 3.1347677919984562, + 3.135299000001396, + 3.135861083996133, + 3.136510749995068, + 3.137201500001538, + 3.137939208994794, + 3.138591750001069, + 3.1392303749962593, + 3.1398940419967403, + 3.140543791996606, + 3.141198708995944, + 3.1417794590015546, + 3.1423686669950257, + 3.1429897919952055, + 3.143634166997799, + 3.1442914590006694, + 3.1461784999992233, + 3.1473142089962494, + 3.147958292000112, + 3.1487090839946177, + 3.1493323339964263, + 3.1500156670008437, + 3.1506879169974127, + 3.151364334000391, + 3.152015209001547, + 3.152615416998742, + 3.1533846669990453, + 3.1541455420010607, + 3.1549099999974715, + 3.1556391669946606, + 3.1563449169989326, + 3.1571032919964637, + 3.1578229590013507, + 3.158508249995066, + 3.159188459001598, + 3.1598425839983975, + 3.1604769170007785, + 3.161112374997174, + 3.1617534589968272, + 3.1627594999954454, + 3.163469166996947, + 3.164185583998915, + 3.1648425419989508, + 3.165494791996025, + 3.166167791998305, + 3.1668260840015137, + 3.1674744999982067, + 3.168104083997605, + 3.1687218750012107, + 3.169341417000396, + 3.169958708997001, + 3.1705888340002275, + 3.1713534590016934, + 3.172032666996529, + 3.1726693339951453, + 3.173315208994609, + 3.173945416994684, + 3.1745927090014447, + 3.1754319999963627, + 3.1761416669978644, + 3.1768406670016702, + 3.177503541999613, + 3.1782113750014105, + 3.178868541996053, + 3.179519958997844, + 3.180217458997504, + 3.1808722089990624, + 3.181494416996429, + 3.1821434589946875, + 3.1827980839952943, + 3.183432375000848, + 3.1840762499996345, + 3.184718917000282, + 3.1853459589983686, + 3.185983999996097, + 3.186659166996833, + 3.1873002919965074, + 3.1879494589957176, + 3.1886094590008724, + 3.189256416997523, + 3.1898834589956095, + 3.190503958998306, + 3.1911713750014314, + 3.1917877919986495, + 3.1924303749983665, + 3.1930466249978053, + 3.193655958995805, + 3.1943129999999655, + 3.194957166997483, + 3.195776084001409, + 3.1964153750013793, + 3.197071999995387, + 3.1978018340014387, + 3.1985352499978035, + 3.199189083999954, + 3.19981099999859, + 3.2004404999970575, + 3.2010604169990984, + 3.2016877499991097, + 3.2023164999991423, + 3.2029784170008497, + 3.2035937089967774, + 3.204208249997464, + 3.2049166669967235, + 3.2055959999997867, + 3.206206458999077, + 3.206884250001167, + 3.2075040839990834, + 3.2082028750010068, + 3.2088552089990117, + 3.209512041998096, + 3.2101410839968594, + 3.210813708996284, + 3.2114552919956623, + 3.2120555419969605, + 3.2126490000009653, + 3.213272834000236, + 3.2138927089981735, + 3.2145259589960915, + 3.215168624999933, + 3.215873291999742, + 3.2165598339997814, + 3.2172377499955473, + 3.21792845899472, + 3.218534791994898, + 3.2191385420010192, + 3.219730459000857, + 3.220347167, + 3.2210782499969355, + 3.2217356249966542, + 3.222391499999503, + 3.222987208995619, + 3.223619708995102, + 3.2242617919982877, + 3.224871667000116, + 3.225563833999331, + 3.2261963749988354, + 3.2268307089980226, + 3.2275000419977005, + 3.228118708997499, + 3.2287273339970852, + 3.229374458998791, + 3.2299828749964945, + 3.2307580419947044, + 3.2313649589996203, + 3.2319976250000764, + 3.2326227919984376, + 3.233271249999234, + 3.2339404999947874, + 3.2346051249987795, + 3.2353435839977465, + 3.2360122919999412, + 3.2366865419971873, + 3.2373247089999495, + 3.2380058749986347, + 3.2386619999961113, + 3.239310500001011, + 3.239958291997027, + 3.240552958995977, + 3.241162541999074, + 3.24176545899536, + 3.242396708999877, + 3.2430446250000386, + 3.2437056669950834, + 3.2443222500005504, + 3.244964917001198, + 3.245588083998882, + 3.246175542000856, + 3.246838333994674, + 3.247599166999862, + 3.248220916997525, + 3.248890292001306, + 3.249540791999607, + 3.2502012499971897, + 3.2508552090002922, + 3.2514735419972567, + 3.2521323339969967, + 3.2527599169989116, + 3.2534228340009577, + 3.2541183339999407, + 3.254775333996804, + 3.255412416998297, + 3.256062333995942, + 3.256756583999959, + 3.257538083998952, + 3.2582414169955882, + 3.2589417499984847, + 3.2596367090009153, + 3.2602917089971015, + 3.260974708995491, + 3.261614249997365, + 3.2622512499947334, + 3.2628969590005, + 3.263619416997244, + 3.264262291995692, + 3.2649291249981616, + 3.2655919169992558, + 3.2662851249988307, + 3.266913374995056, + 3.2675420839950675, + 3.268174958997406, + 3.2688517499991576, + 3.2694997919970774, + 3.270145083995885, + 3.2707757919997675, + 3.27137912499893, + 3.272003209000104, + 3.2726302919982118, + 3.2732778339996003, + 3.273941958999785, + 3.2745652090015938, + 3.2752917499965406, + 3.2759909169981256, + 3.2767066250016796, + 3.2773775839959853, + 3.2781149169968558, + 3.278763333997631, + 3.279424416999973, + 3.280059541997616, + 3.280644083999505, + 3.2812757919964497, + 3.2819489169996814, + 3.282596958997601, + 3.2832426249951823, + 3.283902584000316, + 3.2845695419964613, + 3.285198917001253, + 3.2858230419951724, + 3.2864636250014883, + 3.287090708996402, + 3.287763749998703, + 3.288390834000893, + 3.2890507919946685, + 3.2896669170004316, + 3.2902744169987272, + 3.2909160839990363, + 3.2916325839978526, + 3.2922719169946504, + 3.2929236669951933, + 3.293542958999751, + 3.2942230420012493, + 3.294907791998412, + 3.295593999995617, + 3.2962675000017043, + 3.296959583996795, + 3.297624041995732, + 3.298241999997117, + 3.2989020419990993, + 3.299605000000156, + 3.3002712089946726, + 3.3009477500017965, + 3.3016184169973712, + 3.3022860839992063, + 3.302934416999051, + 3.303578374994686, + 3.304193708994717, + 3.3048376250008005, + 3.305430874999729, + 3.3061100419945433, + 3.306737708997389, + 3.3073635420005303, + 3.3080019999979413, + 3.3086177919976762, + 3.309279166998749, + 3.3099199589996715, + 3.310700750000251, + 3.311351083997579, + 3.3119937919982476, + 3.3126898749978864, + 3.31334433399752, + 3.3139993750010035, + 3.3146590420001303, + 3.3153308339969954, + 3.3160411669960013, + 3.3167107499975828, + 3.317365292001341, + 3.3180281249951804, + 3.318766083997616, + 3.319411833996128, + 3.320068499997433, + 3.3208208340001875, + 3.3214944589999504, + 3.3221349169980385, + 3.322788249999576, + 3.323464834000333, + 3.3241142089973437, + 3.3247379589956836, + 3.3253545420011505, + 3.326063084001362, + 3.326701250000042, + 3.3273434169968823, + 3.3280101669952273, + 3.3286192500017933, + 3.3292625839967513, + 3.329871458998241, + 3.330524583994702, + 3.331263084000966, + 3.331901874997129, + 3.332546249999723, + 3.3331979590002447, + 3.333888499997556, + 3.3345742089950363, + 3.335289541995735, + 3.3360761250005453, + 3.3367260839950177, + 3.33739070899901, + 3.3380390839956817, + 3.3386600839949097, + 3.3393160839987104, + 3.33996366700012, + 3.3405950000014855, + 3.3412170419978793, + 3.341856833998463, + 3.3424987499965937, + 3.3431088750003255, + 3.34373054200114, + 3.3443724169992493, + 3.345017542000278, + 3.345648666996567, + 3.3462386669998523, + 3.3469436669984134, + 3.3476524590005283, + 3.3483074589967146, + 3.3490077499955078, + 3.3497561249969294, + 3.350413583997579, + 3.3510585839976557, + 3.3517078750010114, + 3.352380374999484, + 3.353049708995968, + 3.353686791997461, + 3.35450279199722, + 3.3551896669960115, + 3.3558499589998974, + 3.356484541996906, + 3.35707358399668, + 3.3576872919948073, + 3.3583485839990317, + 3.359012333996361, + 3.3596360000010463, + 3.3602938749972964, + 3.360932124996907, + 3.3615910000007716, + 3.362252124999941, + 3.362869791999401, + 3.3635061669992865, + 3.3643061249968014, + 3.3652555840017158, + 3.3658603750009206, + 3.366502958997444, + 3.3671693750002305, + 3.36786462499731, + 3.3684834169980604, + 3.3691267920003156, + 3.3697196249995613, + 3.370327584001643, + 3.3709754169976804, + 3.37161820899928, + 3.3722664169981726, + 3.3729079170007026, + 3.3736322920012753, + 3.3743342089946964, + 3.37519975000032, + 3.375896334000572, + 3.3765396249946207, + 3.3771783339980175, + 3.377830375000485, + 3.3784997089969693, + 3.3791303749967483, + 3.3797821670013946, + 3.380444249996799, + 3.3810913749985048, + 3.3817543749973993, + 3.3823724999965634, + 3.382995084000868, + 3.383608916999947, + 3.384238541999366, + 3.384987874997023, + 3.3855795839990606, + 3.386210291995667, + 3.386847875000967, + 3.3874817920004716, + 3.388099042000249, + 3.3887057089959853, + 3.3893366670017713, + 3.389943750000384, + 3.3905692089974764, + 3.391206249994866, + 3.391845458994794, + 3.392499666995718, + 3.3931780839993735, + 3.3938234169982024, + 3.3944976669954485, + 3.3952364169963403, + 3.3958626669991645, + 3.396502999996301, + 3.3971652089967392, + 3.397787875001086, + 3.3984167919988977, + 3.399052084001596, + 3.399683374998858, + 3.4003630000006524, + 3.4009723749986733, + 3.4016021249990445, + 3.402213708999625, + 3.40284037499805, + 3.40349412499927, + 3.4041620419957326, + 3.404766624997137, + 3.4054207090011914, + 3.406050666999363, + 3.4066757089967723, + 3.407317166995199, + 3.4079725420015166, + 3.408576958994672, + 3.409270500000275, + 3.4099206249957206, + 3.41054395899846, + 3.4112137089978205, + 3.411928749999788, + 3.4126195419958094, + 3.4134592920017894, + 3.414146458999312, + 3.4148024169990094, + 3.415473333996488, + 3.416105708995019, + 3.416734541999176, + 3.417412874994625, + 3.418056958995294, + 3.418679666996468, + 3.4193407089987886, + 3.4200043339951662, + 3.4206351670000004, + 3.4212619999962044, + 3.4219241669998155, + 3.4225857499986887, + 3.4232239589982782, + 3.4238701249996666, + 3.424489791999804, + 3.4251300420000916, + 3.4257457919957233, + 3.4264114589968813, + 3.4270170839954517, + 3.427683083995362, + 3.4282834170007845, + 3.4288880839958438, + 3.4295159589964896, + 3.4301805419963785, + 3.4309999589968356, + 3.4316750840007444, + 3.4323575000016717, + 3.4330132089962717, + 3.4336978339997586, + 3.4343175839967444, + 3.434924166998826, + 3.4355808749969583, + 3.436199874995509, + 3.436837959001423, + 3.43745316699642, + 3.438069291994907, + 3.4386738339962903, + 3.439273708994733, + 3.439879249999649, + 3.44048233400099, + 3.4410764169952017, + 3.4416935839981306, + 3.442326708995097, + 3.442971166994539, + 3.44361362500058, + 3.444210124995152, + 3.4448706670009415, + 3.445488124998519, + 3.4460844169952907, + 3.446721125001204, + 3.4473894170005224, + 3.448063124997134, + 3.448707999996259, + 3.449337874997582, + 3.449958583994885, + 3.4506303339949227, + 3.451299749998725, + 3.452016958995955, + 3.452711708996503, + 3.4534405000013066, + 3.4541183339970303, + 3.4547372089946293, + 3.4553353340015747, + 3.4559217919959337, + 3.4565253749969997, + 3.457180334000441, + 3.457806124999479, + 3.458487833995605, + 3.4591041669991682, + 3.4597715419949964, + 3.460478000000876, + 3.461153167001612, + 3.4617918340009055, + 3.4624021669951617, + 3.4631165839964524, + 3.4637339170003543, + 3.4643543749989476, + 3.4650108749992796, + 3.46566266699665, + 3.4663013749959646, + 3.466940041995258, + 3.4676045839951257, + 3.468227334000403, + 3.4688772090012208, + 3.4695341249971534, + 3.470236916997237, + 3.4708920839984785, + 3.47163599999476, + 3.4723017500000424, + 3.4729155419991002, + 3.473530416995345, + 3.474177749994851, + 3.474828209000407, + 3.475463791997754, + 3.476055916995392, + 3.476818541996181, + 3.477461583999684, + 3.4781332919956185, + 3.478756249998696, + 3.479351041998598, + 3.479977124996367, + 3.480630541998835, + 3.4812851669994416, + 3.481976416995167, + 3.4826257089953288, + 3.4832756249961676, + 3.4839362089987844, + 3.484688999997161, + 3.4853234170004725, + 3.4860551249948912, + 3.486718791995372, + 3.4873681249955553, + 3.4880050419960753, + 3.4886401670009946, + 3.489279000001261, + 3.4901076249952894, + 3.490818375001254, + 3.4914757500009728, + 3.492121124996629, + 3.4927845839993097, + 3.4934117090015206, + 3.494044541999756, + 3.4946675839964882, + 3.4952719590000925, + 3.4958867499954067, + 3.4965122919966234, + 3.4971759589971043, + 3.497805209000944, + 3.4984264169979724, + 3.499114334001206, + 3.499759999998787, + 3.500374750001356, + 3.5010088749986608, + 3.5016061249989434, + 3.502222499999334, + 3.502855291997548, + 3.503582749995985, + 3.504217374997097, + 3.504875999999058, + 3.505487499998708, + 3.506228291997104, + 3.5068723750009667, + 3.5075207089976175, + 3.5081792089986266, + 3.5088741250001476, + 3.509629667001718, + 3.5103787499974715, + 3.511021416998119, + 3.511659083997074, + 3.5122948749994976, + 3.512920249995659, + 3.5135892089965637, + 3.5142232500002137, + 3.514834374997008, + 3.5155035839998163, + 3.5161559589978424, + 3.516809959000966, + 3.5174497089974466, + 3.5181024170015007, + 3.518726834001427, + 3.519344624997757, + 3.520002999997814, + 3.52066087500134, + 3.521281417000864, + 3.5219090839964338, + 3.522540666999703, + 3.5231666670006234, + 3.5237950000009732, + 3.5244231249962468, + 3.5250925419968553, + 3.5258293340011733, + 3.526504124994972, + 3.5271437089977553, + 3.5277922919995035, + 3.5284862920016167, + 3.5292219999973895, + 3.529953958997794, + 3.530712166997546, + 3.531400667001435, + 3.5320532089972403, + 3.5327256249947823, + 3.5333757089974824, + 3.5339961669960758, + 3.5346477499988396, + 3.535320666996995, + 3.5359379169967724, + 3.5365502089989604, + 3.537176999998337, + 3.5378104170013103, + 3.5384308339998825, + 3.539070916995115, + 3.539687917000265, + 3.5403492089972133, + 3.5411611249946873, + 3.541832292001345, + 3.5424574999997276, + 3.543096583998704, + 3.5437209169976995, + 3.5443177089982782, + 3.5449250419987948, + 3.5455860840011155, + 3.5461448339992785, + 3.5467733339974075, + 3.5474626249997527, + 3.5481374169976334, + 3.5488220839979476, + 3.549560333995032, + 3.550244541998836, + 3.550873499996669, + 3.5514630839970778, + 3.5521528749959543, + 3.5528410420010914, + 3.553455124994798, + 3.554087459000584, + 3.554759958999057, + 3.5553819589986233, + 3.555996666997089, + 3.5566191670004628, + 3.557271249999758, + 3.557880208994902, + 3.558517291996395, + 3.5592073750012787, + 3.5598481249980978, + 3.5604525839953567, + 3.5610919589962577, + 3.5617336249997607, + 3.5623607089946745, + 3.562998624998727, + 3.5636486669973237, + 3.5644134169997415, + 3.5650327920011478, + 3.56572341699939, + 3.566324583996902, + 3.5670259170001373, + 3.5677232919988455, + 3.568391916996916, + 3.569053166997037, + 3.5697057919969666, + 3.5703446670013363, + 3.5710591669994756, + 3.5717240839949227, + 3.57235404200037, + 3.5729930000015884, + 3.573597124996013, + 3.5741951249947306, + 3.5748190000012983, + 3.575457374994585, + 3.5761510000011185, + 3.5768859589952626, + 3.577525833999971, + 3.5781873339947197, + 3.5787964170012856, + 3.5793987500001094, + 3.5799790839955676, + 3.580663666994951, + 3.581327291998605, + 3.5819649170007324, + 3.58260208399588, + 3.5832276250002906, + 3.5838596670000697, + 3.5844815419986844, + 3.585118249997322, + 3.585748708996107, + 3.5864266249991488, + 3.587070749999839, + 3.5877054999946267, + 3.588360499998089, + 3.5890516669969657, + 3.589760874994681, + 3.5904516669979785, + 3.591192209001747, + 3.5918755419988884, + 3.592506708999281, + 3.59312625000166, + 3.5937599589960882, + 3.5943669170010253, + 3.5950203749962384, + 3.595619125000667, + 3.5962496669963, + 3.5969199999963166, + 3.5975484590017004, + 3.5981711669955985, + 3.598779291998653, + 3.599395375000313, + 3.600010875001317, + 3.6006698749988573, + 3.6012967499991646, + 3.6019535000014002, + 3.6025621250009863, + 3.603216124996834, + 3.603826416998345, + 3.6044695419986965, + 3.605097667001246, + 3.6057295840000734, + 3.606383583995921, + 3.607026334000693, + 3.6077824999956647, + 3.608474499997101, + 3.6091415420014528, + 3.609756166995794, + 3.610389124994981, + 3.6110920419960166, + 3.61176025000168, + 3.6124319169975934, + 3.613093249994563, + 3.6137369589996524, + 3.6143877919967053, + 3.615010916997562, + 3.615667874997598, + 3.6163025839996408, + 3.616925041998911, + 3.617577874996641, + 3.6182120419980492, + 3.618814041998121, + 3.6193892090013833, + 3.6199967499997, + 3.6206199590014876, + 3.6212712089982233, + 3.6219373749991064, + 3.622546541999327, + 3.623172583997075, + 3.623769459001778, + 3.6244097919989144, + 3.6250638749988866, + 3.625722999997379, + 3.626330250001047, + 3.6269446250007604, + 3.62753816699842, + 3.628251083995565, + 3.628929792001145, + 3.629745083999296, + 3.630404916999396, + 3.631051333999494, + 3.6316563750006026, + 3.632321375000174, + 3.6329532919990015, + 3.6336053339982755, + 3.634247709000192, + 3.634914124995703, + 3.6355353749968344, + 3.636179542001628, + 3.6368073749981704, + 3.637442874998669, + 3.638095958995109, + 3.6387164170009783, + 3.6393337920017075, + 3.6399934590008343, + 3.6406080839951755, + 3.641362208996725, + 3.641978250001557, + 3.642591291994904, + 3.643223125000077, + 3.6438324999980978, + 3.6444754999974975, + 3.645103458999074, + 3.645702292000351, + 3.646313042001566, + 3.646957500001008, + 3.647881042001245, + 3.648591999997734, + 3.649245708998933, + 3.6498996669979533, + 3.650578000000678, + 3.6512574590014992, + 3.651923583995085, + 3.6525472089997493, + 3.653169124998385, + 3.653807374997996, + 3.654444624997268, + 3.6550774999996065, + 3.6556923749958514, + 3.656321083995863, + 3.656954833997588, + 3.657573541997408, + 3.658164583997859, + 3.6587854999961564, + 3.6594184169953223, + 3.6600916249954025, + 3.660726458998397, + 3.661337958998047, + 3.661952875001589, + 3.6625959999946645, + 3.663248416996794, + 3.6640092089946847, + 3.6646822499969858, + 3.665304333997483, + 3.665968333996716, + 3.6666019999975106, + 3.667264958996384, + 3.667972833995009, + 3.668610249995254, + 3.669297624997853, + 3.669996666998486, + 3.670667250000406, + 3.671296959000756, + 3.6719734169964795, + 3.6725837499980116, + 3.6732067089978955, + 3.673850749997655, + 3.6745059169988963, + 3.675165874999948, + 3.6757988749959623, + 3.6765534590012976, + 3.6772080839946284, + 3.677858541996102, + 3.6785195420015953, + 3.6791424170005484, + 3.679784749998362, + 3.680519249995996, + 3.6811253749983734, + 3.6817948339958093, + 3.6824470840001595, + 3.683184875000734, + 3.683804666994547, + 3.6844979589950526, + 3.685122833994683, + 3.685754583995731, + 3.6864134999996168, + 3.6871154170003138, + 3.687785875001282, + 3.688431834001676, + 3.6890852919968893, + 3.6897372089952114, + 3.690381583997805, + 3.6910284999976284, + 3.6916653340013, + 3.6923001670002122, + 3.692987999995239, + 3.693615083997429, + 3.694283666998672, + 3.694920624999213, + 3.69555233400024, + 3.696184666994668, + 3.696811458998127, + 3.6974987919966225, + 3.698148167000909, + 3.698806208994938, + 3.6994543749970035, + 3.7001544999948237, + 3.7007682920011575, + 3.7013845420005964, + 3.7020582089971867, + 3.702770291994966, + 3.703414833995339, + 3.70407104199694, + 3.704669541999465, + 3.7053329999980633, + 3.7059487090009497, + 3.706738166998548, + 3.7074075839991565, + 3.70819237500109, + 3.7088691249955446, + 3.709527084000001, + 3.7101568750003935, + 3.7107735839963425, + 3.7114759999967646, + 3.7121389169988106, + 3.7127570419979747, + 3.713376749998133, + 3.7140029590009362, + 3.714640792000864, + 3.7152825419980218, + 3.7159317920013564, + 3.7165744169979007, + 3.717225624997809, + 3.717865749997145, + 3.7185056669986807, + 3.7191217919971677, + 3.7197601669977303, + 3.7203932919946965, + 3.721022958998219, + 3.7216671249989304, + 3.722409541995148, + 3.723052124994865, + 3.723901042001671, + 3.72466274999897, + 3.725324416998774, + 3.7260731249989476, + 3.7267879999999423, + 3.727483416994801, + 3.7281553339998936, + 3.7288213339998038, + 3.729440541996155, + 3.7300954169986653, + 3.7307652089948533, + 3.7313979169994127, + 3.732048208999913, + 3.732652250000683, + 3.733329834001779, + 3.7339773339990643, + 3.7345956249992014, + 3.735410374996718, + 3.736237416997028, + 3.7368754589988384, + 3.737529749996611, + 3.7381740839991835, + 3.7387930839977344, + 3.7394254589962657, + 3.740099458998884, + 3.7407336670003133, + 3.741336749997572, + 3.74199737500021, + 3.742670374995214, + 3.7432936249970226, + 3.7439646249986254, + 3.744607166998321, + 3.7452958750000107, + 3.745957291997911, + 3.746651708999707, + 3.747348624994629, + 3.747996833997604, + 3.7486100419992, + 3.749285958998371, + 3.7499231249967124, + 3.750573124998482, + 3.7512224999954924, + 3.7518560419994174, + 3.7525152919988614, + 3.753145249997033, + 3.7537862089957343, + 3.754441583994776, + 3.755081584000436, + 3.7558432090008864, + 3.7565281669958495, + 3.7572106669977074, + 3.757860666999477, + 3.758514083994669, + 3.759166458999971, + 3.759799708997889, + 3.7604105419959524, + 3.7610135419963626, + 3.761642999998003, + 3.762288375000935, + 3.7629271670011804, + 3.7635706669971114, + 3.7642421669952455, + 3.7649441249959636, + 3.765664749997086, + 3.7663847919975524, + 3.7670827499969164, + 3.767756166998879, + 3.7684154999951716, + 3.769086291998974, + 3.7697337089994107, + 3.7703692089999095, + 3.7710039999947185, + 3.7716777499954333, + 3.772329499995976, + 3.772945584001718, + 3.7735845419956604, + 3.7742618749980466, + 3.7749142089960515, + 3.7755902919961954, + 3.7762575000015204, + 3.776904458994977, + 3.777524874996743, + 3.7782166249962756, + 3.77887962499517, + 3.7795290840003872, + 3.780328291999467, + 3.7810148339995067, + 3.781696334001026, + 3.782347749998735, + 3.7830066249953234, + 3.7836824170008185, + 3.7844082500014338, + 3.7851716250006575, + 3.785865208999894, + 3.7865040420001606, + 3.787130291995709, + 3.787763000000268, + 3.788420208999014, + 3.7890486249962123, + 3.789677417000348, + 3.790279708999151, + 3.7909158339971327, + 3.7915695420015254, + 3.7922157919965684, + 3.7928644999992684, + 3.7934914590005064, + 3.7941219999993336, + 3.794753750000382, + 3.7953707089982345, + 3.7959894169980544, + 3.796635291997518, + 3.7972609999997076, + 3.7979101669989177, + 3.798604958996293, + 3.7992517499951646, + 3.799944999998843, + 3.8005994589984766, + 3.8012155839969637, + 3.8017998750001425, + 3.8024262089966214, + 3.8031238339972333, + 3.803785791998962, + 3.804516666998097, + 3.8051926249972894, + 3.8058411669990164, + 3.806485499997507, + 3.807160541997291, + 3.807856333995005, + 3.8085329169989564, + 3.8091888749986538, + 3.809813916996063, + 3.8104331669965177, + 3.8110345839959336, + 3.8117751669997233, + 3.8124450420000358, + 3.8131102089973865, + 3.8137124169952585, + 3.8143583339988254, + 3.8150013749982463, + 3.8155915419993107, + 3.8162156249964028, + 3.816867583998828, + 3.8174995000008494, + 3.8181168750015786, + 3.8187612920009997, + 3.8194007919955766, + 3.8200615839959937, + 3.8207010420010192, + 3.821344958996633, + 3.8219869999957155, + 3.822664541999984, + 3.8233079169949633, + 3.82399712500046, + 3.8246281249957974, + 3.82525058399915, + 3.8259094589957385, + 3.826561124995351, + 3.8271675419964595, + 3.827820166996389, + 3.82847879199835, + 3.829075292000198, + 3.829659041999548, + 3.8303353340015747, + 3.831011750000471, + 3.8316369589956594, + 3.832276916997216, + 3.8329051670007175, + 3.8335778339969693, + 3.834230916996603, + 3.834826250000333, + 3.83543758399901, + 3.8360730839995085, + 3.8366933340003015, + 3.8373464589967625, + 3.837985166996077, + 3.838608624995686, + 3.8392472919949796, + 3.839872958997148, + 3.840524084000208, + 3.841155791997153, + 3.841803167000762, + 3.8425068340002326, + 3.84324524999829, + 3.8439837920013815, + 3.844635583998752, + 3.845266708995041, + 3.8459124169967254, + 3.846573416994943, + 3.847240791998047, + 3.847868083998037, + 3.848533791999216, + 3.8491899169966928, + 3.8497979169987957, + 3.850415000000794, + 3.8510596249980154, + 3.8516746669993154, + 3.8524171249955543, + 3.853050459001679, + 3.8536918749960023, + 3.8543173750003916, + 3.854947791995073, + 3.8555946669948753, + 3.8562244589993497, + 3.8568677919975016, + 3.857530916997348, + 3.8581661249991157, + 3.8588126670001657, + 3.85942987499584, + 3.8602174170009675, + 3.86085487499804, + 3.861496249999618, + 3.8622915000014473, + 3.8629612090007868, + 3.8636635840011877, + 3.864442499994766, + 3.865167083997221, + 3.865780291998817, + 3.866436584001349, + 3.8670751669997117, + 3.8677435839999816, + 3.868382249995193, + 3.8690363749992684, + 3.8696471669973107, + 3.8702564999985043, + 3.870873916996061, + 3.8714887089954573, + 3.8721114590007346, + 3.8727232499950333, + 3.8733520839959965, + 3.8740243749998626, + 3.874700208994909, + 3.875363084000128, + 3.876031125000736, + 3.876685916999122, + 3.877305041998625, + 3.8779622919973917, + 3.8785808339962387, + 3.87921058399661, + 3.87985229199694, + 3.880482959000801, + 3.881266083997616, + 3.8819435839977814, + 3.8826037920007366, + 3.8832252499996684, + 3.883886999996321, + 3.8845102089981083, + 3.8851774590002606, + 3.885858374997042, + 3.8864778749994002, + 3.8871651250010473, + 3.8877929169975687, + 3.888439666996419, + 3.8890797499989276, + 3.8897066669960623, + 3.8903165419978905, + 3.8909776250002324, + 3.8916199169980246, + 3.8923525419959333, + 3.893030084000202, + 3.893674374994589, + 3.894353791998583, + 3.89499487500143, + 3.8956393749976996, + 3.896238417000859, + 3.896875291997276, + 3.897507666995807, + 3.898184041994682, + 3.898844499999541, + 3.8994981669966364, + 3.900116541997704, + 3.900773624998692, + 3.901455541999894, + 3.902206416998524, + 3.902865042000485, + 3.9035272920009447, + 3.904169916997489, + 3.904900749999797, + 3.905507999996189, + 3.9061276669963263, + 3.906818833995203, + 3.9074368750007125, + 3.9080695000011474, + 3.9086974169986206, + 3.9093516249995446, + 3.9100087499973597, + 3.9106417919974774, + 3.9112647919973824, + 3.911916500001098, + 3.912536584000918, + 3.913218166999286, + 3.9138976670001284, + 3.9145209999987856, + 3.9151402919960674, + 3.915755417001492, + 3.916382541996427, + 3.917024208996736, + 3.917641749998438, + 3.9182903749970137, + 3.918905583996093, + 3.9195236250016023, + 3.920247834001202, + 3.920897584001068, + 3.9215485419990728, + 3.922188124997774, + 3.922819499995967, + 3.923455374999321, + 3.924095666996436, + 3.924844499997562, + 3.9255317089991877, + 3.9261936670009163, + 3.9268341249990044, + 3.9274277919976157, + 3.9280782919959165, + 3.9286936249991413, + 3.9293898749965592, + 3.930083791994548, + 3.9307497499976307, + 3.931390999998257, + 3.9320294999997714, + 3.9326890839947737, + 3.9333189589960966, + 3.9339402920013526, + 3.9345816249988275, + 3.9352222089946736, + 3.935844499996165, + 3.936461124998459, + 3.9370783749982365, + 3.9376957499989658, + 3.9383345839960384, + 3.9389585419994546, + 3.939581458995235, + 3.9401915419948637, + 3.940802958997665, + 3.941449041994929, + 3.9420662919947063, + 3.9429114169979584, + 3.943579583996325, + 3.944301584000641, + 3.9449430419990676, + 3.945560291998845, + 3.946213709001313, + 3.946822624995548, + 3.9474801249962184, + 3.9481160419964, + 3.948752333999437, + 3.9494106249985634, + 3.9500549169970327, + 3.950716499995906, + 3.9513415420005913, + 3.9519881250016624, + 3.9526290419962606, + 3.953249375001178, + 3.9539246249987627, + 3.954578541997762, + 3.9551933339971583, + 3.955838458998187, + 3.956478291998792, + 3.9572271249999176, + 3.95784512499813, + 3.9585110420011915, + 3.9591762089985423, + 3.9598588750013732, + 3.9605102499990608, + 3.9611440419976134, + 3.961801833997015, + 3.962439208997239, + 3.963151874995674, + 3.9638298339996254, + 3.9644886669993866, + 3.9651307499952964, + 3.965754917000595, + 3.966404999999213, + 3.9670438339962857, + 3.9676724589953665, + 3.9682764589961153, + 3.968914083998243, + 3.9696107499985374, + 3.970248666999396, + 3.9708552500014775, + 3.9714945839950815, + 3.9721456249972107, + 3.9727821669948753, + 3.9734388340002624, + 3.974084292000043, + 3.9747310419988935, + 3.9753484169996227, + 3.976014166997629, + 3.976636084000347, + 3.977288709000277, + 3.977930875000311, + 3.9785322499956237, + 3.9791647089950857, + 3.979795084000216, + 3.980439541999658, + 3.9811451669957023, + 3.981815999999526, + 3.982478624995565, + 3.9831466249961522, + 3.983781666996947, + 3.9844073339991155, + 3.9850541669948143, + 3.9856489169978886, + 3.9862735419956152, + 3.9868973749980796, + 3.9876799170015147, + 3.9883542919997126, + 3.9889875419976306, + 3.98968520899507, + 3.9904248339953483, + 3.9911050419977983, + 3.9917882090012426, + 3.992465249997622, + 3.993155874995864, + 3.9938484169979347, + 3.994559291997575, + 3.9952280840007006, + 3.9959077919993433, + 3.996563041997433, + 3.9972369169990998, + 3.998005541994644, + 3.9986704170005396, + 3.999284459001501, + 3.9999777089979034, + 4.000729958999727, + 4.001464666995162, + 4.002223584000603, + 4.002867249997507, + 4.003481667001324, + 4.004126041996642, + 4.0047309169967775, + 4.005364416996599, + 4.0060546249951585, + 4.006642458996794, + 4.007208124996396, + 4.007808666996425, + 4.00840108400007, + 4.008994499999972, + 4.009617833995435, + 4.010145583997655, + 4.010652375000063, + 4.011290292000922, + 4.011856958997669, + 4.012382666995109, + 4.012892334001663, + 4.0134201670007315, + 4.01395395900181, + 4.014472709000984, + 4.015009666996775, + 4.015528584001004, + 4.0160102919981, + 4.016578208997089, + 4.019120666998788, + 4.0200388340017525, + 4.0207057500010706, + 4.02139399999578, + 4.0221842089958955, + 4.0227269169990905, + 4.0232345839976915, + 4.023731666995445, + 4.02430212499894, + 4.024976208995213, + 4.025498333998257, + 4.026076417001605, + 4.026654333996703, + 4.027223541997955, + 4.027803166995, + 4.02831979199982, + 4.028872083996248, + 4.029430499998853, + 4.0300764169951435, + 4.030913124996005, + 4.031531791995803, + 4.03216304200032, + 4.032696249996661, + 4.03323987499607, + 4.0337731249965145, + 4.034496208994824, + 4.0350403749980615, + 4.035586124999099, + 4.036127916995611, + 4.036729209001351, + 4.0373154589979094, + 4.037868333994993, + 4.038415167000494, + 4.0389571669948054, + 4.039680124995357, + 4.04032775000087, + 4.0409565000009025, + 4.041588084000978, + 4.0421920840017265, + 4.042766749997099, + 4.043325499995262, + 4.04389179199643, + 4.04441954199865, + 4.0449181250005495, + 4.0454750419958145, + 4.046030666999286, + 4.046589666999353, + 4.047269208997022, + 4.0478416249970905, + 4.048405166999146, + 4.048941083994578, + 4.049468749995867, + 4.0500022919950425, + 4.050517042000138, + 4.051036083998042, + 4.051567416994658, + 4.0520972090016585, + 4.052639541994722, + 4.053169334001723, + 4.053737374997581, + 4.0542628339972, + 4.054904249998799, + 4.055471708998084, + 4.056035959001747, + 4.05652425000153, + 4.057073833995673, + 4.057614666999143, + 4.058136374995229, + 4.058675708998635, + 4.059352541997214, + 4.059901874999923, + 4.060540291997313, + 4.0610986669998965, + 4.061652500000491, + 4.062223333996371, + 4.0627662089973455, + 4.063313416998426, + 4.063851166996756, + 4.064403124997625, + 4.064946209000482, + 4.06552170899522, + 4.066011333998176, + 4.066564374996233, + 4.067080959001032, + 4.067627416996402, + 4.068149250000715, + 4.06870354199782, + 4.069234499998856, + 4.06982679200155, + 4.070519875000173, + 4.071080208996136, + 4.071563291996426, + 4.072132875000534, + 4.072680249999394, + 4.073195416996896, + 4.07370070899924, + 4.074244584000553, + 4.0747824589998345, + 4.0753409169992665, + 4.075849458997254, + 4.076418708995334, + 4.076992624999548, + 4.077537708995806, + 4.078161583995097, + 4.078837333996489, + 4.079464958995231, + 4.080107041998417, + 4.08073429200158, + 4.081314750001184, + 4.081842833998962, + 4.082391333999112, + 4.082979999999225, + 4.083546458998171, + 4.084110124997096, + 4.084716874996957, + 4.085307499997725, + 4.085852917000011, + 4.086445125001774, + 4.0870387089962605, + 4.087589083996136, + 4.088104333997762, + 4.0886778339991, + 4.089262000001327, + 4.089829708995239, + 4.090387791999092, + 4.09092654199776, + 4.091481416995521, + 4.092024375000619, + 4.092593000001216, + 4.0931888749983045, + 4.093781833995308, + 4.094346083998971, + 4.094922208998469, + 4.095490542000334, + 4.096047792001627, + 4.09660804199666, + 4.0971676249973825, + 4.0979109999971115, + 4.09850537499733, + 4.099172499998531, + 4.099769374995958, + 4.100322334001248, + 4.100943583995104, + 4.101468666995061, + 4.102033292001579, + 4.1026754999984405, + 4.10323733399855, + 4.103776374999143, + 4.1043184169975575, + 4.104906499997014, + 4.105492583999876, + 4.1060312499976135, + 4.106611208997492, + 4.10717641699739, + 4.107748999995238, + 4.108291083997756, + 4.108868999996048, + 4.109427958996093, + 4.109974209000939, + 4.110527666998678, + 4.111071166997135, + 4.111606749997009, + 4.11218929199822, + 4.112814208994678, + 4.113450958997419, + 4.114077583995822, + 4.1146758339964435, + 4.115202000000863, + 4.115747124997142, + 4.116257041998324, + 4.116885584000556, + 4.117530083996826, + 4.1181120420005755, + 4.118731791997561, + 4.119275791999826, + 4.119887959001062, + 4.12044616699859, + 4.121040666999761, + 4.121570625000459, + 4.122147124995536, + 4.12264783399587, + 4.123205416995916, + 4.123748041994986, + 4.124322374998883, + 4.124925584001176, + 4.125637459001155, + 4.126252916998055, + 4.126819583994802, + 4.12740012499853, + 4.127978666998388, + 4.128522749997501, + 4.129094083997188, + 4.129638083999453, + 4.130193791999773, + 4.1307742499993765, + 4.131321542001388, + 4.1318253749996074, + 4.132344459001615, + 4.1329255839955295, + 4.133452709000267, + 4.133999291996588, + 4.134546583998599, + 4.135064666996186, + 4.135616667001159, + 4.136210666998522, + 4.136786709001171, + 4.137382166998577, + 4.138031709000643, + 4.138596791999589, + 4.139190249996318, + 4.139730791997863, + 4.140263291999872, + 4.140865000001213, + 4.14142183399963, + 4.141986124996038, + 4.1425278339957, + 4.143081083995639, + 4.143655749998288, + 4.144202499999665, + 4.1447641249978915, + 4.145332333995611, + 4.1458961669995915, + 4.146465792000527, + 4.146993750000547, + 4.147549583998625, + 4.148562958995171, + 4.149109499994665, + 4.149767791997874, + 4.150346166999952, + 4.1509058750016266, + 4.151429541998368, + 4.151983958996425, + 4.152535333996639, + 4.153125833996455, + 4.153703083997243, + 4.154238041999633, + 4.154772709000099, + 4.155348708998645, + 4.155978750000941, + 4.156624249997549, + 4.157220542001596, + 4.157794833998196, + 4.158369833996403, + 4.158914458996151, + 4.159530208999058, + 4.16009016699536, + 4.160675833998539, + 4.1612192089960445, + 4.161759416994755, + 4.162344459000451, + 4.16287949999969, + 4.163432333996752, + 4.164070541999536, + 4.164643874995818, + 4.165147667001293, + 4.165688208995562, + 4.166237124998588, + 4.166820124999504, + 4.167345834001026, + 4.167921667001792, + 4.168476749997353, + 4.169011166995915, + 4.169562750001205, + 4.170144458999857, + 4.17067537499679, + 4.1712145839992445, + 4.171765958999458, + 4.172311333997641, + 4.172916541996528, + 4.1734737919978215, + 4.174055666997447, + 4.174616124997556, + 4.175325958996837, + 4.176058749995718, + 4.17674195899599, + 4.177386249997653, + 4.177974291997089, + 4.1785625420016, + 4.179077583998151, + 4.179619875001663, + 4.180152749999252, + 4.180765375000192, + 4.1813515839967295, + 4.181914458997198, + 4.1824486249970505, + 4.182993458998681, + 4.183570374996634, + 4.18408429199917, + 4.184625834001054, + 4.185196334001375, + 4.185699916997692, + 4.186270416998013, + 4.186814249995223, + 4.187325999999302, + 4.18788024999958, + 4.188409834001504, + 4.188999083999079, + 4.189529333998507, + 4.190047958996729, + 4.190579709000303, + 4.191146708995802, + 4.191738458997861, + 4.19229779199668, + 4.192806416998792, + 4.1934742500016, + 4.194037583998579, + 4.194585541998094, + 4.195250917000521, + 4.195931166999799, + 4.196525499995914, + 4.197139167001296, + 4.197712708999461, + 4.198276374998386, + 4.198831666995829, + 4.199365166998177, + 4.199903084001562, + 4.2004742919962155, + 4.201028291994589, + 4.201531583996257, + 4.202050374995451, + 4.2025744169950485, + 4.203133916998922, + 4.20369208399643, + 4.204257208999479, + 4.204815042001428, + 4.205371291995107, + 4.205926208996971, + 4.206466333998833, + 4.2070103750011185, + 4.207547166995937, + 4.208105666999472, + 4.208767374999297, + 4.209339083994564, + 4.209973291995993, + 4.210521249995509, + 4.2110694169969065, + 4.211635583997122, + 4.212188583995157, + 4.21275041699846, + 4.213267624996661, + 4.213829833999625, + 4.214413666995824, + 4.214989374995639, + 4.2156529589992715, + 4.216308416995162, + 4.216832624995732, + 4.217364208998333, + 4.217917000001762, + 4.218458666997321, + 4.219015458998911, + 4.219551333997515, + 4.220094541997241, + 4.2206686249992345, + 4.22121683399746, + 4.221763791996636, + 4.222369124996476, + 4.222887459000049, + 4.223432209000748, + 4.223947250000492, + 4.224531250001746, + 4.225100916999509, + 4.225697124995349, + 4.2262701250001555, + 4.226813291999861, + 4.227316416996473, + 4.227869624999585, + 4.228390749995015, + 4.22891820899531, + 4.229435499997635, + 4.230030209000688, + 4.230538999996497, + 4.23110016699502, + 4.231655124996905, + 4.232199458994728, + 4.232775500000571, + 4.23332941699482, + 4.233981999997923, + 4.2345194590016035, + 4.235093625000445, + 4.235702874997514, + 4.236245041996881, + 4.236833499999193, + 4.237431333996938, + 4.237943916996301, + 4.238517291996686, + 4.239087541995104, + 4.239669624999806, + 4.240222166998137, + 4.240766958995664, + 4.2413028750015656, + 4.241861958995287, + 4.242417959001614, + 4.242996542001492, + 4.243562042000121, + 4.24411304199748, + 4.2446783339983085, + 4.245200291996298, + 4.245750458998373, + 4.246654124995985, + 4.247392208999372, + 4.247918959001254, + 4.248476417000347, + 4.249023999997007, + 4.249561416996585, + 4.250146416998177, + 4.250733499997295, + 4.251258584001334, + 4.251745292000123, + 4.2522734999947716, + 4.252814125000441, + 4.253367124998476, + 4.253921499999706, + 4.254464583995286, + 4.255078834001324, + 4.25560429199686, + 4.256284083996434, + 4.256854209001176, + 4.257439249995514, + 4.258048083996982, + 4.2586114590012585, + 4.259254874996259, + 4.259837459001574, + 4.260440291996929, + 4.261057833995437, + 4.261625166996964, + 4.262212208996061, + 4.26279079199594, + 4.26340537500073, + 4.263957292001578, + 4.264516999995976, + 4.265016042001662, + 4.265562333996058, + 4.266115458995046, + 4.2666436250001425, + 4.267163541997434, + 4.26768841699959, + 4.268198041994765, + 4.2686952500007465, + 4.269242791997385, + 4.269776542001637, + 4.270308583996666, + 4.270839917000558, + 4.2714117919967975, + 4.272108999997727, + 4.272664500000246, + 4.273227749996295, + 4.273779416995239, + 4.274280749996251, + 4.274836459000653, + 4.275330459000543, + 4.27601416700054, + 4.276559124999039, + 4.277139500001795, + 4.277723084000172, + 4.278298708995862, + 4.278901375000714, + 4.279467041997123, + 4.280038291995879, + 4.280575625001802, + 4.2811411669972586, + 4.281754916999489, + 4.282342541999242, + 4.282893584000703, + 4.283431458999985, + 4.283983624998655, + 4.284534916994744, + 4.285117166997225, + 4.285677749998285, + 4.286213833998772, + 4.286741666997841, + 4.287240874997224, + 4.287802833998285, + 4.288363333995221, + 4.288931958995818, + 4.289485959001468, + 4.290027916998952, + 4.2905757920016185, + 4.291108042001724, + 4.291683499999635, + 4.292291083998862, + 4.292900791995635, + 4.293433792001451, + 4.293989083998895, + 4.294583167000383, + 4.295225000001665, + 4.295767791998514, + 4.296335125000041, + 4.296879166999133, + 4.297449166995648, + 4.297963416996936, + 4.29854041699582, + 4.299082792000263, + 4.299658083997201, + 4.3001924169948325, + 4.300757375000103, + 4.301307000001543, + 4.301881583996874, + 4.302410249998502, + 4.302971416997025, + 4.303576708996843, + 4.304105374998471, + 4.304639000001771, + 4.305154791996756, + 4.305719167001371, + 4.3062705420015845, + 4.306847166997613, + 4.307383999999729, + 4.307906083995476, + 4.308442959001695, + 4.309012541998527, + 4.309551541999099, + 4.310089958999015, + 4.310598916999879, + 4.311133625000366, + 4.311702041995886, + 4.312235792000138, + 4.312785249996523, + 4.3133298749962705, + 4.3138610839960165, + 4.314478666994546, + 4.315057209001679, + 4.315665499998431, + 4.316227041999809, + 4.31675191699469, + 4.317280666997249, + 4.3178015839948785, + 4.31836441699852, + 4.31889974999649, + 4.31957433399657, + 4.320135166999535, + 4.32067983399611, + 4.321269624997512, + 4.321835709000879, + 4.322402291996696, + 4.3229469590005465, + 4.323482374995365, + 4.324021374995937, + 4.324570249998942, + 4.325146999995923, + 4.325673916995584, + 4.3262196669966215, + 4.32679541700054, + 4.327333624998573, + 4.3278752920014085, + 4.328438874996209, + 4.3289794999946025, + 4.32949708399974, + 4.330022292000649, + 4.330611541998223, + 4.331133916995896, + 4.331618749994959, + 4.332169916997373, + 4.332736666998244, + 4.333296208998945, + 4.334002750001673, + 4.334644333997858, + 4.335273500000767, + 4.335867041998426, + 4.336462541999936, + 4.337023084000975, + 4.337573083997995, + 4.338083666996681, + 4.338616417000594, + 4.339187999998103, + 4.3397882919962285, + 4.340335624998261, + 4.340904249998857, + 4.3415061669948045, + 4.342047583995736, + 4.342624541997793, + 4.343207958998391, + 4.343755499998224, + 4.344341291995079, + 4.34489841699542, + 4.345456833994831, + 4.345992916998512, + 4.346520499995677, + 4.347089458999108, + 4.347749874999863, + 4.348336833994836, + 4.34894487499696, + 4.34963741699903, + 4.35029349999968, + 4.3510027500014985, + 4.351640749999206, + 4.3522924999997485, + 4.352992458996596, + 4.353641958994558, + 4.354347291999147, + 4.354999625000346, + 4.355698916995607, + 4.3563022919988725, + 4.356937917000323, + 4.357592041997123, + 4.358208833997196, + 4.358806749994983, + 4.359437084000092, + 4.36004604199843, + 4.3606862089945935, + 4.361300333999679, + 4.361993958998937, + 4.362716416995681, + 4.363348334001785, + 4.363990124998963, + 4.364690124995832, + 4.365380625000398, + 4.366060624997772, + 4.366694374999497, + 4.367419709000387, + 4.368065167000168, + 4.368736500000523, + 4.369375666996348, + 4.370035749998351, + 4.37064366699633, + 4.371284499997273, + 4.371918208998977, + 4.372719416998734, + 4.373366791995068, + 4.374076708998473, + 4.374802792000992, + 4.375500333997479, + 4.3761327089960105, + 4.376772124996933, + 4.377389458997641, + 4.378010458996869, + 4.378640124996309, + 4.379266625001037, + 4.379965125001036, + 4.38057362499967, + 4.381218624999747, + 4.381879708998895, + 4.382515833996877, + 4.383175625000149, + 4.3838159590013674, + 4.384445167001104, + 4.38507920900156, + 4.385722333994636, + 4.386375624999346, + 4.3870048339958885, + 4.387625541996385, + 4.388286875000631, + 4.388909959001467, + 4.389555999994627, + 4.3901646669983165, + 4.39082166699518, + 4.391470916998514, + 4.392144749996078, + 4.392842749999545, + 4.393526041996665, + 4.394343416999618, + 4.394982208999863, + 4.395618583999749, + 4.3962709170009475, + 4.396868833995541, + 4.397512584000651, + 4.398169000000053, + 4.398761459000525, + 4.399351874999411, + 4.400021708999702, + 4.400682499996037, + 4.401343334000558, + 4.401994791995094, + 4.402636083999823, + 4.403232291995664, + 4.404046666997601, + 4.404714042000705, + 4.405378374998691, + 4.4060403749972465, + 4.406686583999544, + 4.407321291997505, + 4.407965458995022, + 4.408594833999814, + 4.409254833997693, + 4.409916708995297, + 4.410564999998314, + 4.411227958997188, + 4.411932249997335, + 4.4126047089957865, + 4.413299125000776, + 4.414696833999187, + 4.4153460419984185, + 4.415961708997202, + 4.41654158399615, + 4.417240499999025, + 4.417890625001746, + 4.418537874997128, + 4.4191941669996595, + 4.419836208995548, + 4.420507874994655, + 4.4211521670004, + 4.421828375001496, + 4.422496333994786, + 4.423167041997658, + 4.423785792001581, + 4.42447008399904, + 4.425140749997809, + 4.4257842090009945, + 4.426403124998615, + 4.427071583995712, + 4.427705624999362, + 4.428341667000495, + 4.429015666995838, + 4.429625416996714, + 4.430325166998955, + 4.431023459001153, + 4.431683916998736, + 4.432487083999149, + 4.433146791998297, + 4.433773625001777, + 4.434411333997559, + 4.435058416995162, + 4.435696499996993, + 4.436357334001514, + 4.436977249999472, + 4.437655958994583, + 4.43828124999709, + 4.438934833997337, + 4.439573208997899, + 4.440206374994887, + 4.440850416998728, + 4.441445042000851, + 4.44207029199606, + 4.44269645899476, + 4.443349458997545, + 4.44397683400166, + 4.444606708995707, + 4.445211708996794, + 4.445863249995455, + 4.446535666997079, + 4.447197749999759, + 4.44789049999963, + 4.448526583997591, + 4.449169791994791, + 4.449797374996706, + 4.450481667001441, + 4.451146749997861, + 4.4518100839995896, + 4.452586250001332, + 4.453250624996144, + 4.453944041997602, + 4.4545945419959025, + 4.455231833999278, + 4.455865416995948, + 4.456506541995623, + 4.457082583998272, + 4.457769374996133, + 4.4584412920012255, + 4.459093459001451, + 4.459719041995413, + 4.460370125001646, + 4.461023374999058, + 4.461635708998074, + 4.462261874999967, + 4.462900041995454, + 4.463524124999822, + 4.46419858399895, + 4.4648597089981195, + 4.465496416996757, + 4.466173458997218, + 4.466785541997524, + 4.467393333994551, + 4.468023166999046, + 4.468623249995289, + 4.469241124999826, + 4.469884458994784, + 4.470504791999701, + 4.471200499996485, + 4.471854584000539, + 4.472504958997888, + 4.473212666998734, + 4.473843250001664, + 4.474480208999012, + 4.475093291999656, + 4.475708250000025, + 4.476351375000377, + 4.476981583997258, + 4.4776395419976325, + 4.478291291998175, + 4.47891924999567, + 4.47956841699488, + 4.480220792000182, + 4.480892084000516, + 4.481527666997863, + 4.482251749999705, + 4.482918083995173, + 4.4835440419992665, + 4.484160374995554, + 4.484785791995819, + 4.48544291700091, + 4.486058292000962, + 4.486697499996808, + 4.48735733400099, + 4.48801258399908, + 4.48869345899584, + 4.489351208998414, + 4.4899849590001395, + 4.49070324999775, + 4.491409124995698, + 4.492077333998168, + 4.492741541995201, + 4.493400084000314, + 4.494070708999061, + 4.494730792001064, + 4.495364458998665, + 4.496064416998706, + 4.496731250001176, + 4.497331166996446, + 4.497964292000688, + 4.498591416995623, + 4.499253124995448, + 4.499897541994869, + 4.500542709000001, + 4.5011645420017885, + 4.501793541996449, + 4.502432041997963, + 4.503076959001191, + 4.503737125000043, + 4.5043367499965825, + 4.504967624998244, + 4.505710833997, + 4.506333958997857, + 4.50696291699569, + 4.507613666995894, + 4.508267708995845, + 4.509031083995069, + 4.50974420899729, + 4.510477333999006, + 4.511148917001265, + 4.5117526249960065, + 4.512390833995596, + 4.513052999995125, + 4.513762999995379, + 4.514436624995142, + 4.515065624997078, + 4.515707833998022, + 4.516425124995294, + 4.517053291994671, + 4.517706083999656, + 4.518359999994573, + 4.51901320899924, + 4.519650709000416, + 4.520284916994569, + 4.5209265839948785, + 4.521591749995423, + 4.522213958996872, + 4.522869874999742, + 4.523596708997502, + 4.52421966700058, + 4.524845916996128, + 4.525562208997144, + 4.526209291994746, + 4.526815541998076, + 4.527467749998323, + 4.5281139590006205, + 4.528922708996106, + 4.529612250000355, + 4.530347542000527, + 4.531010250000691, + 4.53161583399924, + 4.532287499998347, + 4.5329677920017275, + 4.5336489170003915, + 4.534306708999793, + 4.53492854200158, + 4.535543749996577, + 4.536200416994689, + 4.536830083998211, + 4.5375815840016, + 4.538213416999497, + 4.538859416999912, + 4.53945720900083, + 4.540074042000924, + 4.540718874995946, + 4.541369833998033, + 4.541999875000329, + 4.542660209001042, + 4.543304749997333, + 4.543958292000752, + 4.54459433399461, + 4.545253291995323, + 4.545872666996729, + 4.546477666997816, + 4.547099584000534, + 4.547872750001261, + 4.548585666998406, + 4.549292374998913, + 4.549931041998207, + 4.550584584001626, + 4.551232917001471, + 4.551884666994738, + 4.552489417001198, + 4.553127458995732, + 4.55381716699776, + 4.554497208999237, + 4.555122874997323, + 4.555754124994564, + 4.556381958995189, + 4.557047124995734, + 4.55769433399837, + 4.5583542919994215, + 4.558982834001654, + 4.559598084000754, + 4.560240792001423, + 4.560904209, + 4.561514834000263, + 4.562144999996235, + 4.562771833996521, + 4.563441541999055, + 4.5640454999957, + 4.564669999999751, + 4.565287291996356, + 4.565942708999501, + 4.5665953749994515, + 4.567416249999951, + 4.5680949589950615, + 4.568772667000303, + 4.569465125001443, + 4.570137916998647, + 4.5707925419992534, + 4.571430625001085, + 4.572033083997667, + 4.572621999999683, + 4.573267749998195, + 4.57391637499677, + 4.5746689590014284, + 4.575304250000045, + 4.575993209000444, + 4.57661558399559, + 4.577232124996954, + 4.5778650419961195, + 4.578481833996193, + 4.579111166996881, + 4.579718499997398, + 4.58040304199676, + 4.581039083997894, + 4.581659541996487, + 4.582294833999185, + 4.583023250001133, + 4.583657625000342, + 4.584502208999766, + 4.585121541997069, + 4.585911916998157, + 4.586543416997301, + 4.587151209001604, + 4.587764916999731, + 4.58837762499752, + 4.589045249995252, + 4.589760709000984, + 4.590437041995756, + 4.591151749998971, + 4.59181266700034, + 4.592481374995259, + 4.593117958997027, + 4.593777624999348, + 4.594444958995155, + 4.595078458994976, + 4.595709791996342, + 4.596325708997028, + 4.597025833994849, + 4.597652541997377, + 4.598284916995908, + 4.5989544589974685, + 4.599609666998731, + 4.600238041995908, + 4.600911333996919, + 4.601527874998283, + 4.602161958995566, + 4.602806999995664, + 4.603443084000901, + 4.604087333995267, + 4.604708458995447, + 4.605334333995415, + 4.605977708997671, + 4.6066262499953154, + 4.607247624997399, + 4.607849708998401, + 4.608462625001266, + 4.609125916998892, + 4.60974804199941, + 4.61043479199725, + 4.611101499998767, + 4.61174470900005, + 4.612367875000928, + 4.613121292000869, + 4.613826834000065, + 4.614487874998304, + 4.615127541997936, + 4.615782374996343, + 4.616415874996164, + 4.617043250000279, + 4.617688416998135, + 4.61832104199857, + 4.618941166998411, + 4.6195891669995035, + 4.620230499996978, + 4.620864459000586, + 4.621602792001795, + 4.622265708996565, + 4.622875791996194, + 4.623498749999271, + 4.624152249998588, + 4.624812249996467, + 4.6254670419948525, + 4.626104833994759, + 4.62671262499498, + 4.627274416998262, + 4.627960999998322, + 4.628620041999966, + 4.629343374996097, + 4.630039958996349, + 4.630689334000635, + 4.631313917001535, + 4.631946708999749, + 4.632582334001199, + 4.633211624997784, + 4.633861292000802, + 4.634466750001593, + 4.635118334001163, + 4.635708499998145, + 4.636367250001058, + 4.637003416995867, + 4.637607416996616, + 4.6382064999997965, + 4.638835583995387, + 4.6394590839991, + 4.640045084001031, + 4.640679124997405, + 4.64136408399645, + 4.642024458997184, + 4.642631874994549, + 4.643234791998111, + 4.643837249997887, + 4.644460750001599, + 4.64508020899666, + 4.645763666994753, + 4.646400666999398, + 4.64702108399797, + 4.647713209000358, + 4.64833579200058, + 4.649029583997617, + 4.649645042001794, + 4.650303875001555, + 4.650921874999767, + 4.651515874997131, + 4.652137624994793, + 4.652916084000026, + 4.65350179199595, + 4.654127249996236, + 4.654765458995826, + 4.655428708996624, + 4.656064624999999, + 4.656711083996925, + 4.657326249995094, + 4.657955666996713, + 4.658592250001675, + 4.6592151669974555, + 4.659846333997848, + 4.660517666998203, + 4.661129333995632, + 4.661778083995159, + 4.662391208999907, + 4.663027666996641, + 4.6637358340012725, + 4.664359583999612, + 4.665039209001407, + 4.665705416999117, + 4.666303666999738, + 4.667019542001071, + 4.6676702499971725, + 4.668357834001654, + 4.669042083995009, + 4.669755249997252, + 4.670382291995338, + 4.67102916699514, + 4.671679499995662, + 4.6723119169982965, + 4.672992874999181, + 4.673637166997651, + 4.674273249998805, + 4.674924999999348, + 4.675572959000419, + 4.676227208998171, + 4.676977541996166, + 4.677585583995096, + 4.6782344589955756, + 4.678838959000132, + 4.67943324999942, + 4.6800701249958365, + 4.680673874994682, + 4.681316458998481, + 4.681938166999316, + 4.6825607499995385, + 4.6832430840004236, + 4.684017250001489, + 4.68465595899761, + 4.685303541999019, + 4.685960458999034, + 4.686685542001214, + 4.687304499995662, + 4.688036958999874, + 4.688742958998773, + 4.689385416997538, + 4.6900312090001535, + 4.690677874998073, + 4.6913162089986145, + 4.691993458996876, + 4.692599499998323, + 4.6932081669947365, + 4.6938533339998685, + 4.6945249999989755, + 4.695196916996792, + 4.695819333996042, + 4.696462250001787, + 4.697112999994715, + 4.697804374998668, + 4.698487541994837, + 4.699101458994846, + 4.699768624996068, + 4.700443583999004, + 4.701059749997512, + 4.701723250000214, + 4.702392624996719, + 4.703069958995911, + 4.703674416996364, + 4.704311834000691, + 4.7049463340008515, + 4.705579041998135, + 4.7062324169964995, + 4.706903541999054, + 4.707558666996192, + 4.708302041995921, + 4.708964624995133, + 4.70960183400166, + 4.710310916998424, + 4.710958999996365, + 4.711624499999743, + 4.712261249995208, + 4.712916291995498, + 4.713606749995961, + 4.714242374997411, + 4.714883208995161, + 4.715515208998113, + 4.716191374995105, + 4.716855541999394, + 4.717507834000571, + 4.718168833998789, + 4.718777916998079, + 4.719422124995617, + 4.720042041997658, + 4.720660792001581, + 4.721414916995855, + 4.722039833999588, + 4.722682833998988, + 4.723301458994683, + 4.7239325839982484, + 4.724558541995066, + 4.7252518749955925, + 4.725926458995673, + 4.726612458995078, + 4.727307791996282, + 4.727999458998966, + 4.728627749995212, + 4.729275124998821, + 4.72990949999803, + 4.730546334001701, + 4.731298083999718, + 4.7319421249994775, + 4.732610209000995, + 4.733231792000879, + 4.733876291997149, + 4.734479958999145, + 4.735064542001055, + 4.735682166996412, + 4.73633316699852, + 4.7369665000005625, + 4.7376708750016405, + 4.738320749995182, + 4.738981791997503, + 4.739680583996233, + 4.740319416996499, + 4.740958416994545, + 4.741600749999634, + 4.742390374995011, + 4.743039834000228, + 4.743735666997964, + 4.74438158400153, + 4.7450339589995565, + 4.7456929170002695, + 4.746341416997893, + 4.7470643339984235, + 4.7477408749982715, + 4.748399708994839, + 4.7491095419973135, + 4.749749458998849, + 4.750382041995181, + 4.751037208996422, + 4.751670583995292, + 4.752321041996765, + 4.7529850419959985, + 4.7536066669999855, + 4.754218583999318, + 4.754881666995061, + 4.755479667001055, + 4.756136374999187, + 4.756754374997399, + 4.757351708998613, + 4.75799954199465, + 4.758699209000042, + 4.759360584001115, + 4.760006833996158, + 4.760610583995003, + 4.761231999997108, + 4.761825916997623, + 4.762429416994564, + 4.763059208999039, + 4.7637867500016, + 4.764436958997976, + 4.765142083997489, + 4.7658099999971455, + 4.766470709000714, + 4.767104958998971, + 4.767725459001667, + 4.768312916996365, + 4.768937417000416, + 4.769584666995797, + 4.770389166995301, + 4.771020791995397, + 4.771705708997615, + 4.772369166996214, + 4.773016874998575, + 4.773673458999838, + 4.774294458999066, + 4.774940625000454, + 4.775560709000274, + 4.776221499996609, + 4.776852083996346, + 4.777482958998007, + 4.778107375001127, + 4.778752166996128, + 4.779358667001361, + 4.779998999998497, + 4.780723208998097, + 4.7813603339964175, + 4.781988499998988, + 4.782629875000566, + 4.783255249996728, + 4.7842190000010305, + 4.784997999995539, + 4.785697416999028, + 4.786279291998653, + 4.786951417001546, + 4.787629749996995, + 4.7883124590007355, + 4.788928499998292, + 4.789549834000354, + 4.790185541998653, + 4.7907984999983455, + 4.791459791995294, + 4.792070208997757, + 4.792675500000769, + 4.793296249998093, + 4.793974708998576, + 4.794569124998816, + 4.7952272499969695, + 4.795882166996307, + 4.796522459000698, + 4.797151874998235, + 4.79775691699615, + 4.798455916999956, + 4.799140541996167, + 4.7997584999975516, + 4.800348541997664, + 4.800936833999003, + 4.801568833994679, + 4.802208749999409, + 4.802895333996275, + 4.803571791999275, + 4.804232791997492, + 4.805090499998187, + 4.805670333997114, + 4.806410416997096, + 4.807055833996856, + 4.807640624996566, + 4.808276916999603, + 4.8089349169968045, + 4.809541124996031, + 4.81014258399955, + 4.8107327920006355, + 4.811353583994787, + 4.811974374999409, + 4.812619333999464, + 4.813234624998586, + 4.8138532919983845, + 4.814514416997554, + 4.815172624999832, + 4.815809542000352, + 4.816451250000682, + 4.817082749999827, + 4.817672749995836, + 4.818290541996248, + 4.818913333998353, + 4.819566499994835, + 4.820163666998269, + 4.820807874995808, + 4.821453333999671, + 4.822051916999044, + 4.822846208997362, + 4.823545166997064, + 4.8242717499961145, + 4.824876041995594, + 4.825559166994935, + 4.826245333999395, + 4.826879916996404, + 4.827534541997011, + 4.828146542000468, + 4.82875358399906, + 4.829460000000836, + 4.830099624996365, + 4.830748416999995, + 4.831393499996921, + 4.832042834001186, + 4.832676083999104, + 4.833305959000427, + 4.833975041998201, + 4.834648374999233, + 4.835262749998947, + 4.835888583998894, + 4.836495833995286, + 4.837122708995594, + 4.83776133399806, + 4.8384219169965945, + 4.839024791996053, + 4.839676958996279, + 4.840307792001113, + 4.840966458999901, + 4.841587041999446, + 4.84236987499753, + 4.843135874994914, + 4.843857499996375, + 4.844488709000871, + 4.845095042001049, + 4.845760999996855, + 4.846376916997542, + 4.847003292001318, + 4.847638958999596, + 4.848288834000414, + 4.848949458995776, + 4.849578624998685, + 4.850212459001341, + 4.850812249998853, + 4.851431499999308, + 4.852082291996339, + 4.85271987500164, + 4.853351208999811, + 4.854001667001285, + 4.854660334000073, + 4.8552990419993876, + 4.85589629199967, + 4.8565200839948375, + 4.8571076250009355, + 4.857713208999485, + 4.8583591249989695, + 4.859001583994541, + 4.859623042000749, + 4.860232958999404, + 4.860850459001085, + 4.861492666997947, + 4.862201874995662, + 4.862800750001043, + 4.863606541999616, + 4.86428045899811, + 4.864955833996646, + 4.8656341249952675, + 4.866273667001224, + 4.8669480419994215, + 4.86761541699525, + 4.868274000000383, + 4.868896374995529, + 4.869561791994784, + 4.8702002499994705, + 4.870836166999652, + 4.871494958999392, + 4.8721215420009685, + 4.87275262500043, + 4.873367708998558, + 4.87397495899495, + 4.874624708994816, + 4.875261249995674, + 4.875886000001628, + 4.876534625000204, + 4.877180374998716, + 4.877814416999172, + 4.878559291995771, + 4.879199709001114, + 4.879860708999331, + 4.880495999997947, + 4.881218834001629, + 4.881884041999001, + 4.882567791995825, + 4.88321987499512, + 4.883838791996823, + 4.884468124997511, + 4.885150666996196, + 4.885782334000396, + 4.88641179199476, + 4.887031792000926, + 4.887658874999033, + 4.888333750001038, + 4.888966334001452, + 4.889601292001316, + 4.890214499995636, + 4.890830874996027, + 4.89145204200031, + 4.892079624994949, + 4.8927268749976065, + 4.89332704199478, + 4.893948375000036, + 4.89456537499791, + 4.895207166999171, + 4.895873541994661, + 4.89651241699903, + 4.897126958996523, + 4.897772666998208, + 4.898421583995514, + 4.899076041998342, + 4.899733166996157, + 4.900535000000673, + 4.901235541998176, + 4.90201079200051, + 4.902690167000401, + 4.903363459001412, + 4.904030749996309, + 4.90466795899556, + 4.9052922499977285, + 4.905959833995439, + 4.906584666998242, + 4.907237833998806, + 4.9080031249977765, + 4.908622374998231, + 4.909295083998586, + 4.909956709001563, + 4.910582208998676, + 4.911208291996445, + 4.911807584001508, + 4.912430500000482, + 4.913046083995141, + 4.913657541997964, + 4.914307084000029, + 4.914953999999852, + 4.915595916994789, + 4.916211333998945, + 4.916837584001769, + 4.917504999997618, + 4.918103833995701, + 4.918716708998545, + 4.919316416999209, + 4.919978583995544, + 4.920671416999539, + 4.921343666996108, + 4.922014333998959, + 4.922676333997515, + 4.923351541998272, + 4.924029666995921, + 4.924694791996444, + 4.925351833997411, + 4.926004208995437, + 4.9266565419966355, + 4.927315333996376, + 4.9279761249999865, + 4.92859533400042, + 4.929227125001489, + 4.929874834000657, + 4.9305302089996985, + 4.931143083995266, + 4.931798792000336, + 4.932444917001703, + 4.933072959000128, + 4.9337281249972875, + 4.934401458995126, + 4.935020999997505, + 4.935651624997263, + 4.936317125000642, + 4.9369757089953055, + 4.93761066699517, + 4.938209125000867, + 4.938880875000905, + 4.939619333999872, + 4.940288708996377, + 4.940964083994913, + 4.9415887919967645, + 4.942277166999702, + 4.942931041994598, + 4.943614958996477, + 4.944350334000774, + 4.945017792000726, + 4.945657208998455, + 4.946327334000671, + 4.94699454199872, + 4.947607417001564, + 4.9482380420013214, + 4.948914583997976, + 4.949562333997164, + 4.950189541996224, + 4.950816584001586, + 4.9514847499958705, + 4.952235291995748, + 4.952922416996444, + 4.95361704199604, + 4.9542427499982296, + 4.954926749996957, + 4.955560916998365, + 4.956178291999095, + 4.9568456249980954, + 4.957519791998493, + 4.95815975000005, + 4.958808208997652, + 4.9594630419960595, + 4.960057042000699, + 4.960687749997305, + 4.961347917000239, + 4.96205637499952, + 4.962779417001002, + 4.963487624998379, + 4.96416745899478, + 4.964800749999995, + 4.965472874995612, + 4.966101375001017, + 4.966715124995972, + 4.967405541996413, + 4.96809362500062, + 4.968746792001184, + 4.969411999998556, + 4.970068124996033, + 4.970706458996574, + 4.971342708995508, + 4.971979374997318, + 4.972575250001682, + 4.97324520899565, + 4.973883916994964, + 4.974543749995064, + 4.975148041994544, + 4.97579041699646, + 4.976447208995523, + 4.977200499997707, + 4.977822291999473, + 4.978469541994855, + 4.979135000001406, + 4.979841416999989, + 4.980504624996684, + 4.981143541997881, + 4.981795333995251, + 4.9825011669963715, + 4.983134624999366, + 4.983754291999503, + 4.984402208996471, + 4.985050958995998, + 4.985720124997897, + 4.986394624997047, + 4.987048874994798, + 4.987711666995892, + 4.988371084000391, + 4.98901987499994, + 4.989701916994818, + 4.990340500000457, + 4.991071416996419, + 4.991678041995328, + 4.992406334000407, + 4.9930990419961745, + 4.9937838339974405, + 4.9945313339994755, + 4.995196791998751, + 4.995890874997713, + 4.996575833996758, + 4.99724766700092, + 4.997917708999012, + 4.998646624997491, + 4.9997589170016, + 5.00054541699501, + 5.001234999996086, + 5.002005666996411, + 5.002753583998128, + 5.00341616699734, + 5.004545458999928, + 5.005258208999294, + 5.006082667001465, + 5.007007499996689, + 5.00767966699641, + 5.008330083997862, + 5.008952291995229, + 5.009657416994742, + 5.010393208998721, + 5.011480583998491, + 5.012551624997286, + 5.013234583995654, + 5.013975624999148, + 5.014606625001761, + 5.015184124997177, + 5.015760458998557, + 5.016331541999534, + 5.0169799590003095, + 5.017505042000266, + 5.018059374997392, + 5.018552083995019, + 5.019080334001046, + 5.019870208998327, + 5.023319250001805, + 5.023944916996697, + 5.024686500000826, + 5.025402374994883, + 5.02603866699792, + 5.0265863749955315, + 5.027174167000339, + 5.0277263749958365, + 5.028289834001043, + 5.028825583998696, + 5.029369833995588, + 5.030127291996905, + 5.030742791997909, + 5.031504541999311, + 5.032155875000171, + 5.032802124995214, + 5.035026375000598, + 5.035886124998797, + 5.036503541996353, + 5.037145124995732, + 5.037741333995655, + 5.038370875001419, + 5.039005124999676, + 5.039750249998178, + 5.040424083999824, + 5.041114667001239, + 5.041888583997206, + 5.042599041997164, + 5.043205083995417, + 5.043963833995804, + 5.044586541996978, + 5.045345999998972, + 5.04605783399893, + 5.046694625001692, + 5.0473515420017065, + 5.047905667001032, + 5.048501999997825, + 5.049089749998529, + 5.049668333995214, + 5.050240833996213, + 5.050795333998394, + 5.051339083998755, + 5.05189441699622, + 5.0524343340002815, + 5.053004666995548, + 5.053548958996544, + 5.05409787499957, + 5.054669083998306, + 5.05522991700127, + 5.055838166998001, + 5.0563959589999286, + 5.056946749995404, + 5.0575206669964246, + 5.058065583994903, + 5.058605458994862, + 5.059229291997326, + 5.059852166996279, + 5.060573958995519, + 5.0612550000005285, + 5.061972625000635, + 5.062634249996336, + 5.06327387499914, + 5.063922666995495, + 5.06455529199593, + 5.065198500000406, + 5.0658301250005024, + 5.066488124997704, + 5.067164333995606, + 5.067828791994543, + 5.068489708995912, + 5.069180749997031, + 5.069814124995901, + 5.070487958997546, + 5.071149874995172, + 5.071925708994968, + 5.072581666994665, + 5.073257042000478, + 5.073933583997132, + 5.07453383399843, + 5.075144333997741, + 5.0757993340012035, + 5.076523416995769, + 5.077237666999281, + 5.077892749999592, + 5.078536583998357, + 5.079190291995474, + 5.079878584001563, + 5.080590874997142, + 5.081265542001347, + 5.081871709000552, + 5.08251216699864, + 5.08313087499846, + 5.083794917001796, + 5.084546917001717, + 5.0852278339953045, + 5.085909624998749, + 5.0866287919998285, + 5.087302084000839, + 5.087968833999184, + 5.088600999995833, + 5.089233166996564, + 5.089885000001232, + 5.090496999997413, + 5.091139167001529, + 5.091806917000213, + 5.092489666996698, + 5.093138042000646, + 5.093802625000535, + 5.094424333998177, + 5.095094541997241, + 5.095737874995393, + 5.096422374997928, + 5.097141499994905, + 5.097871874997509, + 5.0985434589965735, + 5.099205958998937, + 5.099920499997097, + 5.10056766699563, + 5.101276499997766, + 5.102021916995, + 5.102639749995433, + 5.103300999995554, + 5.1039591250009835, + 5.104617042001337, + 5.1052906670011, + 5.105966458999319, + 5.10662679199595, + 5.107270749998861, + 5.1079346670012455, + 5.108566083996266, + 5.109228666995477, + 5.1098334999987856, + 5.110461416996259, + 5.111114499995892, + 5.111749874995439, + 5.11244091700064, + 5.113096708999365, + 5.1137430839953595, + 5.114368709000701, + 5.115063249999366, + 5.115713833998598, + 5.11631808400125, + 5.117020459001651, + 5.1176415000009, + 5.118343541995273, + 5.119002999999793, + 5.119671417000063, + 5.1203010419994825, + 5.120923499998753, + 5.121567333997518, + 5.12219691700011, + 5.12283749999915, + 5.123437333997572, + 5.124103292000655, + 5.124761958999443, + 5.125457458998426, + 5.126118959000451, + 5.126789624999219, + 5.127397042000666, + 5.12801795899577, + 5.12864350000018, + 5.12930575000064, + 5.130074249995232, + 5.13067074999708, + 5.1313599169952795, + 5.132091458996001, + 5.13276658399991, + 5.133341374996235, + 5.133975917000498, + 5.134593541995855, + 5.135234083994874, + 5.1358321250008885, + 5.13649599999917, + 5.137169208996056, + 5.137902541995572, + 5.138586916997156, + 5.139222500001779, + 5.139875916996971, + 5.140480624999327, + 5.141048042001785, + 5.1416627500002505, + 5.142376333998982, + 5.142985749997024, + 5.143539124997915, + 5.1440880419977475, + 5.144616083998699, + 5.145206959001371, + 5.145727958995849, + 5.1462449169994215, + 5.148241833994689, + 5.149255500000436, + 5.149849417000951, + 5.150470000000496, + 5.15105354199477, + 5.151713499995822, + 5.152370042000257, + 5.153083999997762, + 5.1537233339986415, + 5.154354792000959, + 5.15530966699589, + 5.156100416999834, + 5.156995541998185, + 5.1577779590006685, + 5.158518958996865, + 5.159215291998407, + 5.159879999999248, + 5.160532374997274, + 5.1612178340001265, + 5.161899041995639, + 5.162501541999518, + 5.163111624999146, + 5.163768792001065, + 5.164421374996891, + 5.165119583994965, + 5.165750749998551, + 5.166375791995961, + 5.1670010419984465, + 5.167610249998688, + 5.168192833996727, + 5.168861749996722, + 5.169538083995576, + 5.1702101249975385, + 5.170830750001187, + 5.171480166995025, + 5.172122208998189, + 5.172733333994984, + 5.173348749995057, + 5.174023041996406, + 5.174668041996483, + 5.175431124996976, + 5.176224916998763, + 5.176957541996671, + 5.177610458995332, + 5.17824483399454, + 5.178886541994871, + 5.179490583999723, + 5.180138666997664, + 5.180757999994967, + 5.181384083996818, + 5.182025624999369, + 5.1826324590001605, + 5.183271958994737, + 5.183908458995575, + 5.184541999995417, + 5.185299958997348, + 5.185971749997407, + 5.186585458999616, + 5.187212333999923, + 5.1878881250013364, + 5.188510416999634, + 5.189144249998208, + 5.189813500001037, + 5.190483499995025, + 5.191088958999899, + 5.191694124994683, + 5.192468374996679, + 5.1930561249973834, + 5.193676416995004, + 5.194324791998952, + 5.195008666996728, + 5.195639083998685, + 5.196334959000524, + 5.197044791995722, + 5.197720333999314, + 5.198362416995224, + 5.198994624995976, + 5.1996307500012335, + 5.200240209000185, + 5.200913666994893, + 5.201518083995325, + 5.20214529200166, + 5.20275699999911, + 5.203390958995442, + 5.204030959001102, + 5.204699041998538, + 5.20531724999455, + 5.20593462499528, + 5.206564125001023, + 5.207191875000717, + 5.207868334000523, + 5.208666499995161, + 5.209359417000087, + 5.21001770899602, + 5.210565541994583, + 5.211134874996787, + 5.2116787499981, + 5.212254708996625, + 5.212844749999931, + 5.213403124995239, + 5.213984000001801, + 5.214586083995528, + 5.2152003750015865, + 5.2158671249999315, + 5.216427708997799, + 5.217023083998356, + 5.217581166994933, + 5.2181244589955895, + 5.21863754199876, + 5.219167124996602, + 5.219653624997591, + 5.220226749996073, + 5.220717917000002, + 5.221265583997592, + 5.221804875000089, + 5.222331874996598, + 5.222893624995777, + 5.223475041995698, + 5.224012624996249, + 5.224519625000539, + 5.225043291997281, + 5.2256009170014295, + 5.226171541995427, + 5.22668962500029, + 5.22721054199792, + 5.227717000001576, + 5.228286917001242, + 5.228858541995578, + 5.229393124995113, + 5.229967874998692, + 5.230508125001506, + 5.231059459001699, + 5.231647624998004, + 5.232191833994875, + 5.232697958999779, + 5.233242292000796, + 5.233840499997314, + 5.234428541996749, + 5.235025333997328, + 5.235613833996467, + 5.236187333997805, + 5.236705916999199, + 5.237258708999434, + 5.2378161669985275, + 5.238323459001549, + 5.238877791998675, + 5.239471959001094, + 5.240005499996187, + 5.240559499994561, + 5.24110274999839, + 5.241659708997759, + 5.242223499997635, + 5.242821041996649, + 5.243381125001179, + 5.243937749997713, + 5.244497209001565, + 5.245051499994588, + 5.2456227090006, + 5.246199542001705, + 5.246818958999938, + 5.247474249998049, + 5.248035749995324, + 5.24858620899613, + 5.249177874997258, + 5.249720291998528, + 5.250265499998932, + 5.250827374999062, + 5.251384874994983, + 5.2519239589964855, + 5.252434624999296, + 5.253076208995481, + 5.253673749997688, + 5.254433083995536, + 5.25505775000056, + 5.255594791997282, + 5.256180625001434, + 5.256693499999528, + 5.257261792001373, + 5.257825666994904, + 5.25837304200104, + 5.258970041999419, + 5.259524041997793, + 5.260045791997982, + 5.260592416998406, + 5.26112958399608, + 5.2617019999961485, + 5.262337125001068, + 5.262884416995803, + 5.263433208994684, + 5.264035833999515, + 5.264637291998952, + 5.265182541996182, + 5.2657803339971, + 5.266323042000295, + 5.266864208999323, + 5.267428958999517, + 5.267962874997465, + 5.268516291995184, + 5.269047124995268, + 5.2695807089985465, + 5.27011020899954, + 5.270682458998635, + 5.271229749996564, + 5.271769499995571, + 5.272349749997375, + 5.272974209001404, + 5.273550166995847, + 5.274154041995644, + 5.274732166995818, + 5.275323709000077, + 5.275899833999574, + 5.276461333996849, + 5.277061834000051, + 5.277588708995609, + 5.278156959000626, + 5.278715666994685, + 5.279378374994849, + 5.279957958999148, + 5.28053920900129, + 5.281081417000678, + 5.281642374997318, + 5.282218125001236, + 5.282756417000201, + 5.283303167001577, + 5.283827291998023, + 5.284360208999715, + 5.284948959000758, + 5.285496749995218, + 5.286049333997653, + 5.286601749998226, + 5.287184333996265, + 5.287735083998996, + 5.2882714590014075, + 5.288810958998511, + 5.289350125000055, + 5.28990899999917, + 5.290457458999299, + 5.290992999995069, + 5.291575999995985, + 5.292308374999266, + 5.2930397919990355, + 5.293832208997628, + 5.294437042000936, + 5.294995167001616, + 5.295560166996438, + 5.296115958997689, + 5.29666599999473, + 5.297197749998304, + 5.29775195899856, + 5.298312458995497, + 5.298910583995166, + 5.299442709001596, + 5.299979916999291, + 5.300461749997339, + 5.301005333996727, + 5.301563041997724, + 5.302104999995208, + 5.302684166999825, + 5.3032385839978815, + 5.303779791996931, + 5.3043370000013965, + 5.304877916998521, + 5.305450041996664, + 5.305998833995545, + 5.306579333999252, + 5.307101958998828, + 5.307636416997411, + 5.308174459001748, + 5.3087259589956375, + 5.309246999997413, + 5.309892459001276, + 5.3104291669951635, + 5.31099712500145, + 5.311608958996658, + 5.312168999997084, + 5.312926583996159, + 5.313580834001186, + 5.314298208999389, + 5.314941459000693, + 5.315582208997512, + 5.316253249999136, + 5.3168688750010915, + 5.3175001249983325, + 5.31815391699638, + 5.31877858399821, + 5.319405541995366, + 5.320023749998654, + 5.320654416995239, + 5.321307041995169, + 5.321952916994633, + 5.32259183399583, + 5.323224791995017, + 5.323833416994603, + 5.324479874994722, + 5.325107124997885, + 5.325738833998912, + 5.326426874999015, + 5.327041500000632, + 5.327669291997154, + 5.328320916996745, + 5.329013458998816, + 5.32961449999857, + 5.330300791996706, + 5.331016833995818, + 5.331711041995732, + 5.332747874999768, + 5.33352054200077, + 5.3341744169956655, + 5.334788667001703, + 5.335459499998251, + 5.336118125000212, + 5.336761209000542, + 5.337396750001062, + 5.338007499995001, + 5.33863541699975, + 5.339212833998317, + 5.339859374995285, + 5.340508249995764, + 5.341161459000432, + 5.341816959000425, + 5.3425686249975115, + 5.343205208999279, + 5.343846416995802, + 5.3444775419993675, + 5.345086166998954, + 5.345746833998419, + 5.346323249999841, + 5.347014999999374, + 5.347701250000682, + 5.34842158399988, + 5.349088958995708, + 5.3497474169998895, + 5.350358374998905, + 5.350990250000905, + 5.3516359999994165, + 5.352217374995234, + 5.352808999996341, + 5.353382374996727, + 5.353948500000115, + 5.354458041998441, + 5.355002374999458, + 5.355571874999441, + 5.356099291995633, + 5.356601791994763, + 5.357166999994661, + 5.357714917001431, + 5.358288666997396, + 5.358808500001032, + 5.3593394169947715, + 5.359863749996293, + 5.360446291997505, + 5.360977584001375, + 5.36150666699541, + 5.362037833998329, + 5.3626157089966, + 5.363103042000148, + 5.363627958999132, + 5.364151208996191, + 5.364789250001195, + 5.365388749996782, + 5.365955417000805, + 5.366553250001743, + 5.367102833995887, + 5.367632041998149, + 5.3681677089989535, + 5.368703416999779, + 5.369238708997727, + 5.369894999996177, + 5.370542791999469, + 5.371179666995886, + 5.371777333995851, + 5.37247433399898, + 5.373037749996001, + 5.37358245899668, + 5.374180334001721, + 5.374702166998759, + 5.375292459000775, + 5.375874624995049, + 5.376418041996658, + 5.3769154170004185, + 5.3774792089971015, + 5.378001583994774, + 5.3785909169964725, + 5.3791377499946975, + 5.3797247920010705, + 5.3802722499967786, + 5.380965791999188, + 5.381528041994898, + 5.382069583996781, + 5.382619459000125, + 5.38318816699757, + 5.383746749997954, + 5.384316124996985, + 5.384888208995108, + 5.3854377919997205, + 5.385973958997056, + 5.3865384589953464, + 5.3871171249993495, + 5.387699874998361, + 5.388239874999272, + 5.388791624995065, + 5.389476791999186, + 5.390087583997229, + 5.390670583998144, + 5.39126079199923, + 5.3918179999964195, + 5.392364209001244, + 5.392943166996702, + 5.39348433399573, + 5.394012917000509, + 5.39454833399941, + 5.39508499999647, + 5.395630209000956, + 5.396205833996646, + 5.396768124999653, + 5.397336333997373, + 5.397900249998202, + 5.398406749998685, + 5.398924417000671, + 5.399481458996888, + 5.400041000000783, + 5.4005898339964915, + 5.401090708997799, + 5.401643999997759, + 5.402157999997144, + 5.402711458998965, + 5.403248916998564, + 5.403871583999717, + 5.404451041998982, + 5.405030541995075, + 5.405580999999074, + 5.40614362499764, + 5.4067129169998225, + 5.4072620419974555, + 5.407778333996248, + 5.408307291996607, + 5.408874000000651, + 5.409522499998275, + 5.41010812499735, + 5.4107422919987584, + 5.411302458996943, + 5.41186474999995, + 5.4123630419999245, + 5.412919499998679, + 5.413453458997537, + 5.414028209001117, + 5.414560958997754, + 5.415126416999556, + 5.415632042000652, + 5.416196375001164, + 5.416762041997572, + 5.41730424999696, + 5.41784312499658, + 5.4184150000000955, + 5.418972416999168, + 5.419540709001012, + 5.420122124996851, + 5.420693708998442, + 5.421235166999395, + 5.421748749999097, + 5.42234974999883, + 5.42292629199801, + 5.423485250001249, + 5.424036584001442, + 5.42464291700162, + 5.425203792001412, + 5.425796999996237, + 5.426354666997213, + 5.426932166999904, + 5.427602124997065, + 5.42812733399478, + 5.428732249994937, + 5.429302833996189, + 5.429851875000168, + 5.430440749994887, + 5.431020167001407, + 5.431593083994812, + 5.432127749998472, + 5.4326632090014755, + 5.43317720900086, + 5.433722499998112, + 5.434284541996021, + 5.434787375001179, + 5.435343917000864, + 5.435897416995431, + 5.43642225000076, + 5.436924208996061, + 5.4374370000005, + 5.437942374999693, + 5.4384641669967095, + 5.438991208997322, + 5.439527875001659, + 5.440098166996904, + 5.440635416998703, + 5.441151416998764, + 5.441678874994977, + 5.44223479199718, + 5.442768291999528, + 5.443312874995172, + 5.44383329199627, + 5.444341374997748, + 5.444899666996207, + 5.445439709001221, + 5.445986541999446, + 5.446549916996446, + 5.447024374996545, + 5.44757474999642, + 5.4483073340015835, + 5.448977959000331, + 5.449557041996741, + 5.450143624999328, + 5.4507197919956525, + 5.451276542000414, + 5.4518108339980245, + 5.452338584000245, + 5.453032416997303, + 5.453619833999255, + 5.454182333996869, + 5.454758874999243, + 5.455302583999583, + 5.455877208994934, + 5.456434499996249, + 5.456995249995089, + 5.457521666998218, + 5.458063833997585, + 5.45864570899721, + 5.459214750000683, + 5.45982974999788, + 5.460356083996885, + 5.46091216700006, + 5.461436917001265, + 5.461983959001373, + 5.462540333996003, + 5.463044124997396, + 5.463612833998923, + 5.464163083997846, + 5.464706583996303, + 5.465270249995228, + 5.465793874995143, + 5.466342209001596, + 5.466914999997243, + 5.467548041997361, + 5.468117042000813, + 5.468685084000754, + 5.469254584000737, + 5.46980520899524, + 5.47042112499912, + 5.47094924999692, + 5.471500833999016, + 5.472046292001323, + 5.472548291996645, + 5.473111667000921, + 5.473692958999891, + 5.474221874996147, + 5.4747836669994285, + 5.475343541998882, + 5.475906458996178, + 5.476422374995309, + 5.476945999995223, + 5.477560583996819, + 5.478288583995891, + 5.478966041999229, + 5.479597500001546, + 5.480212750000646, + 5.480854208995879, + 5.481520291999914, + 5.482205249994877, + 5.4828225419987575, + 5.483410499997262, + 5.4840463750006165, + 5.4846785420013475, + 5.485307541996008, + 5.4858937919998425, + 5.48659087499982, + 5.487196875001246, + 5.4879102499980945, + 5.488560833997326, + 5.48923233399546, + 5.489870708996023, + 5.490515459001472, + 5.491143333994842, + 5.491805500001647, + 5.492544834, + 5.493212666995532, + 5.493867083998339, + 5.494559667000431, + 5.495172374998219, + 5.4957914170008735, + 5.49648295899533, + 5.497134708995873, + 5.497760958998697, + 5.498394374997588, + 5.499031166997156, + 5.499657000000298, + 5.50024741699599, + 5.500883166998392, + 5.501542792000691, + 5.502215417000116, + 5.502852874997188, + 5.503466374997515, + 5.504078749996552, + 5.504681166996306, + 5.505307958999765, + 5.505974125000648, + 5.50661024999863, + 5.507258624995302, + 5.507875791998231, + 5.508568749995902, + 5.509270374997868, + 5.510062541994557, + 5.510785667000164, + 5.5113812089985, + 5.5120421669998905, + 5.512684208995779, + 5.513374458998442, + 5.514016666995303, + 5.514622834001784, + 5.515239833999658, + 5.515849208997679, + 5.516440708997834, + 5.5170815419987775, + 5.517726999998558, + 5.518377458996838, + 5.5190219590003835, + 5.519690666995302, + 5.52034054199612, + 5.521001542001613, + 5.5216217919951305, + 5.522217334000743, + 5.522819249999884, + 5.523432292000507, + 5.52403124999546, + 5.524654458997247, + 5.525336708997202, + 5.525971916998969, + 5.526566458996967, + 5.527201833996514, + 5.527998334000586, + 5.528734542000166, + 5.529425458997139, + 5.530073709000135, + 5.530729499994777, + 5.531380374995933, + 5.532040416997916, + 5.532661666999047, + 5.53331079200143, + 5.5339505419979105, + 5.534558916995593, + 5.535170666997146, + 5.535761041996011, + 5.5363652919986635, + 5.537022124997748, + 5.537666708994948, + 5.538301916996716, + 5.538938166995649, + 5.539585708997038, + 5.54020070900151, + 5.540875375001633, + 5.54151075000118, + 5.542149791996053, + 5.542770041996846, + 5.543506999994861, + 5.544143916995381, + 5.544765291997464, + 5.545386749996396, + 5.546017041997402, + 5.546641166998597, + 5.5472850000005565, + 5.548089333999087, + 5.548778374999529, + 5.549475125000754, + 5.550136124998971, + 5.550737375000608, + 5.551372292000451, + 5.552002124997671, + 5.55260529199586, + 5.553217666994897, + 5.553875999998127, + 5.554521541998838, + 5.555144666999695, + 5.555805291995057, + 5.55643124999915, + 5.5570737089947215, + 5.5576991669950075, + 5.55832883399853, + 5.559031500000856, + 5.559679124999093, + 5.56032525000046, + 5.560985416996118, + 5.561774292000337, + 5.562395624998317, + 5.563028083997779, + 5.5636567499968805, + 5.564307666994864, + 5.564939374999085, + 5.565600624999206, + 5.566219374995853, + 5.566899375000503, + 5.567575583998405, + 5.5682604589965194, + 5.568949166998209, + 5.569615583997802, + 5.570242791996861, + 5.570934874995146, + 5.571573499997612, + 5.572146583996073, + 5.57280804200127, + 5.573451374999422, + 5.57408349999605, + 5.574718625000969, + 5.575389249999716, + 5.576020791995688, + 5.576654625001538, + 5.57727916699514, + 5.577889333995699, + 5.578555208994658, + 5.579272541996033, + 5.5799352920003, + 5.580604874994606, + 5.581209874995693, + 5.581841166997037, + 5.582476249997853, + 5.583133458996599, + 5.5838112919955165, + 5.5844794169970555, + 5.585241959000996, + 5.585892416995193, + 5.5865683750016615, + 5.587254958998528, + 5.587955374998273, + 5.588621416995011, + 5.58926524999697, + 5.589899916994909, + 5.590507916997012, + 5.591199916998448, + 5.5919052499957616, + 5.592624459000945, + 5.593267917000048, + 5.593933416996151, + 5.594609874999151, + 5.595258374996774, + 5.595882875000825, + 5.596509916998912, + 5.597148458997253, + 5.59781291699619, + 5.598460666995379, + 5.599093917000573, + 5.599734958996123, + 5.6003601670017815, + 5.600956292000774, + 5.601596458996937, + 5.602213041995128, + 5.602882374994806, + 5.603546416998142, + 5.604150792001747, + 5.60487433399976, + 5.605473249997885, + 5.606129667001369, + 5.6068131669962895, + 5.607478624995565, + 5.608230249999906, + 5.608911416995397, + 5.60956074999558, + 5.610194333996333, + 5.610877458995674, + 5.611517042001651, + 5.612153292000585, + 5.612810749997152, + 5.6135102920015925, + 5.614123708997795, + 5.6147648749974906, + 5.6154103340013535, + 5.616016708998359, + 5.616632999997819, + 5.617233166994993, + 5.617916083996533, + 5.618601791997207, + 5.619253374999971, + 5.619907749998674, + 5.620563291995495, + 5.621219499997096, + 5.62184508399514, + 5.622484333995089, + 5.6231578340011765, + 5.623789917000977, + 5.6244108749961015, + 5.625085583997134, + 5.6258670419992995, + 5.626545833998534, + 5.627259499997308, + 5.627845458999218, + 5.628434792000917, + 5.629017624996777, + 5.62959045900061, + 5.6301526249953895, + 5.63078216699796, + 5.631319333995634, + 5.631881333996716, + 5.632595541996125, + 5.633143084000039, + 5.633705333995749, + 5.63427312499698, + 5.634815459001402, + 5.635335667000618, + 5.635849166996195, + 5.636392166998121, + 5.6369422919960925, + 5.637501917000918, + 5.638043499995547, + 5.638589374997537, + 5.639146083995001, + 5.639677667000797, + 5.6402351669967175, + 5.640788584001712, + 5.64131287499913, + 5.641822500001581, + 5.64238695899985, + 5.642923499995959, + 5.643470208997314, + 5.644048249996558, + 5.644632208997791, + 5.645254625000234, + 5.64581770899531, + 5.6464214169973275, + 5.646964291998302, + 5.647532791997946, + 5.648057083999447, + 5.648592624995217, + 5.649147124997398, + 5.649681625000085, + 5.650220874995284, + 5.650767708997591, + 5.651329583997722, + 5.651859208999667, + 5.652442291997431, + 5.652958541999396, + 5.653505124995718, + 5.654059624997899, + 5.654649416996108, + 5.65528424999502, + 5.655945958998927, + 5.656600834001438, + 5.657221124994976, + 5.6579495839978335, + 5.658584291995794, + 5.659227833995828, + 5.659871749994636, + 5.6605179170001065, + 5.661189166996337, + 5.661820124994847, + 5.66242791699915, + 5.663062542000262, + 5.663699416996678, + 5.664400166999258, + 5.665070292001474, + 5.66589445900172, + 5.666545084000973, + 5.667190667001705, + 5.667846208998526, + 5.668446249997942, + 5.669078041995817, + 5.669733874994563, + 5.670390958999633, + 5.67100595899683, + 5.671605333998741, + 5.672226666996721, + 5.672865249995084, + 5.673478958997293, + 5.6740992499981076, + 5.674725416996807, + 5.675379542000883, + 5.6760369170006015, + 5.676815041995724, + 5.677413749996049, + 5.678024208995339, + 5.678711666994786, + 5.679367999997339, + 5.679975999999442, + 5.681135209000786, + 5.68199787499907, + 5.682667083994602, + 5.68343145900144, + 5.68408449999697, + 5.684704084000259, + 5.685376959001587, + 5.686047916999087, + 5.686680041995714, + 5.687349374995392, + 5.688012667000294, + 5.688712124996528, + 5.6893162919950555, + 5.689949499996146, + 5.690587708995736, + 5.691232124998351, + 5.691879833997518, + 5.692511166998884, + 5.693148209000356, + 5.6937707499964745, + 5.694421542000782, + 5.695064749997982, + 5.695710542000597, + 5.696317834001093, + 5.6969345420002355, + 5.697589499999594, + 5.69826858399756, + 5.698985958995763, + 5.699623874999816, + 5.700358249996498, + 5.700969917001203, + 5.701590874996327, + 5.702229624999745, + 5.702836042000854, + 5.703502833996026, + 5.704210749994672, + 5.704927541999496, + 5.705567334000079, + 5.706194083999435, + 5.706807750000735, + 5.707445041996834, + 5.708135834000132, + 5.708773708996887, + 5.709540916999686, + 5.710260291998566, + 5.710932041998603, + 5.711553333996562, + 5.712227374999202, + 5.712879458995303, + 5.713502334001532, + 5.714126624996425, + 5.714777249995677, + 5.715387291995285, + 5.715998542000307, + 5.71659345900116, + 5.717220916994847, + 5.717857916999492, + 5.718515542001114, + 5.719165834001615, + 5.719824125000741, + 5.72048562499549, + 5.721140916997683, + 5.721768416995474, + 5.722449959001096, + 5.723129833997518, + 5.72379333400022, + 5.724459375000151, + 5.72513666699524, + 5.725798624996969, + 5.726457917000516, + 5.727085749997059, + 5.727685459001805, + 5.72829708399513, + 5.728945666996879, + 5.72958262499742, + 5.730187417000707, + 5.730821583994839, + 5.7314692919972, + 5.732081958994968, + 5.732677667001553, + 5.733282708999468, + 5.733919667000009, + 5.734525041996676, + 5.735111249996407, + 5.735751791995426, + 5.736398666995228, + 5.737018959000125, + 5.737671916998806, + 5.738282708996849, + 5.73891929200181, + 5.739553874998819, + 5.740354249996017, + 5.741034624996246, + 5.741675958997803, + 5.742361833996256, + 5.743075958998816, + 5.743775833994732, + 5.744453166997118, + 5.7451297090010485, + 5.745759958997951, + 5.74651866700151, + 5.747228000000177, + 5.747889708996809, + 5.748520458997518, + 5.749161125000683, + 5.749802166996233, + 5.750450166997325, + 5.751055458997143, + 5.751661166999838, + 5.752264999995532, + 5.75288449999789, + 5.753477792000922, + 5.754084000000148, + 5.754745166996145, + 5.755528208996111, + 5.756199249997735, + 5.756810667000536, + 5.757437041997036, + 5.758042875000683, + 5.758703166997293, + 5.759369958999741, + 5.760017291999247, + 5.760602791997371, + 5.761271167000814, + 5.761909791996004, + 5.762562291994982, + 5.763274500000989, + 5.763996166999277, + 5.7646624999979394, + 5.765350249996118, + 5.76600420899922, + 5.766648416996759, + 5.767273208999541, + 5.7679325839999365, + 5.768582584001706, + 5.769268124997325, + 5.769886249996489, + 5.770510499998636, + 5.7711389169999165, + 5.77182612499746, + 5.772480542000267, + 5.773147250001784, + 5.773771708998538, + 5.77446954199695, + 5.775163209000311, + 5.775796000001719, + 5.776444666997122, + 5.777064791996963, + 5.777706708999176, + 5.778307458997006, + 5.7789347500001895, + 5.779534749999584, + 5.780171250000421, + 5.780840958999761, + 5.781557541995426, + 5.7822583749948535, + 5.782946833998722, + 5.783616749999055, + 5.784262499997567, + 5.7849170839981525, + 5.7855541669996455, + 5.786245167000743, + 5.786897666999721, + 5.787543624996033, + 5.788159458999871, + 5.7888028339948505, + 5.789445624999644, + 5.790102541999659, + 5.790772416999971, + 5.791471291995549, + 5.792145667001023, + 5.792776750000485, + 5.793433624996396, + 5.794100291997893, + 5.794753249996575, + 5.7954331669971, + 5.796110208997561, + 5.796743749997404, + 5.79736899999989, + 5.79801462499745, + 5.79866620899702, + 5.799324791994877, + 5.799966124999628, + 5.800571708998177, + 5.801186584001698, + 5.801829208998242, + 5.802446333997068, + 5.803074041999935, + 5.803632249997463, + 5.804205458996876, + 5.804764749998867, + 5.8053289169984055, + 5.805874334000691, + 5.806443249995937, + 5.8070036669960245, + 5.80753833399649, + 5.808079041999008, + 5.808671041995694, + 5.80918337500043, + 5.809736958995927, + 5.810259917001531, + 5.810807541995018, + 5.8113250419992255, + 5.811907791998237, + 5.812512666998373, + 5.813131374998193, + 5.813784708996536, + 5.814452708997123, + 5.8150558339984855, + 5.8156614170002285, + 5.81633512499684, + 5.816975292000279, + 5.817596208995383, + 5.8182072499985225, + 5.818818959000055, + 5.819426750000275, + 5.8202002920006635, + 5.820871874995646, + 5.82159262499772, + 5.822269042000698, + 5.822879041996202, + 5.823495999997249, + 5.824127833999228, + 5.824803750001593, + 5.825430749995576, + 5.826101916994958, + 5.826727209001547, + 5.82736758399551, + 5.828043916997558, + 5.828684374995646, + 5.829374666995136, + 5.830058166997333, + 5.830646374997741, + 5.831297917000484, + 5.831969083999866, + 5.832578583998838, + 5.8332104590008385, + 5.833894458999566, + 5.834508791995177, + 5.8351109169962, + 5.835681249998743, + 5.836314499996661, + 5.83692579199851, + 5.837544791997061, + 5.838138084000093, + 5.838796249998268, + 5.839446792000672, + 5.840086249998421, + 5.840719749998243, + 5.841371791997517, + 5.842061541996372, + 5.842785624998214, + 5.843465124999057, + 5.844131792000553, + 5.844794917000399, + 5.845459124997433, + 5.846133166996879, + 5.846826959001191, + 5.847433333998197, + 5.84805116699863, + 5.84859508399677, + 5.84909854199941, + 5.849649708994548, + 5.8502101249978296, + 5.850697417001356, + 5.851228542000172, + 5.8517655420000665, + 5.852259624996805, + 5.852776458996232, + 5.853341541995178, + 5.8539288749962, + 5.854481666996435, + 5.854976916998567, + 5.855550959000539, + 5.856100666998827, + 5.856666374995257, + 5.857228333996318, + 5.85780016699573, + 5.858351999995648, + 5.8589033339958405, + 5.859472083997389, + 5.860015124999336, + 5.860551583995402, + 5.861087874996883, + 5.861797874997137, + 5.862770084000658, + 5.863493833996472, + 5.864086249996035, + 5.864665041997796, + 5.865207333998114, + 5.865760874999978, + 5.866301583999302, + 5.8668279589983285, + 5.867317958996864, + 5.867874458999722, + 5.86843283399503, + 5.868994208998629, + 5.869499916996574, + 5.870066958996176, + 5.870627374999458, + 5.8711791669993545, + 5.871702208998613, + 5.87233645899687, + 5.872922666996601, + 5.873443666998355, + 5.873970499997085, + 5.874500541998714, + 5.8750488750010845, + 5.875599416998739, + 5.876184041997476, + 5.876708042000246, + 5.877219709000201, + 5.877727041995968, + 5.87827108399506, + 5.878861541998049, + 5.8794156669973745, + 5.879999874996429, + 5.880557708995184, + 5.881202124997799, + 5.881823291994806, + 5.882459874999768, + 5.883052917000896, + 5.883593209000537, + 5.884099541995965, + 5.884629624997615, + 5.885154750001675, + 5.885732583999925, + 5.886266583998804, + 5.886817916994914, + 5.887373249999655, + 5.8880449589996715, + 5.888585000000603, + 5.88911625000037, + 5.8896314589947, + 5.890155542001594, + 5.89074033399811, + 5.891297292000672, + 5.891834624999319, + 5.892307583999354, + 5.8928201669987175, + 5.893349209000007, + 5.893919916998129, + 5.894483958996716, + 5.895033583998156, + 5.895561708995956, + 5.896085041997139, + 5.896646791996318, + 5.897222416999284, + 5.897817833996669, + 5.898381209000945, + 5.8989145000014105, + 5.89942579199851, + 5.899928667000495, + 5.900526166995405, + 5.901100083996425, + 5.901707583994721, + 5.902288459001284, + 5.902945916997851, + 5.9036173339991365, + 5.904197083997133, + 5.904731292001088, + 5.905232833996706, + 5.905854333999741, + 5.906449249996513, + 5.906962208995537, + 5.907496624997293, + 5.908064709001337, + 5.9086199999946984, + 5.909188708996226, + 5.909762833995046, + 5.91034029200091, + 5.910880167000869, + 5.911416041999473, + 5.911990791995777, + 5.912543291997281, + 5.913059041995439, + 5.913623708998784, + 5.914161708999018, + 5.914721583998471, + 5.91527241699805, + 5.915828416997101, + 5.9163517499982845, + 5.916918208997231, + 5.917458042000362, + 5.918012624999392, + 5.918606624996755, + 5.919254166998144, + 5.920039500000712, + 5.920612791996973, + 5.921219124997151, + 5.921826792000502, + 5.922383917000843, + 5.9229531249948195, + 5.923495625000214, + 5.924122958997032, + 5.924694291999913, + 5.925315542001044, + 5.92586612499872, + 5.926426083999104, + 5.927026666999154, + 5.927581584001018, + 5.92814266699861 + ], + "message_points_y": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 377, + 378, + 379, + 380, + 381, + 382, + 383, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 392, + 393, + 394, + 395, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 403, + 404, + 405, + 406, + 407, + 408, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 416, + 417, + 418, + 419, + 420, + 421, + 422, + 423, + 424, + 425, + 426, + 427, + 428, + 429, + 430, + 431, + 432, + 433, + 434, + 435, + 436, + 437, + 438, + 439, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 448, + 449, + 450, + 451, + 452, + 453, + 454, + 455, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + 496, + 497, + 498, + 499, + 500, + 501, + 502, + 503, + 504, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 560, + 561, + 562, + 563, + 564, + 565, + 566, + 567, + 568, + 569, + 570, + 571, + 572, + 573, + 574, + 575, + 576, + 577, + 578, + 579, + 580, + 581, + 582, + 583, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 592, + 593, + 594, + 595, + 596, + 597, + 598, + 599, + 600, + 601, + 602, + 603, + 604, + 605, + 606, + 607, + 608, + 609, + 610, + 611, + 612, + 613, + 614, + 615, + 616, + 617, + 618, + 619, + 620, + 621, + 622, + 623, + 624, + 625, + 626, + 627, + 628, + 629, + 630, + 631, + 632, + 633, + 634, + 635, + 636, + 637, + 638, + 639, + 640, + 641, + 642, + 643, + 644, + 645, + 646, + 647, + 648, + 649, + 650, + 651, + 652, + 653, + 654, + 655, + 656, + 657, + 658, + 659, + 660, + 661, + 662, + 663, + 664, + 665, + 666, + 667, + 668, + 669, + 670, + 671, + 672, + 673, + 674, + 675, + 676, + 677, + 678, + 679, + 680, + 681, + 682, + 683, + 684, + 685, + 686, + 687, + 688, + 689, + 690, + 691, + 692, + 693, + 694, + 695, + 696, + 697, + 698, + 699, + 700, + 701, + 702, + 703, + 704, + 705, + 706, + 707, + 708, + 709, + 710, + 711, + 712, + 713, + 714, + 715, + 716, + 717, + 718, + 719, + 720, + 721, + 722, + 723, + 724, + 725, + 726, + 727, + 728, + 729, + 730, + 731, + 732, + 733, + 734, + 735, + 736, + 737, + 738, + 739, + 740, + 741, + 742, + 743, + 744, + 745, + 746, + 747, + 748, + 749, + 750, + 751, + 752, + 753, + 754, + 755, + 756, + 757, + 758, + 759, + 760, + 761, + 762, + 763, + 764, + 765, + 766, + 767, + 768, + 769, + 770, + 771, + 772, + 773, + 774, + 775, + 776, + 777, + 778, + 779, + 780, + 781, + 782, + 783, + 784, + 785, + 786, + 787, + 788, + 789, + 790, + 791, + 792, + 793, + 794, + 795, + 796, + 797, + 798, + 799, + 800, + 801, + 802, + 803, + 804, + 805, + 806, + 807, + 808, + 809, + 810, + 811, + 812, + 813, + 814, + 815, + 816, + 817, + 818, + 819, + 820, + 821, + 822, + 823, + 824, + 825, + 826, + 827, + 828, + 829, + 830, + 831, + 832, + 833, + 834, + 835, + 836, + 837, + 838, + 839, + 840, + 841, + 842, + 843, + 844, + 845, + 846, + 847, + 848, + 849, + 850, + 851, + 852, + 853, + 854, + 855, + 856, + 857, + 858, + 859, + 860, + 861, + 862, + 863, + 864, + 865, + 866, + 867, + 868, + 869, + 870, + 871, + 872, + 873, + 874, + 875, + 876, + 877, + 878, + 879, + 880, + 881, + 882, + 883, + 884, + 885, + 886, + 887, + 888, + 889, + 890, + 891, + 892, + 893, + 894, + 895, + 896, + 897, + 898, + 899, + 900, + 901, + 902, + 903, + 904, + 905, + 906, + 907, + 908, + 909, + 910, + 911, + 912, + 913, + 914, + 915, + 916, + 917, + 918, + 919, + 920, + 921, + 922, + 923, + 924, + 925, + 926, + 927, + 928, + 929, + 930, + 931, + 932, + 933, + 934, + 935, + 936, + 937, + 938, + 939, + 940, + 941, + 942, + 943, + 944, + 945, + 946, + 947, + 948, + 949, + 950, + 951, + 952, + 953, + 954, + 955, + 956, + 957, + 958, + 959, + 960, + 961, + 962, + 963, + 964, + 965, + 966, + 967, + 968, + 969, + 970, + 971, + 972, + 973, + 974, + 975, + 976, + 977, + 978, + 979, + 980, + 981, + 982, + 983, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + 1008, + 1009, + 1010, + 1011, + 1012, + 1013, + 1014, + 1015, + 1016, + 1017, + 1018, + 1019, + 1020, + 1021, + 1022, + 1023, + 1024, + 1025, + 1026, + 1027, + 1028, + 1029, + 1030, + 1031, + 1032, + 1033, + 1034, + 1035, + 1036, + 1037, + 1038, + 1039, + 1040, + 1041, + 1042, + 1043, + 1044, + 1045, + 1046, + 1047, + 1048, + 1049, + 1050, + 1051, + 1052, + 1053, + 1054, + 1055, + 1056, + 1057, + 1058, + 1059, + 1060, + 1061, + 1062, + 1063, + 1064, + 1065, + 1066, + 1067, + 1068, + 1069, + 1070, + 1071, + 1072, + 1073, + 1074, + 1075, + 1076, + 1077, + 1078, + 1079, + 1080, + 1081, + 1082, + 1083, + 1084, + 1085, + 1086, + 1087, + 1088, + 1089, + 1090, + 1091, + 1092, + 1093, + 1094, + 1095, + 1096, + 1097, + 1098, + 1099, + 1100, + 1101, + 1102, + 1103, + 1104, + 1105, + 1106, + 1107, + 1108, + 1109, + 1110, + 1111, + 1112, + 1113, + 1114, + 1115, + 1116, + 1117, + 1118, + 1119, + 1120, + 1121, + 1122, + 1123, + 1124, + 1125, + 1126, + 1127, + 1128, + 1129, + 1130, + 1131, + 1132, + 1133, + 1134, + 1135, + 1136, + 1137, + 1138, + 1139, + 1140, + 1141, + 1142, + 1143, + 1144, + 1145, + 1146, + 1147, + 1148, + 1149, + 1150, + 1151, + 1152, + 1153, + 1154, + 1155, + 1156, + 1157, + 1158, + 1159, + 1160, + 1161, + 1162, + 1163, + 1164, + 1165, + 1166, + 1167, + 1168, + 1169, + 1170, + 1171, + 1172, + 1173, + 1174, + 1175, + 1176, + 1177, + 1178, + 1179, + 1180, + 1181, + 1182, + 1183, + 1184, + 1185, + 1186, + 1187, + 1188, + 1189, + 1190, + 1191, + 1192, + 1193, + 1194, + 1195, + 1196, + 1197, + 1198, + 1199, + 1200, + 1201, + 1202, + 1203, + 1204, + 1205, + 1206, + 1207, + 1208, + 1209, + 1210, + 1211, + 1212, + 1213, + 1214, + 1215, + 1216, + 1217, + 1218, + 1219, + 1220, + 1221, + 1222, + 1223, + 1224, + 1225, + 1226, + 1227, + 1228, + 1229, + 1230, + 1231, + 1232, + 1233, + 1234, + 1235, + 1236, + 1237, + 1238, + 1239, + 1240, + 1241, + 1242, + 1243, + 1244, + 1245, + 1246, + 1247, + 1248, + 1249, + 1250, + 1251, + 1252, + 1253, + 1254, + 1255, + 1256, + 1257, + 1258, + 1259, + 1260, + 1261, + 1262, + 1263, + 1264, + 1265, + 1266, + 1267, + 1268, + 1269, + 1270, + 1271, + 1272, + 1273, + 1274, + 1275, + 1276, + 1277, + 1278, + 1279, + 1280, + 1281, + 1282, + 1283, + 1284, + 1285, + 1286, + 1287, + 1288, + 1289, + 1290, + 1291, + 1292, + 1293, + 1294, + 1295, + 1296, + 1297, + 1298, + 1299, + 1300, + 1301, + 1302, + 1303, + 1304, + 1305, + 1306, + 1307, + 1308, + 1309, + 1310, + 1311, + 1312, + 1313, + 1314, + 1315, + 1316, + 1317, + 1318, + 1319, + 1320, + 1321, + 1322, + 1323, + 1324, + 1325, + 1326, + 1327, + 1328, + 1329, + 1330, + 1331, + 1332, + 1333, + 1334, + 1335, + 1336, + 1337, + 1338, + 1339, + 1340, + 1341, + 1342, + 1343, + 1344, + 1345, + 1346, + 1347, + 1348, + 1349, + 1350, + 1351, + 1352, + 1353, + 1354, + 1355, + 1356, + 1357, + 1358, + 1359, + 1360, + 1361, + 1362, + 1363, + 1364, + 1365, + 1366, + 1367, + 1368, + 1369, + 1370, + 1371, + 1372, + 1373, + 1374, + 1375, + 1376, + 1377, + 1378, + 1379, + 1380, + 1381, + 1382, + 1383, + 1384, + 1385, + 1386, + 1387, + 1388, + 1389, + 1390, + 1391, + 1392, + 1393, + 1394, + 1395, + 1396, + 1397, + 1398, + 1399, + 1400, + 1401, + 1402, + 1403, + 1404, + 1405, + 1406, + 1407, + 1408, + 1409, + 1410, + 1411, + 1412, + 1413, + 1414, + 1415, + 1416, + 1417, + 1418, + 1419, + 1420, + 1421, + 1422, + 1423, + 1424, + 1425, + 1426, + 1427, + 1428, + 1429, + 1430, + 1431, + 1432, + 1433, + 1434, + 1435, + 1436, + 1437, + 1438, + 1439, + 1440, + 1441, + 1442, + 1443, + 1444, + 1445, + 1446, + 1447, + 1448, + 1449, + 1450, + 1451, + 1452, + 1453, + 1454, + 1455, + 1456, + 1457, + 1458, + 1459, + 1460, + 1461, + 1462, + 1463, + 1464, + 1465, + 1466, + 1467, + 1468, + 1469, + 1470, + 1471, + 1472, + 1473, + 1474, + 1475, + 1476, + 1477, + 1478, + 1479, + 1480, + 1481, + 1482, + 1483, + 1484, + 1485, + 1486, + 1487, + 1488, + 1489, + 1490, + 1491, + 1492, + 1493, + 1494, + 1495, + 1496, + 1497, + 1498, + 1499, + 1500, + 1501, + 1502, + 1503, + 1504, + 1505, + 1506, + 1507, + 1508, + 1509, + 1510, + 1511, + 1512, + 1513, + 1514, + 1515, + 1516, + 1517, + 1518, + 1519, + 1520, + 1521, + 1522, + 1523, + 1524, + 1525, + 1526, + 1527, + 1528, + 1529, + 1530, + 1531, + 1532, + 1533, + 1534, + 1535, + 1536, + 1537, + 1538, + 1539, + 1540, + 1541, + 1542, + 1543, + 1544, + 1545, + 1546, + 1547, + 1548, + 1549, + 1550, + 1551, + 1552, + 1553, + 1554, + 1555, + 1556, + 1557, + 1558, + 1559, + 1560, + 1561, + 1562, + 1563, + 1564, + 1565, + 1566, + 1567, + 1568, + 1569, + 1570, + 1571, + 1572, + 1573, + 1574, + 1575, + 1576, + 1577, + 1578, + 1579, + 1580, + 1581, + 1582, + 1583, + 1584, + 1585, + 1586, + 1587, + 1588, + 1589, + 1590, + 1591, + 1592, + 1593, + 1594, + 1595, + 1596, + 1597, + 1598, + 1599, + 1600, + 1601, + 1602, + 1603, + 1604, + 1605, + 1606, + 1607, + 1608, + 1609, + 1610, + 1611, + 1612, + 1613, + 1614, + 1615, + 1616, + 1617, + 1618, + 1619, + 1620, + 1621, + 1622, + 1623, + 1624, + 1625, + 1626, + 1627, + 1628, + 1629, + 1630, + 1631, + 1632, + 1633, + 1634, + 1635, + 1636, + 1637, + 1638, + 1639, + 1640, + 1641, + 1642, + 1643, + 1644, + 1645, + 1646, + 1647, + 1648, + 1649, + 1650, + 1651, + 1652, + 1653, + 1654, + 1655, + 1656, + 1657, + 1658, + 1659, + 1660, + 1661, + 1662, + 1663, + 1664, + 1665, + 1666, + 1667, + 1668, + 1669, + 1670, + 1671, + 1672, + 1673, + 1674, + 1675, + 1676, + 1677, + 1678, + 1679, + 1680, + 1681, + 1682, + 1683, + 1684, + 1685, + 1686, + 1687, + 1688, + 1689, + 1690, + 1691, + 1692, + 1693, + 1694, + 1695, + 1696, + 1697, + 1698, + 1699, + 1700, + 1701, + 1702, + 1703, + 1704, + 1705, + 1706, + 1707, + 1708, + 1709, + 1710, + 1711, + 1712, + 1713, + 1714, + 1715, + 1716, + 1717, + 1718, + 1719, + 1720, + 1721, + 1722, + 1723, + 1724, + 1725, + 1726, + 1727, + 1728, + 1729, + 1730, + 1731, + 1732, + 1733, + 1734, + 1735, + 1736, + 1737, + 1738, + 1739, + 1740, + 1741, + 1742, + 1743, + 1744, + 1745, + 1746, + 1747, + 1748, + 1749, + 1750, + 1751, + 1752, + 1753, + 1754, + 1755, + 1756, + 1757, + 1758, + 1759, + 1760, + 1761, + 1762, + 1763, + 1764, + 1765, + 1766, + 1767, + 1768, + 1769, + 1770, + 1771, + 1772, + 1773, + 1774, + 1775, + 1776, + 1777, + 1778, + 1779, + 1780, + 1781, + 1782, + 1783, + 1784, + 1785, + 1786, + 1787, + 1788, + 1789, + 1790, + 1791, + 1792, + 1793, + 1794, + 1795, + 1796, + 1797, + 1798, + 1799, + 1800, + 1801, + 1802, + 1803, + 1804, + 1805, + 1806, + 1807, + 1808, + 1809, + 1810, + 1811, + 1812, + 1813, + 1814, + 1815, + 1816, + 1817, + 1818, + 1819, + 1820, + 1821, + 1822, + 1823, + 1824, + 1825, + 1826, + 1827, + 1828, + 1829, + 1830, + 1831, + 1832, + 1833, + 1834, + 1835, + 1836, + 1837, + 1838, + 1839, + 1840, + 1841, + 1842, + 1843, + 1844, + 1845, + 1846, + 1847, + 1848, + 1849, + 1850, + 1851, + 1852, + 1853, + 1854, + 1855, + 1856, + 1857, + 1858, + 1859, + 1860, + 1861, + 1862, + 1863, + 1864, + 1865, + 1866, + 1867, + 1868, + 1869, + 1870, + 1871, + 1872, + 1873, + 1874, + 1875, + 1876, + 1877, + 1878, + 1879, + 1880, + 1881, + 1882, + 1883, + 1884, + 1885, + 1886, + 1887, + 1888, + 1889, + 1890, + 1891, + 1892, + 1893, + 1894, + 1895, + 1896, + 1897, + 1898, + 1899, + 1900, + 1901, + 1902, + 1903, + 1904, + 1905, + 1906, + 1907, + 1908, + 1909, + 1910, + 1911, + 1912, + 1913, + 1914, + 1915, + 1916, + 1917, + 1918, + 1919, + 1920, + 1921, + 1922, + 1923, + 1924, + 1925, + 1926, + 1927, + 1928, + 1929, + 1930, + 1931, + 1932, + 1933, + 1934, + 1935, + 1936, + 1937, + 1938, + 1939, + 1940, + 1941, + 1942, + 1943, + 1944, + 1945, + 1946, + 1947, + 1948, + 1949, + 1950, + 1951, + 1952, + 1953, + 1954, + 1955, + 1956, + 1957, + 1958, + 1959, + 1960, + 1961, + 1962, + 1963, + 1964, + 1965, + 1966, + 1967, + 1968, + 1969, + 1970, + 1971, + 1972, + 1973, + 1974, + 1975, + 1976, + 1977, + 1978, + 1979, + 1980, + 1981, + 1982, + 1983, + 1984, + 1985, + 1986, + 1987, + 1988, + 1989, + 1990, + 1991, + 1992, + 1993, + 1994, + 1995, + 1996, + 1997, + 1998, + 1999, + 2000, + 2001, + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030, + 2031, + 2032, + 2033, + 2034, + 2035, + 2036, + 2037, + 2038, + 2039, + 2040, + 2041, + 2042, + 2043, + 2044, + 2045, + 2046, + 2047, + 2048, + 2049, + 2050, + 2051, + 2052, + 2053, + 2054, + 2055, + 2056, + 2057, + 2058, + 2059, + 2060, + 2061, + 2062, + 2063, + 2064, + 2065, + 2066, + 2067, + 2068, + 2069, + 2070, + 2071, + 2072, + 2073, + 2074, + 2075, + 2076, + 2077, + 2078, + 2079, + 2080, + 2081, + 2082, + 2083, + 2084, + 2085, + 2086, + 2087, + 2088, + 2089, + 2090, + 2091, + 2092, + 2093, + 2094, + 2095, + 2096, + 2097, + 2098, + 2099, + 2100, + 2101, + 2102, + 2103, + 2104, + 2105, + 2106, + 2107, + 2108, + 2109, + 2110, + 2111, + 2112, + 2113, + 2114, + 2115, + 2116, + 2117, + 2118, + 2119, + 2120, + 2121, + 2122, + 2123, + 2124, + 2125, + 2126, + 2127, + 2128, + 2129, + 2130, + 2131, + 2132, + 2133, + 2134, + 2135, + 2136, + 2137, + 2138, + 2139, + 2140, + 2141, + 2142, + 2143, + 2144, + 2145, + 2146, + 2147, + 2148, + 2149, + 2150, + 2151, + 2152, + 2153, + 2154, + 2155, + 2156, + 2157, + 2158, + 2159, + 2160, + 2161, + 2162, + 2163, + 2164, + 2165, + 2166, + 2167, + 2168, + 2169, + 2170, + 2171, + 2172, + 2173, + 2174, + 2175, + 2176, + 2177, + 2178, + 2179, + 2180, + 2181, + 2182, + 2183, + 2184, + 2185, + 2186, + 2187, + 2188, + 2189, + 2190, + 2191, + 2192, + 2193, + 2194, + 2195, + 2196, + 2197, + 2198, + 2199, + 2200, + 2201, + 2202, + 2203, + 2204, + 2205, + 2206, + 2207, + 2208, + 2209, + 2210, + 2211, + 2212, + 2213, + 2214, + 2215, + 2216, + 2217, + 2218, + 2219, + 2220, + 2221, + 2222, + 2223, + 2224, + 2225, + 2226, + 2227, + 2228, + 2229, + 2230, + 2231, + 2232, + 2233, + 2234, + 2235, + 2236, + 2237, + 2238, + 2239, + 2240, + 2241, + 2242, + 2243, + 2244, + 2245, + 2246, + 2247, + 2248, + 2249, + 2250, + 2251, + 2252, + 2253, + 2254, + 2255, + 2256, + 2257, + 2258, + 2259, + 2260, + 2261, + 2262, + 2263, + 2264, + 2265, + 2266, + 2267, + 2268, + 2269, + 2270, + 2271, + 2272, + 2273, + 2274, + 2275, + 2276, + 2277, + 2278, + 2279, + 2280, + 2281, + 2282, + 2283, + 2284, + 2285, + 2286, + 2287, + 2288, + 2289, + 2290, + 2291, + 2292, + 2293, + 2294, + 2295, + 2296, + 2297, + 2298, + 2299, + 2300, + 2301, + 2302, + 2303, + 2304, + 2305, + 2306, + 2307, + 2308, + 2309, + 2310, + 2311, + 2312, + 2313, + 2314, + 2315, + 2316, + 2317, + 2318, + 2319, + 2320, + 2321, + 2322, + 2323, + 2324, + 2325, + 2326, + 2327, + 2328, + 2329, + 2330, + 2331, + 2332, + 2333, + 2334, + 2335, + 2336, + 2337, + 2338, + 2339, + 2340, + 2341, + 2342, + 2343, + 2344, + 2345, + 2346, + 2347, + 2348, + 2349, + 2350, + 2351, + 2352, + 2353, + 2354, + 2355, + 2356, + 2357, + 2358, + 2359, + 2360, + 2361, + 2362, + 2363, + 2364, + 2365, + 2366, + 2367, + 2368, + 2369, + 2370, + 2371, + 2372, + 2373, + 2374, + 2375, + 2376, + 2377, + 2378, + 2379, + 2380, + 2381, + 2382, + 2383, + 2384, + 2385, + 2386, + 2387, + 2388, + 2389, + 2390, + 2391, + 2392, + 2393, + 2394, + 2395, + 2396, + 2397, + 2398, + 2399, + 2400, + 2401, + 2402, + 2403, + 2404, + 2405, + 2406, + 2407, + 2408, + 2409, + 2410, + 2411, + 2412, + 2413, + 2414, + 2415, + 2416, + 2417, + 2418, + 2419, + 2420, + 2421, + 2422, + 2423, + 2424, + 2425, + 2426, + 2427, + 2428, + 2429, + 2430, + 2431, + 2432, + 2433, + 2434, + 2435, + 2436, + 2437, + 2438, + 2439, + 2440, + 2441, + 2442, + 2443, + 2444, + 2445, + 2446, + 2447, + 2448, + 2449, + 2450, + 2451, + 2452, + 2453, + 2454, + 2455, + 2456, + 2457, + 2458, + 2459, + 2460, + 2461, + 2462, + 2463, + 2464, + 2465, + 2466, + 2467, + 2468, + 2469, + 2470, + 2471, + 2472, + 2473, + 2474, + 2475, + 2476, + 2477, + 2478, + 2479, + 2480, + 2481, + 2482, + 2483, + 2484, + 2485, + 2486, + 2487, + 2488, + 2489, + 2490, + 2491, + 2492, + 2493, + 2494, + 2495, + 2496, + 2497, + 2498, + 2499, + 2500, + 2501, + 2502, + 2503, + 2504, + 2505, + 2506, + 2507, + 2508, + 2509, + 2510, + 2511, + 2512, + 2513, + 2514, + 2515, + 2516, + 2517, + 2518, + 2519, + 2520, + 2521, + 2522, + 2523, + 2524, + 2525, + 2526, + 2527, + 2528, + 2529, + 2530, + 2531, + 2532, + 2533, + 2534, + 2535, + 2536, + 2537, + 2538, + 2539, + 2540, + 2541, + 2542, + 2543, + 2544, + 2545, + 2546, + 2547, + 2548, + 2549, + 2550, + 2551, + 2552, + 2553, + 2554, + 2555, + 2556, + 2557, + 2558, + 2559, + 2560, + 2561, + 2562, + 2563, + 2564, + 2565, + 2566, + 2567, + 2568, + 2569, + 2570, + 2571, + 2572, + 2573, + 2574, + 2575, + 2576, + 2577, + 2578, + 2579, + 2580, + 2581, + 2582, + 2583, + 2584, + 2585, + 2586, + 2587, + 2588, + 2589, + 2590, + 2591, + 2592, + 2593, + 2594, + 2595, + 2596, + 2597, + 2598, + 2599, + 2600, + 2601, + 2602, + 2603, + 2604, + 2605, + 2606, + 2607, + 2608, + 2609, + 2610, + 2611, + 2612, + 2613, + 2614, + 2615, + 2616, + 2617, + 2618, + 2619, + 2620, + 2621, + 2622, + 2623, + 2624, + 2625, + 2626, + 2627, + 2628, + 2629, + 2630, + 2631, + 2632, + 2633, + 2634, + 2635, + 2636, + 2637, + 2638, + 2639, + 2640, + 2641, + 2642, + 2643, + 2644, + 2645, + 2646, + 2647, + 2648, + 2649, + 2650, + 2651, + 2652, + 2653, + 2654, + 2655, + 2656, + 2657, + 2658, + 2659, + 2660, + 2661, + 2662, + 2663, + 2664, + 2665, + 2666, + 2667, + 2668, + 2669, + 2670, + 2671, + 2672, + 2673, + 2674, + 2675, + 2676, + 2677, + 2678, + 2679, + 2680, + 2681, + 2682, + 2683, + 2684, + 2685, + 2686, + 2687, + 2688, + 2689, + 2690, + 2691, + 2692, + 2693, + 2694, + 2695, + 2696, + 2697, + 2698, + 2699, + 2700, + 2701, + 2702, + 2703, + 2704, + 2705, + 2706, + 2707, + 2708, + 2709, + 2710, + 2711, + 2712, + 2713, + 2714, + 2715, + 2716, + 2717, + 2718, + 2719, + 2720, + 2721, + 2722, + 2723, + 2724, + 2725, + 2726, + 2727, + 2728, + 2729, + 2730, + 2731, + 2732, + 2733, + 2734, + 2735, + 2736, + 2737, + 2738, + 2739, + 2740, + 2741, + 2742, + 2743, + 2744, + 2745, + 2746, + 2747, + 2748, + 2749, + 2750, + 2751, + 2752, + 2753, + 2754, + 2755, + 2756, + 2757, + 2758, + 2759, + 2760, + 2761, + 2762, + 2763, + 2764, + 2765, + 2766, + 2767, + 2768, + 2769, + 2770, + 2771, + 2772, + 2773, + 2774, + 2775, + 2776, + 2777, + 2778, + 2779, + 2780, + 2781, + 2782, + 2783, + 2784, + 2785, + 2786, + 2787, + 2788, + 2789, + 2790, + 2791, + 2792, + 2793, + 2794, + 2795, + 2796, + 2797, + 2798, + 2799, + 2800, + 2801, + 2802, + 2803, + 2804, + 2805, + 2806, + 2807, + 2808, + 2809, + 2810, + 2811, + 2812, + 2813, + 2814, + 2815, + 2816, + 2817, + 2818, + 2819, + 2820, + 2821, + 2822, + 2823, + 2824, + 2825, + 2826, + 2827, + 2828, + 2829, + 2830, + 2831, + 2832, + 2833, + 2834, + 2835, + 2836, + 2837, + 2838, + 2839, + 2840, + 2841, + 2842, + 2843, + 2844, + 2845, + 2846, + 2847, + 2848, + 2849, + 2850, + 2851, + 2852, + 2853, + 2854, + 2855, + 2856, + 2857, + 2858, + 2859, + 2860, + 2861, + 2862, + 2863, + 2864, + 2865, + 2866, + 2867, + 2868, + 2869, + 2870, + 2871, + 2872, + 2873, + 2874, + 2875, + 2876, + 2877, + 2878, + 2879, + 2880, + 2881, + 2882, + 2883, + 2884, + 2885, + 2886, + 2887, + 2888, + 2889, + 2890, + 2891, + 2892, + 2893, + 2894, + 2895, + 2896, + 2897, + 2898, + 2899, + 2900, + 2901, + 2902, + 2903, + 2904, + 2905, + 2906, + 2907, + 2908, + 2909, + 2910, + 2911, + 2912, + 2913, + 2914, + 2915, + 2916, + 2917, + 2918, + 2919, + 2920, + 2921, + 2922, + 2923, + 2924, + 2925, + 2926, + 2927, + 2928, + 2929, + 2930, + 2931, + 2932, + 2933, + 2934, + 2935, + 2936, + 2937, + 2938, + 2939, + 2940, + 2941, + 2942, + 2943, + 2944, + 2945, + 2946, + 2947, + 2948, + 2949, + 2950, + 2951, + 2952, + 2953, + 2954, + 2955, + 2956, + 2957, + 2958, + 2959, + 2960, + 2961, + 2962, + 2963, + 2964, + 2965, + 2966, + 2967, + 2968, + 2969, + 2970, + 2971, + 2972, + 2973, + 2974, + 2975, + 2976, + 2977, + 2978, + 2979, + 2980, + 2981, + 2982, + 2983, + 2984, + 2985, + 2986, + 2987, + 2988, + 2989, + 2990, + 2991, + 2992, + 2993, + 2994, + 2995, + 2996, + 2997, + 2998, + 2999, + 3000, + 3001, + 3002, + 3003, + 3004, + 3005, + 3006, + 3007, + 3008, + 3009, + 3010, + 3011, + 3012, + 3013, + 3014, + 3015, + 3016, + 3017, + 3018, + 3019, + 3020, + 3021, + 3022, + 3023, + 3024, + 3025, + 3026, + 3027, + 3028, + 3029, + 3030, + 3031, + 3032, + 3033, + 3034, + 3035, + 3036, + 3037, + 3038, + 3039, + 3040, + 3041, + 3042, + 3043, + 3044, + 3045, + 3046, + 3047, + 3048, + 3049, + 3050, + 3051, + 3052, + 3053, + 3054, + 3055, + 3056, + 3057, + 3058, + 3059, + 3060, + 3061, + 3062, + 3063, + 3064, + 3065, + 3066, + 3067, + 3068, + 3069, + 3070, + 3071, + 3072, + 3073, + 3074, + 3075, + 3076, + 3077, + 3078, + 3079, + 3080, + 3081, + 3082, + 3083, + 3084, + 3085, + 3086, + 3087, + 3088, + 3089, + 3090, + 3091, + 3092, + 3093, + 3094, + 3095, + 3096, + 3097, + 3098, + 3099, + 3100, + 3101, + 3102, + 3103, + 3104, + 3105, + 3106, + 3107, + 3108, + 3109, + 3110, + 3111, + 3112, + 3113, + 3114, + 3115, + 3116, + 3117, + 3118, + 3119, + 3120, + 3121, + 3122, + 3123, + 3124, + 3125, + 3126, + 3127, + 3128, + 3129, + 3130, + 3131, + 3132, + 3133, + 3134, + 3135, + 3136, + 3137, + 3138, + 3139, + 3140, + 3141, + 3142, + 3143, + 3144, + 3145, + 3146, + 3147, + 3148, + 3149, + 3150, + 3151, + 3152, + 3153, + 3154, + 3155, + 3156, + 3157, + 3158, + 3159, + 3160, + 3161, + 3162, + 3163, + 3164, + 3165, + 3166, + 3167, + 3168, + 3169, + 3170, + 3171, + 3172, + 3173, + 3174, + 3175, + 3176, + 3177, + 3178, + 3179, + 3180, + 3181, + 3182, + 3183, + 3184, + 3185, + 3186, + 3187, + 3188, + 3189, + 3190, + 3191, + 3192, + 3193, + 3194, + 3195, + 3196, + 3197, + 3198, + 3199, + 3200, + 3201, + 3202, + 3203, + 3204, + 3205, + 3206, + 3207, + 3208, + 3209, + 3210, + 3211, + 3212, + 3213, + 3214, + 3215, + 3216, + 3217, + 3218, + 3219, + 3220, + 3221, + 3222, + 3223, + 3224, + 3225, + 3226, + 3227, + 3228, + 3229, + 3230, + 3231, + 3232, + 3233, + 3234, + 3235, + 3236, + 3237, + 3238, + 3239, + 3240, + 3241, + 3242, + 3243, + 3244, + 3245, + 3246, + 3247, + 3248, + 3249, + 3250, + 3251, + 3252, + 3253, + 3254, + 3255, + 3256, + 3257, + 3258, + 3259, + 3260, + 3261, + 3262, + 3263, + 3264, + 3265, + 3266, + 3267, + 3268, + 3269, + 3270, + 3271, + 3272, + 3273, + 3274, + 3275, + 3276, + 3277, + 3278, + 3279, + 3280, + 3281, + 3282, + 3283, + 3284, + 3285, + 3286, + 3287, + 3288, + 3289, + 3290, + 3291, + 3292, + 3293, + 3294, + 3295, + 3296, + 3297, + 3298, + 3299, + 3300, + 3301, + 3302, + 3303, + 3304, + 3305, + 3306, + 3307, + 3308, + 3309, + 3310, + 3311, + 3312, + 3313, + 3314, + 3315, + 3316, + 3317, + 3318, + 3319, + 3320, + 3321, + 3322, + 3323, + 3324, + 3325, + 3326, + 3327, + 3328, + 3329, + 3330, + 3331, + 3332, + 3333, + 3334, + 3335, + 3336, + 3337, + 3338, + 3339, + 3340, + 3341, + 3342, + 3343, + 3344, + 3345, + 3346, + 3347, + 3348, + 3349, + 3350, + 3351, + 3352, + 3353, + 3354, + 3355, + 3356, + 3357, + 3358, + 3359, + 3360, + 3361, + 3362, + 3363, + 3364, + 3365, + 3366, + 3367, + 3368, + 3369, + 3370, + 3371, + 3372, + 3373, + 3374, + 3375, + 3376, + 3377, + 3378, + 3379, + 3380, + 3381, + 3382, + 3383, + 3384, + 3385, + 3386, + 3387, + 3388, + 3389, + 3390, + 3391, + 3392, + 3393, + 3394, + 3395, + 3396, + 3397, + 3398, + 3399, + 3400, + 3401, + 3402, + 3403, + 3404, + 3405, + 3406, + 3407, + 3408, + 3409, + 3410, + 3411, + 3412, + 3413, + 3414, + 3415, + 3416, + 3417, + 3418, + 3419, + 3420, + 3421, + 3422, + 3423, + 3424, + 3425, + 3426, + 3427, + 3428, + 3429, + 3430, + 3431, + 3432, + 3433, + 3434, + 3435, + 3436, + 3437, + 3438, + 3439, + 3440, + 3441, + 3442, + 3443, + 3444, + 3445, + 3446, + 3447, + 3448, + 3449, + 3450, + 3451, + 3452, + 3453, + 3454, + 3455, + 3456, + 3457, + 3458, + 3459, + 3460, + 3461, + 3462, + 3463, + 3464, + 3465, + 3466, + 3467, + 3468, + 3469, + 3470, + 3471, + 3472, + 3473, + 3474, + 3475, + 3476, + 3477, + 3478, + 3479, + 3480, + 3481, + 3482, + 3483, + 3484, + 3485, + 3486, + 3487, + 3488, + 3489, + 3490, + 3491, + 3492, + 3493, + 3494, + 3495, + 3496, + 3497, + 3498, + 3499, + 3500, + 3501, + 3502, + 3503, + 3504, + 3505, + 3506, + 3507, + 3508, + 3509, + 3510, + 3511, + 3512, + 3513, + 3514, + 3515, + 3516, + 3517, + 3518, + 3519, + 3520, + 3521, + 3522, + 3523, + 3524, + 3525, + 3526, + 3527, + 3528, + 3529, + 3530, + 3531, + 3532, + 3533, + 3534, + 3535, + 3536, + 3537, + 3538, + 3539, + 3540, + 3541, + 3542, + 3543, + 3544, + 3545, + 3546, + 3547, + 3548, + 3549, + 3550, + 3551, + 3552, + 3553, + 3554, + 3555, + 3556, + 3557, + 3558, + 3559, + 3560, + 3561, + 3562, + 3563, + 3564, + 3565, + 3566, + 3567, + 3568, + 3569, + 3570, + 3571, + 3572, + 3573, + 3574, + 3575, + 3576, + 3577, + 3578, + 3579, + 3580, + 3581, + 3582, + 3583, + 3584, + 3585, + 3586, + 3587, + 3588, + 3589, + 3590, + 3591, + 3592, + 3593, + 3594, + 3595, + 3596, + 3597, + 3598, + 3599, + 3600, + 3601, + 3602, + 3603, + 3604, + 3605, + 3606, + 3607, + 3608, + 3609, + 3610, + 3611, + 3612, + 3613, + 3614, + 3615, + 3616, + 3617, + 3618, + 3619, + 3620, + 3621, + 3622, + 3623, + 3624, + 3625, + 3626, + 3627, + 3628, + 3629, + 3630, + 3631, + 3632, + 3633, + 3634, + 3635, + 3636, + 3637, + 3638, + 3639, + 3640, + 3641, + 3642, + 3643, + 3644, + 3645, + 3646, + 3647, + 3648, + 3649, + 3650, + 3651, + 3652, + 3653, + 3654, + 3655, + 3656, + 3657, + 3658, + 3659, + 3660, + 3661, + 3662, + 3663, + 3664, + 3665, + 3666, + 3667, + 3668, + 3669, + 3670, + 3671, + 3672, + 3673, + 3674, + 3675, + 3676, + 3677, + 3678, + 3679, + 3680, + 3681, + 3682, + 3683, + 3684, + 3685, + 3686, + 3687, + 3688, + 3689, + 3690, + 3691, + 3692, + 3693, + 3694, + 3695, + 3696, + 3697, + 3698, + 3699, + 3700, + 3701, + 3702, + 3703, + 3704, + 3705, + 3706, + 3707, + 3708, + 3709, + 3710, + 3711, + 3712, + 3713, + 3714, + 3715, + 3716, + 3717, + 3718, + 3719, + 3720, + 3721, + 3722, + 3723, + 3724, + 3725, + 3726, + 3727, + 3728, + 3729, + 3730, + 3731, + 3732, + 3733, + 3734, + 3735, + 3736, + 3737, + 3738, + 3739, + 3740, + 3741, + 3742, + 3743, + 3744, + 3745, + 3746, + 3747, + 3748, + 3749, + 3750, + 3751, + 3752, + 3753, + 3754, + 3755, + 3756, + 3757, + 3758, + 3759, + 3760, + 3761, + 3762, + 3763, + 3764, + 3765, + 3766, + 3767, + 3768, + 3769, + 3770, + 3771, + 3772, + 3773, + 3774, + 3775, + 3776, + 3777, + 3778, + 3779, + 3780, + 3781, + 3782, + 3783, + 3784, + 3785, + 3786, + 3787, + 3788, + 3789, + 3790, + 3791, + 3792, + 3793, + 3794, + 3795, + 3796, + 3797, + 3798, + 3799, + 3800, + 3801, + 3802, + 3803, + 3804, + 3805, + 3806, + 3807, + 3808, + 3809, + 3810, + 3811, + 3812, + 3813, + 3814, + 3815, + 3816, + 3817, + 3818, + 3819, + 3820, + 3821, + 3822, + 3823, + 3824, + 3825, + 3826, + 3827, + 3828, + 3829, + 3830, + 3831, + 3832, + 3833, + 3834, + 3835, + 3836, + 3837, + 3838, + 3839, + 3840, + 3841, + 3842, + 3843, + 3844, + 3845, + 3846, + 3847, + 3848, + 3849, + 3850, + 3851, + 3852, + 3853, + 3854, + 3855, + 3856, + 3857, + 3858, + 3859, + 3860, + 3861, + 3862, + 3863, + 3864, + 3865, + 3866, + 3867, + 3868, + 3869, + 3870, + 3871, + 3872, + 3873, + 3874, + 3875, + 3876, + 3877, + 3878, + 3879, + 3880, + 3881, + 3882, + 3883, + 3884, + 3885, + 3886, + 3887, + 3888, + 3889, + 3890, + 3891, + 3892, + 3893, + 3894, + 3895, + 3896, + 3897, + 3898, + 3899, + 3900, + 3901, + 3902, + 3903, + 3904, + 3905, + 3906, + 3907, + 3908, + 3909, + 3910, + 3911, + 3912, + 3913, + 3914, + 3915, + 3916, + 3917, + 3918, + 3919, + 3920, + 3921, + 3922, + 3923, + 3924, + 3925, + 3926, + 3927, + 3928, + 3929, + 3930, + 3931, + 3932, + 3933, + 3934, + 3935, + 3936, + 3937, + 3938, + 3939, + 3940, + 3941, + 3942, + 3943, + 3944, + 3945, + 3946, + 3947, + 3948, + 3949, + 3950, + 3951, + 3952, + 3953, + 3954, + 3955, + 3956, + 3957, + 3958, + 3959, + 3960, + 3961, + 3962, + 3963, + 3964, + 3965, + 3966, + 3967, + 3968, + 3969, + 3970, + 3971, + 3972, + 3973, + 3974, + 3975, + 3976, + 3977, + 3978, + 3979, + 3980, + 3981, + 3982, + 3983, + 3984, + 3985, + 3986, + 3987, + 3988, + 3989, + 3990, + 3991, + 3992, + 3993, + 3994, + 3995, + 3996, + 3997, + 3998, + 3999, + 4000, + 4001, + 4002, + 4003, + 4004, + 4005, + 4006, + 4007, + 4008, + 4009, + 4010, + 4011, + 4012, + 4013, + 4014, + 4015, + 4016, + 4017, + 4018, + 4019, + 4020, + 4021, + 4022, + 4023, + 4024, + 4025, + 4026, + 4027, + 4028, + 4029, + 4030, + 4031, + 4032, + 4033, + 4034, + 4035, + 4036, + 4037, + 4038, + 4039, + 4040, + 4041, + 4042, + 4043, + 4044, + 4045, + 4046, + 4047, + 4048, + 4049, + 4050, + 4051, + 4052, + 4053, + 4054, + 4055, + 4056, + 4057, + 4058, + 4059, + 4060, + 4061, + 4062, + 4063, + 4064, + 4065, + 4066, + 4067, + 4068, + 4069, + 4070, + 4071, + 4072, + 4073, + 4074, + 4075, + 4076, + 4077, + 4078, + 4079, + 4080, + 4081, + 4082, + 4083, + 4084, + 4085, + 4086, + 4087, + 4088, + 4089, + 4090, + 4091, + 4092, + 4093, + 4094, + 4095, + 4096, + 4097, + 4098, + 4099, + 4100, + 4101, + 4102, + 4103, + 4104, + 4105, + 4106, + 4107, + 4108, + 4109, + 4110, + 4111, + 4112, + 4113, + 4114, + 4115, + 4116, + 4117, + 4118, + 4119, + 4120, + 4121, + 4122, + 4123, + 4124, + 4125, + 4126, + 4127, + 4128, + 4129, + 4130, + 4131, + 4132, + 4133, + 4134, + 4135, + 4136, + 4137, + 4138, + 4139, + 4140, + 4141, + 4142, + 4143, + 4144, + 4145, + 4146, + 4147, + 4148, + 4149, + 4150, + 4151, + 4152, + 4153, + 4154, + 4155, + 4156, + 4157, + 4158, + 4159, + 4160, + 4161, + 4162, + 4163, + 4164, + 4165, + 4166, + 4167, + 4168, + 4169, + 4170, + 4171, + 4172, + 4173, + 4174, + 4175, + 4176, + 4177, + 4178, + 4179, + 4180, + 4181, + 4182, + 4183, + 4184, + 4185, + 4186, + 4187, + 4188, + 4189, + 4190, + 4191, + 4192, + 4193, + 4194, + 4195, + 4196, + 4197, + 4198, + 4199, + 4200, + 4201, + 4202, + 4203, + 4204, + 4205, + 4206, + 4207, + 4208, + 4209, + 4210, + 4211, + 4212, + 4213, + 4214, + 4215, + 4216, + 4217, + 4218, + 4219, + 4220, + 4221, + 4222, + 4223, + 4224, + 4225, + 4226, + 4227, + 4228, + 4229, + 4230, + 4231, + 4232, + 4233, + 4234, + 4235, + 4236, + 4237, + 4238, + 4239, + 4240, + 4241, + 4242, + 4243, + 4244, + 4245, + 4246, + 4247, + 4248, + 4249, + 4250, + 4251, + 4252, + 4253, + 4254, + 4255, + 4256, + 4257, + 4258, + 4259, + 4260, + 4261, + 4262, + 4263, + 4264, + 4265, + 4266, + 4267, + 4268, + 4269, + 4270, + 4271, + 4272, + 4273, + 4274, + 4275, + 4276, + 4277, + 4278, + 4279, + 4280, + 4281, + 4282, + 4283, + 4284, + 4285, + 4286, + 4287, + 4288, + 4289, + 4290, + 4291, + 4292, + 4293, + 4294, + 4295, + 4296, + 4297, + 4298, + 4299, + 4300, + 4301, + 4302, + 4303, + 4304, + 4305, + 4306, + 4307, + 4308, + 4309, + 4310, + 4311, + 4312, + 4313, + 4314, + 4315, + 4316, + 4317, + 4318, + 4319, + 4320, + 4321, + 4322, + 4323, + 4324, + 4325, + 4326, + 4327, + 4328, + 4329, + 4330, + 4331, + 4332, + 4333, + 4334, + 4335, + 4336, + 4337, + 4338, + 4339, + 4340, + 4341, + 4342, + 4343, + 4344, + 4345, + 4346, + 4347, + 4348, + 4349, + 4350, + 4351, + 4352, + 4353, + 4354, + 4355, + 4356, + 4357, + 4358, + 4359, + 4360, + 4361, + 4362, + 4363, + 4364, + 4365, + 4366, + 4367, + 4368, + 4369, + 4370, + 4371, + 4372, + 4373, + 4374, + 4375, + 4376, + 4377, + 4378, + 4379, + 4380, + 4381, + 4382, + 4383, + 4384, + 4385, + 4386, + 4387, + 4388, + 4389, + 4390, + 4391, + 4392, + 4393, + 4394, + 4395, + 4396, + 4397, + 4398, + 4399, + 4400, + 4401, + 4402, + 4403, + 4404, + 4405, + 4406, + 4407, + 4408, + 4409, + 4410, + 4411, + 4412, + 4413, + 4414, + 4415, + 4416, + 4417, + 4418, + 4419, + 4420, + 4421, + 4422, + 4423, + 4424, + 4425, + 4426, + 4427, + 4428, + 4429, + 4430, + 4431, + 4432, + 4433, + 4434, + 4435, + 4436, + 4437, + 4438, + 4439, + 4440, + 4441, + 4442, + 4443, + 4444, + 4445, + 4446, + 4447, + 4448, + 4449, + 4450, + 4451, + 4452, + 4453, + 4454, + 4455, + 4456, + 4457, + 4458, + 4459, + 4460, + 4461, + 4462, + 4463, + 4464, + 4465, + 4466, + 4467, + 4468, + 4469, + 4470, + 4471, + 4472, + 4473, + 4474, + 4475, + 4476, + 4477, + 4478, + 4479, + 4480, + 4481, + 4482, + 4483, + 4484, + 4485, + 4486, + 4487, + 4488, + 4489, + 4490, + 4491, + 4492, + 4493, + 4494, + 4495, + 4496, + 4497, + 4498, + 4499, + 4500, + 4501, + 4502, + 4503, + 4504, + 4505, + 4506, + 4507, + 4508, + 4509, + 4510, + 4511, + 4512, + 4513, + 4514, + 4515, + 4516, + 4517, + 4518, + 4519, + 4520, + 4521, + 4522, + 4523, + 4524, + 4525, + 4526, + 4527, + 4528, + 4529, + 4530, + 4531, + 4532, + 4533, + 4534, + 4535, + 4536, + 4537, + 4538, + 4539, + 4540, + 4541, + 4542, + 4543, + 4544, + 4545, + 4546, + 4547, + 4548, + 4549, + 4550, + 4551, + 4552, + 4553, + 4554, + 4555, + 4556, + 4557, + 4558, + 4559, + 4560, + 4561, + 4562, + 4563, + 4564, + 4565, + 4566, + 4567, + 4568, + 4569, + 4570, + 4571, + 4572, + 4573, + 4574, + 4575, + 4576, + 4577, + 4578, + 4579, + 4580, + 4581, + 4582, + 4583, + 4584, + 4585, + 4586, + 4587, + 4588, + 4589, + 4590, + 4591, + 4592, + 4593, + 4594, + 4595, + 4596, + 4597, + 4598, + 4599, + 4600, + 4601, + 4602, + 4603, + 4604, + 4605, + 4606, + 4607, + 4608, + 4609, + 4610, + 4611, + 4612, + 4613, + 4614, + 4615, + 4616, + 4617, + 4618, + 4619, + 4620, + 4621, + 4622, + 4623, + 4624, + 4625, + 4626, + 4627, + 4628, + 4629, + 4630, + 4631, + 4632, + 4633, + 4634, + 4635, + 4636, + 4637, + 4638, + 4639, + 4640, + 4641, + 4642, + 4643, + 4644, + 4645, + 4646, + 4647, + 4648, + 4649, + 4650, + 4651, + 4652, + 4653, + 4654, + 4655, + 4656, + 4657, + 4658, + 4659, + 4660, + 4661, + 4662, + 4663, + 4664, + 4665, + 4666, + 4667, + 4668, + 4669, + 4670, + 4671, + 4672, + 4673, + 4674, + 4675, + 4676, + 4677, + 4678, + 4679, + 4680, + 4681, + 4682, + 4683, + 4684, + 4685, + 4686, + 4687, + 4688, + 4689, + 4690, + 4691, + 4692, + 4693, + 4694, + 4695, + 4696, + 4697, + 4698, + 4699, + 4700, + 4701, + 4702, + 4703, + 4704, + 4705, + 4706, + 4707, + 4708, + 4709, + 4710, + 4711, + 4712, + 4713, + 4714, + 4715, + 4716, + 4717, + 4718, + 4719, + 4720, + 4721, + 4722, + 4723, + 4724, + 4725, + 4726, + 4727, + 4728, + 4729, + 4730, + 4731, + 4732, + 4733, + 4734, + 4735, + 4736, + 4737, + 4738, + 4739, + 4740, + 4741, + 4742, + 4743, + 4744, + 4745, + 4746, + 4747, + 4748, + 4749, + 4750, + 4751, + 4752, + 4753, + 4754, + 4755, + 4756, + 4757, + 4758, + 4759, + 4760, + 4761, + 4762, + 4763, + 4764, + 4765, + 4766, + 4767, + 4768, + 4769, + 4770, + 4771, + 4772, + 4773, + 4774, + 4775, + 4776, + 4777, + 4778, + 4779, + 4780, + 4781, + 4782, + 4783, + 4784, + 4785, + 4786, + 4787, + 4788, + 4789, + 4790, + 4791, + 4792, + 4793, + 4794, + 4795, + 4796, + 4797, + 4798, + 4799, + 4800, + 4801, + 4802, + 4803, + 4804, + 4805, + 4806, + 4807, + 4808, + 4809, + 4810, + 4811, + 4812, + 4813, + 4814, + 4815, + 4816, + 4817, + 4818, + 4819, + 4820, + 4821, + 4822, + 4823, + 4824, + 4825, + 4826, + 4827, + 4828, + 4829, + 4830, + 4831, + 4832, + 4833, + 4834, + 4835, + 4836, + 4837, + 4838, + 4839, + 4840, + 4841, + 4842, + 4843, + 4844, + 4845, + 4846, + 4847, + 4848, + 4849, + 4850, + 4851, + 4852, + 4853, + 4854, + 4855, + 4856, + 4857, + 4858, + 4859, + 4860, + 4861, + 4862, + 4863, + 4864, + 4865, + 4866, + 4867, + 4868, + 4869, + 4870, + 4871, + 4872, + 4873, + 4874, + 4875, + 4876, + 4877, + 4878, + 4879, + 4880, + 4881, + 4882, + 4883, + 4884, + 4885, + 4886, + 4887, + 4888, + 4889, + 4890, + 4891, + 4892, + 4893, + 4894, + 4895, + 4896, + 4897, + 4898, + 4899, + 4900, + 4901, + 4902, + 4903, + 4904, + 4905, + 4906, + 4907, + 4908, + 4909, + 4910, + 4911, + 4912, + 4913, + 4914, + 4915, + 4916, + 4917, + 4918, + 4919, + 4920, + 4921, + 4922, + 4923, + 4924, + 4925, + 4926, + 4927, + 4928, + 4929, + 4930, + 4931, + 4932, + 4933, + 4934, + 4935, + 4936, + 4937, + 4938, + 4939, + 4940, + 4941, + 4942, + 4943, + 4944, + 4945, + 4946, + 4947, + 4948, + 4949, + 4950, + 4951, + 4952, + 4953, + 4954, + 4955, + 4956, + 4957, + 4958, + 4959, + 4960, + 4961, + 4962, + 4963, + 4964, + 4965, + 4966, + 4967, + 4968, + 4969, + 4970, + 4971, + 4972, + 4973, + 4974, + 4975, + 4976, + 4977, + 4978, + 4979, + 4980, + 4981, + 4982, + 4983, + 4984, + 4985, + 4986, + 4987, + 4988, + 4989, + 4990, + 4991, + 4992, + 4993, + 4994, + 4995, + 4996, + 4997, + 4998, + 4999, + 5000, + 5001, + 5002, + 5003, + 5004, + 5005, + 5006, + 5007, + 5008, + 5009, + 5010, + 5011, + 5012, + 5013, + 5014, + 5015, + 5016, + 5017, + 5018, + 5019, + 5020, + 5021, + 5022, + 5023, + 5024, + 5025, + 5026, + 5027, + 5028, + 5029, + 5030, + 5031, + 5032, + 5033, + 5034, + 5035, + 5036, + 5037, + 5038, + 5039, + 5040, + 5041, + 5042, + 5043, + 5044, + 5045, + 5046, + 5047, + 5048, + 5049, + 5050, + 5051, + 5052, + 5053, + 5054, + 5055, + 5056, + 5057, + 5058, + 5059, + 5060, + 5061, + 5062, + 5063, + 5064, + 5065, + 5066, + 5067, + 5068, + 5069, + 5070, + 5071, + 5072, + 5073, + 5074, + 5075, + 5076, + 5077, + 5078, + 5079, + 5080, + 5081, + 5082, + 5083, + 5084, + 5085, + 5086, + 5087, + 5088, + 5089, + 5090, + 5091, + 5092, + 5093, + 5094, + 5095, + 5096, + 5097, + 5098, + 5099, + 5100, + 5101, + 5102, + 5103, + 5104, + 5105, + 5106, + 5107, + 5108, + 5109, + 5110, + 5111, + 5112, + 5113, + 5114, + 5115, + 5116, + 5117, + 5118, + 5119, + 5120, + 5121, + 5122, + 5123, + 5124, + 5125, + 5126, + 5127, + 5128, + 5129, + 5130, + 5131, + 5132, + 5133, + 5134, + 5135, + 5136, + 5137, + 5138, + 5139, + 5140, + 5141, + 5142, + 5143, + 5144, + 5145, + 5146, + 5147, + 5148, + 5149, + 5150, + 5151, + 5152, + 5153, + 5154, + 5155, + 5156, + 5157, + 5158, + 5159, + 5160, + 5161, + 5162, + 5163, + 5164, + 5165, + 5166, + 5167, + 5168, + 5169, + 5170, + 5171, + 5172, + 5173, + 5174, + 5175, + 5176, + 5177, + 5178, + 5179, + 5180, + 5181, + 5182, + 5183, + 5184, + 5185, + 5186, + 5187, + 5188, + 5189, + 5190, + 5191, + 5192, + 5193, + 5194, + 5195, + 5196, + 5197, + 5198, + 5199, + 5200, + 5201, + 5202, + 5203, + 5204, + 5205, + 5206, + 5207, + 5208, + 5209, + 5210, + 5211, + 5212, + 5213, + 5214, + 5215, + 5216, + 5217, + 5218, + 5219, + 5220, + 5221, + 5222, + 5223, + 5224, + 5225, + 5226, + 5227, + 5228, + 5229, + 5230, + 5231, + 5232, + 5233, + 5234, + 5235, + 5236, + 5237, + 5238, + 5239, + 5240, + 5241, + 5242, + 5243, + 5244, + 5245, + 5246, + 5247, + 5248, + 5249, + 5250, + 5251, + 5252, + 5253, + 5254, + 5255, + 5256, + 5257, + 5258, + 5259, + 5260, + 5261, + 5262, + 5263, + 5264, + 5265, + 5266, + 5267, + 5268, + 5269, + 5270, + 5271, + 5272, + 5273, + 5274, + 5275, + 5276, + 5277, + 5278, + 5279, + 5280, + 5281, + 5282, + 5283, + 5284, + 5285, + 5286, + 5287, + 5288, + 5289, + 5290, + 5291, + 5292, + 5293, + 5294, + 5295, + 5296, + 5297, + 5298, + 5299, + 5300, + 5301, + 5302, + 5303, + 5304, + 5305, + 5306, + 5307, + 5308, + 5309, + 5310, + 5311, + 5312, + 5313, + 5314, + 5315, + 5316, + 5317, + 5318, + 5319, + 5320, + 5321, + 5322, + 5323, + 5324, + 5325, + 5326, + 5327, + 5328, + 5329, + 5330, + 5331, + 5332, + 5333, + 5334, + 5335, + 5336, + 5337, + 5338, + 5339, + 5340, + 5341, + 5342, + 5343, + 5344, + 5345, + 5346, + 5347, + 5348, + 5349, + 5350, + 5351, + 5352, + 5353, + 5354, + 5355, + 5356, + 5357, + 5358, + 5359, + 5360, + 5361, + 5362, + 5363, + 5364, + 5365, + 5366, + 5367, + 5368, + 5369, + 5370, + 5371, + 5372, + 5373, + 5374, + 5375, + 5376, + 5377, + 5378, + 5379, + 5380, + 5381, + 5382, + 5383, + 5384, + 5385, + 5386, + 5387, + 5388, + 5389, + 5390, + 5391, + 5392, + 5393, + 5394, + 5395, + 5396, + 5397, + 5398, + 5399, + 5400, + 5401, + 5402, + 5403, + 5404, + 5405, + 5406, + 5407, + 5408, + 5409, + 5410, + 5411, + 5412, + 5413, + 5414, + 5415, + 5416, + 5417, + 5418, + 5419, + 5420, + 5421, + 5422, + 5423, + 5424, + 5425, + 5426, + 5427, + 5428, + 5429, + 5430, + 5431, + 5432, + 5433, + 5434, + 5435, + 5436, + 5437, + 5438, + 5439, + 5440, + 5441, + 5442, + 5443, + 5444, + 5445, + 5446, + 5447, + 5448, + 5449, + 5450, + 5451, + 5452, + 5453, + 5454, + 5455, + 5456, + 5457, + 5458, + 5459, + 5460, + 5461, + 5462, + 5463, + 5464, + 5465, + 5466, + 5467, + 5468, + 5469, + 5470, + 5471, + 5472, + 5473, + 5474, + 5475, + 5476, + 5477, + 5478, + 5479, + 5480, + 5481, + 5482, + 5483, + 5484, + 5485, + 5486, + 5487, + 5488, + 5489, + 5490, + 5491, + 5492, + 5493, + 5494, + 5495, + 5496, + 5497, + 5498, + 5499, + 5500, + 5501, + 5502, + 5503, + 5504, + 5505, + 5506, + 5507, + 5508, + 5509, + 5510, + 5511, + 5512, + 5513, + 5514, + 5515, + 5516, + 5517, + 5518, + 5519, + 5520, + 5521, + 5522, + 5523, + 5524, + 5525, + 5526, + 5527, + 5528, + 5529, + 5530, + 5531, + 5532, + 5533, + 5534, + 5535, + 5536, + 5537, + 5538, + 5539, + 5540, + 5541, + 5542, + 5543, + 5544, + 5545, + 5546, + 5547, + 5548, + 5549, + 5550, + 5551, + 5552, + 5553, + 5554, + 5555, + 5556, + 5557, + 5558, + 5559, + 5560, + 5561, + 5562, + 5563, + 5564, + 5565, + 5566, + 5567, + 5568, + 5569, + 5570, + 5571, + 5572, + 5573, + 5574, + 5575, + 5576, + 5577, + 5578, + 5579, + 5580, + 5581, + 5582, + 5583, + 5584, + 5585, + 5586, + 5587, + 5588, + 5589, + 5590, + 5591, + 5592, + 5593, + 5594, + 5595, + 5596, + 5597, + 5598, + 5599, + 5600, + 5601, + 5602, + 5603, + 5604, + 5605, + 5606, + 5607, + 5608, + 5609, + 5610, + 5611, + 5612, + 5613, + 5614, + 5615, + 5616, + 5617, + 5618, + 5619, + 5620, + 5621, + 5622, + 5623, + 5624, + 5625, + 5626, + 5627, + 5628, + 5629, + 5630, + 5631, + 5632, + 5633, + 5634, + 5635, + 5636, + 5637, + 5638, + 5639, + 5640, + 5641, + 5642, + 5643, + 5644, + 5645, + 5646, + 5647, + 5648, + 5649, + 5650, + 5651, + 5652, + 5653, + 5654, + 5655, + 5656, + 5657, + 5658, + 5659, + 5660, + 5661, + 5662, + 5663, + 5664, + 5665, + 5666, + 5667, + 5668, + 5669, + 5670, + 5671, + 5672, + 5673, + 5674, + 5675, + 5676, + 5677, + 5678, + 5679, + 5680, + 5681, + 5682, + 5683, + 5684, + 5685, + 5686, + 5687, + 5688, + 5689, + 5690, + 5691, + 5692, + 5693, + 5694, + 5695, + 5696, + 5697, + 5698, + 5699, + 5700, + 5701, + 5702, + 5703, + 5704, + 5705, + 5706, + 5707, + 5708, + 5709, + 5710, + 5711, + 5712, + 5713, + 5714, + 5715, + 5716, + 5717, + 5718, + 5719, + 5720, + 5721, + 5722, + 5723, + 5724, + 5725, + 5726, + 5727, + 5728, + 5729, + 5730, + 5731, + 5732, + 5733, + 5734, + 5735, + 5736, + 5737, + 5738, + 5739, + 5740, + 5741, + 5742, + 5743, + 5744, + 5745, + 5746, + 5747, + 5748, + 5749, + 5750, + 5751, + 5752, + 5753, + 5754, + 5755, + 5756, + 5757, + 5758, + 5759, + 5760, + 5761, + 5762, + 5763, + 5764, + 5765, + 5766, + 5767, + 5768, + 5769, + 5770, + 5771, + 5772, + 5773, + 5774, + 5775, + 5776, + 5777, + 5778, + 5779, + 5780, + 5781, + 5782, + 5783, + 5784, + 5785, + 5786, + 5787, + 5788, + 5789, + 5790, + 5791, + 5792, + 5793, + 5794, + 5795, + 5796, + 5797, + 5798, + 5799, + 5800, + 5801, + 5802, + 5803, + 5804, + 5805, + 5806, + 5807, + 5808, + 5809, + 5810, + 5811, + 5812, + 5813, + 5814, + 5815, + 5816, + 5817, + 5818, + 5819, + 5820, + 5821, + 5822, + 5823, + 5824, + 5825, + 5826, + 5827, + 5828, + 5829, + 5830, + 5831, + 5832, + 5833, + 5834, + 5835, + 5836, + 5837, + 5838, + 5839, + 5840, + 5841, + 5842, + 5843, + 5844, + 5845, + 5846, + 5847, + 5848, + 5849, + 5850, + 5851, + 5852, + 5853, + 5854, + 5855, + 5856, + 5857, + 5858, + 5859, + 5860, + 5861, + 5862, + 5863, + 5864, + 5865, + 5866, + 5867, + 5868, + 5869, + 5870, + 5871, + 5872, + 5873, + 5874, + 5875, + 5876, + 5877, + 5878, + 5879, + 5880, + 5881, + 5882, + 5883, + 5884, + 5885, + 5886, + 5887, + 5888, + 5889, + 5890, + 5891, + 5892, + 5893, + 5894, + 5895, + 5896, + 5897, + 5898, + 5899, + 5900, + 5901, + 5902, + 5903, + 5904, + 5905, + 5906, + 5907, + 5908, + 5909, + 5910, + 5911, + 5912, + 5913, + 5914, + 5915, + 5916, + 5917, + 5918, + 5919, + 5920, + 5921, + 5922, + 5923, + 5924, + 5925, + 5926, + 5927, + 5928, + 5929, + 5930, + 5931, + 5932, + 5933, + 5934, + 5935, + 5936, + 5937, + 5938, + 5939, + 5940, + 5941, + 5942, + 5943, + 5944, + 5945, + 5946, + 5947, + 5948, + 5949, + 5950, + 5951, + 5952, + 5953, + 5954, + 5955, + 5956, + 5957, + 5958, + 5959, + 5960, + 5961, + 5962, + 5963, + 5964, + 5965, + 5966, + 5967, + 5968, + 5969, + 5970, + 5971, + 5972, + 5973, + 5974, + 5975, + 5976, + 5977, + 5978, + 5979, + 5980, + 5981, + 5982, + 5983, + 5984, + 5985, + 5986, + 5987, + 5988, + 5989, + 5990, + 5991, + 5992, + 5993, + 5994, + 5995, + 5996, + 5997, + 5998, + 5999, + 6000, + 6001, + 6002, + 6003, + 6004, + 6005, + 6006, + 6007, + 6008, + 6009, + 6010, + 6011, + 6012, + 6013, + 6014, + 6015, + 6016, + 6017, + 6018, + 6019, + 6020, + 6021, + 6022, + 6023, + 6024, + 6025, + 6026, + 6027, + 6028, + 6029, + 6030, + 6031, + 6032, + 6033, + 6034, + 6035, + 6036, + 6037, + 6038, + 6039, + 6040, + 6041, + 6042, + 6043, + 6044, + 6045, + 6046, + 6047, + 6048, + 6049, + 6050, + 6051, + 6052, + 6053, + 6054, + 6055, + 6056, + 6057, + 6058, + 6059, + 6060, + 6061, + 6062, + 6063, + 6064, + 6065, + 6066, + 6067, + 6068, + 6069, + 6070, + 6071, + 6072, + 6073, + 6074, + 6075, + 6076, + 6077, + 6078, + 6079, + 6080, + 6081, + 6082, + 6083, + 6084, + 6085, + 6086, + 6087, + 6088, + 6089, + 6090, + 6091, + 6092, + 6093, + 6094, + 6095, + 6096, + 6097, + 6098, + 6099, + 6100, + 6101, + 6102, + 6103, + 6104, + 6105, + 6106, + 6107, + 6108, + 6109, + 6110, + 6111, + 6112, + 6113, + 6114, + 6115, + 6116, + 6117, + 6118, + 6119, + 6120, + 6121, + 6122, + 6123, + 6124, + 6125, + 6126, + 6127, + 6128, + 6129, + 6130, + 6131, + 6132, + 6133, + 6134, + 6135, + 6136, + 6137, + 6138, + 6139, + 6140, + 6141, + 6142, + 6143, + 6144, + 6145, + 6146, + 6147, + 6148, + 6149, + 6150, + 6151, + 6152, + 6153, + 6154, + 6155, + 6156, + 6157, + 6158, + 6159, + 6160, + 6161, + 6162, + 6163, + 6164, + 6165, + 6166, + 6167, + 6168, + 6169, + 6170, + 6171, + 6172, + 6173, + 6174, + 6175, + 6176, + 6177, + 6178, + 6179, + 6180, + 6181, + 6182, + 6183, + 6184, + 6185, + 6186, + 6187, + 6188, + 6189, + 6190, + 6191, + 6192, + 6193, + 6194, + 6195, + 6196, + 6197, + 6198, + 6199, + 6200, + 6201, + 6202, + 6203, + 6204, + 6205, + 6206, + 6207, + 6208, + 6209, + 6210, + 6211, + 6212, + 6213, + 6214, + 6215, + 6216, + 6217, + 6218, + 6219, + 6220, + 6221, + 6222, + 6223, + 6224, + 6225, + 6226, + 6227, + 6228, + 6229, + 6230, + 6231, + 6232, + 6233, + 6234, + 6235, + 6236, + 6237, + 6238, + 6239, + 6240, + 6241, + 6242, + 6243, + 6244, + 6245, + 6246, + 6247, + 6248, + 6249, + 6250, + 6251, + 6252, + 6253, + 6254, + 6255, + 6256, + 6257, + 6258, + 6259, + 6260, + 6261, + 6262, + 6263, + 6264, + 6265, + 6266, + 6267, + 6268, + 6269, + 6270, + 6271, + 6272, + 6273, + 6274, + 6275, + 6276, + 6277, + 6278, + 6279, + 6280, + 6281, + 6282, + 6283, + 6284, + 6285, + 6286, + 6287, + 6288, + 6289, + 6290, + 6291, + 6292, + 6293, + 6294, + 6295, + 6296, + 6297, + 6298, + 6299, + 6300, + 6301, + 6302, + 6303, + 6304, + 6305, + 6306, + 6307, + 6308, + 6309, + 6310, + 6311, + 6312, + 6313, + 6314, + 6315, + 6316, + 6317, + 6318, + 6319, + 6320, + 6321, + 6322, + 6323, + 6324, + 6325, + 6326, + 6327, + 6328, + 6329, + 6330, + 6331, + 6332, + 6333, + 6334, + 6335, + 6336, + 6337, + 6338, + 6339, + 6340, + 6341, + 6342, + 6343, + 6344, + 6345, + 6346, + 6347, + 6348, + 6349, + 6350, + 6351, + 6352, + 6353, + 6354, + 6355, + 6356, + 6357, + 6358, + 6359, + 6360, + 6361, + 6362, + 6363, + 6364, + 6365, + 6366, + 6367, + 6368, + 6369, + 6370, + 6371, + 6372, + 6373, + 6374, + 6375, + 6376, + 6377, + 6378, + 6379, + 6380, + 6381, + 6382, + 6383, + 6384, + 6385, + 6386, + 6387, + 6388, + 6389, + 6390, + 6391, + 6392, + 6393, + 6394, + 6395, + 6396, + 6397, + 6398, + 6399, + 6400, + 6401, + 6402, + 6403, + 6404, + 6405, + 6406, + 6407, + 6408, + 6409, + 6410, + 6411, + 6412, + 6413, + 6414, + 6415, + 6416, + 6417, + 6418, + 6419, + 6420, + 6421, + 6422, + 6423, + 6424, + 6425, + 6426, + 6427, + 6428, + 6429, + 6430, + 6431, + 6432, + 6433, + 6434, + 6435, + 6436, + 6437, + 6438, + 6439, + 6440, + 6441, + 6442, + 6443, + 6444, + 6445, + 6446, + 6447, + 6448, + 6449, + 6450, + 6451, + 6452, + 6453, + 6454, + 6455, + 6456, + 6457, + 6458, + 6459, + 6460, + 6461, + 6462, + 6463, + 6464, + 6465, + 6466, + 6467, + 6468, + 6469, + 6470, + 6471, + 6472, + 6473, + 6474, + 6475, + 6476, + 6477, + 6478, + 6479, + 6480, + 6481, + 6482, + 6483, + 6484, + 6485, + 6486, + 6487, + 6488, + 6489, + 6490, + 6491, + 6492, + 6493, + 6494, + 6495, + 6496, + 6497, + 6498, + 6499, + 6500, + 6501, + 6502, + 6503, + 6504, + 6505, + 6506, + 6507, + 6508, + 6509, + 6510, + 6511, + 6512, + 6513, + 6514, + 6515, + 6516, + 6517, + 6518, + 6519, + 6520, + 6521, + 6522, + 6523, + 6524, + 6525, + 6526, + 6527, + 6528, + 6529, + 6530, + 6531, + 6532, + 6533, + 6534, + 6535, + 6536, + 6537, + 6538, + 6539, + 6540, + 6541, + 6542, + 6543, + 6544, + 6545, + 6546, + 6547, + 6548, + 6549, + 6550, + 6551, + 6552, + 6553, + 6554, + 6555, + 6556, + 6557, + 6558, + 6559, + 6560, + 6561, + 6562, + 6563, + 6564, + 6565, + 6566, + 6567, + 6568, + 6569, + 6570, + 6571, + 6572, + 6573, + 6574, + 6575, + 6576, + 6577, + 6578, + 6579, + 6580, + 6581, + 6582, + 6583, + 6584, + 6585, + 6586, + 6587, + 6588, + 6589, + 6590, + 6591, + 6592, + 6593, + 6594, + 6595, + 6596, + 6597, + 6598, + 6599, + 6600, + 6601, + 6602, + 6603, + 6604, + 6605, + 6606, + 6607, + 6608, + 6609, + 6610, + 6611, + 6612, + 6613, + 6614, + 6615, + 6616, + 6617, + 6618, + 6619, + 6620, + 6621, + 6622, + 6623, + 6624, + 6625, + 6626, + 6627, + 6628, + 6629, + 6630, + 6631, + 6632, + 6633, + 6634, + 6635, + 6636, + 6637, + 6638, + 6639, + 6640, + 6641, + 6642, + 6643, + 6644, + 6645, + 6646, + 6647, + 6648, + 6649, + 6650, + 6651, + 6652, + 6653, + 6654, + 6655, + 6656, + 6657, + 6658, + 6659, + 6660, + 6661, + 6662, + 6663, + 6664, + 6665, + 6666, + 6667, + 6668, + 6669, + 6670, + 6671, + 6672, + 6673, + 6674, + 6675, + 6676, + 6677, + 6678, + 6679, + 6680, + 6681, + 6682, + 6683, + 6684, + 6685, + 6686, + 6687, + 6688, + 6689, + 6690, + 6691, + 6692, + 6693, + 6694, + 6695, + 6696, + 6697, + 6698, + 6699, + 6700, + 6701, + 6702, + 6703, + 6704, + 6705, + 6706, + 6707, + 6708, + 6709, + 6710, + 6711, + 6712, + 6713, + 6714, + 6715, + 6716, + 6717, + 6718, + 6719, + 6720, + 6721, + 6722, + 6723, + 6724, + 6725, + 6726, + 6727, + 6728, + 6729, + 6730, + 6731, + 6732, + 6733, + 6734, + 6735, + 6736, + 6737, + 6738, + 6739, + 6740, + 6741, + 6742, + 6743, + 6744, + 6745, + 6746, + 6747, + 6748, + 6749, + 6750, + 6751, + 6752, + 6753, + 6754, + 6755, + 6756, + 6757, + 6758, + 6759, + 6760, + 6761, + 6762, + 6763, + 6764, + 6765, + 6766, + 6767, + 6768, + 6769, + 6770, + 6771, + 6772, + 6773, + 6774, + 6775, + 6776, + 6777, + 6778, + 6779, + 6780, + 6781, + 6782, + 6783, + 6784, + 6785, + 6786, + 6787, + 6788, + 6789, + 6790, + 6791, + 6792, + 6793, + 6794, + 6795, + 6796, + 6797, + 6798, + 6799, + 6800, + 6801, + 6802, + 6803, + 6804, + 6805, + 6806, + 6807, + 6808, + 6809, + 6810, + 6811, + 6812, + 6813, + 6814, + 6815, + 6816, + 6817, + 6818, + 6819, + 6820, + 6821, + 6822, + 6823, + 6824, + 6825, + 6826, + 6827, + 6828, + 6829, + 6830, + 6831, + 6832, + 6833, + 6834, + 6835, + 6836, + 6837, + 6838, + 6839, + 6840, + 6841, + 6842, + 6843, + 6844, + 6845, + 6846, + 6847, + 6848, + 6849, + 6850, + 6851, + 6852, + 6853, + 6854, + 6855, + 6856, + 6857, + 6858, + 6859, + 6860, + 6861, + 6862, + 6863, + 6864, + 6865, + 6866, + 6867, + 6868, + 6869, + 6870, + 6871, + 6872, + 6873, + 6874, + 6875, + 6876, + 6877, + 6878, + 6879, + 6880, + 6881, + 6882, + 6883, + 6884, + 6885, + 6886, + 6887, + 6888, + 6889, + 6890, + 6891, + 6892, + 6893, + 6894, + 6895, + 6896, + 6897, + 6898, + 6899, + 6900, + 6901, + 6902, + 6903, + 6904, + 6905, + 6906, + 6907, + 6908, + 6909, + 6910, + 6911, + 6912, + 6913, + 6914, + 6915, + 6916, + 6917, + 6918, + 6919, + 6920, + 6921, + 6922, + 6923, + 6924, + 6925, + 6926, + 6927, + 6928, + 6929, + 6930, + 6931, + 6932, + 6933, + 6934, + 6935, + 6936, + 6937, + 6938, + 6939, + 6940, + 6941, + 6942, + 6943, + 6944, + 6945, + 6946, + 6947, + 6948, + 6949, + 6950, + 6951, + 6952, + 6953, + 6954, + 6955, + 6956, + 6957, + 6958, + 6959, + 6960, + 6961, + 6962, + 6963, + 6964, + 6965, + 6966, + 6967, + 6968, + 6969, + 6970, + 6971, + 6972, + 6973, + 6974, + 6975, + 6976, + 6977, + 6978, + 6979, + 6980, + 6981, + 6982, + 6983, + 6984, + 6985, + 6986, + 6987, + 6988, + 6989, + 6990, + 6991, + 6992, + 6993, + 6994, + 6995, + 6996, + 6997, + 6998, + 6999, + 7000, + 7001, + 7002, + 7003, + 7004, + 7005, + 7006, + 7007, + 7008, + 7009, + 7010, + 7011, + 7012, + 7013, + 7014, + 7015, + 7016, + 7017, + 7018, + 7019, + 7020, + 7021, + 7022, + 7023, + 7024, + 7025, + 7026, + 7027, + 7028, + 7029, + 7030, + 7031, + 7032, + 7033, + 7034, + 7035, + 7036, + 7037, + 7038, + 7039, + 7040, + 7041, + 7042, + 7043, + 7044, + 7045, + 7046, + 7047, + 7048, + 7049, + 7050, + 7051, + 7052, + 7053, + 7054, + 7055, + 7056, + 7057, + 7058, + 7059, + 7060, + 7061, + 7062, + 7063, + 7064, + 7065, + 7066, + 7067, + 7068, + 7069, + 7070, + 7071, + 7072, + 7073, + 7074, + 7075, + 7076, + 7077, + 7078, + 7079, + 7080, + 7081, + 7082, + 7083, + 7084, + 7085, + 7086, + 7087, + 7088, + 7089, + 7090, + 7091, + 7092, + 7093, + 7094, + 7095, + 7096, + 7097, + 7098, + 7099, + 7100, + 7101, + 7102, + 7103, + 7104, + 7105, + 7106, + 7107, + 7108, + 7109, + 7110, + 7111, + 7112, + 7113, + 7114, + 7115, + 7116, + 7117, + 7118, + 7119, + 7120, + 7121, + 7122, + 7123, + 7124, + 7125, + 7126, + 7127, + 7128, + 7129, + 7130, + 7131, + 7132, + 7133, + 7134, + 7135, + 7136, + 7137, + 7138, + 7139, + 7140, + 7141, + 7142, + 7143, + 7144, + 7145, + 7146, + 7147, + 7148, + 7149, + 7150, + 7151, + 7152, + 7153, + 7154, + 7155, + 7156, + 7157, + 7158, + 7159, + 7160, + 7161, + 7162, + 7163, + 7164, + 7165, + 7166, + 7167, + 7168, + 7169, + 7170, + 7171, + 7172, + 7173, + 7174, + 7175, + 7176, + 7177, + 7178, + 7179, + 7180, + 7181, + 7182, + 7183, + 7184, + 7185, + 7186, + 7187, + 7188, + 7189, + 7190, + 7191, + 7192, + 7193, + 7194, + 7195, + 7196, + 7197, + 7198, + 7199, + 7200, + 7201, + 7202, + 7203, + 7204, + 7205, + 7206, + 7207, + 7208, + 7209, + 7210, + 7211, + 7212, + 7213, + 7214, + 7215, + 7216, + 7217, + 7218, + 7219, + 7220, + 7221, + 7222, + 7223, + 7224, + 7225, + 7226, + 7227, + 7228, + 7229, + 7230, + 7231, + 7232, + 7233, + 7234, + 7235, + 7236, + 7237, + 7238, + 7239, + 7240, + 7241, + 7242, + 7243, + 7244, + 7245, + 7246, + 7247, + 7248, + 7249, + 7250, + 7251, + 7252, + 7253, + 7254, + 7255, + 7256, + 7257, + 7258, + 7259, + 7260, + 7261, + 7262, + 7263, + 7264, + 7265, + 7266, + 7267, + 7268, + 7269, + 7270, + 7271, + 7272, + 7273, + 7274, + 7275, + 7276, + 7277, + 7278, + 7279, + 7280, + 7281, + 7282, + 7283, + 7284, + 7285, + 7286, + 7287, + 7288, + 7289, + 7290, + 7291, + 7292, + 7293, + 7294, + 7295, + 7296, + 7297, + 7298, + 7299, + 7300, + 7301, + 7302, + 7303, + 7304, + 7305, + 7306, + 7307, + 7308, + 7309, + 7310, + 7311, + 7312, + 7313, + 7314, + 7315, + 7316, + 7317, + 7318, + 7319, + 7320, + 7321, + 7322, + 7323, + 7324, + 7325, + 7326, + 7327, + 7328, + 7329, + 7330, + 7331, + 7332, + 7333, + 7334, + 7335, + 7336, + 7337, + 7338, + 7339, + 7340, + 7341, + 7342, + 7343, + 7344, + 7345, + 7346, + 7347, + 7348, + 7349, + 7350, + 7351, + 7352, + 7353, + 7354, + 7355, + 7356, + 7357, + 7358, + 7359, + 7360, + 7361, + 7362, + 7363, + 7364, + 7365, + 7366, + 7367, + 7368, + 7369, + 7370, + 7371, + 7372, + 7373, + 7374, + 7375, + 7376, + 7377, + 7378, + 7379, + 7380, + 7381, + 7382, + 7383, + 7384, + 7385, + 7386, + 7387, + 7388, + 7389, + 7390, + 7391, + 7392, + 7393, + 7394, + 7395, + 7396, + 7397, + 7398, + 7399, + 7400, + 7401, + 7402, + 7403, + 7404, + 7405, + 7406, + 7407, + 7408, + 7409, + 7410, + 7411, + 7412, + 7413, + 7414, + 7415, + 7416, + 7417, + 7418, + 7419, + 7420, + 7421, + 7422, + 7423, + 7424, + 7425, + 7426, + 7427, + 7428, + 7429, + 7430, + 7431, + 7432, + 7433, + 7434, + 7435, + 7436, + 7437, + 7438, + 7439, + 7440, + 7441, + 7442, + 7443, + 7444, + 7445, + 7446, + 7447, + 7448, + 7449, + 7450, + 7451, + 7452, + 7453, + 7454, + 7455, + 7456, + 7457, + 7458, + 7459, + 7460, + 7461, + 7462, + 7463, + 7464, + 7465, + 7466, + 7467, + 7468, + 7469, + 7470, + 7471, + 7472, + 7473, + 7474, + 7475, + 7476, + 7477, + 7478, + 7479, + 7480, + 7481, + 7482, + 7483, + 7484, + 7485, + 7486, + 7487, + 7488, + 7489, + 7490, + 7491, + 7492, + 7493, + 7494, + 7495, + 7496, + 7497, + 7498, + 7499, + 7500, + 7501, + 7502, + 7503, + 7504, + 7505, + 7506, + 7507, + 7508, + 7509, + 7510, + 7511, + 7512, + 7513, + 7514, + 7515, + 7516, + 7517, + 7518, + 7519, + 7520, + 7521, + 7522, + 7523, + 7524, + 7525, + 7526, + 7527, + 7528, + 7529, + 7530, + 7531, + 7532, + 7533, + 7534, + 7535, + 7536, + 7537, + 7538, + 7539, + 7540, + 7541, + 7542, + 7543, + 7544, + 7545, + 7546, + 7547, + 7548, + 7549, + 7550, + 7551, + 7552, + 7553, + 7554, + 7555, + 7556, + 7557, + 7558, + 7559, + 7560, + 7561, + 7562, + 7563, + 7564, + 7565, + 7566, + 7567, + 7568, + 7569, + 7570, + 7571, + 7572, + 7573, + 7574, + 7575, + 7576, + 7577, + 7578, + 7579, + 7580, + 7581, + 7582, + 7583, + 7584, + 7585, + 7586, + 7587, + 7588, + 7589, + 7590, + 7591, + 7592, + 7593, + 7594, + 7595, + 7596, + 7597, + 7598, + 7599, + 7600, + 7601, + 7602, + 7603, + 7604, + 7605, + 7606, + 7607, + 7608, + 7609, + 7610, + 7611, + 7612, + 7613, + 7614, + 7615, + 7616, + 7617, + 7618, + 7619, + 7620, + 7621, + 7622, + 7623, + 7624, + 7625, + 7626, + 7627, + 7628, + 7629, + 7630, + 7631, + 7632, + 7633, + 7634, + 7635, + 7636, + 7637, + 7638, + 7639, + 7640, + 7641, + 7642, + 7643, + 7644, + 7645, + 7646, + 7647, + 7648, + 7649, + 7650, + 7651, + 7652, + 7653, + 7654, + 7655, + 7656, + 7657, + 7658, + 7659, + 7660, + 7661, + 7662, + 7663, + 7664, + 7665, + 7666, + 7667, + 7668, + 7669, + 7670, + 7671, + 7672, + 7673, + 7674, + 7675, + 7676, + 7677, + 7678, + 7679, + 7680, + 7681, + 7682, + 7683, + 7684, + 7685, + 7686, + 7687, + 7688, + 7689, + 7690, + 7691, + 7692, + 7693, + 7694, + 7695, + 7696, + 7697, + 7698, + 7699, + 7700, + 7701, + 7702, + 7703, + 7704, + 7705, + 7706, + 7707, + 7708, + 7709, + 7710, + 7711, + 7712, + 7713, + 7714, + 7715, + 7716, + 7717, + 7718, + 7719, + 7720, + 7721, + 7722, + 7723, + 7724, + 7725, + 7726, + 7727, + 7728, + 7729, + 7730, + 7731, + 7732, + 7733, + 7734, + 7735, + 7736, + 7737, + 7738, + 7739, + 7740, + 7741, + 7742, + 7743, + 7744, + 7745, + 7746, + 7747, + 7748, + 7749, + 7750, + 7751, + 7752, + 7753, + 7754, + 7755, + 7756, + 7757, + 7758, + 7759, + 7760, + 7761, + 7762, + 7763, + 7764, + 7765, + 7766, + 7767, + 7768, + 7769, + 7770, + 7771, + 7772, + 7773, + 7774, + 7775, + 7776, + 7777, + 7778, + 7779, + 7780, + 7781, + 7782, + 7783, + 7784, + 7785, + 7786, + 7787, + 7788, + 7789, + 7790, + 7791, + 7792, + 7793, + 7794, + 7795, + 7796, + 7797, + 7798, + 7799, + 7800, + 7801, + 7802, + 7803, + 7804, + 7805, + 7806, + 7807, + 7808, + 7809, + 7810, + 7811, + 7812, + 7813, + 7814, + 7815, + 7816, + 7817, + 7818, + 7819, + 7820, + 7821, + 7822, + 7823, + 7824, + 7825, + 7826, + 7827, + 7828, + 7829, + 7830, + 7831, + 7832, + 7833, + 7834, + 7835, + 7836, + 7837, + 7838, + 7839, + 7840, + 7841, + 7842, + 7843, + 7844, + 7845, + 7846, + 7847, + 7848, + 7849, + 7850, + 7851, + 7852, + 7853, + 7854, + 7855, + 7856, + 7857, + 7858, + 7859, + 7860, + 7861, + 7862, + 7863, + 7864, + 7865, + 7866, + 7867, + 7868, + 7869, + 7870, + 7871, + 7872, + 7873, + 7874, + 7875, + 7876, + 7877, + 7878, + 7879, + 7880, + 7881, + 7882, + 7883, + 7884, + 7885, + 7886, + 7887, + 7888, + 7889, + 7890, + 7891, + 7892, + 7893, + 7894, + 7895, + 7896, + 7897, + 7898, + 7899, + 7900, + 7901, + 7902, + 7903, + 7904, + 7905, + 7906, + 7907, + 7908, + 7909, + 7910, + 7911, + 7912, + 7913, + 7914, + 7915, + 7916, + 7917, + 7918, + 7919, + 7920, + 7921, + 7922, + 7923, + 7924, + 7925, + 7926, + 7927, + 7928, + 7929, + 7930, + 7931, + 7932, + 7933, + 7934, + 7935, + 7936, + 7937, + 7938, + 7939, + 7940, + 7941, + 7942, + 7943, + 7944, + 7945, + 7946, + 7947, + 7948, + 7949, + 7950, + 7951, + 7952, + 7953, + 7954, + 7955, + 7956, + 7957, + 7958, + 7959, + 7960, + 7961, + 7962, + 7963, + 7964, + 7965, + 7966, + 7967, + 7968, + 7969, + 7970, + 7971, + 7972, + 7973, + 7974, + 7975, + 7976, + 7977, + 7978, + 7979, + 7980, + 7981, + 7982, + 7983, + 7984, + 7985, + 7986, + 7987, + 7988, + 7989, + 7990, + 7991, + 7992, + 7993, + 7994, + 7995, + 7996, + 7997, + 7998, + 7999, + 8000, + 8001, + 8002, + 8003, + 8004, + 8005, + 8006, + 8007, + 8008, + 8009, + 8010, + 8011, + 8012, + 8013, + 8014, + 8015, + 8016, + 8017, + 8018, + 8019, + 8020, + 8021, + 8022, + 8023, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8032, + 8033, + 8034, + 8035, + 8036, + 8037, + 8038, + 8039, + 8040, + 8041, + 8042, + 8043, + 8044, + 8045, + 8046, + 8047, + 8048, + 8049, + 8050, + 8051, + 8052, + 8053, + 8054, + 8055, + 8056, + 8057, + 8058, + 8059, + 8060, + 8061, + 8062, + 8063, + 8064, + 8065, + 8066, + 8067, + 8068, + 8069, + 8070, + 8071, + 8072, + 8073, + 8074, + 8075, + 8076, + 8077, + 8078, + 8079, + 8080, + 8081, + 8082, + 8083, + 8084, + 8085, + 8086, + 8087, + 8088, + 8089, + 8090, + 8091, + 8092, + 8093, + 8094, + 8095, + 8096, + 8097, + 8098, + 8099, + 8100, + 8101, + 8102, + 8103, + 8104, + 8105, + 8106, + 8107, + 8108, + 8109, + 8110, + 8111, + 8112, + 8113, + 8114, + 8115, + 8116, + 8117, + 8118, + 8119, + 8120, + 8121, + 8122, + 8123, + 8124, + 8125, + 8126, + 8127, + 8128, + 8129, + 8130, + 8131, + 8132, + 8133, + 8134, + 8135, + 8136, + 8137, + 8138, + 8139, + 8140, + 8141, + 8142, + 8143, + 8144, + 8145, + 8146, + 8147, + 8148, + 8149, + 8150, + 8151, + 8152, + 8153, + 8154, + 8155, + 8156, + 8157, + 8158, + 8159, + 8160, + 8161, + 8162, + 8163, + 8164, + 8165, + 8166, + 8167, + 8168, + 8169, + 8170, + 8171, + 8172, + 8173, + 8174, + 8175, + 8176, + 8177, + 8178, + 8179, + 8180, + 8181, + 8182, + 8183, + 8184, + 8185, + 8186, + 8187, + 8188, + 8189, + 8190, + 8191, + 8192, + 8193, + 8194, + 8195, + 8196, + 8197, + 8198, + 8199, + 8200, + 8201, + 8202, + 8203, + 8204, + 8205, + 8206, + 8207, + 8208, + 8209, + 8210, + 8211, + 8212, + 8213, + 8214, + 8215, + 8216, + 8217, + 8218, + 8219, + 8220, + 8221, + 8222, + 8223, + 8224, + 8225, + 8226, + 8227, + 8228, + 8229, + 8230, + 8231, + 8232, + 8233, + 8234, + 8235, + 8236, + 8237, + 8238, + 8239, + 8240, + 8241, + 8242, + 8243, + 8244, + 8245, + 8246, + 8247, + 8248, + 8249, + 8250, + 8251, + 8252, + 8253, + 8254, + 8255, + 8256, + 8257, + 8258, + 8259, + 8260, + 8261, + 8262, + 8263, + 8264, + 8265, + 8266, + 8267, + 8268, + 8269, + 8270, + 8271, + 8272, + 8273, + 8274, + 8275, + 8276, + 8277, + 8278, + 8279, + 8280, + 8281, + 8282, + 8283, + 8284, + 8285, + 8286, + 8287, + 8288, + 8289, + 8290, + 8291, + 8292, + 8293, + 8294, + 8295, + 8296, + 8297, + 8298, + 8299, + 8300, + 8301, + 8302, + 8303, + 8304, + 8305, + 8306, + 8307, + 8308, + 8309, + 8310, + 8311, + 8312, + 8313, + 8314, + 8315, + 8316, + 8317, + 8318, + 8319, + 8320, + 8321, + 8322, + 8323, + 8324, + 8325, + 8326, + 8327, + 8328, + 8329, + 8330, + 8331, + 8332, + 8333, + 8334, + 8335, + 8336, + 8337, + 8338, + 8339, + 8340, + 8341, + 8342, + 8343, + 8344, + 8345, + 8346, + 8347, + 8348, + 8349, + 8350, + 8351, + 8352, + 8353, + 8354, + 8355, + 8356, + 8357, + 8358, + 8359, + 8360, + 8361, + 8362, + 8363, + 8364, + 8365, + 8366, + 8367, + 8368, + 8369, + 8370, + 8371, + 8372, + 8373, + 8374, + 8375, + 8376, + 8377, + 8378, + 8379, + 8380, + 8381, + 8382, + 8383, + 8384, + 8385, + 8386, + 8387, + 8388, + 8389, + 8390, + 8391, + 8392, + 8393, + 8394, + 8395, + 8396, + 8397, + 8398, + 8399, + 8400, + 8401, + 8402, + 8403, + 8404, + 8405, + 8406, + 8407, + 8408, + 8409, + 8410, + 8411, + 8412, + 8413, + 8414, + 8415, + 8416, + 8417, + 8418, + 8419, + 8420, + 8421, + 8422, + 8423, + 8424, + 8425, + 8426, + 8427, + 8428, + 8429, + 8430, + 8431, + 8432, + 8433, + 8434, + 8435, + 8436, + 8437, + 8438, + 8439, + 8440, + 8441, + 8442, + 8443, + 8444, + 8445, + 8446, + 8447, + 8448, + 8449, + 8450, + 8451, + 8452, + 8453, + 8454, + 8455, + 8456, + 8457, + 8458, + 8459, + 8460, + 8461, + 8462, + 8463, + 8464, + 8465, + 8466, + 8467, + 8468, + 8469, + 8470, + 8471, + 8472, + 8473, + 8474, + 8475, + 8476, + 8477, + 8478, + 8479, + 8480, + 8481, + 8482, + 8483, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8491, + 8492, + 8493, + 8494, + 8495, + 8496, + 8497, + 8498, + 8499, + 8500, + 8501, + 8502, + 8503, + 8504, + 8505, + 8506, + 8507, + 8508, + 8509, + 8510, + 8511, + 8512, + 8513, + 8514, + 8515, + 8516, + 8517, + 8518, + 8519, + 8520, + 8521, + 8522, + 8523, + 8524, + 8525, + 8526, + 8527, + 8528, + 8529, + 8530, + 8531, + 8532, + 8533, + 8534, + 8535, + 8536, + 8537, + 8538, + 8539, + 8540, + 8541, + 8542, + 8543, + 8544, + 8545, + 8546, + 8547, + 8548, + 8549, + 8550, + 8551, + 8552, + 8553, + 8554, + 8555, + 8556, + 8557, + 8558, + 8559, + 8560, + 8561, + 8562, + 8563, + 8564, + 8565, + 8566, + 8567, + 8568, + 8569, + 8570, + 8571, + 8572, + 8573, + 8574, + 8575, + 8576, + 8577, + 8578, + 8579, + 8580, + 8581, + 8582, + 8583, + 8584, + 8585, + 8586, + 8587, + 8588, + 8589, + 8590, + 8591, + 8592, + 8593, + 8594, + 8595, + 8596, + 8597, + 8598, + 8599, + 8600, + 8601, + 8602, + 8603, + 8604, + 8605, + 8606, + 8607, + 8608, + 8609, + 8610 + ], + "reason": "process stopped after the container memory limit was reached" +} \ No newline at end of file diff --git a/evidence/lab1-2/memory-experiment.png b/evidence/lab1-2/memory-experiment.png new file mode 100644 index 00000000..84ac64d3 Binary files /dev/null and b/evidence/lab1-2/memory-experiment.png differ diff --git a/evidence/lab1-2/memory-experiment.txt b/evidence/lab1-2/memory-experiment.txt new file mode 100644 index 00000000..6e9dfea9 --- /dev/null +++ b/evidence/lab1-2/memory-experiment.txt @@ -0,0 +1,8 @@ +$ python3 scripts/memory_experiment.py --image mtusi2026lab1-messenger:arm64 --memory 64m --max-messages 20000 --output evidence/memory-experiment.json --plot evidence/memory-experiment.png +memory_limit=64m +successful_messages=8610 +failed_requests=0 +OOMKilled=true +exit_code=137 +failure_time_seconds=5.9315 +plot=evidence/memory-experiment.png diff --git a/evidence/lab1-2/postgres/explain-analyze.txt b/evidence/lab1-2/postgres/explain-analyze.txt new file mode 100644 index 00000000..fbcb2165 --- /dev/null +++ b/evidence/lab1-2/postgres/explain-analyze.txt @@ -0,0 +1,64 @@ +# EXPLAIN (ANALYZE, BUFFERS) + +## history_first_page + +Limit (cost=0.29..5.40 rows=51 width=73) (actual time=0.007..0.012 rows=51.00 loops=1) + Buffers: shared hit=4 + -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.29..1002.85 rows=10000 width=73) (actual time=0.006..0.009 rows=51.00 loops=1) + Index Cond: (chat_id = '01a0f77e-9381-736f-9a2b-af3b1e1e87fd'::uuid) + Index Searches: 1 + Buffers: shared hit=4 +Planning: + Buffers: shared hit=44 +Planning Time: 0.147 ms +Execution Time: 0.019 ms + +## history_next_page + +Limit (cost=0.29..7.71 rows=51 width=73) (actual time=0.004..0.010 rows=51.00 loops=1) + Buffers: shared hit=4 + -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.29..524.01 rows=3599 width=73) (actual time=0.004..0.008 rows=51.00 loops=1) + Index Cond: ((chat_id = '01a0f77e-9381-736f-9a2b-af3b1e1e87fd'::uuid) AND (ROW(created_at, id) > ROW('2026-10-01 11:44:23.146682+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))) + Index Searches: 1 + Buffers: shared hit=4 +Planning Time: 0.021 ms +Execution Time: 0.027 ms + +## chats_list_for_member + +Limit (cost=0.57..446.14 rows=51 width=70) (actual time=0.018..0.081 rows=51.00 loops=1) + Buffers: shared hit=309 + -> Nested Loop (cost=0.57..87375.78 rows=10001 width=70) (actual time=0.018..0.079 rows=51.00 loops=1) + Buffers: shared hit=309 + -> Index Scan using chats_created_at_id_idx on chats c (cost=0.29..554.24 rows=10001 width=38) (actual time=0.004..0.007 rows=51.00 loops=1) + Index Searches: 1 + Buffers: shared hit=3 + -> Index Only Scan using chat_members_user_id_chat_id_idx on chat_members visible (cost=0.29..0.36 rows=1 width=16) (actual time=0.001..0.001 rows=1.00 loops=51) + Index Cond: ((user_id = '01a0f77e-937a-7d1e-aacb-8909b9a65779'::uuid) AND (chat_id = c.id)) + Heap Fetches: 51 + Index Searches: 51 + Buffers: shared hit=153 + SubPlan 1 + -> Aggregate (cost=8.31..8.32 rows=1 width=32) (actual time=0.001..0.001 rows=1.00 loops=51) + Buffers: shared hit=153 + -> Index Only Scan using chat_members_pkey on chat_members m (cost=0.29..8.30 rows=1 width=16) (actual time=0.000..0.000 rows=1.00 loops=51) + Index Cond: (chat_id = c.id) + Heap Fetches: 51 + Index Searches: 51 + Buffers: shared hit=153 +Planning: + Buffers: shared hit=95 +Planning Time: 0.250 ms +Execution Time: 0.098 ms + +## user_by_username + +Index Scan using users_username_key on users (cost=0.29..8.30 rows=1 width=42) (actual time=0.005..0.005 rows=1.00 loops=1) + Index Cond: (username = 'bulk_5000'::text) + Index Searches: 1 + Buffers: shared hit=3 +Planning: + Buffers: shared hit=43 +Planning Time: 0.085 ms +Execution Time: 0.008 ms + diff --git a/evidence/lab1-2/quality.txt b/evidence/lab1-2/quality.txt new file mode 100644 index 00000000..300529d2 --- /dev/null +++ b/evidence/lab1-2/quality.txt @@ -0,0 +1,43 @@ +$ make check +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_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. + +$ go vet ./... + +$ make lint +/Users/vladislav/Projects/mtusi2026lab1-fork/bin/golangci-lint run -v +level=info msg="golangci-lint has version 2.13.2 built with go1.27.0 from (unknown, modified: ?, mod sum: \"h1:bCyq3E4vo9qwzifjpzJqYndEt7Ncva80qkk8G2B4TXU=\") on (unknown)" +level=info msg="[config_reader] Config search paths: [./ /Users/vladislav/Projects/mtusi2026lab1-fork /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.97475ms: 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|files|name|types_sizes|deps|exports_file|imports) took 122.006042ms" +level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 4.792166ms" +level=info msg="[linters_context/goanalysis] analyzers took 0s with no stages" +level=info msg="[runner/exclusion_rules] Skipped 2 issues by rules: [Path: \"_test\\\\.go\", Linters: \"gosec, prealloc, forcetypeassert, unparam\"]" +level=info msg="[runner] Issues before processing: 280, after processing: 0" +level=info msg="[runner] Processors filtering stat (in/out): exclusion_paths: 280/280, invalid_issue: 280/280, path_absoluter: 280/280, filename_unadjuster: 280/280, generated_file_filter: 280/100, exclusion_rules: 100/0, cgo: 280/280, path_relativity: 280/280" +level=info msg="[runner] processing took 607.916µs with stages: generated_file_filter: 420.959µs, exclusion_rules: 86.124µs, path_relativity: 83.917µs, sort_results: 4.458µs, invalid_issue: 4.292µs, cgo: 3.959µs, path_absoluter: 1.417µs, filename_unadjuster: 792ns, max_same_issues: 582ns, nolint_filter: 457ns, fixer: 292ns, exclusion_paths: 167ns, path_prettifier: 125ns, source_code: 125ns, path_shortener: 124ns, uniq_by_line: 42ns, severity-rules: 42ns, max_per_file_from_linter: 42ns, max_from_linter: 0s, diff: 0s" +level=info msg="[runner] linters took 422.737625ms with stages: goanalysis_metalinter: 422.101875ms" +0 issues. +level=info msg="File cache stats: 0 entries of total size 0B" +level=info msg="Memory: 7 samples, avg is 87.0MB, max is 111.2MB" +level=info msg="Execution took 555.972916ms" + +$ make unit-test +go test -race -shuffle=on -count=1 -timeout=5m ./... +? mtusi-messenger/cmd/messenger [no test files] +ok mtusi-messenger/internal/config 1.838s +ok mtusi-messenger/internal/domain 1.498s +ok mtusi-messenger/internal/logger 2.150s +ok mtusi-messenger/internal/service/chat 2.470s +? mtusi-messenger/internal/service/chat/mocks [no test files] +ok mtusi-messenger/internal/service/message 2.797s +? mtusi-messenger/internal/service/message/mocks [no test files] +ok mtusi-messenger/internal/service/user 3.474s +? mtusi-messenger/internal/service/user/mocks [no test files] +ok mtusi-messenger/internal/storage/memory 3.159s +ok mtusi-messenger/internal/transport/rest 3.863s +? mtusi-messenger/internal/transport/rest/oas [no test files] diff --git a/evidence/lab1-2/restart.txt b/evidence/lab1-2/restart.txt new file mode 100644 index 00000000..f695225c --- /dev/null +++ b/evidence/lab1-2/restart.txt @@ -0,0 +1,10 @@ +$ docker stop mtusi2026lab1-messenger-lab1 +$ docker run -d --name mtusi2026lab1-messenger-lab1 -p 127.0.0.1:8080:8080 mtusi2026lab1-messenger:verify +$ curl -i -H "X-User-Id: " http://127.0.0.1:8080/api/v1/users/me +HTTP/1.1 401 Unauthorized +Content-Type: application/json; charset=utf-8 +X-Request-Id: eadf9c21-d861-4c2c-8e76-46f086d27a11 +Date: Thu, 24 Sep 2026 20:13:02 GMT +Content-Length: 110 + +{"error":{"code":"unauthorized","message":"Unauthorized","request_id":"eadf9c21-d861-4c2c-8e76-46f086d27a11"}} \ No newline at end of file diff --git a/evidence/lab1-2/sigterm.txt b/evidence/lab1-2/sigterm.txt new file mode 100644 index 00000000..65cf8c63 --- /dev/null +++ b/evidence/lab1-2/sigterm.txt @@ -0,0 +1,7 @@ +$ docker kill --signal=TERM mtusi2026lab1-messenger-lab1 +$ docker wait mtusi2026lab1-messenger-lab1 +0 +elapsed_ms=114 +{"level":"info","time":"2026-09-24T20:14:19.192628563Z","msg":"server started","addr":"0.0.0.0:8080"} +{"level":"info","time":"2026-09-24T20:14:20.186231067Z","msg":"shutdown signal received","timeout":"10s"} +{"level":"info","time":"2026-09-24T20:14:20.188996621Z","msg":"server stopped"} diff --git a/evidence/lab1-2/track1-benchmark/baseline-storage-benchmark.txt b/evidence/lab1-2/track1-benchmark/baseline-storage-benchmark.txt new file mode 100644 index 00000000..2565d062 --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/baseline-storage-benchmark.txt @@ -0,0 +1,21 @@ +goos: darwin +goarch: arm64 +pkg: mtusi-messenger/internal/storage/memory +cpu: Apple M5 Pro +BenchmarkMessageCreate/history=1000-18 3822346 309.5 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 3904586 307.6 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 3889698 308.1 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 3892981 308.2 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 3888345 308.3 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 3578911 335.4 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 3570348 335.9 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 3581305 335.0 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 3573933 336.0 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 3563053 336.4 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 3425475 349.8 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 3435330 349.1 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 3438290 349.3 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 3420394 349.8 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 3420736 350.1 ns/op 16 B/op 1 allocs/op +PASS +ok mtusi-messenger/internal/storage/memory 18.237s diff --git a/evidence/lab1-2/track1-benchmark/baseline.json b/evidence/lab1-2/track1-benchmark/baseline.json new file mode 100644 index 00000000..32d17dac --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/baseline.json @@ -0,0 +1,128 @@ +[ + { + "history": 100, + "concurrency": 1, + "duration_seconds": 2.002, + "successful_requests": 526, + "failed_requests": 0, + "rps": 262.791, + "p50_ms": 3.378, + "p95_ms": 4.12, + "p99_ms": 16.979, + "rss_min_kib": 18880, + "rss_max_kib": 22816, + "rss_delta_kib": 3936 + }, + { + "history": 100, + "concurrency": 4, + "duration_seconds": 2.002, + "successful_requests": 1450, + "failed_requests": 0, + "rps": 724.134, + "p50_ms": 4.18, + "p95_ms": 16.695, + "p99_ms": 21.604, + "rss_min_kib": 20512, + "rss_max_kib": 24208, + "rss_delta_kib": 3696 + }, + { + "history": 100, + "concurrency": 16, + "duration_seconds": 2.079, + "successful_requests": 2315, + "failed_requests": 0, + "rps": 1113.309, + "p50_ms": 8.563, + "p95_ms": 29.584, + "p99_ms": 93.023, + "rss_min_kib": 18880, + "rss_max_kib": 25296, + "rss_delta_kib": 6416 + }, + { + "history": 1000, + "concurrency": 1, + "duration_seconds": 2.007, + "successful_requests": 478, + "failed_requests": 0, + "rps": 238.14, + "p50_ms": 3.477, + "p95_ms": 10.892, + "p99_ms": 20.404, + "rss_min_kib": 23120, + "rss_max_kib": 23584, + "rss_delta_kib": 464 + }, + { + "history": 1000, + "concurrency": 4, + "duration_seconds": 2.003, + "successful_requests": 1380, + "failed_requests": 0, + "rps": 688.971, + "p50_ms": 4.197, + "p95_ms": 17.189, + "p99_ms": 28.458, + "rss_min_kib": 23344, + "rss_max_kib": 24592, + "rss_delta_kib": 1248 + }, + { + "history": 1000, + "concurrency": 16, + "duration_seconds": 2.005, + "successful_requests": 2298, + "failed_requests": 0, + "rps": 1146.063, + "p50_ms": 8.474, + "p95_ms": 29.384, + "p99_ms": 92.528, + "rss_min_kib": 23232, + "rss_max_kib": 26272, + "rss_delta_kib": 3040 + }, + { + "history": 5000, + "concurrency": 1, + "duration_seconds": 2.001, + "successful_requests": 494, + "failed_requests": 0, + "rps": 246.902, + "p50_ms": 3.414, + "p95_ms": 10.767, + "p99_ms": 18.996, + "rss_min_kib": 25248, + "rss_max_kib": 25296, + "rss_delta_kib": 48 + }, + { + "history": 5000, + "concurrency": 4, + "duration_seconds": 2.004, + "successful_requests": 1398, + "failed_requests": 0, + "rps": 697.712, + "p50_ms": 4.147, + "p95_ms": 17.142, + "p99_ms": 26.446, + "rss_min_kib": 24816, + "rss_max_kib": 25104, + "rss_delta_kib": 288 + }, + { + "history": 5000, + "concurrency": 16, + "duration_seconds": 2.006, + "successful_requests": 2261, + "failed_requests": 0, + "rps": 1126.862, + "p50_ms": 8.635, + "p95_ms": 24.133, + "p99_ms": 93.225, + "rss_min_kib": 25200, + "rss_max_kib": 26752, + "rss_delta_kib": 1552 + } +] diff --git a/evidence/lab1-2/track1-benchmark/comparison.json b/evidence/lab1-2/track1-benchmark/comparison.json new file mode 100644 index 00000000..2718ba4e --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/comparison.json @@ -0,0 +1,110 @@ +[ + { + "history": 100, + "concurrency": 1, + "rps_before": 262.791, + "p95_ms_before": 4.12, + "p99_ms_before": 16.979, + "rss_max_kib_before": 22816, + "rps_after": 265.189, + "p95_ms_after": 4.276, + "p99_ms_after": 17.123, + "rss_max_kib_after": 22736 + }, + { + "history": 100, + "concurrency": 4, + "rps_before": 724.134, + "p95_ms_before": 16.695, + "p99_ms_before": 21.604, + "rss_max_kib_before": 24208, + "rps_after": 720.55, + "p95_ms_after": 16.868, + "p99_ms_after": 21.043, + "rss_max_kib_after": 24128 + }, + { + "history": 100, + "concurrency": 16, + "rps_before": 1113.309, + "p95_ms_before": 29.584, + "p99_ms_before": 93.023, + "rss_max_kib_before": 25296, + "rps_after": 1125.923, + "p95_ms_after": 29.142, + "p99_ms_after": 91.221, + "rss_max_kib_after": 25216 + }, + { + "history": 1000, + "concurrency": 1, + "rps_before": 238.14, + "p95_ms_before": 10.892, + "p99_ms_before": 20.404, + "rss_max_kib_before": 23584, + "rps_after": 237.68, + "p95_ms_after": 11.279, + "p99_ms_after": 19.675, + "rss_max_kib_after": 23504 + }, + { + "history": 1000, + "concurrency": 4, + "rps_before": 688.971, + "p95_ms_before": 17.189, + "p99_ms_before": 28.458, + "rss_max_kib_before": 24592, + "rps_after": 667.05, + "p95_ms_after": 17.243, + "p99_ms_after": 29.938, + "rss_max_kib_after": 25280 + }, + { + "history": 1000, + "concurrency": 16, + "rps_before": 1146.063, + "p95_ms_before": 29.384, + "p99_ms_before": 92.528, + "rss_max_kib_before": 26272, + "rps_after": 1102.581, + "p95_ms_after": 30.252, + "p99_ms_after": 93.912, + "rss_max_kib_after": 25200 + }, + { + "history": 5000, + "concurrency": 1, + "rps_before": 246.902, + "p95_ms_before": 10.767, + "p99_ms_before": 18.996, + "rss_max_kib_before": 25296, + "rps_after": 241.241, + "p95_ms_after": 10.897, + "p99_ms_after": 18.681, + "rss_max_kib_after": 25456 + }, + { + "history": 5000, + "concurrency": 4, + "rps_before": 697.712, + "p95_ms_before": 17.142, + "p99_ms_before": 26.446, + "rss_max_kib_before": 25104, + "rps_after": 685.839, + "p95_ms_after": 17.418, + "p99_ms_after": 26.618, + "rss_max_kib_after": 25376 + }, + { + "history": 5000, + "concurrency": 16, + "rps_before": 1126.862, + "p95_ms_before": 24.133, + "p99_ms_before": 93.225, + "rss_max_kib_before": 26752, + "rps_after": 1079.866, + "p95_ms_after": 31.525, + "p99_ms_after": 94.709, + "rss_max_kib_after": 26640 + } +] diff --git a/evidence/lab1-2/track1-benchmark/go-baseline/results.json b/evidence/lab1-2/track1-benchmark/go-baseline/results.json new file mode 100644 index 00000000..322933b8 --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/go-baseline/results.json @@ -0,0 +1,211 @@ +{ + "mode": "baseline", + "command": [ + "go", + "run", + "-overlay", + "/var/folders/jd/nsgkfx9s75xb84909646j0zm0000gn/T/messenger-track1-58qai1az/overlay.json", + "./cmd/messenger" + ], + "go_version": "go version go1.27.1 darwin/arm64", + "os_arch": [ + "darwin", + "arm64" + ], + "requests_per_case": 100000, + "rss_source": "ps RSS of go run child executable, KiB; sampled every 100 ms", + "rows": [ + { + "history": 1000, + "concurrency": 1, + "duration_seconds": 13.634, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7334.409, + "p50_ms": 0.13, + "p95_ms": 0.146, + "p99_ms": 0.186, + "rss_min_kib": 23616, + "rss_max_kib": 59968, + "rss_delta_kib": 36352 + }, + { + "history": 1000, + "concurrency": 4, + "duration_seconds": 11.333, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 8823.924, + "p50_ms": 0.42, + "p95_ms": 0.654, + "p99_ms": 0.869, + "rss_min_kib": 23424, + "rss_max_kib": 58464, + "rss_delta_kib": 35040 + }, + { + "history": 1000, + "concurrency": 16, + "duration_seconds": 13.63, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7336.995, + "p50_ms": 2.021, + "p95_ms": 3.514, + "p99_ms": 4.631, + "rss_min_kib": 23520, + "rss_max_kib": 66544, + "rss_delta_kib": 43024 + }, + { + "history": 1000, + "concurrency": 32, + "duration_seconds": 13.538, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7386.656, + "p50_ms": 4.022, + "p95_ms": 7.026, + "p99_ms": 8.953, + "rss_min_kib": 23856, + "rss_max_kib": 65616, + "rss_delta_kib": 41760 + }, + { + "history": 10000, + "concurrency": 1, + "duration_seconds": 14.008, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7138.887, + "p50_ms": 0.13, + "p95_ms": 0.149, + "p99_ms": 0.21, + "rss_min_kib": 25984, + "rss_max_kib": 70416, + "rss_delta_kib": 44432 + }, + { + "history": 10000, + "concurrency": 4, + "duration_seconds": 11.057, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 9043.732, + "p50_ms": 0.406, + "p95_ms": 0.626, + "p99_ms": 0.841, + "rss_min_kib": 26272, + "rss_max_kib": 67376, + "rss_delta_kib": 41104 + }, + { + "history": 10000, + "concurrency": 16, + "duration_seconds": 13.436, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7442.895, + "p50_ms": 1.977, + "p95_ms": 3.485, + "p99_ms": 4.703, + "rss_min_kib": 26576, + "rss_max_kib": 75616, + "rss_delta_kib": 49040 + }, + { + "history": 10000, + "concurrency": 32, + "duration_seconds": 13.546, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7382.485, + "p50_ms": 4.01, + "p95_ms": 7.051, + "p99_ms": 9.096, + "rss_min_kib": 25456, + "rss_max_kib": 77792, + "rss_delta_kib": 52336 + }, + { + "history": 50000, + "concurrency": 1, + "duration_seconds": 13.969, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7158.653, + "p50_ms": 0.13, + "p95_ms": 0.149, + "p99_ms": 0.211, + "rss_min_kib": 40080, + "rss_max_kib": 81072, + "rss_delta_kib": 40992 + }, + { + "history": 50000, + "concurrency": 4, + "duration_seconds": 11.014, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 9079.212, + "p50_ms": 0.404, + "p95_ms": 0.623, + "p99_ms": 0.823, + "rss_min_kib": 40448, + "rss_max_kib": 77088, + "rss_delta_kib": 36640 + }, + { + "history": 50000, + "concurrency": 16, + "duration_seconds": 13.479, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7419.068, + "p50_ms": 1.99, + "p95_ms": 3.471, + "p99_ms": 4.694, + "rss_min_kib": 42336, + "rss_max_kib": 79552, + "rss_delta_kib": 37216 + }, + { + "history": 50000, + "concurrency": 32, + "duration_seconds": 13.464, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7427.333, + "p50_ms": 3.99, + "p95_ms": 7.049, + "p99_ms": 9.007, + "rss_min_kib": 40336, + "rss_max_kib": 89552, + "rss_delta_kib": 49216 + } + ] +} diff --git a/evidence/lab1-2/track1-benchmark/go-comparison.json b/evidence/lab1-2/track1-benchmark/go-comparison.json new file mode 100644 index 00000000..de948fc4 --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/go-comparison.json @@ -0,0 +1,266 @@ +[ + { + "history": 1000, + "concurrency": 1, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.634, + "duration_seconds_after": 13.919, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7334.409, + "rps_after": 7184.594, + "p50_ms_before": 0.13, + "p50_ms_after": 0.129, + "p95_ms_before": 0.146, + "p95_ms_after": 0.15, + "p99_ms_before": 0.186, + "p99_ms_after": 0.231, + "rss_max_kib_before": 59968, + "rss_max_kib_after": 62048 + }, + { + "history": 1000, + "concurrency": 4, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 11.333, + "duration_seconds_after": 11.115, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 8823.924, + "rps_after": 8996.523, + "p50_ms_before": 0.42, + "p50_ms_after": 0.407, + "p95_ms_before": 0.654, + "p95_ms_after": 0.632, + "p99_ms_before": 0.869, + "p99_ms_after": 0.867, + "rss_max_kib_before": 58464, + "rss_max_kib_after": 61040 + }, + { + "history": 1000, + "concurrency": 16, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.63, + "duration_seconds_after": 13.364, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7336.995, + "rps_after": 7482.719, + "p50_ms_before": 2.021, + "p50_ms_after": 1.977, + "p95_ms_before": 3.514, + "p95_ms_after": 3.445, + "p99_ms_before": 4.631, + "p99_ms_after": 4.577, + "rss_max_kib_before": 66544, + "rss_max_kib_after": 61328 + }, + { + "history": 1000, + "concurrency": 32, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.538, + "duration_seconds_after": 13.547, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7386.656, + "rps_after": 7381.5, + "p50_ms_before": 4.022, + "p50_ms_after": 4.016, + "p95_ms_before": 7.026, + "p95_ms_after": 7.058, + "p99_ms_before": 8.953, + "p99_ms_after": 9.054, + "rss_max_kib_before": 65616, + "rss_max_kib_after": 68768 + }, + { + "history": 10000, + "concurrency": 1, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 14.008, + "duration_seconds_after": 13.984, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7138.887, + "rps_after": 7150.931, + "p50_ms_before": 0.13, + "p50_ms_after": 0.131, + "p95_ms_before": 0.149, + "p95_ms_after": 0.146, + "p99_ms_before": 0.21, + "p99_ms_after": 0.187, + "rss_max_kib_before": 70416, + "rss_max_kib_after": 68128 + }, + { + "history": 10000, + "concurrency": 4, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 11.057, + "duration_seconds_after": 11.046, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 9043.732, + "rps_after": 9052.965, + "p50_ms_before": 0.406, + "p50_ms_after": 0.404, + "p95_ms_before": 0.626, + "p95_ms_after": 0.628, + "p99_ms_before": 0.841, + "p99_ms_after": 0.859, + "rss_max_kib_before": 67376, + "rss_max_kib_after": 71632 + }, + { + "history": 10000, + "concurrency": 16, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.436, + "duration_seconds_after": 13.439, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7442.895, + "rps_after": 7440.817, + "p50_ms_before": 1.977, + "p50_ms_after": 1.989, + "p95_ms_before": 3.485, + "p95_ms_after": 3.468, + "p99_ms_before": 4.703, + "p99_ms_after": 4.701, + "rss_max_kib_before": 75616, + "rss_max_kib_after": 73712 + }, + { + "history": 10000, + "concurrency": 32, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.546, + "duration_seconds_after": 13.478, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7382.485, + "rps_after": 7419.326, + "p50_ms_before": 4.01, + "p50_ms_after": 3.984, + "p95_ms_before": 7.051, + "p95_ms_after": 7.049, + "p99_ms_before": 9.096, + "p99_ms_after": 9.096, + "rss_max_kib_before": 77792, + "rss_max_kib_after": 70976 + }, + { + "history": 50000, + "concurrency": 1, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.969, + "duration_seconds_after": 13.863, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7158.653, + "rps_after": 7213.61, + "p50_ms_before": 0.13, + "p50_ms_after": 0.129, + "p95_ms_before": 0.149, + "p95_ms_after": 0.145, + "p99_ms_before": 0.211, + "p99_ms_after": 0.191, + "rss_max_kib_before": 81072, + "rss_max_kib_after": 81824 + }, + { + "history": 50000, + "concurrency": 4, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 11.014, + "duration_seconds_after": 11.066, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 9079.212, + "rps_after": 9036.335, + "p50_ms_before": 0.404, + "p50_ms_after": 0.405, + "p95_ms_before": 0.623, + "p95_ms_after": 0.63, + "p99_ms_before": 0.823, + "p99_ms_after": 0.842, + "rss_max_kib_before": 77088, + "rss_max_kib_after": 86832 + }, + { + "history": 50000, + "concurrency": 16, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.479, + "duration_seconds_after": 13.416, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7419.068, + "rps_after": 7453.53, + "p50_ms_before": 1.99, + "p50_ms_after": 1.978, + "p95_ms_before": 3.471, + "p95_ms_after": 3.455, + "p99_ms_before": 4.694, + "p99_ms_after": 4.688, + "rss_max_kib_before": 79552, + "rss_max_kib_after": 89824 + }, + { + "history": 50000, + "concurrency": 32, + "requested_requests": 100000, + "warmup_requests": 100, + "duration_seconds_before": 13.464, + "duration_seconds_after": 13.542, + "successful_requests_before": 100000, + "successful_requests_after": 100000, + "failed_requests_before": 0, + "failed_requests_after": 0, + "rps_before": 7427.333, + "rps_after": 7384.536, + "p50_ms_before": 3.99, + "p50_ms_after": 4.005, + "p95_ms_before": 7.049, + "p95_ms_after": 7.084, + "p99_ms_before": 9.007, + "p99_ms_after": 9.203, + "rss_max_kib_before": 89552, + "rss_max_kib_after": 80128 + } +] diff --git a/evidence/lab1-2/track1-benchmark/go-optimized/results.json b/evidence/lab1-2/track1-benchmark/go-optimized/results.json new file mode 100644 index 00000000..abd5f1cf --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/go-optimized/results.json @@ -0,0 +1,209 @@ +{ + "mode": "optimized", + "command": [ + "go", + "run", + "./cmd/messenger" + ], + "go_version": "go version go1.27.1 darwin/arm64", + "os_arch": [ + "darwin", + "arm64" + ], + "requests_per_case": 100000, + "rss_source": "ps RSS of go run child executable, KiB; sampled every 100 ms", + "rows": [ + { + "history": 1000, + "concurrency": 1, + "duration_seconds": 13.919, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7184.594, + "p50_ms": 0.129, + "p95_ms": 0.15, + "p99_ms": 0.231, + "rss_min_kib": 23504, + "rss_max_kib": 62048, + "rss_delta_kib": 38544 + }, + { + "history": 1000, + "concurrency": 4, + "duration_seconds": 11.115, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 8996.523, + "p50_ms": 0.407, + "p95_ms": 0.632, + "p99_ms": 0.867, + "rss_min_kib": 23744, + "rss_max_kib": 61040, + "rss_delta_kib": 37296 + }, + { + "history": 1000, + "concurrency": 16, + "duration_seconds": 13.364, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7482.719, + "p50_ms": 1.977, + "p95_ms": 3.445, + "p99_ms": 4.577, + "rss_min_kib": 22480, + "rss_max_kib": 61328, + "rss_delta_kib": 38848 + }, + { + "history": 1000, + "concurrency": 32, + "duration_seconds": 13.547, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7381.5, + "p50_ms": 4.016, + "p95_ms": 7.058, + "p99_ms": 9.054, + "rss_min_kib": 23152, + "rss_max_kib": 68768, + "rss_delta_kib": 45616 + }, + { + "history": 10000, + "concurrency": 1, + "duration_seconds": 13.984, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7150.931, + "p50_ms": 0.131, + "p95_ms": 0.146, + "p99_ms": 0.187, + "rss_min_kib": 25936, + "rss_max_kib": 68128, + "rss_delta_kib": 42192 + }, + { + "history": 10000, + "concurrency": 4, + "duration_seconds": 11.046, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 9052.965, + "p50_ms": 0.404, + "p95_ms": 0.628, + "p99_ms": 0.859, + "rss_min_kib": 26448, + "rss_max_kib": 71632, + "rss_delta_kib": 45184 + }, + { + "history": 10000, + "concurrency": 16, + "duration_seconds": 13.439, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7440.817, + "p50_ms": 1.989, + "p95_ms": 3.468, + "p99_ms": 4.701, + "rss_min_kib": 26480, + "rss_max_kib": 73712, + "rss_delta_kib": 47232 + }, + { + "history": 10000, + "concurrency": 32, + "duration_seconds": 13.478, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7419.326, + "p50_ms": 3.984, + "p95_ms": 7.049, + "p99_ms": 9.096, + "rss_min_kib": 26176, + "rss_max_kib": 70976, + "rss_delta_kib": 44800 + }, + { + "history": 50000, + "concurrency": 1, + "duration_seconds": 13.863, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7213.61, + "p50_ms": 0.129, + "p95_ms": 0.145, + "p99_ms": 0.191, + "rss_min_kib": 40592, + "rss_max_kib": 81824, + "rss_delta_kib": 41232 + }, + { + "history": 50000, + "concurrency": 4, + "duration_seconds": 11.066, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 9036.335, + "p50_ms": 0.405, + "p95_ms": 0.63, + "p99_ms": 0.842, + "rss_min_kib": 42944, + "rss_max_kib": 86832, + "rss_delta_kib": 43888 + }, + { + "history": 50000, + "concurrency": 16, + "duration_seconds": 13.416, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7453.53, + "p50_ms": 1.978, + "p95_ms": 3.455, + "p99_ms": 4.688, + "rss_min_kib": 40768, + "rss_max_kib": 89824, + "rss_delta_kib": 49056 + }, + { + "history": 50000, + "concurrency": 32, + "duration_seconds": 13.542, + "requested_requests": 100000, + "warmup_requests": 100, + "successful_requests": 100000, + "failed_requests": 0, + "rps": 7384.536, + "p50_ms": 4.005, + "p95_ms": 7.084, + "p99_ms": 9.203, + "rss_min_kib": 42848, + "rss_max_kib": 80128, + "rss_delta_kib": 37280 + } + ] +} diff --git a/evidence/lab1-2/track1-benchmark/optimized-storage-benchmark.txt b/evidence/lab1-2/track1-benchmark/optimized-storage-benchmark.txt new file mode 100644 index 00000000..0122d9de --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/optimized-storage-benchmark.txt @@ -0,0 +1,21 @@ +goos: darwin +goarch: arm64 +pkg: mtusi-messenger/internal/storage/memory +cpu: Apple M5 Pro +BenchmarkMessageCreate/history=1000-18 4830075 243.3 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 4958697 241.4 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 4984602 241.8 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 4976372 241.8 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=1000-18 4962843 241.7 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 4967149 241.8 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 4946976 242.1 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 4950400 242.3 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 4938321 242.4 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=10000-18 4955269 242.2 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 4943572 242.0 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 4969927 242.4 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 4931466 242.5 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 4948990 242.8 ns/op 16 B/op 1 allocs/op +BenchmarkMessageCreate/history=50000-18 4953249 242.6 ns/op 16 B/op 1 allocs/op +PASS +ok mtusi-messenger/internal/storage/memory 18.240s diff --git a/evidence/lab1-2/track1-benchmark/optimized.json b/evidence/lab1-2/track1-benchmark/optimized.json new file mode 100644 index 00000000..973b960c --- /dev/null +++ b/evidence/lab1-2/track1-benchmark/optimized.json @@ -0,0 +1,128 @@ +[ + { + "history": 100, + "concurrency": 1, + "duration_seconds": 2.002, + "successful_requests": 531, + "failed_requests": 0, + "rps": 265.189, + "p50_ms": 3.355, + "p95_ms": 4.276, + "p99_ms": 17.123, + "rss_min_kib": 18800, + "rss_max_kib": 22736, + "rss_delta_kib": 3936 + }, + { + "history": 100, + "concurrency": 4, + "duration_seconds": 2.005, + "successful_requests": 1445, + "failed_requests": 0, + "rps": 720.55, + "p50_ms": 4.197, + "p95_ms": 16.868, + "p99_ms": 21.043, + "rss_min_kib": 20768, + "rss_max_kib": 24128, + "rss_delta_kib": 3360 + }, + { + "history": 100, + "concurrency": 16, + "duration_seconds": 2.012, + "successful_requests": 2265, + "failed_requests": 0, + "rps": 1125.923, + "p50_ms": 8.851, + "p95_ms": 29.142, + "p99_ms": 91.221, + "rss_min_kib": 20672, + "rss_max_kib": 25216, + "rss_delta_kib": 4544 + }, + { + "history": 1000, + "concurrency": 1, + "duration_seconds": 2.011, + "successful_requests": 478, + "failed_requests": 0, + "rps": 237.68, + "p50_ms": 3.467, + "p95_ms": 11.279, + "p99_ms": 19.675, + "rss_min_kib": 23264, + "rss_max_kib": 23504, + "rss_delta_kib": 240 + }, + { + "history": 1000, + "concurrency": 4, + "duration_seconds": 2.004, + "successful_requests": 1337, + "failed_requests": 0, + "rps": 667.05, + "p50_ms": 4.249, + "p95_ms": 17.243, + "p99_ms": 29.938, + "rss_min_kib": 23264, + "rss_max_kib": 25280, + "rss_delta_kib": 2016 + }, + { + "history": 1000, + "concurrency": 16, + "duration_seconds": 2.005, + "successful_requests": 2211, + "failed_requests": 0, + "rps": 1102.581, + "p50_ms": 8.818, + "p95_ms": 30.252, + "p99_ms": 93.912, + "rss_min_kib": 23424, + "rss_max_kib": 25200, + "rss_delta_kib": 1776 + }, + { + "history": 5000, + "concurrency": 1, + "duration_seconds": 2.002, + "successful_requests": 483, + "failed_requests": 0, + "rps": 241.241, + "p50_ms": 3.466, + "p95_ms": 10.897, + "p99_ms": 18.681, + "rss_min_kib": 25456, + "rss_max_kib": 25456, + "rss_delta_kib": 0 + }, + { + "history": 5000, + "concurrency": 4, + "duration_seconds": 2.003, + "successful_requests": 1374, + "failed_requests": 0, + "rps": 685.839, + "p50_ms": 4.207, + "p95_ms": 17.418, + "p99_ms": 26.618, + "rss_min_kib": 24304, + "rss_max_kib": 25376, + "rss_delta_kib": 1072 + }, + { + "history": 5000, + "concurrency": 16, + "duration_seconds": 2.002, + "successful_requests": 2162, + "failed_requests": 0, + "rps": 1079.866, + "p50_ms": 8.939, + "p95_ms": 31.525, + "p99_ms": 94.709, + "rss_min_kib": 24848, + "rss_max_kib": 26640, + "rss_delta_kib": 1792 + } +] diff --git a/evidence/lb-readiness.txt b/evidence/lb-readiness.txt new file mode 100644 index 00000000..00056343 --- /dev/null +++ b/evidence/lb-readiness.txt @@ -0,0 +1,31 @@ +# LB excludes a not-ready but reachable replica (lab3) +# generated: 2026-10-16T14:02:26Z +# lb: haproxy:3.2-alpine + +## 1. baseline: requests through LB by replica + 18 52861386fddb + 22 8587b4251b72 + stats: api1=UP api2=UP api3=MAINT (resolution) api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP + +## 2. start a temporary TCP proxy to postgres and a candidate replica behind the same network alias + instance-id: 9e9e905440d3, readiness while its database is reachable: 200 + load balancer slot for the candidate: api3, stats: api1=UP api2=UP api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP + +## 3. cut the candidate's database access (stop only the TCP proxy) + candidate is still running: running, readiness: 503 + waiting for the load balancer to mark api3 DOWN + api3 went DOWN 2s after its database was cut (check: inter 2s fall 2) + stats after failure: api1=UP api2=UP api3=DOWN api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP + +## 4. 40 requests through LB while the candidate is not ready + 18 52861386fddb + 22 8587b4251b72 + (the candidate must not appear above) + +## 5. business writes through LB during the exclusion + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1163.529, + +## 6. cleanup + stats after cleanup: api1=UP api2=UP api3=MAINT (resolution) api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP diff --git a/evidence/load-32clients.json b/evidence/load-32clients.json new file mode 100644 index 00000000..5f1db3f7 --- /dev/null +++ b/evidence/load-32clients.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 30.0, + "elapsed_seconds": 30.031, + "concurrency": 32, + "successful_requests": 38549, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1283.644, + "successful_latency_ms": { + "p50": 19.177, + "p95": 52.823, + "p99": 60.246 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/load-32clients.txt b/evidence/load-32clients.txt new file mode 100644 index 00000000..abad4265 --- /dev/null +++ b/evidence/load-32clients.txt @@ -0,0 +1,18 @@ +# контейнерный стенд через LB, 32 клиента, 30 с — 2026-10-16T14:26:39Z +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 30.0, + "elapsed_seconds": 30.031, + "concurrency": 32, + "successful_requests": 38549, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1283.644, + "successful_latency_ms": { + "p50": 19.177, + "p95": 52.823, + "p99": 60.246 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/native-load.json b/evidence/native-load.json new file mode 100644 index 00000000..d7664cc7 --- /dev/null +++ b/evidence/native-load.json @@ -0,0 +1,22 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 90.0, + "elapsed_seconds": 90.033, + "concurrency": 32, + "successful_requests": 220781, + "failed_requests": 0, + "error_ratio": 0.0, + "errors_by_kind": {}, + "successful_rps": 2452.222, + "successful_latency_ms": { + "p50": 12.541, + "p95": 17.549, + "p99": 22.396 + }, + "instances": { + "Vladislavs-MacBook-Pro.local": 220781 + }, + "bootstrap_attempts": 1, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} diff --git a/evidence/native-load.txt b/evidence/native-load.txt new file mode 100644 index 00000000..7d08d0b5 --- /dev/null +++ b/evidence/native-load.txt @@ -0,0 +1,23 @@ +# нативный процесс вне Docker, 32 клиента, 90 с — 2026-10-16T14:26:39Z +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 90.0, + "elapsed_seconds": 90.033, + "concurrency": 32, + "successful_requests": 220781, + "failed_requests": 0, + "error_ratio": 0.0, + "errors_by_kind": {}, + "successful_rps": 2452.222, + "successful_latency_ms": { + "p50": 12.541, + "p95": 17.549, + "p99": 22.396 + }, + "instances": { + "Vladislavs-MacBook-Pro.local": 220781 + }, + "bootstrap_attempts": 1, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} diff --git a/evidence/path-overhead/README.md b/evidence/path-overhead/README.md new file mode 100644 index 00000000..b1efa16a --- /dev/null +++ b/evidence/path-overhead/README.md @@ -0,0 +1,40 @@ +# Контроль пути «хост -> Colima VM -> LB» + +Один и тот же генератор (`tests/load.py`), один и тот же профиль (закрытый цикл, +8 клиентов, 15 с прогрева, 60 с замера) и один и тот же стенд. Меняется только +место клиента: на хосте (через опубликованный порт) или в контейнере внутри VM +(напрямую в балансировщик по docker-сети). Воспроизведение: +`scripts/path_overhead_check.sh`. + +| клиент | успешных | отказов | ошибки | RPS | p50, мс | p95, мс | +| --- | --- | --- | --- | --- | --- | --- | +| на хосте, `http://127.0.0.1:8080` | 92 378 | 32 575 | 26.1 % | 1 539 | 3.79 | 7.16 | +| в VM, `http://lb` | 88 596 | **0** | 0 % | 1 475 | 5.29 | 8.42 | + +## Что это показывает + +1. **Пропускная способность одна и та же** (1 539 против 1 475, разница в пределах + разброса; клиент в VM даже немного медленнее, потому что делит с стендом те же + 2 vCPU). Значит путь «хост -> проброс порта -> VM» **не задаёт потолок**: его + исключение из маршрута ничего не прибавляет. +2. **Отказы целиком клиентские.** Тот же стенд под той же нагрузкой не отказал ни + разу для клиента внутри VM. При этом за прогон с 26 % клиентских отказов + балансировщик отдал все запросы без 5xx (`hrsp_5xx=0` в статистике HAProxy), а + в логах API нет ни одной записи уровня выше `info`. +3. Причина — сам проброс порта: генератор ходит без keep-alive (новое TCP-соединение + на запрос), и под шквалом соединений forwarder хоста начинает их отклонять. + Наблюдения: в момент замера на хосте было **19 556 сокетов в `TIME_WAIT`** при + диапазоне эфемерных портов 49 152-65 535 (16 384), а точечный пробник из 40 000 + быстрых подключений подряд получил 1 294 успеха и 38 706 `ECONNREFUSED`. +4. Предел этой хрупкости тоже измерен: прогон на ~4 500 соединений/с по тривиальному + `/health/live` дал 100 % отказов, после чего проброс порта (и доступ к Docker-эндпоинту + Colima) перестал отвечать до `colima restart`. Стенд при этом не падал — недоступным + был именно хостовый путь; серия трека 1 поэтому снимается клиентом внутри VM + (`CLIENT=vm`), где отказов нет. + +Клиент на хосте способен на большее: тот же закрытый цикл по тривиальному серверу, +поднятому на самом хосте (без Docker), дал 4 469 RPS без отказов — то есть ~1 500 RPS +не являются потолком генератора. + +Артефакты: `outside.txt`, `inside.txt`, `load-outside.json`, `load-inside.json`, +`summary.txt`. diff --git a/evidence/path-overhead/inside.txt b/evidence/path-overhead/inside.txt new file mode 100644 index 00000000..b8c7061b --- /dev/null +++ b/evidence/path-overhead/inside.txt @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.073, + "concurrency": 8, + "successful_requests": 88596, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1474.795, + "successful_latency_ms": { + "p50": 5.292, + "p95": 8.415, + "p99": 10.433 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/path-overhead/load-inside.json b/evidence/path-overhead/load-inside.json new file mode 100644 index 00000000..b8c7061b --- /dev/null +++ b/evidence/path-overhead/load-inside.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.073, + "concurrency": 8, + "successful_requests": 88596, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1474.795, + "successful_latency_ms": { + "p50": 5.292, + "p95": 8.415, + "p99": 10.433 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/path-overhead/load-outside.json b/evidence/path-overhead/load-outside.json new file mode 100644 index 00000000..20b2005f --- /dev/null +++ b/evidence/path-overhead/load-outside.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.026, + "concurrency": 8, + "successful_requests": 92378, + "failed_requests": 32575, + "error_ratio": 0.260698, + "successful_rps": 1538.959, + "successful_latency_ms": { + "p50": 3.793, + "p95": 7.159, + "p99": 21.756 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/path-overhead/outside.txt b/evidence/path-overhead/outside.txt new file mode 100644 index 00000000..20b2005f --- /dev/null +++ b/evidence/path-overhead/outside.txt @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.026, + "concurrency": 8, + "successful_requests": 92378, + "failed_requests": 32575, + "error_ratio": 0.260698, + "successful_rps": 1538.959, + "successful_latency_ms": { + "p50": 3.793, + "p95": 7.159, + "p99": 21.756 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/path-overhead/summary.txt b/evidence/path-overhead/summary.txt new file mode 100644 index 00000000..d9c322f1 --- /dev/null +++ b/evidence/path-overhead/summary.txt @@ -0,0 +1,9 @@ +# Контроль пути к балансировщику +# generated: 2026-10-16T18:17:21Z +# profile: tests/load.py duration=60 concurrency=8 warmup=15 +# docker network: mtusi-messenger-lab3_default +# клиент в VM: python:3.12-alpine + +=== извне: клиент на хосте, http://127.0.0.1:8080 === + +=== изнутри: клиент в VM, http://lb === diff --git a/evidence/persistence.txt b/evidence/persistence.txt new file mode 100644 index 00000000..0946dd7d --- /dev/null +++ b/evidence/persistence.txt @@ -0,0 +1,4 @@ +# make test-persistence — 2026-10-16T13:59:43Z +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. diff --git a/evidence/quality.txt b/evidence/quality.txt new file mode 100644 index 00000000..917d5292 --- /dev/null +++ b/evidence/quality.txt @@ -0,0 +1,35 @@ +# quality checks — 2026-10-16T14:30:53Z +python3 scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. +.venv/bin/python scripts/validate_openapi.py +PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested. +env -u APP_ENV -u SERVER_HOST -u SERVER_PORT -u SERVER_READ_HEADER_TIMEOUT -u SERVER_SHUTDOWN_TIMEOUT -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 go test -race -shuffle=on -count=1 -timeout=5m ./... +? mtusi-messenger/cmd/messenger [no test files] +? mtusi-messenger/cmd/migrate [no test files] +ok mtusi-messenger/internal/config 1.633s +ok mtusi-messenger/internal/domain 1.222s +ok mtusi-messenger/internal/health 1.397s +ok mtusi-messenger/internal/logger 1.803s +ok mtusi-messenger/internal/platform/cache 2.104s +? mtusi-messenger/internal/platform/cache/mocks [no test files] +ok mtusi-messenger/internal/platform/password 2.659s +ok mtusi-messenger/internal/platform/token 2.147s +ok mtusi-messenger/internal/service/chat 2.733s +? mtusi-messenger/internal/service/chat/mocks [no test files] +ok mtusi-messenger/internal/service/message 2.527s +? mtusi-messenger/internal/service/message/mocks [no test files] +ok mtusi-messenger/internal/service/session 3.204s +? mtusi-messenger/internal/service/session/mocks [no test files] +ok mtusi-messenger/internal/service/user 3.505s +? mtusi-messenger/internal/service/user/mocks [no test files] +ok mtusi-messenger/internal/storage/postgres 3.147s +? 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/transport/rest 3.609s +? mtusi-messenger/internal/transport/rest/internal/oas [no test files] +? mtusi-messenger/internal/transport/rest/mocks [no test files] +go test -tags=integration -p 1 -count=1 -timeout=15m ./internal/storage/postgres ./internal/storage/redis +ok mtusi-messenger/internal/storage/postgres 7.210s +ok mtusi-messenger/internal/storage/redis 1.192s diff --git a/evidence/quota-semantics.txt b/evidence/quota-semantics.txt new file mode 100644 index 00000000..f50c0cfd --- /dev/null +++ b/evidence/quota-semantics.txt @@ -0,0 +1,33 @@ +# Что означает CPU% в `docker stats` на этом стенде + +Колонка `cpu_percent` в `stats-*.csv` снимается через `docker stats`. Чтобы не +толковать её наугад, поведение проверено прямым экспериментом на том же Docker-host +(Colima, 2 vCPU). + +```sh +docker run -d --name lab3-quota-probe --cpus 0.5 alpine:3.20 sh -c 'while :; do :; done' +sleep 12 +docker stats --no-stream --format '{{.Name}} CPU={{.CPUPerc}}' lab3-quota-probe +docker exec lab3-quota-probe cat /sys/fs/cgroup/cpu.max +``` + +``` +lab3-quota-probe CPU=49.49% MEM=344KiB / 1.913GiB +50000 100000 +``` + +Контейнер упёрт в свою квоту (`cpu.max = 50000 100000` — это 0.5 CPU) и показывает +**49.49 %**. Значит в этом окружении `docker stats` печатает процент от **одного +ядра**: 100 % = 1 ядро, квота 0.5 CPU = ~50 %, квота 0.25 = ~25 %. + +Как это читать в артефактах: + +| сервис | квота | наблюдение в профилях | вывод | +| --- | --- | --- | --- | +| `postgres` | 0.50 | 45-50.5 % | 0.45-0.5 ядра, то есть **у самой квоты** | +| `api` (2 реплики) | 0.50 каждая | ~20 % каждая | 0.2 ядра, квота не выбрана | +| `lb` | 0.25 | 11-14 % | 0.11-0.14 ядра, квота не выбрана | + +Отсюда же следует, что разница между профилем `r2` (PostgreSQL 0.50) и `db1cpu` +(PostgreSQL 1.00) читается корректно: в `db1cpu` загрузка БД падала до ~46 %, то есть +удвоенная квота не была использована — БД не была зажата квотой. diff --git a/evidence/rolling-update/after/load.json b/evidence/rolling-update/after/load.json new file mode 100644 index 00000000..d45df8a2 --- /dev/null +++ b/evidence/rolling-update/after/load.json @@ -0,0 +1,26 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 97359, + "failed_requests": 3, + "error_ratio": 3.1e-05, + "errors_by_kind": { + "http_error": 3 + }, + "successful_rps": 1622.308, + "successful_latency_ms": { + "p50": 4.011, + "p95": 8.688, + "p99": 23.718 + }, + "instances": { + "f00a99f95855": 594, + "8782633d0431": 48162, + "4248067e3f04": 48603 + }, + "bootstrap_attempts": 1, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} diff --git a/evidence/rolling-update/after/load.txt b/evidence/rolling-update/after/load.txt new file mode 100644 index 00000000..d45df8a2 --- /dev/null +++ b/evidence/rolling-update/after/load.txt @@ -0,0 +1,26 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 97359, + "failed_requests": 3, + "error_ratio": 3.1e-05, + "errors_by_kind": { + "http_error": 3 + }, + "successful_rps": 1622.308, + "successful_latency_ms": { + "p50": 4.011, + "p95": 8.688, + "p99": 23.718 + }, + "instances": { + "f00a99f95855": 594, + "8782633d0431": 48162, + "4248067e3f04": 48603 + }, + "bootstrap_attempts": 1, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} diff --git a/evidence/rolling-update/after/rolling-update.txt b/evidence/rolling-update/after/rolling-update.txt new file mode 100644 index 00000000..769e63a4 --- /dev/null +++ b/evidence/rolling-update/after/rolling-update.txt @@ -0,0 +1,136 @@ +# Rolling update under load (surge, one replica at a time) +# generated: 2026-10-16T14:26:39Z +# load: tolerant loader, duration=60s concurrency=8 +# проверки готовности LB: httpchk /health/ready, inter 2s fall 2 rise 2, timeout check 1s + +time="2026-10-16T17:26:40+03:00" level=warning msg="buildx Docker CLI plugin not found: falling back to the classic builder. BuildKit-only build features (multi-arch, secrets, ssh, additional contexts, ...) will not be available" + Image mtusi-messenger:lab3 Building + Image mtusi-messenger:lab3 Building +Sending build context to Docker daemon 238kB +Step 1/25 : ARG GO_VERSION=1.27.1 +Step 2/25 : ARG ALPINE_VERSION=3.22 +Step 3/25 : FROM golang:${GO_VERSION}-alpine AS build + ---> 8a5910f31396 +Step 4/25 : ARG TARGETOS + ---> Using cache + ---> d5f2c47ea7a5 +Step 5/25 : ARG TARGETARCH + ---> Using cache + ---> 047ee34b445c +Step 6/25 : ARG VERSION=dev + ---> Using cache + ---> a529d045efeb +Step 7/25 : ENV GOTOOLCHAIN=local + ---> Using cache + ---> 428f1b16b5c5 +Step 8/25 : WORKDIR /opt + ---> Using cache + ---> f37febf8b423 +Step 9/25 : COPY go.mod go.sum ./ + ---> Using cache + ---> c4015f597b99 +Step 10/25 : RUN go mod download + ---> Using cache + ---> 34ef6a6167b0 +Step 11/25 : ARG GOFLAGS="-p=2" + ---> Using cache + ---> deb54a0ce57a +Step 12/25 : ENV GOFLAGS=$GOFLAGS + ---> Using cache + ---> 3da36569422d +Step 13/25 : COPY . . + ---> 198f052f6cce +Step 14/25 : RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -buildvcs=false -tags timetzdata -ldflags="-s -w -X main.version=${VERSION}" -o /out/messenger ./cmd/messenger && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -buildvcs=false -tags timetzdata -ldflags="-s -w -X main.version=${VERSION}" -o /out/migrate ./cmd/migrate + ---> Running in 658437823eb9 + ---> Removed intermediate container 658437823eb9 + ---> 10a89d0bb592 +Step 15/25 : FROM alpine:${ALPINE_VERSION} AS runtime + ---> 5291449c3df7 +Step 16/25 : RUN apk add --no-cache ca-certificates wget && addgroup -S -g 10001 app && adduser -S -D -H -u 10001 -G app app + ---> Using cache + ---> f47b074d9bd5 +Step 17/25 : COPY --from=build --chown=10001:10001 /out/messenger /usr/local/bin/messenger + ---> Using cache + ---> 703f8f10d2cc +Step 18/25 : COPY --from=build --chown=10001:10001 /out/migrate /usr/local/bin/migrate + ---> Using cache + ---> c9121622dae2 +Step 19/25 : COPY --chown=10001:10001 config/dev/config.yaml /etc/messenger/dev/config.yaml + ---> Using cache + ---> 0379076307ea +Step 20/25 : USER 10001:10001 + ---> Using cache + ---> 2ff943b7d2e0 +Step 21/25 : EXPOSE 8080 + ---> Using cache + ---> 01674ab574a6 +Step 22/25 : STOPSIGNAL SIGTERM + ---> Using cache + ---> 6c30af2a102c +Step 23/25 : HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O /dev/null "http://127.0.0.1:${SERVER_PORT:-8080}/health/live" || exit 1 + ---> Using cache + ---> 76379f8db08d +Step 24/25 : ENTRYPOINT ["/usr/local/bin/messenger"] + ---> Using cache + ---> 778babec5020 +Step 25/25 : LABEL com.docker.compose.image.builder=classic + ---> Using cache + ---> 9e7e0224c87c +Successfully built 9e7e0224c87c +Successfully tagged mtusi-messenger:lab3 + Image mtusi-messenger:lab3 Built + Image mtusi-messenger:lab3 Built +реплик до обновления: 2 +образ старых реплик: sha256:9e7e0224c87cee0ccfa05d5799ec8e2a84b836e51fbda6f1dc3d175d5c0d4640 +образ новой ревизии: sha256:9e7e0224c87cee0ccfa05d5799ec8e2a84b836e51fbda6f1dc3d175d5c0d4640 +ревизия меняется: нет (образ не изменился) +слотов UP до: 3; restarts до: mtusi-messenger-lab3-api-1=0 mtusi-messenger-lab3-api-2=0 + + step 1: lb-rollout-1 обслуживает (образ 9e7e0224c87cee0ccfa05d5799ec8e2a84b836e51fbda6f1dc3d175d5c0d4640, instance 8782633d0431), старый контейнер 2ed432da6dd1 (2ed432da6dd1) снят; UP-слотов 3; 5xx накоплено 416; старт шага 2026-10-16T14:27:22Z + step 2: lb-rollout-2 обслуживает (образ 9e7e0224c87cee0ccfa05d5799ec8e2a84b836e51fbda6f1dc3d175d5c0d4640, instance 4248067e3f04), старый контейнер f00a99f95855 (f00a99f95855) снят; UP-слотов 4; 5xx накоплено 419; старт шага 2026-10-16T14:27:22Z + +load summary (tolerant generator): +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 97359, + "failed_requests": 3, + "error_ratio": 3.1e-05, + "errors_by_kind": { + "http_error": 3 + }, + "successful_rps": 1622.308, + "successful_latency_ms": { + "p50": 4.011, + "p95": 8.688, + "p99": 23.718 + }, + "instances": { + "f00a99f95855": 594, + "8782633d0431": 48162, + "4248067e3f04": 48603 + }, + "bootstrap_attempts": 1, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} + +5xx от LB за время обновления (hrsp_5xx frontend): 3 +restarts после: lb-rollout-2=0 lb-rollout-1=0 + +возврат стенда под управление compose: + Container mtusi-messenger-lab3-api-2 Creating + Container mtusi-messenger-lab3-api-1 Creating + Container mtusi-messenger-lab3-api-1 Created + Container mtusi-messenger-lab3-api-2 Created + Container mtusi-messenger-lab3-api-1 Starting + Container mtusi-messenger-lab3-api-1 Started + Container mtusi-messenger-lab3-api-2 Starting + Container mtusi-messenger-lab3-api-2 Started +снято временных контейнеров наплыва: проверено +UP-слотов после: 3; restarts в конце: mtusi-messenger-lab3-api-1=0 mtusi-messenger-lab3-api-2=0 +API containers после обновления: +mtusi-messenger-lab3-api-1 Up Less than a second (health: starting) +mtusi-messenger-lab3-api-2 Up Less than a second (health: starting) diff --git a/evidence/rolling-update/emulated/load.json b/evidence/rolling-update/emulated/load.json new file mode 100644 index 00000000..e46ce7be --- /dev/null +++ b/evidence/rolling-update/emulated/load.json @@ -0,0 +1,23 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 45.0, + "elapsed_seconds": 45.014, + "concurrency": 8, + "successful_requests": 89560, + "failed_requests": 0, + "error_ratio": 0.0, + "errors_by_kind": {}, + "successful_rps": 1989.584, + "successful_latency_ms": { + "p50": 3.905, + "p95": 6.02, + "p99": 7.984 + }, + "instances": { + "388ebcb74200": 7524, + "73d07d7d76db": 45354, + "cc6274635bd6": 36682 + }, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} diff --git a/evidence/rolling-update/emulated/load.txt b/evidence/rolling-update/emulated/load.txt new file mode 100644 index 00000000..e46ce7be --- /dev/null +++ b/evidence/rolling-update/emulated/load.txt @@ -0,0 +1,23 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 45.0, + "elapsed_seconds": 45.014, + "concurrency": 8, + "successful_requests": 89560, + "failed_requests": 0, + "error_ratio": 0.0, + "errors_by_kind": {}, + "successful_rps": 1989.584, + "successful_latency_ms": { + "p50": 3.905, + "p95": 6.02, + "p99": 7.984 + }, + "instances": { + "388ebcb74200": 7524, + "73d07d7d76db": 45354, + "cc6274635bd6": 36682 + }, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} diff --git a/evidence/rolling-update/emulated/rolling-update.txt b/evidence/rolling-update/emulated/rolling-update.txt new file mode 100644 index 00000000..c41c89d0 --- /dev/null +++ b/evidence/rolling-update/emulated/rolling-update.txt @@ -0,0 +1,134 @@ +# Rolling update under load +# generated: 2026-10-15T19:03:13Z +# load: tests/load.py duration=45s concurrency=8 (closed loop) +# steps: delete one replica, recreate it from the freshly built image, wait for health + LB + +time="2026-10-15T22:03:13+03:00" level=warning msg="buildx Docker CLI plugin not found: falling back to the classic builder. BuildKit-only build features (multi-arch, secrets, ssh, additional contexts, ...) will not be available" + Image mtusi-messenger:lab3 Building + Image mtusi-messenger:lab3 Building +Sending build context to Docker daemon 213.7kB +Step 1/25 : ARG GO_VERSION=1.27.1 +Step 2/25 : ARG ALPINE_VERSION=3.22 +Step 3/25 : FROM golang:${GO_VERSION}-alpine AS build + ---> 8a5910f31396 +Step 4/25 : ARG TARGETOS + ---> Using cache + ---> d5f2c47ea7a5 +Step 5/25 : ARG TARGETARCH + ---> Using cache + ---> 047ee34b445c +Step 6/25 : ARG VERSION=dev + ---> Using cache + ---> a529d045efeb +Step 7/25 : ENV GOTOOLCHAIN=local + ---> Using cache + ---> 428f1b16b5c5 +Step 8/25 : WORKDIR /opt + ---> Using cache + ---> f37febf8b423 +Step 9/25 : COPY go.mod go.sum ./ + ---> Using cache + ---> c4015f597b99 +Step 10/25 : RUN go mod download + ---> Using cache + ---> 34ef6a6167b0 +Step 11/25 : ARG GOFLAGS="-p=2" + ---> Using cache + ---> deb54a0ce57a +Step 12/25 : ENV GOFLAGS=$GOFLAGS + ---> Using cache + ---> 3da36569422d +Step 13/25 : COPY . . + ---> Using cache + ---> 596dc1ab02d1 +Step 14/25 : RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -buildvcs=false -tags timetzdata -ldflags="-s -w -X main.version=${VERSION}" -o /out/messenger ./cmd/messenger && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -buildvcs=false -tags timetzdata -ldflags="-s -w -X main.version=${VERSION}" -o /out/migrate ./cmd/migrate + ---> Using cache + ---> 01aa8bc6200d +Step 15/25 : FROM alpine:${ALPINE_VERSION} AS runtime + ---> 5291449c3df7 +Step 16/25 : RUN apk add --no-cache ca-certificates wget && addgroup -S -g 10001 app && adduser -S -D -H -u 10001 -G app app + ---> Using cache + ---> f47b074d9bd5 +Step 17/25 : COPY --from=build --chown=10001:10001 /out/messenger /usr/local/bin/messenger + ---> Using cache + ---> 50fc6abe3b04 +Step 18/25 : COPY --from=build --chown=10001:10001 /out/migrate /usr/local/bin/migrate + ---> Using cache + ---> 9bf6afe0256d +Step 19/25 : COPY --chown=10001:10001 config/dev/config.yaml /etc/messenger/dev/config.yaml + ---> Using cache + ---> 0d1870a325ec +Step 20/25 : USER 10001:10001 + ---> Using cache + ---> 1991f2ae06cc +Step 21/25 : EXPOSE 8080 + ---> Using cache + ---> 762d1bfb7606 +Step 22/25 : STOPSIGNAL SIGTERM + ---> Using cache + ---> 8a9d8f4f7101 +Step 23/25 : HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O /dev/null "http://127.0.0.1:${SERVER_PORT:-8080}/health/live" || exit 1 + ---> Using cache + ---> 65dea502a3f3 +Step 24/25 : ENTRYPOINT ["/usr/local/bin/messenger"] + ---> Using cache + ---> 83bbee72905e +Step 25/25 : LABEL com.docker.compose.image.builder=classic + ---> Using cache + ---> 037f969d5ea1 +Successfully built 037f969d5ea1 +Successfully tagged mtusi-messenger:lab3 + Image mtusi-messenger:lab3 Built + Image mtusi-messenger:lab3 Built + Container mtusi-messenger-lab3-api-13 Recreate + Container mtusi-messenger-lab3-api-14 Recreate + Container mtusi-messenger-lab3-api-13 Recreated + Container mtusi-messenger-lab3-api-14 Recreated + Container mtusi-messenger-lab3-api-14 Starting + Container mtusi-messenger-lab3-api-14 Started + Container mtusi-messenger-lab3-api-13 Starting + Container mtusi-messenger-lab3-api-13 Started +replicas before: 2; instances seen through LB: 2 + Container mtusi-messenger-lab3-api-13 Running + Container mtusi-messenger-lab3-api-14 Creating + Container mtusi-messenger-lab3-api-14 Created + Container mtusi-messenger-lab3-api-14 Starting + Container mtusi-messenger-lab3-api-14 Started + step 1: removed 54a7e7888b5f at 2026-10-15T19:03:20Z, 2 healthy replicas served again at 2026-10-15T19:03:26Z + Container mtusi-messenger-lab3-api-14 Running + Container mtusi-messenger-lab3-api-15 Creating + Container mtusi-messenger-lab3-api-15 Created + Container mtusi-messenger-lab3-api-15 Starting + Container mtusi-messenger-lab3-api-15 Started + step 2: removed 388ebcb74200 at 2026-10-15T19:03:26Z, 2 healthy replicas served again at 2026-10-15T19:03:31Z + +load summary (tolerant generator): +{ + "lab": 3, + "workload": "closed-loop POST messages; failures counted, not raised", + "requested_duration_seconds": 45.0, + "elapsed_seconds": 45.014, + "concurrency": 8, + "successful_requests": 89560, + "failed_requests": 0, + "error_ratio": 0.0, + "errors_by_kind": {}, + "successful_rps": 1989.584, + "successful_latency_ms": { + "p50": 3.905, + "p95": 6.02, + "p99": 7.984 + }, + "instances": { + "388ebcb74200": 7524, + "73d07d7d76db": 45354, + "cc6274635bd6": 36682 + }, + "note": "Percentiles cover successful writes only; transitional errors are expected during a rolling update." +} + +LB responses with 5xx during the update: 0 + +API containers after the update: +mtusi-messenger-lab3-api-15 Up 41 seconds (healthy) +mtusi-messenger-lab3-api-14 Up 46 seconds (healthy) diff --git a/evidence/smoke.txt b/evidence/smoke.txt new file mode 100644 index 00000000..9ac3434e --- /dev/null +++ b/evidence/smoke.txt @@ -0,0 +1,3 @@ +# make test — 2026-10-16T14:07:37Z (final image) +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: lab3 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/stand.txt b/evidence/stand.txt new file mode 100644 index 00000000..bc9dd061 --- /dev/null +++ b/evidence/stand.txt @@ -0,0 +1,34 @@ +# Lab3 stand evidence +# generated: 2026-10-16T13:38:19Z + +## docker ps (ports) +mtusi-messenger-lab3-api-6 | 8080/tcp +mtusi-messenger-lab3-api-5 | 8080/tcp +mtusi-messenger-lab3-lb-1 | 127.0.0.1:8404->8404/tcp, 127.0.0.1:8080->80/tcp +mtusi-messenger-lab3-postgres-1 | 5432/tcp +mtusi-messenger-lab3-redis-1 | 6379/tcp + +## compose config: limits/replicas/published + api: + replicas: 2 + cpus: 0.5 + memory: "268435456" + lb: + cpus: 0.25 + memory: "67108864" + published: "8080" + published: "8404" + migrate: + cpus: 0.5 + memory: "268435456" + postgres: + cpus: 0.5 + memory: "402653184" + redis: + cpus: 0.25 + memory: "201326592" + default: + build: + image: mtusi-messenger:lab3 + +container_name: absent diff --git a/evidence/track1/load-ctl1base.json b/evidence/track1/load-ctl1base.json new file mode 100644 index 00000000..8e0050e7 --- /dev/null +++ b/evidence/track1/load-ctl1base.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.082, + "concurrency": 8, + "successful_requests": 83581, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1391.108, + "successful_latency_ms": { + "p50": 5.571, + "p95": 9.03, + "p99": 11.692 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-ctl2pg.json b/evidence/track1/load-ctl2pg.json new file mode 100644 index 00000000..0d68d982 --- /dev/null +++ b/evidence/track1/load-ctl2pg.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.072, + "concurrency": 8, + "successful_requests": 83599, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1391.647, + "successful_latency_ms": { + "p50": 5.575, + "p95": 8.994, + "p99": 11.512 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-ctl3base.json b/evidence/track1/load-ctl3base.json new file mode 100644 index 00000000..e7ad3006 --- /dev/null +++ b/evidence/track1/load-ctl3base.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.078, + "concurrency": 8, + "successful_requests": 81711, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1360.087, + "successful_latency_ms": { + "p50": 5.664, + "p95": 9.482, + "p99": 12.322 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-ctl4lb.json b/evidence/track1/load-ctl4lb.json new file mode 100644 index 00000000..ed604474 --- /dev/null +++ b/evidence/track1/load-ctl4lb.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.074, + "concurrency": 8, + "successful_requests": 81688, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1359.794, + "successful_latency_ms": { + "p50": 5.688, + "p95": 9.37, + "p99": 12.032 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-d2.json b/evidence/track1/load-d2.json new file mode 100644 index 00000000..9590a53a --- /dev/null +++ b/evidence/track1/load-d2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.068, + "concurrency": 8, + "successful_requests": 83445, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1389.179, + "successful_latency_ms": { + "p50": 5.585, + "p95": 9.054, + "p99": 11.711 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-db1cpu.json b/evidence/track1/load-db1cpu.json new file mode 100644 index 00000000..f9ae7147 --- /dev/null +++ b/evidence/track1/load-db1cpu.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.077, + "concurrency": 8, + "successful_requests": 76301, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1270.045, + "successful_latency_ms": { + "p50": 6.057, + "p95": 10.141, + "p99": 13.724 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-g05.json b/evidence/track1/load-g05.json new file mode 100644 index 00000000..413da3bf --- /dev/null +++ b/evidence/track1/load-g05.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.064, + "concurrency": 8, + "successful_requests": 89486, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1489.856, + "successful_latency_ms": { + "p50": 5.238, + "p95": 8.245, + "p99": 10.54 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-g10.json b/evidence/track1/load-g10.json new file mode 100644 index 00000000..69f2ef24 --- /dev/null +++ b/evidence/track1/load-g10.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.071, + "concurrency": 8, + "successful_requests": 89886, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1496.325, + "successful_latency_ms": { + "p50": 5.207, + "p95": 8.221, + "p99": 10.508 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-g15.json b/evidence/track1/load-g15.json new file mode 100644 index 00000000..d1726719 --- /dev/null +++ b/evidence/track1/load-g15.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.061, + "concurrency": 8, + "successful_requests": 89566, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1491.252, + "successful_latency_ms": { + "p50": 5.251, + "p95": 8.176, + "p99": 10.209 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-lb1cpu.json b/evidence/track1/load-lb1cpu.json new file mode 100644 index 00000000..91e3616f --- /dev/null +++ b/evidence/track1/load-lb1cpu.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.071, + "concurrency": 8, + "successful_requests": 82138, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1367.357, + "successful_latency_ms": { + "p50": 5.67, + "p95": 9.26, + "p99": 12.055 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-pool10.json b/evidence/track1/load-pool10.json new file mode 100644 index 00000000..46d7de0d --- /dev/null +++ b/evidence/track1/load-pool10.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.074, + "concurrency": 8, + "successful_requests": 84040, + "failed_requests": 4, + "error_ratio": 4.8e-05, + "successful_rps": 1398.951, + "successful_latency_ms": { + "p50": 5.556, + "p95": 8.741, + "p99": 11.048 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-pool5.json b/evidence/track1/load-pool5.json new file mode 100644 index 00000000..03dfbc9c --- /dev/null +++ b/evidence/track1/load-pool5.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.078, + "concurrency": 8, + "successful_requests": 78078, + "failed_requests": 4, + "error_ratio": 5.1e-05, + "successful_rps": 1299.617, + "successful_latency_ms": { + "p50": 5.957, + "p95": 9.594, + "p99": 12.386 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-r1.json b/evidence/track1/load-r1.json new file mode 100644 index 00000000..48015e61 --- /dev/null +++ b/evidence/track1/load-r1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.075, + "concurrency": 8, + "successful_requests": 92690, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1542.892, + "successful_latency_ms": { + "p50": 5.047, + "p95": 8.006, + "p99": 10.239 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-r2.json b/evidence/track1/load-r2.json new file mode 100644 index 00000000..ee84407f --- /dev/null +++ b/evidence/track1/load-r2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.073, + "concurrency": 8, + "successful_requests": 89588, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1491.325, + "successful_latency_ms": { + "p50": 5.245, + "p95": 8.225, + "p99": 10.303 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/load-r4.json b/evidence/track1/load-r4.json new file mode 100644 index 00000000..89fd5bb7 --- /dev/null +++ b/evidence/track1/load-r4.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.069, + "concurrency": 8, + "successful_requests": 85041, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1415.713, + "successful_latency_ms": { + "p50": 5.538, + "p95": 8.614, + "p99": 10.749 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/profile-ctl1base.json b/evidence/track1/profile-ctl1base.json new file mode 100644 index 00000000..05ce1e9c --- /dev/null +++ b/evidence/track1/profile-ctl1base.json @@ -0,0 +1 @@ +{"label":"ctl1base","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-ctl2pg.json b/evidence/track1/profile-ctl2pg.json new file mode 100644 index 00000000..6a812b63 --- /dev/null +++ b/evidence/track1/profile-ctl2pg.json @@ -0,0 +1 @@ +{"label":"ctl2pg","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"1.00","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-ctl3base.json b/evidence/track1/profile-ctl3base.json new file mode 100644 index 00000000..4f65cdcc --- /dev/null +++ b/evidence/track1/profile-ctl3base.json @@ -0,0 +1 @@ +{"label":"ctl3base","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-ctl4lb.json b/evidence/track1/profile-ctl4lb.json new file mode 100644 index 00000000..44e58b80 --- /dev/null +++ b/evidence/track1/profile-ctl4lb.json @@ -0,0 +1 @@ +{"label":"ctl4lb","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"1.00","client":"vm"} diff --git a/evidence/track1/profile-d2.json b/evidence/track1/profile-d2.json new file mode 100644 index 00000000..03c21fd8 --- /dev/null +++ b/evidence/track1/profile-d2.json @@ -0,0 +1 @@ +{"label":"d2","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-db1cpu.json b/evidence/track1/profile-db1cpu.json new file mode 100644 index 00000000..e6b0cfd7 --- /dev/null +++ b/evidence/track1/profile-db1cpu.json @@ -0,0 +1 @@ +{"label":"db1cpu","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"1.00","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-g05.json b/evidence/track1/profile-g05.json new file mode 100644 index 00000000..e44efa92 --- /dev/null +++ b/evidence/track1/profile-g05.json @@ -0,0 +1 @@ +{"label":"g05","replicas":2,"total_cpu":0.5,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-g10.json b/evidence/track1/profile-g10.json new file mode 100644 index 00000000..168f6b88 --- /dev/null +++ b/evidence/track1/profile-g10.json @@ -0,0 +1 @@ +{"label":"g10","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-g15.json b/evidence/track1/profile-g15.json new file mode 100644 index 00000000..886a5b35 --- /dev/null +++ b/evidence/track1/profile-g15.json @@ -0,0 +1 @@ +{"label":"g15","replicas":2,"total_cpu":1.5,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-lb1cpu.json b/evidence/track1/profile-lb1cpu.json new file mode 100644 index 00000000..6ade2805 --- /dev/null +++ b/evidence/track1/profile-lb1cpu.json @@ -0,0 +1 @@ +{"label":"lb1cpu","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"1.00","client":"vm"} diff --git a/evidence/track1/profile-pool10.json b/evidence/track1/profile-pool10.json new file mode 100644 index 00000000..02414d36 --- /dev/null +++ b/evidence/track1/profile-pool10.json @@ -0,0 +1 @@ +{"label":"pool10","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-pool5.json b/evidence/track1/profile-pool5.json new file mode 100644 index 00000000..42c7878d --- /dev/null +++ b/evidence/track1/profile-pool5.json @@ -0,0 +1 @@ +{"label":"pool5","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":5,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-r1.json b/evidence/track1/profile-r1.json new file mode 100644 index 00000000..79621834 --- /dev/null +++ b/evidence/track1/profile-r1.json @@ -0,0 +1 @@ +{"label":"r1","replicas":1,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-r2.json b/evidence/track1/profile-r2.json new file mode 100644 index 00000000..ef370477 --- /dev/null +++ b/evidence/track1/profile-r2.json @@ -0,0 +1 @@ +{"label":"r2","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/profile-r4.json b/evidence/track1/profile-r4.json new file mode 100644 index 00000000..e37896ba --- /dev/null +++ b/evidence/track1/profile-r4.json @@ -0,0 +1 @@ +{"label":"r4","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25","client":"vm"} diff --git a/evidence/track1/scaling-fixed-budget.png b/evidence/track1/scaling-fixed-budget.png new file mode 100644 index 00000000..ba60ea56 Binary files /dev/null and b/evidence/track1/scaling-fixed-budget.png differ diff --git a/evidence/track1/scaling-growth.png b/evidence/track1/scaling-growth.png new file mode 100644 index 00000000..95891c0e Binary files /dev/null and b/evidence/track1/scaling-growth.png differ diff --git a/evidence/track1/stats-ctl1base.csv b/evidence/track1/stats-ctl1base.csv new file mode 100644 index 00000000..ffdb55be --- /dev/null +++ b/evidence/track1/stats-ctl1base.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:39:11Z,mtusi-messenger-lab3-lb-1,10.42%,10.98MiB / 64MiB +2026-10-16T18:39:11Z,mtusi-messenger-lab3-postgres-1,9.11%,205.8MiB / 384MiB +2026-10-16T18:39:11Z,mtusi-messenger-lab3-api-2,13.76%,155.3MiB / 384MiB +2026-10-16T18:39:11Z,mtusi-messenger-lab3-api-1,13.93%,154.9MiB / 384MiB +2026-10-16T18:39:11Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:11Z,mtusi-messenger-lab2-redis-1,0.74%,4.785MiB / 1.913GiB +2026-10-16T18:39:11Z,mtusi-messenger-lab3-redis-1,0.65%,6.965MiB / 192MiB +2026-10-16T18:39:11Z,vigilant_cerf,29.03%,22.25MiB / 1.913GiB +2026-10-16T18:39:15Z,vigilant_cerf,27.90%,22.02MiB / 1.913GiB +2026-10-16T18:39:15Z,mtusi-messenger-lab3-lb-1,10.22%,10.96MiB / 64MiB +2026-10-16T18:39:15Z,mtusi-messenger-lab3-postgres-1,37.42%,206.1MiB / 384MiB +2026-10-16T18:39:15Z,mtusi-messenger-lab3-api-2,14.05%,135.2MiB / 384MiB +2026-10-16T18:39:15Z,mtusi-messenger-lab3-api-1,13.69%,134.3MiB / 384MiB +2026-10-16T18:39:15Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:15Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:15Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:39:18Z,vigilant_cerf,28.10%,22.11MiB / 1.913GiB +2026-10-16T18:39:18Z,mtusi-messenger-lab3-lb-1,10.61%,10.98MiB / 64MiB +2026-10-16T18:39:18Z,mtusi-messenger-lab3-postgres-1,35.88%,206.3MiB / 384MiB +2026-10-16T18:39:18Z,mtusi-messenger-lab3-api-2,14.13%,11.55MiB / 384MiB +2026-10-16T18:39:18Z,mtusi-messenger-lab3-api-1,14.15%,11.43MiB / 384MiB +2026-10-16T18:39:18Z,mtusi-messenger-lab2-postgres-1,0.72%,29.81MiB / 1.913GiB +2026-10-16T18:39:18Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:39:18Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:39:21Z,vigilant_cerf,27.15%,22.21MiB / 1.913GiB +2026-10-16T18:39:21Z,mtusi-messenger-lab3-lb-1,10.16%,11MiB / 64MiB +2026-10-16T18:39:21Z,mtusi-messenger-lab3-postgres-1,36.03%,206.5MiB / 384MiB +2026-10-16T18:39:21Z,mtusi-messenger-lab3-api-2,13.42%,11.61MiB / 384MiB +2026-10-16T18:39:21Z,mtusi-messenger-lab3-api-1,13.55%,11.3MiB / 384MiB +2026-10-16T18:39:21Z,mtusi-messenger-lab2-postgres-1,0.20%,29.81MiB / 1.913GiB +2026-10-16T18:39:21Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:39:21Z,mtusi-messenger-lab3-redis-1,0.17%,7.215MiB / 192MiB +2026-10-16T18:39:24Z,vigilant_cerf,28.63%,22.42MiB / 1.913GiB +2026-10-16T18:39:24Z,mtusi-messenger-lab3-lb-1,10.56%,10.97MiB / 64MiB +2026-10-16T18:39:24Z,mtusi-messenger-lab3-postgres-1,37.87%,206.7MiB / 384MiB +2026-10-16T18:39:24Z,mtusi-messenger-lab3-api-2,14.33%,11.6MiB / 384MiB +2026-10-16T18:39:24Z,mtusi-messenger-lab3-api-1,14.27%,11.3MiB / 384MiB +2026-10-16T18:39:24Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:24Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:39:24Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:39:27Z,vigilant_cerf,30.19%,22.61MiB / 1.913GiB +2026-10-16T18:39:27Z,mtusi-messenger-lab3-lb-1,10.82%,10.98MiB / 64MiB +2026-10-16T18:39:27Z,mtusi-messenger-lab3-postgres-1,38.22%,206.9MiB / 384MiB +2026-10-16T18:39:27Z,mtusi-messenger-lab3-api-2,14.18%,11.5MiB / 384MiB +2026-10-16T18:39:27Z,mtusi-messenger-lab3-api-1,14.53%,11.3MiB / 384MiB +2026-10-16T18:39:27Z,mtusi-messenger-lab2-postgres-1,0.68%,29.81MiB / 1.913GiB +2026-10-16T18:39:27Z,mtusi-messenger-lab2-redis-1,0.74%,4.785MiB / 1.913GiB +2026-10-16T18:39:27Z,mtusi-messenger-lab3-redis-1,0.67%,6.965MiB / 192MiB +2026-10-16T18:39:30Z,vigilant_cerf,29.47%,22.8MiB / 1.913GiB +2026-10-16T18:39:30Z,mtusi-messenger-lab3-lb-1,10.76%,11MiB / 64MiB +2026-10-16T18:39:30Z,mtusi-messenger-lab3-postgres-1,36.67%,207.1MiB / 384MiB +2026-10-16T18:39:30Z,mtusi-messenger-lab3-api-2,13.46%,11.38MiB / 384MiB +2026-10-16T18:39:30Z,mtusi-messenger-lab3-api-1,13.54%,11.18MiB / 384MiB +2026-10-16T18:39:30Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:30Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:30Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:39:33Z,vigilant_cerf,24.72%,22.98MiB / 1.913GiB +2026-10-16T18:39:33Z,mtusi-messenger-lab3-lb-1,9.32%,10.98MiB / 64MiB +2026-10-16T18:39:33Z,mtusi-messenger-lab3-postgres-1,47.65%,214.8MiB / 384MiB +2026-10-16T18:39:33Z,mtusi-messenger-lab3-api-2,13.62%,11.38MiB / 384MiB +2026-10-16T18:39:33Z,mtusi-messenger-lab3-api-1,12.69%,11.2MiB / 384MiB +2026-10-16T18:39:33Z,mtusi-messenger-lab2-postgres-1,0.21%,29.81MiB / 1.913GiB +2026-10-16T18:39:33Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:33Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:39:36Z,vigilant_cerf,28.10%,23.13MiB / 1.913GiB +2026-10-16T18:39:36Z,mtusi-messenger-lab3-lb-1,10.32%,10.96MiB / 64MiB +2026-10-16T18:39:36Z,mtusi-messenger-lab3-postgres-1,35.61%,205.3MiB / 384MiB +2026-10-16T18:39:36Z,mtusi-messenger-lab3-api-2,14.20%,11.36MiB / 384MiB +2026-10-16T18:39:36Z,mtusi-messenger-lab3-api-1,14.02%,11.2MiB / 384MiB +2026-10-16T18:39:36Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:36Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:36Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:39:40Z,vigilant_cerf,28.39%,23.59MiB / 1.913GiB +2026-10-16T18:39:40Z,mtusi-messenger-lab3-lb-1,10.50%,10.99MiB / 64MiB +2026-10-16T18:39:40Z,mtusi-messenger-lab3-postgres-1,37.38%,205.5MiB / 384MiB +2026-10-16T18:39:40Z,mtusi-messenger-lab3-api-2,14.22%,11.43MiB / 384MiB +2026-10-16T18:39:40Z,mtusi-messenger-lab3-api-1,13.87%,11.14MiB / 384MiB +2026-10-16T18:39:40Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:40Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:40Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:39:43Z,vigilant_cerf,27.30%,23.51MiB / 1.913GiB +2026-10-16T18:39:43Z,mtusi-messenger-lab3-lb-1,10.23%,10.99MiB / 64MiB +2026-10-16T18:39:43Z,mtusi-messenger-lab3-postgres-1,35.63%,206MiB / 384MiB +2026-10-16T18:39:43Z,mtusi-messenger-lab3-api-2,13.80%,11.46MiB / 384MiB +2026-10-16T18:39:43Z,mtusi-messenger-lab3-api-1,13.70%,11.15MiB / 384MiB +2026-10-16T18:39:43Z,mtusi-messenger-lab2-postgres-1,0.68%,29.81MiB / 1.913GiB +2026-10-16T18:39:43Z,mtusi-messenger-lab2-redis-1,0.63%,4.785MiB / 1.913GiB +2026-10-16T18:39:43Z,mtusi-messenger-lab3-redis-1,0.75%,6.957MiB / 192MiB +2026-10-16T18:39:46Z,vigilant_cerf,29.06%,23.73MiB / 1.913GiB +2026-10-16T18:39:46Z,mtusi-messenger-lab3-lb-1,10.88%,10.98MiB / 64MiB +2026-10-16T18:39:46Z,mtusi-messenger-lab3-postgres-1,37.29%,206MiB / 384MiB +2026-10-16T18:39:46Z,mtusi-messenger-lab3-api-2,14.35%,11.29MiB / 384MiB +2026-10-16T18:39:46Z,mtusi-messenger-lab3-api-1,14.81%,11.14MiB / 384MiB +2026-10-16T18:39:46Z,mtusi-messenger-lab2-postgres-1,0.21%,29.81MiB / 1.913GiB +2026-10-16T18:39:46Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:39:46Z,mtusi-messenger-lab3-redis-1,0.18%,6.957MiB / 192MiB +2026-10-16T18:39:49Z,vigilant_cerf,28.47%,23.93MiB / 1.913GiB +2026-10-16T18:39:49Z,mtusi-messenger-lab3-lb-1,10.58%,10.99MiB / 64MiB +2026-10-16T18:39:49Z,mtusi-messenger-lab3-postgres-1,37.67%,206.2MiB / 384MiB +2026-10-16T18:39:49Z,mtusi-messenger-lab3-api-2,14.04%,11.34MiB / 384MiB +2026-10-16T18:39:49Z,mtusi-messenger-lab3-api-1,14.09%,11.48MiB / 384MiB +2026-10-16T18:39:49Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:49Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:49Z,mtusi-messenger-lab3-redis-1,0.18%,6.957MiB / 192MiB +2026-10-16T18:39:52Z,vigilant_cerf,28.15%,24.09MiB / 1.913GiB +2026-10-16T18:39:52Z,mtusi-messenger-lab3-lb-1,10.34%,10.97MiB / 64MiB +2026-10-16T18:39:52Z,mtusi-messenger-lab3-postgres-1,36.32%,206.4MiB / 384MiB +2026-10-16T18:39:52Z,mtusi-messenger-lab3-api-2,14.29%,11.33MiB / 384MiB +2026-10-16T18:39:52Z,mtusi-messenger-lab3-api-1,14.24%,11.23MiB / 384MiB +2026-10-16T18:39:52Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:52Z,mtusi-messenger-lab2-redis-1,0.65%,4.785MiB / 1.913GiB +2026-10-16T18:39:52Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:39:55Z,vigilant_cerf,28.97%,24.3MiB / 1.913GiB +2026-10-16T18:39:55Z,mtusi-messenger-lab3-lb-1,10.72%,10.97MiB / 64MiB +2026-10-16T18:39:55Z,mtusi-messenger-lab3-postgres-1,36.99%,206.6MiB / 384MiB +2026-10-16T18:39:55Z,mtusi-messenger-lab3-api-2,14.86%,11.4MiB / 384MiB +2026-10-16T18:39:55Z,mtusi-messenger-lab3-api-1,14.76%,11.03MiB / 384MiB +2026-10-16T18:39:55Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:39:55Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:55Z,mtusi-messenger-lab3-redis-1,0.18%,6.957MiB / 192MiB +2026-10-16T18:39:58Z,vigilant_cerf,29.95%,24.72MiB / 1.913GiB +2026-10-16T18:39:58Z,mtusi-messenger-lab3-lb-1,10.71%,10.97MiB / 64MiB +2026-10-16T18:39:58Z,mtusi-messenger-lab3-postgres-1,36.41%,206.8MiB / 384MiB +2026-10-16T18:39:58Z,mtusi-messenger-lab3-api-2,14.23%,11.39MiB / 384MiB +2026-10-16T18:39:58Z,mtusi-messenger-lab3-api-1,13.61%,11.25MiB / 384MiB +2026-10-16T18:39:58Z,mtusi-messenger-lab2-postgres-1,0.91%,29.81MiB / 1.913GiB +2026-10-16T18:39:58Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:39:58Z,mtusi-messenger-lab3-redis-1,0.18%,6.957MiB / 192MiB +2026-10-16T18:40:01Z,vigilant_cerf,28.69%,24.66MiB / 1.913GiB +2026-10-16T18:40:01Z,mtusi-messenger-lab3-lb-1,10.67%,10.96MiB / 64MiB +2026-10-16T18:40:01Z,mtusi-messenger-lab3-postgres-1,36.54%,207MiB / 384MiB +2026-10-16T18:40:01Z,mtusi-messenger-lab3-api-2,14.44%,11.45MiB / 384MiB +2026-10-16T18:40:01Z,mtusi-messenger-lab3-api-1,14.10%,11.25MiB / 384MiB +2026-10-16T18:40:01Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:01Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:01Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:04Z,vigilant_cerf,29.61%,24.88MiB / 1.913GiB +2026-10-16T18:40:04Z,mtusi-messenger-lab3-lb-1,10.82%,10.96MiB / 64MiB +2026-10-16T18:40:04Z,mtusi-messenger-lab3-postgres-1,36.50%,207.2MiB / 384MiB +2026-10-16T18:40:04Z,mtusi-messenger-lab3-api-2,14.13%,11.38MiB / 384MiB +2026-10-16T18:40:04Z,mtusi-messenger-lab3-api-1,14.61%,11.32MiB / 384MiB +2026-10-16T18:40:04Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:04Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:40:04Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:08Z,vigilant_cerf,27.20%,25.07MiB / 1.913GiB +2026-10-16T18:40:08Z,mtusi-messenger-lab3-lb-1,10.32%,10.96MiB / 64MiB +2026-10-16T18:40:08Z,mtusi-messenger-lab3-postgres-1,35.59%,207.4MiB / 384MiB +2026-10-16T18:40:08Z,mtusi-messenger-lab3-api-2,13.61%,11.44MiB / 384MiB +2026-10-16T18:40:08Z,mtusi-messenger-lab3-api-1,13.49%,11.21MiB / 384MiB +2026-10-16T18:40:08Z,mtusi-messenger-lab2-postgres-1,0.66%,29.81MiB / 1.913GiB +2026-10-16T18:40:08Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:40:08Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:11Z,mtusi-messenger-lab3-lb-1,10.35%,11MiB / 64MiB +2026-10-16T18:40:11Z,mtusi-messenger-lab3-postgres-1,40.41%,213.1MiB / 384MiB +2026-10-16T18:40:11Z,mtusi-messenger-lab3-api-2,6.89%,11.42MiB / 384MiB +2026-10-16T18:40:11Z,mtusi-messenger-lab3-api-1,6.43%,11.12MiB / 384MiB +2026-10-16T18:40:11Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:11Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:40:11Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB diff --git a/evidence/track1/stats-ctl2pg.csv b/evidence/track1/stats-ctl2pg.csv new file mode 100644 index 00000000..3284ebd9 --- /dev/null +++ b/evidence/track1/stats-ctl2pg.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:40:31Z,mtusi-messenger-lab3-postgres-1,11.65%,61.89MiB / 384MiB +2026-10-16T18:40:31Z,mtusi-messenger-lab3-lb-1,10.42%,10.98MiB / 64MiB +2026-10-16T18:40:31Z,mtusi-messenger-lab3-api-2,14.23%,155.7MiB / 384MiB +2026-10-16T18:40:31Z,mtusi-messenger-lab3-api-1,13.78%,155.1MiB / 384MiB +2026-10-16T18:40:31Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:31Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:31Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:31Z,pedantic_mahavira,28.33%,22.26MiB / 1.913GiB +2026-10-16T18:40:34Z,pedantic_mahavira,28.56%,24.29MiB / 1.913GiB +2026-10-16T18:40:34Z,mtusi-messenger-lab3-postgres-1,36.60%,66.01MiB / 384MiB +2026-10-16T18:40:34Z,mtusi-messenger-lab3-lb-1,10.50%,10.98MiB / 64MiB +2026-10-16T18:40:34Z,mtusi-messenger-lab3-api-2,14.25%,135.3MiB / 384MiB +2026-10-16T18:40:34Z,mtusi-messenger-lab3-api-1,13.76%,170MiB / 384MiB +2026-10-16T18:40:34Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:34Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:34Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:37Z,pedantic_mahavira,28.38%,24.36MiB / 1.913GiB +2026-10-16T18:40:37Z,mtusi-messenger-lab3-postgres-1,36.14%,68.2MiB / 384MiB +2026-10-16T18:40:37Z,mtusi-messenger-lab3-lb-1,10.22%,10.97MiB / 64MiB +2026-10-16T18:40:37Z,mtusi-messenger-lab3-api-2,13.73%,11.52MiB / 384MiB +2026-10-16T18:40:37Z,mtusi-messenger-lab3-api-1,14.06%,13.66MiB / 384MiB +2026-10-16T18:40:37Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:37Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:37Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:40Z,pedantic_mahavira,29.15%,24.44MiB / 1.913GiB +2026-10-16T18:40:40Z,mtusi-messenger-lab3-postgres-1,35.58%,71.04MiB / 384MiB +2026-10-16T18:40:40Z,mtusi-messenger-lab3-lb-1,10.15%,10.98MiB / 64MiB +2026-10-16T18:40:40Z,mtusi-messenger-lab3-api-2,13.64%,11.48MiB / 384MiB +2026-10-16T18:40:40Z,mtusi-messenger-lab3-api-1,14.02%,13.66MiB / 384MiB +2026-10-16T18:40:40Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:40Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:40Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:43Z,pedantic_mahavira,27.46%,24.66MiB / 1.913GiB +2026-10-16T18:40:43Z,mtusi-messenger-lab3-postgres-1,36.68%,72.97MiB / 384MiB +2026-10-16T18:40:43Z,mtusi-messenger-lab3-lb-1,10.24%,10.96MiB / 64MiB +2026-10-16T18:40:43Z,mtusi-messenger-lab3-api-2,14.53%,11.33MiB / 384MiB +2026-10-16T18:40:43Z,mtusi-messenger-lab3-api-1,14.26%,13.97MiB / 384MiB +2026-10-16T18:40:43Z,mtusi-messenger-lab2-postgres-1,0.74%,29.81MiB / 1.913GiB +2026-10-16T18:40:43Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:43Z,mtusi-messenger-lab3-redis-1,0.67%,6.957MiB / 192MiB +2026-10-16T18:40:46Z,pedantic_mahavira,28.24%,24.84MiB / 1.913GiB +2026-10-16T18:40:46Z,mtusi-messenger-lab3-postgres-1,35.76%,75.46MiB / 384MiB +2026-10-16T18:40:46Z,mtusi-messenger-lab3-lb-1,10.04%,10.98MiB / 64MiB +2026-10-16T18:40:46Z,mtusi-messenger-lab3-api-2,13.76%,11.39MiB / 384MiB +2026-10-16T18:40:46Z,mtusi-messenger-lab3-api-1,13.82%,13.96MiB / 384MiB +2026-10-16T18:40:46Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:46Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:46Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:49Z,pedantic_mahavira,31.42%,25.05MiB / 1.913GiB +2026-10-16T18:40:49Z,mtusi-messenger-lab3-postgres-1,36.98%,77.13MiB / 384MiB +2026-10-16T18:40:49Z,mtusi-messenger-lab3-lb-1,11.41%,10.97MiB / 64MiB +2026-10-16T18:40:49Z,mtusi-messenger-lab3-api-2,14.88%,11.27MiB / 384MiB +2026-10-16T18:40:49Z,mtusi-messenger-lab3-api-1,14.75%,14MiB / 384MiB +2026-10-16T18:40:49Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:49Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:49Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:40:53Z,pedantic_mahavira,27.89%,25.26MiB / 1.913GiB +2026-10-16T18:40:53Z,mtusi-messenger-lab3-postgres-1,35.53%,80.31MiB / 384MiB +2026-10-16T18:40:53Z,mtusi-messenger-lab3-lb-1,10.28%,10.98MiB / 64MiB +2026-10-16T18:40:53Z,mtusi-messenger-lab3-api-2,13.57%,11.39MiB / 384MiB +2026-10-16T18:40:53Z,mtusi-messenger-lab3-api-1,14.11%,13.44MiB / 384MiB +2026-10-16T18:40:53Z,mtusi-messenger-lab2-postgres-1,0.43%,30.59MiB / 1.913GiB +2026-10-16T18:40:53Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:40:53Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:56Z,pedantic_mahavira,30.50%,25.43MiB / 1.913GiB +2026-10-16T18:40:56Z,mtusi-messenger-lab3-postgres-1,37.59%,82.57MiB / 384MiB +2026-10-16T18:40:56Z,mtusi-messenger-lab3-lb-1,10.97%,10.96MiB / 64MiB +2026-10-16T18:40:56Z,mtusi-messenger-lab3-api-2,14.45%,11.45MiB / 384MiB +2026-10-16T18:40:56Z,mtusi-messenger-lab3-api-1,14.76%,13.42MiB / 384MiB +2026-10-16T18:40:56Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:40:56Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:40:56Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:40:59Z,pedantic_mahavira,28.10%,25.62MiB / 1.913GiB +2026-10-16T18:40:59Z,mtusi-messenger-lab3-postgres-1,35.77%,84.95MiB / 384MiB +2026-10-16T18:40:59Z,mtusi-messenger-lab3-lb-1,10.29%,11MiB / 64MiB +2026-10-16T18:40:59Z,mtusi-messenger-lab3-api-2,14.32%,11.45MiB / 384MiB +2026-10-16T18:40:59Z,mtusi-messenger-lab3-api-1,13.92%,13.69MiB / 384MiB +2026-10-16T18:40:59Z,mtusi-messenger-lab2-postgres-1,0.74%,29.81MiB / 1.913GiB +2026-10-16T18:40:59Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:40:59Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:02Z,pedantic_mahavira,28.73%,25.76MiB / 1.913GiB +2026-10-16T18:41:02Z,mtusi-messenger-lab3-postgres-1,35.90%,87.42MiB / 384MiB +2026-10-16T18:41:02Z,mtusi-messenger-lab3-lb-1,10.64%,10.97MiB / 64MiB +2026-10-16T18:41:02Z,mtusi-messenger-lab3-api-2,14.14%,11.46MiB / 384MiB +2026-10-16T18:41:02Z,mtusi-messenger-lab3-api-1,13.89%,13.55MiB / 384MiB +2026-10-16T18:41:02Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:02Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:02Z,mtusi-messenger-lab3-redis-1,0.63%,6.957MiB / 192MiB +2026-10-16T18:41:05Z,pedantic_mahavira,27.91%,26.25MiB / 1.913GiB +2026-10-16T18:41:05Z,mtusi-messenger-lab3-postgres-1,36.52%,89.9MiB / 384MiB +2026-10-16T18:41:05Z,mtusi-messenger-lab3-lb-1,10.15%,10.98MiB / 64MiB +2026-10-16T18:41:05Z,mtusi-messenger-lab3-api-2,14.31%,11.45MiB / 384MiB +2026-10-16T18:41:05Z,mtusi-messenger-lab3-api-1,14.21%,13.27MiB / 384MiB +2026-10-16T18:41:05Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:05Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:05Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:08Z,pedantic_mahavira,28.22%,26.46MiB / 1.913GiB +2026-10-16T18:41:08Z,mtusi-messenger-lab3-postgres-1,36.21%,92.43MiB / 384MiB +2026-10-16T18:41:08Z,mtusi-messenger-lab3-lb-1,10.34%,10.96MiB / 64MiB +2026-10-16T18:41:08Z,mtusi-messenger-lab3-api-2,13.53%,11.37MiB / 384MiB +2026-10-16T18:41:08Z,mtusi-messenger-lab3-api-1,13.11%,13.4MiB / 384MiB +2026-10-16T18:41:08Z,mtusi-messenger-lab2-postgres-1,0.71%,29.81MiB / 1.913GiB +2026-10-16T18:41:08Z,mtusi-messenger-lab2-redis-1,0.70%,4.785MiB / 1.913GiB +2026-10-16T18:41:08Z,mtusi-messenger-lab3-redis-1,0.64%,6.957MiB / 192MiB +2026-10-16T18:41:11Z,pedantic_mahavira,30.00%,26.39MiB / 1.913GiB +2026-10-16T18:41:11Z,mtusi-messenger-lab3-postgres-1,37.07%,95.12MiB / 384MiB +2026-10-16T18:41:11Z,mtusi-messenger-lab3-lb-1,10.88%,10.98MiB / 64MiB +2026-10-16T18:41:11Z,mtusi-messenger-lab3-api-2,14.09%,11.5MiB / 384MiB +2026-10-16T18:41:11Z,mtusi-messenger-lab3-api-1,13.96%,14.06MiB / 384MiB +2026-10-16T18:41:11Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:11Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:11Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:14Z,pedantic_mahavira,28.94%,26.86MiB / 1.913GiB +2026-10-16T18:41:14Z,mtusi-messenger-lab3-postgres-1,36.87%,98.02MiB / 384MiB +2026-10-16T18:41:14Z,mtusi-messenger-lab3-lb-1,10.54%,10.98MiB / 64MiB +2026-10-16T18:41:14Z,mtusi-messenger-lab3-api-2,14.01%,11.48MiB / 384MiB +2026-10-16T18:41:14Z,mtusi-messenger-lab3-api-1,14.01%,13.3MiB / 384MiB +2026-10-16T18:41:14Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:14Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:41:14Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:41:18Z,pedantic_mahavira,27.91%,26.78MiB / 1.913GiB +2026-10-16T18:41:18Z,mtusi-messenger-lab3-postgres-1,35.56%,100.3MiB / 384MiB +2026-10-16T18:41:18Z,mtusi-messenger-lab3-lb-1,10.11%,10.98MiB / 64MiB +2026-10-16T18:41:18Z,mtusi-messenger-lab3-api-2,13.81%,11.36MiB / 384MiB +2026-10-16T18:41:18Z,mtusi-messenger-lab3-api-1,13.67%,13.97MiB / 384MiB +2026-10-16T18:41:18Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:18Z,mtusi-messenger-lab2-redis-1,0.68%,4.785MiB / 1.913GiB +2026-10-16T18:41:18Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:41:21Z,pedantic_mahavira,28.09%,27MiB / 1.913GiB +2026-10-16T18:41:21Z,mtusi-messenger-lab3-postgres-1,36.95%,102.5MiB / 384MiB +2026-10-16T18:41:21Z,mtusi-messenger-lab3-lb-1,10.57%,10.98MiB / 64MiB +2026-10-16T18:41:21Z,mtusi-messenger-lab3-api-2,14.86%,11.31MiB / 384MiB +2026-10-16T18:41:21Z,mtusi-messenger-lab3-api-1,14.30%,13.9MiB / 384MiB +2026-10-16T18:41:21Z,mtusi-messenger-lab2-postgres-1,0.21%,29.81MiB / 1.913GiB +2026-10-16T18:41:21Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:21Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:24Z,pedantic_mahavira,28.31%,27.16MiB / 1.913GiB +2026-10-16T18:41:24Z,mtusi-messenger-lab3-postgres-1,37.04%,105.2MiB / 384MiB +2026-10-16T18:41:24Z,mtusi-messenger-lab3-lb-1,10.50%,10.98MiB / 64MiB +2026-10-16T18:41:24Z,mtusi-messenger-lab3-api-2,13.90%,11.3MiB / 384MiB +2026-10-16T18:41:24Z,mtusi-messenger-lab3-api-1,13.93%,13.28MiB / 384MiB +2026-10-16T18:41:24Z,mtusi-messenger-lab2-postgres-1,0.71%,29.81MiB / 1.913GiB +2026-10-16T18:41:24Z,mtusi-messenger-lab2-redis-1,0.69%,4.785MiB / 1.913GiB +2026-10-16T18:41:24Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:27Z,pedantic_mahavira,27.91%,27.3MiB / 1.913GiB +2026-10-16T18:41:27Z,mtusi-messenger-lab3-postgres-1,36.35%,107.2MiB / 384MiB +2026-10-16T18:41:27Z,mtusi-messenger-lab3-lb-1,10.54%,10.97MiB / 64MiB +2026-10-16T18:41:27Z,mtusi-messenger-lab3-api-2,14.16%,11.3MiB / 384MiB +2026-10-16T18:41:27Z,mtusi-messenger-lab3-api-1,14.33%,13.36MiB / 384MiB +2026-10-16T18:41:27Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:27Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:41:27Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:30Z,mtusi-messenger-lab3-postgres-1,52.09%,131.8MiB / 384MiB +2026-10-16T18:41:30Z,mtusi-messenger-lab3-lb-1,4.38%,10.94MiB / 64MiB +2026-10-16T18:41:30Z,mtusi-messenger-lab3-api-2,5.96%,11.32MiB / 384MiB +2026-10-16T18:41:30Z,mtusi-messenger-lab3-api-1,5.70%,13.66MiB / 384MiB +2026-10-16T18:41:30Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:30Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:30Z,mtusi-messenger-lab3-redis-1,0.21%,6.957MiB / 192MiB diff --git a/evidence/track1/stats-ctl3base.csv b/evidence/track1/stats-ctl3base.csv new file mode 100644 index 00000000..f9e7e23a --- /dev/null +++ b/evidence/track1/stats-ctl3base.csv @@ -0,0 +1,161 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:41:49Z,mtusi-messenger-lab3-postgres-1,35.44%,62.66MiB / 384MiB +2026-10-16T18:41:49Z,mtusi-messenger-lab3-lb-1,10.26%,10.97MiB / 64MiB +2026-10-16T18:41:49Z,mtusi-messenger-lab3-api-2,13.44%,91.65MiB / 384MiB +2026-10-16T18:41:49Z,mtusi-messenger-lab3-api-1,13.36%,155.2MiB / 384MiB +2026-10-16T18:41:49Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:49Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:41:49Z,mtusi-messenger-lab3-redis-1,0.65%,6.957MiB / 192MiB +2026-10-16T18:41:49Z,epic_hawking,28.60%,21.95MiB / 1.913GiB +2026-10-16T18:41:52Z,epic_hawking,29.52%,22.05MiB / 1.913GiB +2026-10-16T18:41:52Z,mtusi-messenger-lab3-postgres-1,37.42%,65.88MiB / 384MiB +2026-10-16T18:41:52Z,mtusi-messenger-lab3-lb-1,10.78%,11.2MiB / 64MiB +2026-10-16T18:41:52Z,mtusi-messenger-lab3-api-2,14.39%,69.87MiB / 384MiB +2026-10-16T18:41:52Z,mtusi-messenger-lab3-api-1,13.57%,185.9MiB / 384MiB +2026-10-16T18:41:52Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:52Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:41:52Z,mtusi-messenger-lab3-redis-1,0.67%,6.957MiB / 192MiB +2026-10-16T18:41:55Z,epic_hawking,28.60%,22.11MiB / 1.913GiB +2026-10-16T18:41:55Z,mtusi-messenger-lab3-postgres-1,35.91%,68.02MiB / 384MiB +2026-10-16T18:41:55Z,mtusi-messenger-lab3-lb-1,10.52%,10.99MiB / 64MiB +2026-10-16T18:41:55Z,mtusi-messenger-lab3-api-2,14.55%,11.61MiB / 384MiB +2026-10-16T18:41:55Z,mtusi-messenger-lab3-api-1,14.35%,11.3MiB / 384MiB +2026-10-16T18:41:55Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:41:55Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:55Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:41:59Z,epic_hawking,28.08%,22.46MiB / 1.913GiB +2026-10-16T18:41:59Z,mtusi-messenger-lab3-postgres-1,35.62%,70.33MiB / 384MiB +2026-10-16T18:41:59Z,mtusi-messenger-lab3-lb-1,10.16%,10.96MiB / 64MiB +2026-10-16T18:41:59Z,mtusi-messenger-lab3-api-2,13.66%,11.57MiB / 384MiB +2026-10-16T18:41:59Z,mtusi-messenger-lab3-api-1,14.14%,11.25MiB / 384MiB +2026-10-16T18:41:59Z,mtusi-messenger-lab2-postgres-1,0.68%,29.81MiB / 1.913GiB +2026-10-16T18:41:59Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:41:59Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:02Z,epic_hawking,28.29%,22.34MiB / 1.913GiB +2026-10-16T18:42:02Z,mtusi-messenger-lab3-postgres-1,36.72%,72.77MiB / 384MiB +2026-10-16T18:42:02Z,mtusi-messenger-lab3-lb-1,10.35%,10.96MiB / 64MiB +2026-10-16T18:42:02Z,mtusi-messenger-lab3-api-2,13.67%,11.64MiB / 384MiB +2026-10-16T18:42:02Z,mtusi-messenger-lab3-api-1,13.83%,11.25MiB / 384MiB +2026-10-16T18:42:02Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:02Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:42:02Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:05Z,epic_hawking,28.83%,22.84MiB / 1.913GiB +2026-10-16T18:42:05Z,mtusi-messenger-lab3-postgres-1,36.56%,75.35MiB / 384MiB +2026-10-16T18:42:05Z,mtusi-messenger-lab3-lb-1,10.82%,10.99MiB / 64MiB +2026-10-16T18:42:05Z,mtusi-messenger-lab3-api-2,13.34%,11.54MiB / 384MiB +2026-10-16T18:42:05Z,mtusi-messenger-lab3-api-1,14.43%,11.22MiB / 384MiB +2026-10-16T18:42:05Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:05Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:05Z,mtusi-messenger-lab3-redis-1,0.21%,6.957MiB / 192MiB +2026-10-16T18:42:08Z,epic_hawking,28.40%,22.78MiB / 1.913GiB +2026-10-16T18:42:08Z,mtusi-messenger-lab3-postgres-1,33.85%,77.43MiB / 384MiB +2026-10-16T18:42:08Z,mtusi-messenger-lab3-lb-1,9.92%,10.99MiB / 64MiB +2026-10-16T18:42:08Z,mtusi-messenger-lab3-api-2,13.71%,11.57MiB / 384MiB +2026-10-16T18:42:08Z,mtusi-messenger-lab3-api-1,13.97%,11.21MiB / 384MiB +2026-10-16T18:42:08Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:08Z,mtusi-messenger-lab2-redis-1,0.73%,4.785MiB / 1.913GiB +2026-10-16T18:42:08Z,mtusi-messenger-lab3-redis-1,0.68%,6.957MiB / 192MiB +2026-10-16T18:42:11Z,epic_hawking,27.64%,22.96MiB / 1.913GiB +2026-10-16T18:42:11Z,mtusi-messenger-lab3-postgres-1,35.76%,80.21MiB / 384MiB +2026-10-16T18:42:11Z,mtusi-messenger-lab3-lb-1,10.31%,10.97MiB / 64MiB +2026-10-16T18:42:11Z,mtusi-messenger-lab3-api-2,13.42%,11.35MiB / 384MiB +2026-10-16T18:42:11Z,mtusi-messenger-lab3-api-1,13.83%,11.22MiB / 384MiB +2026-10-16T18:42:11Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:11Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:11Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:14Z,epic_hawking,29.00%,23.12MiB / 1.913GiB +2026-10-16T18:42:14Z,mtusi-messenger-lab3-postgres-1,35.23%,81.23MiB / 384MiB +2026-10-16T18:42:14Z,mtusi-messenger-lab3-lb-1,10.55%,10.96MiB / 64MiB +2026-10-16T18:42:14Z,mtusi-messenger-lab3-api-2,13.82%,11.47MiB / 384MiB +2026-10-16T18:42:14Z,mtusi-messenger-lab3-api-1,14.21%,11.13MiB / 384MiB +2026-10-16T18:42:14Z,mtusi-messenger-lab2-postgres-1,0.77%,29.81MiB / 1.913GiB +2026-10-16T18:42:14Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:42:14Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:17Z,epic_hawking,28.76%,23.33MiB / 1.913GiB +2026-10-16T18:42:17Z,mtusi-messenger-lab3-postgres-1,36.08%,84.45MiB / 384MiB +2026-10-16T18:42:17Z,mtusi-messenger-lab3-lb-1,10.59%,10.98MiB / 64MiB +2026-10-16T18:42:17Z,mtusi-messenger-lab3-api-2,14.57%,11.42MiB / 384MiB +2026-10-16T18:42:17Z,mtusi-messenger-lab3-api-1,13.42%,11.18MiB / 384MiB +2026-10-16T18:42:17Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:17Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:42:17Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:20Z,epic_hawking,27.44%,23.51MiB / 1.913GiB +2026-10-16T18:42:20Z,mtusi-messenger-lab3-postgres-1,35.57%,86.7MiB / 384MiB +2026-10-16T18:42:20Z,mtusi-messenger-lab3-lb-1,10.26%,10.98MiB / 64MiB +2026-10-16T18:42:20Z,mtusi-messenger-lab3-api-2,13.74%,11.42MiB / 384MiB +2026-10-16T18:42:20Z,mtusi-messenger-lab3-api-1,13.24%,11.18MiB / 384MiB +2026-10-16T18:42:20Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:20Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:42:20Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:24Z,epic_hawking,28.47%,23.7MiB / 1.913GiB +2026-10-16T18:42:24Z,mtusi-messenger-lab3-postgres-1,34.27%,89.02MiB / 384MiB +2026-10-16T18:42:24Z,mtusi-messenger-lab3-lb-1,10.30%,10.99MiB / 64MiB +2026-10-16T18:42:24Z,mtusi-messenger-lab3-api-2,14.42%,11.41MiB / 384MiB +2026-10-16T18:42:24Z,mtusi-messenger-lab3-api-1,14.37%,11.18MiB / 384MiB +2026-10-16T18:42:24Z,mtusi-messenger-lab2-postgres-1,0.73%,29.81MiB / 1.913GiB +2026-10-16T18:42:24Z,mtusi-messenger-lab2-redis-1,0.64%,4.785MiB / 1.913GiB +2026-10-16T18:42:24Z,mtusi-messenger-lab3-redis-1,0.67%,6.957MiB / 192MiB +2026-10-16T18:42:27Z,epic_hawking,28.75%,23.89MiB / 1.913GiB +2026-10-16T18:42:27Z,mtusi-messenger-lab3-postgres-1,38.08%,91.55MiB / 384MiB +2026-10-16T18:42:27Z,mtusi-messenger-lab3-lb-1,10.73%,10.98MiB / 64MiB +2026-10-16T18:42:27Z,mtusi-messenger-lab3-api-2,14.35%,11.45MiB / 384MiB +2026-10-16T18:42:27Z,mtusi-messenger-lab3-api-1,14.02%,11.33MiB / 384MiB +2026-10-16T18:42:27Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:27Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:27Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:30Z,epic_hawking,27.81%,24.28MiB / 1.913GiB +2026-10-16T18:42:30Z,mtusi-messenger-lab3-postgres-1,35.00%,93.16MiB / 384MiB +2026-10-16T18:42:30Z,mtusi-messenger-lab3-lb-1,10.15%,10.97MiB / 64MiB +2026-10-16T18:42:30Z,mtusi-messenger-lab3-api-2,13.36%,11.44MiB / 384MiB +2026-10-16T18:42:30Z,mtusi-messenger-lab3-api-1,13.94%,11.22MiB / 384MiB +2026-10-16T18:42:30Z,mtusi-messenger-lab2-postgres-1,0.83%,29.81MiB / 1.913GiB +2026-10-16T18:42:30Z,mtusi-messenger-lab2-redis-1,0.67%,4.785MiB / 1.913GiB +2026-10-16T18:42:30Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:42:32Z,epic_hawking,29.13%,24.1MiB / 1.913GiB +2026-10-16T18:42:32Z,mtusi-messenger-lab3-postgres-1,36.57%,96.05MiB / 384MiB +2026-10-16T18:42:32Z,mtusi-messenger-lab3-lb-1,10.32%,10.98MiB / 64MiB +2026-10-16T18:42:32Z,mtusi-messenger-lab3-api-2,14.07%,11.38MiB / 384MiB +2026-10-16T18:42:32Z,mtusi-messenger-lab3-api-1,14.32%,11.14MiB / 384MiB +2026-10-16T18:42:32Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:32Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:32Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:42:35Z,epic_hawking,28.28%,24.39MiB / 1.913GiB +2026-10-16T18:42:35Z,mtusi-messenger-lab3-postgres-1,36.24%,98.32MiB / 384MiB +2026-10-16T18:42:35Z,mtusi-messenger-lab3-lb-1,10.42%,10.98MiB / 64MiB +2026-10-16T18:42:35Z,mtusi-messenger-lab3-api-2,13.75%,11.45MiB / 384MiB +2026-10-16T18:42:35Z,mtusi-messenger-lab3-api-1,14.16%,11.16MiB / 384MiB +2026-10-16T18:42:35Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:35Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:35Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:42:38Z,epic_hawking,28.57%,24.55MiB / 1.913GiB +2026-10-16T18:42:38Z,mtusi-messenger-lab3-postgres-1,35.96%,100.7MiB / 384MiB +2026-10-16T18:42:38Z,mtusi-messenger-lab3-lb-1,10.43%,10.98MiB / 64MiB +2026-10-16T18:42:38Z,mtusi-messenger-lab3-api-2,14.36%,11.52MiB / 384MiB +2026-10-16T18:42:38Z,mtusi-messenger-lab3-api-1,14.39%,11.16MiB / 384MiB +2026-10-16T18:42:38Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:38Z,mtusi-messenger-lab2-redis-1,0.62%,4.785MiB / 1.913GiB +2026-10-16T18:42:38Z,mtusi-messenger-lab3-redis-1,0.68%,6.957MiB / 192MiB +2026-10-16T18:42:41Z,epic_hawking,28.73%,24.78MiB / 1.913GiB +2026-10-16T18:42:41Z,mtusi-messenger-lab3-postgres-1,36.12%,103.3MiB / 384MiB +2026-10-16T18:42:41Z,mtusi-messenger-lab3-lb-1,10.51%,10.97MiB / 64MiB +2026-10-16T18:42:41Z,mtusi-messenger-lab3-api-2,14.36%,11.39MiB / 384MiB +2026-10-16T18:42:41Z,mtusi-messenger-lab3-api-1,14.22%,11.21MiB / 384MiB +2026-10-16T18:42:41Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:41Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:41Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:42:44Z,epic_hawking,29.47%,24.95MiB / 1.913GiB +2026-10-16T18:42:44Z,mtusi-messenger-lab3-postgres-1,36.20%,105.4MiB / 384MiB +2026-10-16T18:42:44Z,mtusi-messenger-lab3-lb-1,10.87%,10.98MiB / 64MiB +2026-10-16T18:42:44Z,mtusi-messenger-lab3-api-2,13.87%,11.39MiB / 384MiB +2026-10-16T18:42:44Z,mtusi-messenger-lab3-api-1,14.12%,11.2MiB / 384MiB +2026-10-16T18:42:44Z,mtusi-messenger-lab2-postgres-1,0.72%,29.81MiB / 1.913GiB +2026-10-16T18:42:44Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:42:44Z,mtusi-messenger-lab3-redis-1,0.69%,6.957MiB / 192MiB +2026-10-16T18:42:47Z,epic_hawking,28.65%,25.13MiB / 1.913GiB +2026-10-16T18:42:47Z,mtusi-messenger-lab3-postgres-1,35.34%,107.9MiB / 384MiB +2026-10-16T18:42:47Z,mtusi-messenger-lab3-lb-1,10.59%,10.98MiB / 64MiB +2026-10-16T18:42:47Z,mtusi-messenger-lab3-api-2,13.50%,11.39MiB / 384MiB +2026-10-16T18:42:47Z,mtusi-messenger-lab3-api-1,13.86%,11.43MiB / 384MiB +2026-10-16T18:42:47Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:42:47Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:42:47Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB diff --git a/evidence/track1/stats-ctl4lb.csv b/evidence/track1/stats-ctl4lb.csv new file mode 100644 index 00000000..72ed4efb --- /dev/null +++ b/evidence/track1/stats-ctl4lb.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:43:08Z,mtusi-messenger-lab3-lb-1,10.52%,10.99MiB / 64MiB +2026-10-16T18:43:08Z,mtusi-messenger-lab3-postgres-1,37.06%,121.7MiB / 384MiB +2026-10-16T18:43:08Z,mtusi-messenger-lab3-api-2,13.75%,155.6MiB / 384MiB +2026-10-16T18:43:08Z,mtusi-messenger-lab3-api-1,20.72%,140.6MiB / 384MiB +2026-10-16T18:43:08Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:08Z,mtusi-messenger-lab2-redis-1,0.62%,4.785MiB / 1.913GiB +2026-10-16T18:43:08Z,mtusi-messenger-lab3-redis-1,0.66%,6.957MiB / 192MiB +2026-10-16T18:43:08Z,blissful_blackburn,28.42%,21.99MiB / 1.913GiB +2026-10-16T18:43:11Z,blissful_blackburn,30.04%,22.53MiB / 1.913GiB +2026-10-16T18:43:11Z,mtusi-messenger-lab3-lb-1,9.25%,10.99MiB / 64MiB +2026-10-16T18:43:11Z,mtusi-messenger-lab3-postgres-1,41.51%,135.5MiB / 384MiB +2026-10-16T18:43:11Z,mtusi-messenger-lab3-api-2,11.91%,197.8MiB / 384MiB +2026-10-16T18:43:11Z,mtusi-messenger-lab3-api-1,12.28%,196.6MiB / 384MiB +2026-10-16T18:43:11Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:11Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:11Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:43:14Z,blissful_blackburn,23.80%,22.07MiB / 1.913GiB +2026-10-16T18:43:14Z,mtusi-messenger-lab3-lb-1,9.03%,10.99MiB / 64MiB +2026-10-16T18:43:14Z,mtusi-messenger-lab3-postgres-1,47.71%,137.7MiB / 384MiB +2026-10-16T18:43:14Z,mtusi-messenger-lab3-api-2,11.94%,11.71MiB / 384MiB +2026-10-16T18:43:14Z,mtusi-messenger-lab3-api-1,11.88%,11.31MiB / 384MiB +2026-10-16T18:43:14Z,mtusi-messenger-lab2-postgres-1,0.73%,29.81MiB / 1.913GiB +2026-10-16T18:43:14Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:43:14Z,mtusi-messenger-lab3-redis-1,0.63%,6.957MiB / 192MiB +2026-10-16T18:43:18Z,blissful_blackburn,27.97%,22.18MiB / 1.913GiB +2026-10-16T18:43:18Z,mtusi-messenger-lab3-lb-1,10.19%,11.02MiB / 64MiB +2026-10-16T18:43:18Z,mtusi-messenger-lab3-postgres-1,36.02%,135MiB / 384MiB +2026-10-16T18:43:18Z,mtusi-messenger-lab3-api-2,13.35%,11.52MiB / 384MiB +2026-10-16T18:43:18Z,mtusi-messenger-lab3-api-1,13.87%,11.3MiB / 384MiB +2026-10-16T18:43:18Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:18Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:18Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:43:21Z,blissful_blackburn,28.51%,22.37MiB / 1.913GiB +2026-10-16T18:43:21Z,mtusi-messenger-lab3-lb-1,10.33%,11MiB / 64MiB +2026-10-16T18:43:21Z,mtusi-messenger-lab3-postgres-1,35.89%,133.2MiB / 384MiB +2026-10-16T18:43:21Z,mtusi-messenger-lab3-api-2,13.59%,11.55MiB / 384MiB +2026-10-16T18:43:21Z,mtusi-messenger-lab3-api-1,13.82%,11.31MiB / 384MiB +2026-10-16T18:43:21Z,mtusi-messenger-lab2-postgres-1,0.19%,29.81MiB / 1.913GiB +2026-10-16T18:43:21Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:43:21Z,mtusi-messenger-lab3-redis-1,0.19%,6.957MiB / 192MiB +2026-10-16T18:43:24Z,blissful_blackburn,27.99%,22.55MiB / 1.913GiB +2026-10-16T18:43:24Z,mtusi-messenger-lab3-lb-1,10.39%,10.99MiB / 64MiB +2026-10-16T18:43:24Z,mtusi-messenger-lab3-postgres-1,36.88%,135.4MiB / 384MiB +2026-10-16T18:43:24Z,mtusi-messenger-lab3-api-2,14.33%,11.48MiB / 384MiB +2026-10-16T18:43:24Z,mtusi-messenger-lab3-api-1,14.40%,11.32MiB / 384MiB +2026-10-16T18:43:24Z,mtusi-messenger-lab2-postgres-1,0.70%,29.81MiB / 1.913GiB +2026-10-16T18:43:24Z,mtusi-messenger-lab2-redis-1,0.65%,4.785MiB / 1.913GiB +2026-10-16T18:43:24Z,mtusi-messenger-lab3-redis-1,0.66%,6.965MiB / 192MiB +2026-10-16T18:43:27Z,blissful_blackburn,28.33%,22.74MiB / 1.913GiB +2026-10-16T18:43:27Z,mtusi-messenger-lab3-lb-1,10.34%,11MiB / 64MiB +2026-10-16T18:43:27Z,mtusi-messenger-lab3-postgres-1,36.42%,137.7MiB / 384MiB +2026-10-16T18:43:27Z,mtusi-messenger-lab3-api-2,13.26%,11.38MiB / 384MiB +2026-10-16T18:43:27Z,mtusi-messenger-lab3-api-1,13.71%,11.32MiB / 384MiB +2026-10-16T18:43:27Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:27Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:27Z,mtusi-messenger-lab3-redis-1,0.20%,6.957MiB / 192MiB +2026-10-16T18:43:30Z,blissful_blackburn,27.59%,22.93MiB / 1.913GiB +2026-10-16T18:43:30Z,mtusi-messenger-lab3-lb-1,10.16%,11MiB / 64MiB +2026-10-16T18:43:30Z,mtusi-messenger-lab3-postgres-1,34.15%,139.3MiB / 384MiB +2026-10-16T18:43:30Z,mtusi-messenger-lab3-api-2,13.94%,11.39MiB / 384MiB +2026-10-16T18:43:30Z,mtusi-messenger-lab3-api-1,13.73%,11.25MiB / 384MiB +2026-10-16T18:43:30Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:30Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:43:30Z,mtusi-messenger-lab3-redis-1,0.19%,6.992MiB / 192MiB +2026-10-16T18:43:33Z,blissful_blackburn,26.70%,23.08MiB / 1.913GiB +2026-10-16T18:43:33Z,mtusi-messenger-lab3-lb-1,9.95%,11.01MiB / 64MiB +2026-10-16T18:43:33Z,mtusi-messenger-lab3-postgres-1,34.95%,142.7MiB / 384MiB +2026-10-16T18:43:33Z,mtusi-messenger-lab3-api-2,13.15%,11.53MiB / 384MiB +2026-10-16T18:43:33Z,mtusi-messenger-lab3-api-1,13.21%,11.12MiB / 384MiB +2026-10-16T18:43:33Z,mtusi-messenger-lab2-postgres-1,0.22%,29.81MiB / 1.913GiB +2026-10-16T18:43:33Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:43:33Z,mtusi-messenger-lab3-redis-1,0.19%,6.992MiB / 192MiB +2026-10-16T18:43:36Z,blissful_blackburn,28.13%,23.54MiB / 1.913GiB +2026-10-16T18:43:36Z,mtusi-messenger-lab3-lb-1,10.47%,11.27MiB / 64MiB +2026-10-16T18:43:36Z,mtusi-messenger-lab3-postgres-1,36.23%,144.8MiB / 384MiB +2026-10-16T18:43:36Z,mtusi-messenger-lab3-api-2,14.08%,11.43MiB / 384MiB +2026-10-16T18:43:36Z,mtusi-messenger-lab3-api-1,14.16%,11.13MiB / 384MiB +2026-10-16T18:43:36Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:36Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:43:36Z,mtusi-messenger-lab3-redis-1,0.19%,6.992MiB / 192MiB +2026-10-16T18:43:39Z,blissful_blackburn,28.91%,23.48MiB / 1.913GiB +2026-10-16T18:43:39Z,mtusi-messenger-lab3-lb-1,10.72%,11.01MiB / 64MiB +2026-10-16T18:43:39Z,mtusi-messenger-lab3-postgres-1,37.07%,147.1MiB / 384MiB +2026-10-16T18:43:39Z,mtusi-messenger-lab3-api-2,13.96%,11.5MiB / 384MiB +2026-10-16T18:43:39Z,mtusi-messenger-lab3-api-1,13.84%,11.07MiB / 384MiB +2026-10-16T18:43:39Z,mtusi-messenger-lab2-postgres-1,0.72%,29.81MiB / 1.913GiB +2026-10-16T18:43:39Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:39Z,mtusi-messenger-lab3-redis-1,0.67%,6.992MiB / 192MiB +2026-10-16T18:43:42Z,blissful_blackburn,27.77%,23.67MiB / 1.913GiB +2026-10-16T18:43:42Z,mtusi-messenger-lab3-lb-1,10.40%,10.99MiB / 64MiB +2026-10-16T18:43:42Z,mtusi-messenger-lab3-postgres-1,37.59%,149.4MiB / 384MiB +2026-10-16T18:43:42Z,mtusi-messenger-lab3-api-2,13.94%,11.43MiB / 384MiB +2026-10-16T18:43:42Z,mtusi-messenger-lab3-api-1,14.05%,11.24MiB / 384MiB +2026-10-16T18:43:42Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:42Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:42Z,mtusi-messenger-lab3-redis-1,0.19%,6.992MiB / 192MiB +2026-10-16T18:43:46Z,blissful_blackburn,27.80%,23.84MiB / 1.913GiB +2026-10-16T18:43:46Z,mtusi-messenger-lab3-lb-1,10.20%,11MiB / 64MiB +2026-10-16T18:43:46Z,mtusi-messenger-lab3-postgres-1,35.19%,151.7MiB / 384MiB +2026-10-16T18:43:46Z,mtusi-messenger-lab3-api-2,14.44%,11.44MiB / 384MiB +2026-10-16T18:43:46Z,mtusi-messenger-lab3-api-1,13.98%,11.24MiB / 384MiB +2026-10-16T18:43:46Z,mtusi-messenger-lab2-postgres-1,0.88%,29.81MiB / 1.913GiB +2026-10-16T18:43:46Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:46Z,mtusi-messenger-lab3-redis-1,0.20%,6.992MiB / 192MiB +2026-10-16T18:43:49Z,blissful_blackburn,27.27%,24.04MiB / 1.913GiB +2026-10-16T18:43:49Z,mtusi-messenger-lab3-lb-1,10.18%,11MiB / 64MiB +2026-10-16T18:43:49Z,mtusi-messenger-lab3-postgres-1,36.67%,154.2MiB / 384MiB +2026-10-16T18:43:49Z,mtusi-messenger-lab3-api-2,14.04%,11.34MiB / 384MiB +2026-10-16T18:43:49Z,mtusi-messenger-lab3-api-1,14.23%,11.23MiB / 384MiB +2026-10-16T18:43:49Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:49Z,mtusi-messenger-lab2-redis-1,0.69%,4.785MiB / 1.913GiB +2026-10-16T18:43:49Z,mtusi-messenger-lab3-redis-1,0.69%,6.992MiB / 192MiB +2026-10-16T18:43:52Z,blissful_blackburn,27.87%,24.21MiB / 1.913GiB +2026-10-16T18:43:52Z,mtusi-messenger-lab3-lb-1,10.40%,11MiB / 64MiB +2026-10-16T18:43:52Z,mtusi-messenger-lab3-postgres-1,37.43%,156.5MiB / 384MiB +2026-10-16T18:43:52Z,mtusi-messenger-lab3-api-2,14.13%,11.36MiB / 384MiB +2026-10-16T18:43:52Z,mtusi-messenger-lab3-api-1,14.17%,11.23MiB / 384MiB +2026-10-16T18:43:52Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:52Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:43:52Z,mtusi-messenger-lab3-redis-1,0.19%,6.992MiB / 192MiB +2026-10-16T18:43:55Z,blissful_blackburn,28.35%,24.4MiB / 1.913GiB +2026-10-16T18:43:55Z,mtusi-messenger-lab3-lb-1,10.61%,11MiB / 64MiB +2026-10-16T18:43:55Z,mtusi-messenger-lab3-postgres-1,37.50%,159MiB / 384MiB +2026-10-16T18:43:55Z,mtusi-messenger-lab3-api-2,13.99%,11.37MiB / 384MiB +2026-10-16T18:43:55Z,mtusi-messenger-lab3-api-1,13.96%,11.23MiB / 384MiB +2026-10-16T18:43:55Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:55Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:55Z,mtusi-messenger-lab3-redis-1,0.19%,6.992MiB / 192MiB +2026-10-16T18:43:58Z,blissful_blackburn,29.54%,24.55MiB / 1.913GiB +2026-10-16T18:43:58Z,mtusi-messenger-lab3-lb-1,10.10%,11.01MiB / 64MiB +2026-10-16T18:43:58Z,mtusi-messenger-lab3-postgres-1,35.33%,161.2MiB / 384MiB +2026-10-16T18:43:58Z,mtusi-messenger-lab3-api-2,13.38%,11.38MiB / 384MiB +2026-10-16T18:43:58Z,mtusi-messenger-lab3-api-1,13.00%,11.13MiB / 384MiB +2026-10-16T18:43:58Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:43:58Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:43:58Z,mtusi-messenger-lab3-redis-1,0.70%,6.992MiB / 192MiB +2026-10-16T18:44:01Z,blissful_blackburn,28.68%,24.79MiB / 1.913GiB +2026-10-16T18:44:01Z,mtusi-messenger-lab3-lb-1,10.66%,11.01MiB / 64MiB +2026-10-16T18:44:01Z,mtusi-messenger-lab3-postgres-1,36.62%,163.4MiB / 384MiB +2026-10-16T18:44:01Z,mtusi-messenger-lab3-api-2,14.11%,11.43MiB / 384MiB +2026-10-16T18:44:01Z,mtusi-messenger-lab3-api-1,13.93%,11.05MiB / 384MiB +2026-10-16T18:44:01Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:44:01Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:44:01Z,mtusi-messenger-lab3-redis-1,0.20%,6.992MiB / 192MiB +2026-10-16T18:44:04Z,blissful_blackburn,28.27%,24.98MiB / 1.913GiB +2026-10-16T18:44:04Z,mtusi-messenger-lab3-lb-1,10.63%,11MiB / 64MiB +2026-10-16T18:44:04Z,mtusi-messenger-lab3-postgres-1,36.96%,165.6MiB / 384MiB +2026-10-16T18:44:04Z,mtusi-messenger-lab3-api-2,14.09%,11.54MiB / 384MiB +2026-10-16T18:44:04Z,mtusi-messenger-lab3-api-1,14.40%,11.08MiB / 384MiB +2026-10-16T18:44:04Z,mtusi-messenger-lab2-postgres-1,0.71%,29.81MiB / 1.913GiB +2026-10-16T18:44:04Z,mtusi-messenger-lab2-redis-1,0.67%,4.785MiB / 1.913GiB +2026-10-16T18:44:04Z,mtusi-messenger-lab3-redis-1,0.20%,6.992MiB / 192MiB +2026-10-16T18:44:07Z,mtusi-messenger-lab3-lb-1,4.51%,10.95MiB / 64MiB +2026-10-16T18:44:07Z,mtusi-messenger-lab3-postgres-1,37.23%,174MiB / 384MiB +2026-10-16T18:44:07Z,mtusi-messenger-lab3-api-2,5.50%,11.16MiB / 384MiB +2026-10-16T18:44:07Z,mtusi-messenger-lab3-api-1,6.22%,11.07MiB / 384MiB +2026-10-16T18:44:07Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:44:07Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:44:07Z,mtusi-messenger-lab3-redis-1,0.20%,6.992MiB / 192MiB diff --git a/evidence/track1/stats-d2.csv b/evidence/track1/stats-d2.csv new file mode 100644 index 00000000..db71f536 --- /dev/null +++ b/evidence/track1/stats-d2.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:37:46Z,mtusi-messenger-lab3-lb-1,10.04%,11.02MiB / 64MiB +2026-10-16T18:37:46Z,mtusi-messenger-lab3-postgres-1,35.27%,182.1MiB / 384MiB +2026-10-16T18:37:46Z,mtusi-messenger-lab3-api-2,14.00%,154.2MiB / 384MiB +2026-10-16T18:37:46Z,mtusi-messenger-lab3-api-1,13.44%,154MiB / 384MiB +2026-10-16T18:37:46Z,mtusi-messenger-lab2-postgres-1,0.63%,31.4MiB / 1.913GiB +2026-10-16T18:37:46Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:37:46Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:37:46Z,tender_proskuriakova,27.59%,21.97MiB / 1.913GiB +2026-10-16T18:37:49Z,tender_proskuriakova,30.17%,22.02MiB / 1.913GiB +2026-10-16T18:37:49Z,mtusi-messenger-lab3-lb-1,10.31%,11.01MiB / 64MiB +2026-10-16T18:37:49Z,mtusi-messenger-lab3-postgres-1,36.00%,183.5MiB / 384MiB +2026-10-16T18:37:49Z,mtusi-messenger-lab3-api-2,13.64%,183MiB / 384MiB +2026-10-16T18:37:49Z,mtusi-messenger-lab3-api-1,13.69%,198.9MiB / 384MiB +2026-10-16T18:37:49Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:37:49Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:37:49Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:37:52Z,tender_proskuriakova,29.00%,22.32MiB / 1.913GiB +2026-10-16T18:37:52Z,mtusi-messenger-lab3-lb-1,10.61%,10.99MiB / 64MiB +2026-10-16T18:37:52Z,mtusi-messenger-lab3-postgres-1,38.24%,188MiB / 384MiB +2026-10-16T18:37:52Z,mtusi-messenger-lab3-api-2,14.81%,11.5MiB / 384MiB +2026-10-16T18:37:52Z,mtusi-messenger-lab3-api-1,14.48%,12.16MiB / 384MiB +2026-10-16T18:37:52Z,mtusi-messenger-lab2-postgres-1,0.79%,29.81MiB / 1.913GiB +2026-10-16T18:37:52Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:37:52Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:37:56Z,tender_proskuriakova,26.80%,22.16MiB / 1.913GiB +2026-10-16T18:37:56Z,mtusi-messenger-lab3-lb-1,9.80%,11MiB / 64MiB +2026-10-16T18:37:56Z,mtusi-messenger-lab3-postgres-1,34.21%,191.5MiB / 384MiB +2026-10-16T18:37:56Z,mtusi-messenger-lab3-api-2,14.24%,11.5MiB / 384MiB +2026-10-16T18:37:56Z,mtusi-messenger-lab3-api-1,13.77%,11.34MiB / 384MiB +2026-10-16T18:37:56Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:37:56Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:37:56Z,mtusi-messenger-lab3-redis-1,0.65%,6.965MiB / 192MiB +2026-10-16T18:37:59Z,tender_proskuriakova,29.06%,22.42MiB / 1.913GiB +2026-10-16T18:37:59Z,mtusi-messenger-lab3-lb-1,10.57%,11MiB / 64MiB +2026-10-16T18:37:59Z,mtusi-messenger-lab3-postgres-1,37.59%,196.3MiB / 384MiB +2026-10-16T18:37:59Z,mtusi-messenger-lab3-api-2,14.20%,11.27MiB / 384MiB +2026-10-16T18:37:59Z,mtusi-messenger-lab3-api-1,14.14%,11.32MiB / 384MiB +2026-10-16T18:37:59Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:37:59Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:37:59Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:02Z,tender_proskuriakova,27.65%,22.61MiB / 1.913GiB +2026-10-16T18:38:02Z,mtusi-messenger-lab3-lb-1,10.20%,10.98MiB / 64MiB +2026-10-16T18:38:02Z,mtusi-messenger-lab3-postgres-1,35.22%,196.5MiB / 384MiB +2026-10-16T18:38:02Z,mtusi-messenger-lab3-api-2,13.34%,11.31MiB / 384MiB +2026-10-16T18:38:02Z,mtusi-messenger-lab3-api-1,13.08%,11.3MiB / 384MiB +2026-10-16T18:38:02Z,mtusi-messenger-lab2-postgres-1,0.68%,29.81MiB / 1.913GiB +2026-10-16T18:38:02Z,mtusi-messenger-lab2-redis-1,0.68%,4.785MiB / 1.913GiB +2026-10-16T18:38:02Z,mtusi-messenger-lab3-redis-1,0.66%,6.965MiB / 192MiB +2026-10-16T18:38:05Z,tender_proskuriakova,28.49%,23.05MiB / 1.913GiB +2026-10-16T18:38:05Z,mtusi-messenger-lab3-lb-1,10.40%,10.99MiB / 64MiB +2026-10-16T18:38:05Z,mtusi-messenger-lab3-postgres-1,36.49%,196.7MiB / 384MiB +2026-10-16T18:38:05Z,mtusi-messenger-lab3-api-2,14.02%,11.34MiB / 384MiB +2026-10-16T18:38:05Z,mtusi-messenger-lab3-api-1,14.84%,11.32MiB / 384MiB +2026-10-16T18:38:05Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:05Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:38:05Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:08Z,tender_proskuriakova,28.47%,22.98MiB / 1.913GiB +2026-10-16T18:38:08Z,mtusi-messenger-lab3-lb-1,10.61%,10.99MiB / 64MiB +2026-10-16T18:38:08Z,mtusi-messenger-lab3-postgres-1,35.52%,197.1MiB / 384MiB +2026-10-16T18:38:08Z,mtusi-messenger-lab3-api-2,14.00%,11.24MiB / 384MiB +2026-10-16T18:38:08Z,mtusi-messenger-lab3-api-1,14.47%,11.29MiB / 384MiB +2026-10-16T18:38:08Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:08Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:38:08Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:11Z,tender_proskuriakova,28.10%,23.17MiB / 1.913GiB +2026-10-16T18:38:11Z,mtusi-messenger-lab3-lb-1,10.49%,11.01MiB / 64MiB +2026-10-16T18:38:11Z,mtusi-messenger-lab3-postgres-1,36.37%,197.1MiB / 384MiB +2026-10-16T18:38:11Z,mtusi-messenger-lab3-api-2,14.02%,11.64MiB / 384MiB +2026-10-16T18:38:11Z,mtusi-messenger-lab3-api-1,14.43%,11.32MiB / 384MiB +2026-10-16T18:38:11Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:11Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:38:11Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:14Z,tender_proskuriakova,28.46%,23.38MiB / 1.913GiB +2026-10-16T18:38:14Z,mtusi-messenger-lab3-lb-1,10.62%,10.99MiB / 64MiB +2026-10-16T18:38:14Z,mtusi-messenger-lab3-postgres-1,36.94%,197.5MiB / 384MiB +2026-10-16T18:38:14Z,mtusi-messenger-lab3-api-2,14.65%,11.57MiB / 384MiB +2026-10-16T18:38:14Z,mtusi-messenger-lab3-api-1,14.91%,11.19MiB / 384MiB +2026-10-16T18:38:14Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:14Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:38:14Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:38:17Z,tender_proskuriakova,27.29%,23.55MiB / 1.913GiB +2026-10-16T18:38:17Z,mtusi-messenger-lab3-lb-1,10.22%,11.24MiB / 64MiB +2026-10-16T18:38:17Z,mtusi-messenger-lab3-postgres-1,36.45%,197.3MiB / 384MiB +2026-10-16T18:38:17Z,mtusi-messenger-lab3-api-2,14.17%,11.51MiB / 384MiB +2026-10-16T18:38:17Z,mtusi-messenger-lab3-api-1,14.56%,11.18MiB / 384MiB +2026-10-16T18:38:17Z,mtusi-messenger-lab2-postgres-1,0.21%,29.81MiB / 1.913GiB +2026-10-16T18:38:17Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:38:17Z,mtusi-messenger-lab3-redis-1,0.68%,6.965MiB / 192MiB +2026-10-16T18:38:21Z,tender_proskuriakova,27.96%,23.75MiB / 1.913GiB +2026-10-16T18:38:21Z,mtusi-messenger-lab3-lb-1,10.84%,11MiB / 64MiB +2026-10-16T18:38:21Z,mtusi-messenger-lab3-postgres-1,36.12%,197.4MiB / 384MiB +2026-10-16T18:38:21Z,mtusi-messenger-lab3-api-2,13.71%,11.43MiB / 384MiB +2026-10-16T18:38:21Z,mtusi-messenger-lab3-api-1,13.32%,11.07MiB / 384MiB +2026-10-16T18:38:21Z,mtusi-messenger-lab2-postgres-1,0.17%,29.81MiB / 1.913GiB +2026-10-16T18:38:21Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:38:21Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:38:24Z,tender_proskuriakova,27.15%,24.21MiB / 1.913GiB +2026-10-16T18:38:24Z,mtusi-messenger-lab3-lb-1,10.05%,11MiB / 64MiB +2026-10-16T18:38:24Z,mtusi-messenger-lab3-postgres-1,37.35%,197.4MiB / 384MiB +2026-10-16T18:38:24Z,mtusi-messenger-lab3-api-2,13.95%,11.33MiB / 384MiB +2026-10-16T18:38:24Z,mtusi-messenger-lab3-api-1,14.36%,11.09MiB / 384MiB +2026-10-16T18:38:24Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:24Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:38:24Z,mtusi-messenger-lab3-redis-1,0.21%,6.965MiB / 192MiB +2026-10-16T18:38:27Z,tender_proskuriakova,29.46%,24.12MiB / 1.913GiB +2026-10-16T18:38:27Z,mtusi-messenger-lab3-lb-1,10.74%,10.98MiB / 64MiB +2026-10-16T18:38:27Z,mtusi-messenger-lab3-postgres-1,37.86%,197.5MiB / 384MiB +2026-10-16T18:38:27Z,mtusi-messenger-lab3-api-2,14.53%,11.45MiB / 384MiB +2026-10-16T18:38:27Z,mtusi-messenger-lab3-api-1,14.56%,11.16MiB / 384MiB +2026-10-16T18:38:27Z,mtusi-messenger-lab2-postgres-1,0.70%,29.81MiB / 1.913GiB +2026-10-16T18:38:27Z,mtusi-messenger-lab2-redis-1,0.63%,4.785MiB / 1.913GiB +2026-10-16T18:38:27Z,mtusi-messenger-lab3-redis-1,0.74%,6.973MiB / 192MiB +2026-10-16T18:38:30Z,tender_proskuriakova,27.00%,24.34MiB / 1.913GiB +2026-10-16T18:38:30Z,mtusi-messenger-lab3-lb-1,9.93%,10.99MiB / 64MiB +2026-10-16T18:38:30Z,mtusi-messenger-lab3-postgres-1,35.51%,197.5MiB / 384MiB +2026-10-16T18:38:30Z,mtusi-messenger-lab3-api-2,13.69%,11.37MiB / 384MiB +2026-10-16T18:38:30Z,mtusi-messenger-lab3-api-1,13.66%,11.24MiB / 384MiB +2026-10-16T18:38:30Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:30Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:38:30Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:33Z,tender_proskuriakova,27.60%,24.5MiB / 1.913GiB +2026-10-16T18:38:33Z,mtusi-messenger-lab3-lb-1,10.25%,10.96MiB / 64MiB +2026-10-16T18:38:33Z,mtusi-messenger-lab3-postgres-1,37.17%,197.7MiB / 384MiB +2026-10-16T18:38:33Z,mtusi-messenger-lab3-api-2,14.31%,11.37MiB / 384MiB +2026-10-16T18:38:33Z,mtusi-messenger-lab3-api-1,13.78%,11.21MiB / 384MiB +2026-10-16T18:38:33Z,mtusi-messenger-lab2-postgres-1,0.20%,29.81MiB / 1.913GiB +2026-10-16T18:38:33Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:38:33Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:36Z,tender_proskuriakova,26.96%,24.71MiB / 1.913GiB +2026-10-16T18:38:36Z,mtusi-messenger-lab3-lb-1,10.02%,10.97MiB / 64MiB +2026-10-16T18:38:36Z,mtusi-messenger-lab3-postgres-1,35.56%,197.8MiB / 384MiB +2026-10-16T18:38:36Z,mtusi-messenger-lab3-api-2,13.12%,11.37MiB / 384MiB +2026-10-16T18:38:36Z,mtusi-messenger-lab3-api-1,13.42%,11.18MiB / 384MiB +2026-10-16T18:38:36Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:36Z,mtusi-messenger-lab2-redis-1,0.40%,5.824MiB / 1.913GiB +2026-10-16T18:38:36Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:38:39Z,tender_proskuriakova,29.00%,24.89MiB / 1.913GiB +2026-10-16T18:38:39Z,mtusi-messenger-lab3-lb-1,10.49%,10.98MiB / 64MiB +2026-10-16T18:38:39Z,mtusi-messenger-lab3-postgres-1,36.22%,197.9MiB / 384MiB +2026-10-16T18:38:39Z,mtusi-messenger-lab3-api-2,13.98%,11.44MiB / 384MiB +2026-10-16T18:38:39Z,mtusi-messenger-lab3-api-1,14.42%,11.3MiB / 384MiB +2026-10-16T18:38:39Z,mtusi-messenger-lab2-postgres-1,0.00%,29.81MiB / 1.913GiB +2026-10-16T18:38:39Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:38:39Z,mtusi-messenger-lab3-redis-1,0.17%,6.965MiB / 192MiB +2026-10-16T18:38:42Z,tender_proskuriakova,28.87%,25.12MiB / 1.913GiB +2026-10-16T18:38:42Z,mtusi-messenger-lab3-lb-1,10.72%,10.96MiB / 64MiB +2026-10-16T18:38:42Z,mtusi-messenger-lab3-postgres-1,36.79%,197.9MiB / 384MiB +2026-10-16T18:38:42Z,mtusi-messenger-lab3-api-2,14.36%,11.36MiB / 384MiB +2026-10-16T18:38:42Z,mtusi-messenger-lab3-api-1,13.99%,11.3MiB / 384MiB +2026-10-16T18:38:42Z,mtusi-messenger-lab2-postgres-1,0.66%,29.81MiB / 1.913GiB +2026-10-16T18:38:42Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:38:42Z,mtusi-messenger-lab3-redis-1,0.69%,6.965MiB / 192MiB +2026-10-16T18:38:46Z,mtusi-messenger-lab3-lb-1,4.53%,10.94MiB / 64MiB +2026-10-16T18:38:46Z,mtusi-messenger-lab3-postgres-1,32.69%,201.2MiB / 384MiB +2026-10-16T18:38:46Z,mtusi-messenger-lab3-api-2,6.34%,11.35MiB / 384MiB +2026-10-16T18:38:46Z,mtusi-messenger-lab3-api-1,6.77%,11.16MiB / 384MiB +2026-10-16T18:38:46Z,mtusi-messenger-lab2-postgres-1,0.20%,29.81MiB / 1.913GiB +2026-10-16T18:38:46Z,mtusi-messenger-lab2-redis-1,0.21%,4.785MiB / 1.913GiB +2026-10-16T18:38:46Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB diff --git a/evidence/track1/stats-db1cpu.csv b/evidence/track1/stats-db1cpu.csv new file mode 100644 index 00000000..4de9dbbc --- /dev/null +++ b/evidence/track1/stats-db1cpu.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:34:51Z,mtusi-messenger-lab3-api-2,13.78%,152.3MiB / 384MiB +2026-10-16T18:34:51Z,mtusi-messenger-lab3-api-1,13.60%,152.2MiB / 384MiB +2026-10-16T18:34:51Z,mtusi-messenger-lab3-postgres-1,34.25%,65.82MiB / 384MiB +2026-10-16T18:34:51Z,mtusi-messenger-lab3-lb-1,9.89%,13.87MiB / 64MiB +2026-10-16T18:34:51Z,mtusi-messenger-lab2-postgres-1,0.73%,29.5MiB / 1.913GiB +2026-10-16T18:34:51Z,mtusi-messenger-lab2-redis-1,0.65%,4.785MiB / 1.913GiB +2026-10-16T18:34:51Z,mtusi-messenger-lab3-redis-1,0.68%,6.965MiB / 192MiB +2026-10-16T18:34:51Z,amazing_moore,27.09%,21.96MiB / 1.913GiB +2026-10-16T18:34:54Z,amazing_moore,28.20%,22.04MiB / 1.913GiB +2026-10-16T18:34:54Z,mtusi-messenger-lab3-api-2,13.41%,194.1MiB / 384MiB +2026-10-16T18:34:54Z,mtusi-messenger-lab3-api-1,13.37%,193.8MiB / 384MiB +2026-10-16T18:34:54Z,mtusi-messenger-lab3-postgres-1,35.47%,68.46MiB / 384MiB +2026-10-16T18:34:54Z,mtusi-messenger-lab3-lb-1,10.12%,13.87MiB / 64MiB +2026-10-16T18:34:54Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:54Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:34:54Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:34:57Z,amazing_moore,27.30%,22.09MiB / 1.913GiB +2026-10-16T18:34:57Z,mtusi-messenger-lab3-api-2,13.11%,11.04MiB / 384MiB +2026-10-16T18:34:57Z,mtusi-messenger-lab3-api-1,13.07%,11.31MiB / 384MiB +2026-10-16T18:34:57Z,mtusi-messenger-lab3-postgres-1,34.05%,70.27MiB / 384MiB +2026-10-16T18:34:57Z,mtusi-messenger-lab3-lb-1,9.91%,13.88MiB / 64MiB +2026-10-16T18:34:57Z,mtusi-messenger-lab2-postgres-1,0.28%,29.5MiB / 1.913GiB +2026-10-16T18:34:57Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:34:57Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:35:00Z,amazing_moore,27.93%,22.18MiB / 1.913GiB +2026-10-16T18:35:00Z,mtusi-messenger-lab3-api-2,13.35%,11.11MiB / 384MiB +2026-10-16T18:35:00Z,mtusi-messenger-lab3-api-1,12.96%,11.18MiB / 384MiB +2026-10-16T18:35:00Z,mtusi-messenger-lab3-postgres-1,34.19%,72.47MiB / 384MiB +2026-10-16T18:35:00Z,mtusi-messenger-lab3-lb-1,10.29%,13.87MiB / 64MiB +2026-10-16T18:35:00Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:00Z,mtusi-messenger-lab2-redis-1,0.88%,4.785MiB / 1.913GiB +2026-10-16T18:35:00Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:35:03Z,amazing_moore,27.82%,22.35MiB / 1.913GiB +2026-10-16T18:35:03Z,mtusi-messenger-lab3-api-2,13.30%,11.15MiB / 384MiB +2026-10-16T18:35:03Z,mtusi-messenger-lab3-api-1,12.99%,11.26MiB / 384MiB +2026-10-16T18:35:03Z,mtusi-messenger-lab3-postgres-1,34.68%,74.84MiB / 384MiB +2026-10-16T18:35:03Z,mtusi-messenger-lab3-lb-1,10.17%,13.85MiB / 64MiB +2026-10-16T18:35:03Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:03Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:03Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:35:06Z,amazing_moore,28.66%,22.49MiB / 1.913GiB +2026-10-16T18:35:06Z,mtusi-messenger-lab3-api-2,13.60%,11.02MiB / 384MiB +2026-10-16T18:35:06Z,mtusi-messenger-lab3-api-1,13.54%,11.27MiB / 384MiB +2026-10-16T18:35:06Z,mtusi-messenger-lab3-postgres-1,35.53%,77.09MiB / 384MiB +2026-10-16T18:35:06Z,mtusi-messenger-lab3-lb-1,10.31%,13.88MiB / 64MiB +2026-10-16T18:35:06Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:06Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:06Z,mtusi-messenger-lab3-redis-1,0.21%,6.965MiB / 192MiB +2026-10-16T18:35:09Z,amazing_moore,25.33%,22.74MiB / 1.913GiB +2026-10-16T18:35:09Z,mtusi-messenger-lab3-api-2,12.84%,11.19MiB / 384MiB +2026-10-16T18:35:09Z,mtusi-messenger-lab3-api-1,12.83%,11.21MiB / 384MiB +2026-10-16T18:35:09Z,mtusi-messenger-lab3-postgres-1,41.18%,83.8MiB / 384MiB +2026-10-16T18:35:09Z,mtusi-messenger-lab3-lb-1,9.53%,13.85MiB / 64MiB +2026-10-16T18:35:09Z,mtusi-messenger-lab2-postgres-1,0.24%,29.5MiB / 1.913GiB +2026-10-16T18:35:09Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:09Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:35:12Z,amazing_moore,22.98%,22.88MiB / 1.913GiB +2026-10-16T18:35:12Z,mtusi-messenger-lab3-api-2,11.61%,10.91MiB / 384MiB +2026-10-16T18:35:12Z,mtusi-messenger-lab3-api-1,11.59%,11.17MiB / 384MiB +2026-10-16T18:35:12Z,mtusi-messenger-lab3-postgres-1,35.96%,87.25MiB / 384MiB +2026-10-16T18:35:12Z,mtusi-messenger-lab3-lb-1,8.54%,13.86MiB / 64MiB +2026-10-16T18:35:12Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:12Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:12Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:35:15Z,amazing_moore,26.11%,23.03MiB / 1.913GiB +2026-10-16T18:35:15Z,mtusi-messenger-lab3-api-2,13.30%,10.94MiB / 384MiB +2026-10-16T18:35:15Z,mtusi-messenger-lab3-api-1,12.73%,11.34MiB / 384MiB +2026-10-16T18:35:15Z,mtusi-messenger-lab3-postgres-1,37.26%,91.92MiB / 384MiB +2026-10-16T18:35:15Z,mtusi-messenger-lab3-lb-1,9.52%,14.1MiB / 64MiB +2026-10-16T18:35:15Z,mtusi-messenger-lab2-postgres-1,0.65%,29.5MiB / 1.913GiB +2026-10-16T18:35:15Z,mtusi-messenger-lab2-redis-1,0.65%,4.785MiB / 1.913GiB +2026-10-16T18:35:15Z,mtusi-messenger-lab3-redis-1,0.67%,6.965MiB / 192MiB +2026-10-16T18:35:19Z,amazing_moore,25.87%,23.5MiB / 1.913GiB +2026-10-16T18:35:19Z,mtusi-messenger-lab3-api-2,13.49%,11.36MiB / 384MiB +2026-10-16T18:35:19Z,mtusi-messenger-lab3-api-1,12.81%,11.31MiB / 384MiB +2026-10-16T18:35:19Z,mtusi-messenger-lab3-postgres-1,41.93%,107.9MiB / 384MiB +2026-10-16T18:35:19Z,mtusi-messenger-lab3-lb-1,9.57%,13.84MiB / 64MiB +2026-10-16T18:35:19Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:19Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:19Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:35:22Z,amazing_moore,24.60%,23.33MiB / 1.913GiB +2026-10-16T18:35:22Z,mtusi-messenger-lab3-api-2,11.90%,10.9MiB / 384MiB +2026-10-16T18:35:22Z,mtusi-messenger-lab3-api-1,11.95%,11.16MiB / 384MiB +2026-10-16T18:35:22Z,mtusi-messenger-lab3-postgres-1,42.34%,109.1MiB / 384MiB +2026-10-16T18:35:22Z,mtusi-messenger-lab3-lb-1,9.19%,13.87MiB / 64MiB +2026-10-16T18:35:22Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:22Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:22Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:35:25Z,amazing_moore,24.31%,23.52MiB / 1.913GiB +2026-10-16T18:35:25Z,mtusi-messenger-lab3-api-2,12.84%,11MiB / 384MiB +2026-10-16T18:35:25Z,mtusi-messenger-lab3-api-1,12.86%,11.2MiB / 384MiB +2026-10-16T18:35:25Z,mtusi-messenger-lab3-postgres-1,38.49%,114.3MiB / 384MiB +2026-10-16T18:35:25Z,mtusi-messenger-lab3-lb-1,9.29%,13.88MiB / 64MiB +2026-10-16T18:35:25Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:25Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:25Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:35:28Z,amazing_moore,22.65%,23.65MiB / 1.913GiB +2026-10-16T18:35:28Z,mtusi-messenger-lab3-api-2,12.26%,10.96MiB / 384MiB +2026-10-16T18:35:28Z,mtusi-messenger-lab3-api-1,11.44%,11.15MiB / 384MiB +2026-10-16T18:35:28Z,mtusi-messenger-lab3-postgres-1,49.84%,174.3MiB / 384MiB +2026-10-16T18:35:28Z,mtusi-messenger-lab3-lb-1,8.60%,13.88MiB / 64MiB +2026-10-16T18:35:28Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:28Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:28Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:35:31Z,amazing_moore,25.87%,23.81MiB / 1.913GiB +2026-10-16T18:35:31Z,mtusi-messenger-lab3-api-2,12.60%,11.04MiB / 384MiB +2026-10-16T18:35:31Z,mtusi-messenger-lab3-api-1,13.32%,11.22MiB / 384MiB +2026-10-16T18:35:31Z,mtusi-messenger-lab3-postgres-1,37.43%,192.5MiB / 384MiB +2026-10-16T18:35:31Z,mtusi-messenger-lab3-lb-1,9.76%,13.86MiB / 64MiB +2026-10-16T18:35:31Z,mtusi-messenger-lab2-postgres-1,0.72%,29.5MiB / 1.913GiB +2026-10-16T18:35:31Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:35:31Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:35:34Z,amazing_moore,24.65%,23.99MiB / 1.913GiB +2026-10-16T18:35:34Z,mtusi-messenger-lab3-api-2,12.60%,11MiB / 384MiB +2026-10-16T18:35:34Z,mtusi-messenger-lab3-api-1,12.86%,11.19MiB / 384MiB +2026-10-16T18:35:34Z,mtusi-messenger-lab3-postgres-1,34.67%,193.2MiB / 384MiB +2026-10-16T18:35:34Z,mtusi-messenger-lab3-lb-1,9.06%,13.88MiB / 64MiB +2026-10-16T18:35:34Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:34Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:34Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:35:37Z,amazing_moore,26.81%,24.18MiB / 1.913GiB +2026-10-16T18:35:37Z,mtusi-messenger-lab3-api-2,12.81%,11.02MiB / 384MiB +2026-10-16T18:35:37Z,mtusi-messenger-lab3-api-1,13.28%,11.18MiB / 384MiB +2026-10-16T18:35:37Z,mtusi-messenger-lab3-postgres-1,37.50%,194.3MiB / 384MiB +2026-10-16T18:35:37Z,mtusi-messenger-lab3-lb-1,9.90%,13.88MiB / 64MiB +2026-10-16T18:35:37Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:37Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:35:37Z,mtusi-messenger-lab3-redis-1,0.22%,6.965MiB / 192MiB +2026-10-16T18:35:40Z,amazing_moore,26.79%,24.36MiB / 1.913GiB +2026-10-16T18:35:40Z,mtusi-messenger-lab3-api-2,13.71%,10.9MiB / 384MiB +2026-10-16T18:35:40Z,mtusi-messenger-lab3-api-1,14.18%,11.2MiB / 384MiB +2026-10-16T18:35:40Z,mtusi-messenger-lab3-postgres-1,36.11%,194.9MiB / 384MiB +2026-10-16T18:35:40Z,mtusi-messenger-lab3-lb-1,9.97%,13.85MiB / 64MiB +2026-10-16T18:35:40Z,mtusi-messenger-lab2-postgres-1,0.57%,30.52MiB / 1.913GiB +2026-10-16T18:35:40Z,mtusi-messenger-lab2-redis-1,0.21%,4.785MiB / 1.913GiB +2026-10-16T18:35:40Z,mtusi-messenger-lab3-redis-1,0.68%,6.965MiB / 192MiB +2026-10-16T18:35:44Z,amazing_moore,27.98%,24.57MiB / 1.913GiB +2026-10-16T18:35:44Z,mtusi-messenger-lab3-api-2,14.12%,11.05MiB / 384MiB +2026-10-16T18:35:44Z,mtusi-messenger-lab3-api-1,14.01%,11.37MiB / 384MiB +2026-10-16T18:35:44Z,mtusi-messenger-lab3-postgres-1,38.09%,195.4MiB / 384MiB +2026-10-16T18:35:44Z,mtusi-messenger-lab3-lb-1,10.36%,13.89MiB / 64MiB +2026-10-16T18:35:44Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:44Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:44Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:35:47Z,amazing_moore,28.52%,24.73MiB / 1.913GiB +2026-10-16T18:35:47Z,mtusi-messenger-lab3-api-2,13.84%,11.13MiB / 384MiB +2026-10-16T18:35:47Z,mtusi-messenger-lab3-api-1,14.18%,11.25MiB / 384MiB +2026-10-16T18:35:47Z,mtusi-messenger-lab3-postgres-1,37.17%,195.9MiB / 384MiB +2026-10-16T18:35:47Z,mtusi-messenger-lab3-lb-1,10.58%,14.12MiB / 64MiB +2026-10-16T18:35:47Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:47Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:35:47Z,mtusi-messenger-lab3-redis-1,0.64%,6.965MiB / 192MiB +2026-10-16T18:35:50Z,mtusi-messenger-lab3-api-2,6.30%,11.55MiB / 384MiB +2026-10-16T18:35:50Z,mtusi-messenger-lab3-api-1,6.30%,11.35MiB / 384MiB +2026-10-16T18:35:50Z,mtusi-messenger-lab3-postgres-1,51.72%,215.3MiB / 384MiB +2026-10-16T18:35:50Z,mtusi-messenger-lab3-lb-1,4.72%,13.83MiB / 64MiB +2026-10-16T18:35:50Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:35:50Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:35:50Z,mtusi-messenger-lab3-redis-1,0.32%,7.633MiB / 192MiB diff --git a/evidence/track1/stats-g05.csv b/evidence/track1/stats-g05.csv new file mode 100644 index 00000000..8af45434 --- /dev/null +++ b/evidence/track1/stats-g05.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:28:05Z,mtusi-messenger-lab3-api-2,13.88%,87.73MiB / 384MiB +2026-10-16T18:28:05Z,mtusi-messenger-lab3-api-1,13.38%,151.9MiB / 384MiB +2026-10-16T18:28:05Z,mtusi-messenger-lab3-lb-1,10.29%,16.29MiB / 64MiB +2026-10-16T18:28:05Z,mtusi-messenger-lab3-postgres-1,35.45%,265.5MiB / 384MiB +2026-10-16T18:28:05Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:05Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:05Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:05Z,upbeat_williams,33.13%,21.96MiB / 1.913GiB +2026-10-16T18:28:08Z,upbeat_williams,30.30%,22.02MiB / 1.913GiB +2026-10-16T18:28:08Z,mtusi-messenger-lab3-api-2,14.09%,135.3MiB / 384MiB +2026-10-16T18:28:08Z,mtusi-messenger-lab3-api-1,13.84%,131.8MiB / 384MiB +2026-10-16T18:28:08Z,mtusi-messenger-lab3-lb-1,10.91%,16.28MiB / 64MiB +2026-10-16T18:28:08Z,mtusi-messenger-lab3-postgres-1,38.09%,265.6MiB / 384MiB +2026-10-16T18:28:08Z,mtusi-messenger-lab2-postgres-1,0.67%,34.82MiB / 1.913GiB +2026-10-16T18:28:08Z,mtusi-messenger-lab2-redis-1,0.66%,4.199MiB / 1.913GiB +2026-10-16T18:28:08Z,mtusi-messenger-lab3-redis-1,0.62%,6.977MiB / 192MiB +2026-10-16T18:28:11Z,upbeat_williams,28.20%,22.08MiB / 1.913GiB +2026-10-16T18:28:11Z,mtusi-messenger-lab3-api-2,14.80%,11.68MiB / 384MiB +2026-10-16T18:28:11Z,mtusi-messenger-lab3-api-1,15.31%,10.97MiB / 384MiB +2026-10-16T18:28:11Z,mtusi-messenger-lab3-lb-1,10.68%,16.29MiB / 64MiB +2026-10-16T18:28:11Z,mtusi-messenger-lab3-postgres-1,36.50%,268.6MiB / 384MiB +2026-10-16T18:28:11Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:11Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:11Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:14Z,upbeat_williams,27.26%,22.23MiB / 1.913GiB +2026-10-16T18:28:14Z,mtusi-messenger-lab3-api-2,14.25%,11MiB / 384MiB +2026-10-16T18:28:14Z,mtusi-messenger-lab3-api-1,15.03%,10.91MiB / 384MiB +2026-10-16T18:28:14Z,mtusi-messenger-lab3-lb-1,10.07%,16.26MiB / 64MiB +2026-10-16T18:28:14Z,mtusi-messenger-lab3-postgres-1,35.39%,268.8MiB / 384MiB +2026-10-16T18:28:14Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:14Z,mtusi-messenger-lab2-redis-1,0.17%,4.199MiB / 1.913GiB +2026-10-16T18:28:14Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:17Z,upbeat_williams,28.84%,22.43MiB / 1.913GiB +2026-10-16T18:28:17Z,mtusi-messenger-lab3-api-2,13.88%,11.14MiB / 384MiB +2026-10-16T18:28:17Z,mtusi-messenger-lab3-api-1,14.24%,10.91MiB / 384MiB +2026-10-16T18:28:17Z,mtusi-messenger-lab3-lb-1,10.22%,16.51MiB / 64MiB +2026-10-16T18:28:17Z,mtusi-messenger-lab3-postgres-1,35.29%,268.9MiB / 384MiB +2026-10-16T18:28:17Z,mtusi-messenger-lab2-postgres-1,0.70%,34.82MiB / 1.913GiB +2026-10-16T18:28:17Z,mtusi-messenger-lab2-redis-1,0.63%,4.199MiB / 1.913GiB +2026-10-16T18:28:17Z,mtusi-messenger-lab3-redis-1,0.66%,6.977MiB / 192MiB +2026-10-16T18:28:21Z,upbeat_williams,29.30%,22.66MiB / 1.913GiB +2026-10-16T18:28:21Z,mtusi-messenger-lab3-api-2,14.19%,11.11MiB / 384MiB +2026-10-16T18:28:21Z,mtusi-messenger-lab3-api-1,14.46%,10.98MiB / 384MiB +2026-10-16T18:28:21Z,mtusi-messenger-lab3-lb-1,10.73%,16.29MiB / 64MiB +2026-10-16T18:28:21Z,mtusi-messenger-lab3-postgres-1,37.12%,269.5MiB / 384MiB +2026-10-16T18:28:21Z,mtusi-messenger-lab2-postgres-1,0.18%,34.82MiB / 1.913GiB +2026-10-16T18:28:21Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:28:21Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:24Z,upbeat_williams,28.44%,22.81MiB / 1.913GiB +2026-10-16T18:28:24Z,mtusi-messenger-lab3-api-2,14.10%,11.09MiB / 384MiB +2026-10-16T18:28:24Z,mtusi-messenger-lab3-api-1,14.10%,10.94MiB / 384MiB +2026-10-16T18:28:24Z,mtusi-messenger-lab3-lb-1,10.70%,16.27MiB / 64MiB +2026-10-16T18:28:24Z,mtusi-messenger-lab3-postgres-1,36.80%,269.9MiB / 384MiB +2026-10-16T18:28:24Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:24Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:24Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:27Z,upbeat_williams,27.96%,23.09MiB / 1.913GiB +2026-10-16T18:28:27Z,mtusi-messenger-lab3-api-2,14.55%,11.14MiB / 384MiB +2026-10-16T18:28:27Z,mtusi-messenger-lab3-api-1,13.92%,10.88MiB / 384MiB +2026-10-16T18:28:27Z,mtusi-messenger-lab3-lb-1,10.35%,16.28MiB / 64MiB +2026-10-16T18:28:27Z,mtusi-messenger-lab3-postgres-1,36.05%,269.8MiB / 384MiB +2026-10-16T18:28:27Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:27Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:27Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:30Z,upbeat_williams,28.32%,23.31MiB / 1.913GiB +2026-10-16T18:28:30Z,mtusi-messenger-lab3-api-2,14.02%,11.05MiB / 384MiB +2026-10-16T18:28:30Z,mtusi-messenger-lab3-api-1,14.54%,10.98MiB / 384MiB +2026-10-16T18:28:30Z,mtusi-messenger-lab3-lb-1,10.55%,16.5MiB / 64MiB +2026-10-16T18:28:30Z,mtusi-messenger-lab3-postgres-1,36.43%,270MiB / 384MiB +2026-10-16T18:28:30Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:30Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:30Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:33Z,upbeat_williams,28.66%,23.49MiB / 1.913GiB +2026-10-16T18:28:33Z,mtusi-messenger-lab3-api-2,13.80%,11MiB / 384MiB +2026-10-16T18:28:33Z,mtusi-messenger-lab3-api-1,13.54%,10.86MiB / 384MiB +2026-10-16T18:28:33Z,mtusi-messenger-lab3-lb-1,10.41%,16.29MiB / 64MiB +2026-10-16T18:28:33Z,mtusi-messenger-lab3-postgres-1,36.22%,270.2MiB / 384MiB +2026-10-16T18:28:33Z,mtusi-messenger-lab2-postgres-1,1.01%,34.82MiB / 1.913GiB +2026-10-16T18:28:33Z,mtusi-messenger-lab2-redis-1,0.67%,4.199MiB / 1.913GiB +2026-10-16T18:28:33Z,mtusi-messenger-lab3-redis-1,0.64%,6.977MiB / 192MiB +2026-10-16T18:28:36Z,upbeat_williams,28.14%,23.7MiB / 1.913GiB +2026-10-16T18:28:36Z,mtusi-messenger-lab3-api-2,14.37%,11.15MiB / 384MiB +2026-10-16T18:28:36Z,mtusi-messenger-lab3-api-1,14.01%,10.8MiB / 384MiB +2026-10-16T18:28:36Z,mtusi-messenger-lab3-lb-1,10.62%,16.25MiB / 64MiB +2026-10-16T18:28:36Z,mtusi-messenger-lab3-postgres-1,36.49%,270MiB / 384MiB +2026-10-16T18:28:36Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:36Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:36Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:39Z,upbeat_williams,28.14%,23.81MiB / 1.913GiB +2026-10-16T18:28:39Z,mtusi-messenger-lab3-api-2,14.18%,10.98MiB / 384MiB +2026-10-16T18:28:39Z,mtusi-messenger-lab3-api-1,14.24%,10.81MiB / 384MiB +2026-10-16T18:28:39Z,mtusi-messenger-lab3-lb-1,10.32%,16.26MiB / 64MiB +2026-10-16T18:28:39Z,mtusi-messenger-lab3-postgres-1,36.41%,270.5MiB / 384MiB +2026-10-16T18:28:39Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:39Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:39Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:42Z,upbeat_williams,28.61%,24.11MiB / 1.913GiB +2026-10-16T18:28:42Z,mtusi-messenger-lab3-api-2,14.62%,11.12MiB / 384MiB +2026-10-16T18:28:42Z,mtusi-messenger-lab3-api-1,14.02%,10.89MiB / 384MiB +2026-10-16T18:28:42Z,mtusi-messenger-lab3-lb-1,10.65%,16.29MiB / 64MiB +2026-10-16T18:28:42Z,mtusi-messenger-lab3-postgres-1,36.60%,270.5MiB / 384MiB +2026-10-16T18:28:42Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:42Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:42Z,mtusi-messenger-lab3-redis-1,0.66%,6.977MiB / 192MiB +2026-10-16T18:28:45Z,upbeat_williams,27.52%,24.34MiB / 1.913GiB +2026-10-16T18:28:45Z,mtusi-messenger-lab3-api-2,14.94%,11.18MiB / 384MiB +2026-10-16T18:28:45Z,mtusi-messenger-lab3-api-1,13.81%,10.92MiB / 384MiB +2026-10-16T18:28:45Z,mtusi-messenger-lab3-lb-1,10.34%,16.26MiB / 64MiB +2026-10-16T18:28:45Z,mtusi-messenger-lab3-postgres-1,35.75%,270.4MiB / 384MiB +2026-10-16T18:28:45Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:45Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:28:45Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:49Z,upbeat_williams,28.67%,24.53MiB / 1.913GiB +2026-10-16T18:28:49Z,mtusi-messenger-lab3-api-2,14.11%,11.04MiB / 384MiB +2026-10-16T18:28:49Z,mtusi-messenger-lab3-api-1,14.08%,11.03MiB / 384MiB +2026-10-16T18:28:49Z,mtusi-messenger-lab3-lb-1,10.21%,16.29MiB / 64MiB +2026-10-16T18:28:49Z,mtusi-messenger-lab3-postgres-1,35.95%,270.6MiB / 384MiB +2026-10-16T18:28:49Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:49Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:49Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:52Z,upbeat_williams,28.27%,24.74MiB / 1.913GiB +2026-10-16T18:28:52Z,mtusi-messenger-lab3-api-2,14.39%,11.04MiB / 384MiB +2026-10-16T18:28:52Z,mtusi-messenger-lab3-api-1,14.07%,10.94MiB / 384MiB +2026-10-16T18:28:52Z,mtusi-messenger-lab3-lb-1,10.52%,16.29MiB / 64MiB +2026-10-16T18:28:52Z,mtusi-messenger-lab3-postgres-1,36.78%,270.7MiB / 384MiB +2026-10-16T18:28:52Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:52Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:52Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:55Z,upbeat_williams,27.02%,24.94MiB / 1.913GiB +2026-10-16T18:28:55Z,mtusi-messenger-lab3-api-2,13.63%,11.04MiB / 384MiB +2026-10-16T18:28:55Z,mtusi-messenger-lab3-api-1,14.19%,10.93MiB / 384MiB +2026-10-16T18:28:55Z,mtusi-messenger-lab3-lb-1,10.18%,16.29MiB / 64MiB +2026-10-16T18:28:55Z,mtusi-messenger-lab3-postgres-1,35.76%,270.7MiB / 384MiB +2026-10-16T18:28:55Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:28:55Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:28:55Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:28:58Z,upbeat_williams,29.09%,25.16MiB / 1.913GiB +2026-10-16T18:28:58Z,mtusi-messenger-lab3-api-2,13.96%,11.11MiB / 384MiB +2026-10-16T18:28:58Z,mtusi-messenger-lab3-api-1,13.61%,10.9MiB / 384MiB +2026-10-16T18:28:58Z,mtusi-messenger-lab3-lb-1,10.62%,16.29MiB / 64MiB +2026-10-16T18:28:58Z,mtusi-messenger-lab3-postgres-1,36.74%,272.9MiB / 384MiB +2026-10-16T18:28:58Z,mtusi-messenger-lab2-postgres-1,0.19%,34.82MiB / 1.913GiB +2026-10-16T18:28:58Z,mtusi-messenger-lab2-redis-1,0.64%,4.199MiB / 1.913GiB +2026-10-16T18:28:58Z,mtusi-messenger-lab3-redis-1,0.66%,6.977MiB / 192MiB +2026-10-16T18:29:01Z,upbeat_williams,25.39%,25.34MiB / 1.913GiB +2026-10-16T18:29:01Z,mtusi-messenger-lab3-api-2,12.80%,11.16MiB / 384MiB +2026-10-16T18:29:01Z,mtusi-messenger-lab3-api-1,12.74%,10.93MiB / 384MiB +2026-10-16T18:29:01Z,mtusi-messenger-lab3-lb-1,9.48%,16.28MiB / 64MiB +2026-10-16T18:29:01Z,mtusi-messenger-lab3-postgres-1,38.35%,270.8MiB / 384MiB +2026-10-16T18:29:01Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:01Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:29:01Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:29:04Z,mtusi-messenger-lab3-api-2,13.21%,11.02MiB / 384MiB +2026-10-16T18:29:04Z,mtusi-messenger-lab3-api-1,13.26%,11.03MiB / 384MiB +2026-10-16T18:29:04Z,mtusi-messenger-lab3-lb-1,10.01%,16.24MiB / 64MiB +2026-10-16T18:29:04Z,mtusi-messenger-lab3-postgres-1,32.96%,268.4MiB / 384MiB +2026-10-16T18:29:04Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:04Z,mtusi-messenger-lab2-redis-1,0.17%,4.199MiB / 1.913GiB +2026-10-16T18:29:04Z,mtusi-messenger-lab3-redis-1,0.67%,6.977MiB / 192MiB diff --git a/evidence/track1/stats-g10.csv b/evidence/track1/stats-g10.csv new file mode 100644 index 00000000..91fb784a --- /dev/null +++ b/evidence/track1/stats-g10.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:29:29Z,mtusi-messenger-lab3-api-1,13.80%,156.6MiB / 384MiB +2026-10-16T18:29:29Z,mtusi-messenger-lab3-api-2,13.49%,156.6MiB / 384MiB +2026-10-16T18:29:29Z,mtusi-messenger-lab3-lb-1,10.45%,16.26MiB / 64MiB +2026-10-16T18:29:29Z,mtusi-messenger-lab3-postgres-1,36.48%,268.8MiB / 384MiB +2026-10-16T18:29:29Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:29Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:29:29Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:29:29Z,naughty_keldysh,28.43%,21.98MiB / 1.913GiB +2026-10-16T18:29:32Z,naughty_keldysh,28.58%,22.05MiB / 1.913GiB +2026-10-16T18:29:32Z,mtusi-messenger-lab3-api-1,14.95%,52.15MiB / 384MiB +2026-10-16T18:29:32Z,mtusi-messenger-lab3-api-2,14.34%,62.34MiB / 384MiB +2026-10-16T18:29:32Z,mtusi-messenger-lab3-lb-1,10.40%,16.29MiB / 64MiB +2026-10-16T18:29:32Z,mtusi-messenger-lab3-postgres-1,35.93%,269.1MiB / 384MiB +2026-10-16T18:29:32Z,mtusi-messenger-lab2-postgres-1,0.21%,34.82MiB / 1.913GiB +2026-10-16T18:29:32Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:29:32Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:29:36Z,naughty_keldysh,28.32%,22.15MiB / 1.913GiB +2026-10-16T18:29:36Z,mtusi-messenger-lab3-api-1,13.63%,11.23MiB / 384MiB +2026-10-16T18:29:36Z,mtusi-messenger-lab3-api-2,13.58%,11.29MiB / 384MiB +2026-10-16T18:29:36Z,mtusi-messenger-lab3-lb-1,10.14%,16.26MiB / 64MiB +2026-10-16T18:29:36Z,mtusi-messenger-lab3-postgres-1,36.88%,270.3MiB / 384MiB +2026-10-16T18:29:36Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:36Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:29:36Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:29:39Z,naughty_keldysh,28.61%,22.3MiB / 1.913GiB +2026-10-16T18:29:39Z,mtusi-messenger-lab3-api-1,14.26%,11.15MiB / 384MiB +2026-10-16T18:29:39Z,mtusi-messenger-lab3-api-2,13.72%,10.9MiB / 384MiB +2026-10-16T18:29:39Z,mtusi-messenger-lab3-lb-1,10.63%,16.28MiB / 64MiB +2026-10-16T18:29:39Z,mtusi-messenger-lab3-postgres-1,36.56%,270.3MiB / 384MiB +2026-10-16T18:29:39Z,mtusi-messenger-lab2-postgres-1,0.68%,34.82MiB / 1.913GiB +2026-10-16T18:29:39Z,mtusi-messenger-lab2-redis-1,0.65%,4.199MiB / 1.913GiB +2026-10-16T18:29:39Z,mtusi-messenger-lab3-redis-1,0.73%,6.977MiB / 192MiB +2026-10-16T18:29:42Z,naughty_keldysh,28.97%,22.49MiB / 1.913GiB +2026-10-16T18:29:42Z,mtusi-messenger-lab3-api-1,14.60%,10.68MiB / 384MiB +2026-10-16T18:29:42Z,mtusi-messenger-lab3-api-2,14.52%,10.87MiB / 384MiB +2026-10-16T18:29:42Z,mtusi-messenger-lab3-lb-1,10.75%,16.29MiB / 64MiB +2026-10-16T18:29:42Z,mtusi-messenger-lab3-postgres-1,37.67%,270.4MiB / 384MiB +2026-10-16T18:29:42Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:42Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:29:42Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:29:45Z,naughty_keldysh,29.76%,22.67MiB / 1.913GiB +2026-10-16T18:29:45Z,mtusi-messenger-lab3-api-1,14.46%,10.93MiB / 384MiB +2026-10-16T18:29:45Z,mtusi-messenger-lab3-api-2,14.29%,10.87MiB / 384MiB +2026-10-16T18:29:45Z,mtusi-messenger-lab3-lb-1,10.65%,16.28MiB / 64MiB +2026-10-16T18:29:45Z,mtusi-messenger-lab3-postgres-1,36.82%,271MiB / 384MiB +2026-10-16T18:29:45Z,mtusi-messenger-lab2-postgres-1,0.18%,34.82MiB / 1.913GiB +2026-10-16T18:29:45Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:29:45Z,mtusi-messenger-lab3-redis-1,0.20%,6.977MiB / 192MiB +2026-10-16T18:29:48Z,naughty_keldysh,27.39%,22.93MiB / 1.913GiB +2026-10-16T18:29:48Z,mtusi-messenger-lab3-api-1,13.86%,10.8MiB / 384MiB +2026-10-16T18:29:48Z,mtusi-messenger-lab3-api-2,13.67%,10.85MiB / 384MiB +2026-10-16T18:29:48Z,mtusi-messenger-lab3-lb-1,10.06%,16.25MiB / 64MiB +2026-10-16T18:29:48Z,mtusi-messenger-lab3-postgres-1,38.84%,270.8MiB / 384MiB +2026-10-16T18:29:48Z,mtusi-messenger-lab2-postgres-1,0.67%,34.82MiB / 1.913GiB +2026-10-16T18:29:48Z,mtusi-messenger-lab2-redis-1,0.67%,4.199MiB / 1.913GiB +2026-10-16T18:29:48Z,mtusi-messenger-lab3-redis-1,0.66%,6.977MiB / 192MiB +2026-10-16T18:29:51Z,naughty_keldysh,29.45%,23.12MiB / 1.913GiB +2026-10-16T18:29:51Z,mtusi-messenger-lab3-api-1,14.35%,10.64MiB / 384MiB +2026-10-16T18:29:51Z,mtusi-messenger-lab3-api-2,14.56%,10.83MiB / 384MiB +2026-10-16T18:29:51Z,mtusi-messenger-lab3-lb-1,10.98%,16.28MiB / 64MiB +2026-10-16T18:29:51Z,mtusi-messenger-lab3-postgres-1,37.64%,270.8MiB / 384MiB +2026-10-16T18:29:51Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:51Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:29:51Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:29:54Z,naughty_keldysh,27.49%,23.29MiB / 1.913GiB +2026-10-16T18:29:54Z,mtusi-messenger-lab3-api-1,14.27%,10.68MiB / 384MiB +2026-10-16T18:29:54Z,mtusi-messenger-lab3-api-2,14.53%,10.88MiB / 384MiB +2026-10-16T18:29:54Z,mtusi-messenger-lab3-lb-1,10.26%,16.26MiB / 64MiB +2026-10-16T18:29:54Z,mtusi-messenger-lab3-postgres-1,36.56%,270.9MiB / 384MiB +2026-10-16T18:29:54Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:29:54Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:29:54Z,mtusi-messenger-lab3-redis-1,0.18%,6.977MiB / 192MiB +2026-10-16T18:29:57Z,naughty_keldysh,28.83%,23.57MiB / 1.913GiB +2026-10-16T18:29:57Z,mtusi-messenger-lab3-api-1,14.13%,10.96MiB / 384MiB +2026-10-16T18:29:57Z,mtusi-messenger-lab3-api-2,15.01%,11.04MiB / 384MiB +2026-10-16T18:29:57Z,mtusi-messenger-lab3-lb-1,10.74%,16.29MiB / 64MiB +2026-10-16T18:29:57Z,mtusi-messenger-lab3-postgres-1,36.68%,271.1MiB / 384MiB +2026-10-16T18:29:57Z,mtusi-messenger-lab2-postgres-1,0.18%,34.82MiB / 1.913GiB +2026-10-16T18:29:57Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:29:57Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:00Z,naughty_keldysh,28.97%,23.72MiB / 1.913GiB +2026-10-16T18:30:00Z,mtusi-messenger-lab3-api-1,13.99%,10.96MiB / 384MiB +2026-10-16T18:30:00Z,mtusi-messenger-lab3-api-2,14.05%,11.02MiB / 384MiB +2026-10-16T18:30:00Z,mtusi-messenger-lab3-lb-1,10.74%,16.27MiB / 64MiB +2026-10-16T18:30:00Z,mtusi-messenger-lab3-postgres-1,37.33%,275.4MiB / 384MiB +2026-10-16T18:30:00Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:00Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:00Z,mtusi-messenger-lab3-redis-1,0.18%,6.977MiB / 192MiB +2026-10-16T18:30:04Z,naughty_keldysh,28.93%,23.98MiB / 1.913GiB +2026-10-16T18:30:04Z,mtusi-messenger-lab3-api-1,13.37%,10.94MiB / 384MiB +2026-10-16T18:30:04Z,mtusi-messenger-lab3-api-2,14.18%,10.96MiB / 384MiB +2026-10-16T18:30:04Z,mtusi-messenger-lab3-lb-1,10.67%,16.25MiB / 64MiB +2026-10-16T18:30:04Z,mtusi-messenger-lab3-postgres-1,38.03%,271.5MiB / 384MiB +2026-10-16T18:30:04Z,mtusi-messenger-lab2-postgres-1,0.66%,34.82MiB / 1.913GiB +2026-10-16T18:30:04Z,mtusi-messenger-lab2-redis-1,0.67%,4.199MiB / 1.913GiB +2026-10-16T18:30:04Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:07Z,naughty_keldysh,28.00%,24.4MiB / 1.913GiB +2026-10-16T18:30:07Z,mtusi-messenger-lab3-api-1,14.69%,10.81MiB / 384MiB +2026-10-16T18:30:07Z,mtusi-messenger-lab3-api-2,14.98%,10.88MiB / 384MiB +2026-10-16T18:30:07Z,mtusi-messenger-lab3-lb-1,10.42%,16.27MiB / 64MiB +2026-10-16T18:30:07Z,mtusi-messenger-lab3-postgres-1,36.38%,271.7MiB / 384MiB +2026-10-16T18:30:07Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:07Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:07Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:10Z,naughty_keldysh,28.42%,24.38MiB / 1.913GiB +2026-10-16T18:30:10Z,mtusi-messenger-lab3-api-1,14.50%,10.88MiB / 384MiB +2026-10-16T18:30:10Z,mtusi-messenger-lab3-api-2,13.94%,10.93MiB / 384MiB +2026-10-16T18:30:10Z,mtusi-messenger-lab3-lb-1,10.50%,16.27MiB / 64MiB +2026-10-16T18:30:10Z,mtusi-messenger-lab3-postgres-1,36.20%,271.7MiB / 384MiB +2026-10-16T18:30:10Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:10Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:10Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:13Z,naughty_keldysh,27.55%,24.55MiB / 1.913GiB +2026-10-16T18:30:13Z,mtusi-messenger-lab3-api-1,13.98%,10.9MiB / 384MiB +2026-10-16T18:30:13Z,mtusi-messenger-lab3-api-2,13.78%,10.93MiB / 384MiB +2026-10-16T18:30:13Z,mtusi-messenger-lab3-lb-1,10.23%,16.25MiB / 64MiB +2026-10-16T18:30:13Z,mtusi-messenger-lab3-postgres-1,36.16%,272.4MiB / 384MiB +2026-10-16T18:30:13Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:13Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:13Z,mtusi-messenger-lab3-redis-1,0.64%,6.977MiB / 192MiB +2026-10-16T18:30:16Z,naughty_keldysh,28.30%,24.75MiB / 1.913GiB +2026-10-16T18:30:16Z,mtusi-messenger-lab3-api-1,13.59%,10.79MiB / 384MiB +2026-10-16T18:30:16Z,mtusi-messenger-lab3-api-2,13.59%,10.88MiB / 384MiB +2026-10-16T18:30:16Z,mtusi-messenger-lab3-lb-1,10.45%,16.27MiB / 64MiB +2026-10-16T18:30:16Z,mtusi-messenger-lab3-postgres-1,36.62%,272.7MiB / 384MiB +2026-10-16T18:30:16Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:16Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:16Z,mtusi-messenger-lab3-redis-1,0.18%,6.977MiB / 192MiB +2026-10-16T18:30:19Z,naughty_keldysh,27.86%,24.97MiB / 1.913GiB +2026-10-16T18:30:19Z,mtusi-messenger-lab3-api-1,13.93%,10.88MiB / 384MiB +2026-10-16T18:30:19Z,mtusi-messenger-lab3-api-2,14.01%,10.84MiB / 384MiB +2026-10-16T18:30:19Z,mtusi-messenger-lab3-lb-1,10.26%,16.3MiB / 64MiB +2026-10-16T18:30:19Z,mtusi-messenger-lab3-postgres-1,36.35%,269.9MiB / 384MiB +2026-10-16T18:30:19Z,mtusi-messenger-lab2-postgres-1,0.71%,34.82MiB / 1.913GiB +2026-10-16T18:30:19Z,mtusi-messenger-lab2-redis-1,0.17%,4.199MiB / 1.913GiB +2026-10-16T18:30:19Z,mtusi-messenger-lab3-redis-1,0.18%,6.977MiB / 192MiB +2026-10-16T18:30:22Z,naughty_keldysh,28.53%,25.39MiB / 1.913GiB +2026-10-16T18:30:22Z,mtusi-messenger-lab3-api-1,14.36%,10.89MiB / 384MiB +2026-10-16T18:30:22Z,mtusi-messenger-lab3-api-2,13.45%,10.88MiB / 384MiB +2026-10-16T18:30:22Z,mtusi-messenger-lab3-lb-1,10.50%,16.28MiB / 64MiB +2026-10-16T18:30:22Z,mtusi-messenger-lab3-postgres-1,35.65%,270.2MiB / 384MiB +2026-10-16T18:30:22Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:22Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:22Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:25Z,naughty_keldysh,27.52%,25.38MiB / 1.913GiB +2026-10-16T18:30:25Z,mtusi-messenger-lab3-api-1,13.65%,10.88MiB / 384MiB +2026-10-16T18:30:25Z,mtusi-messenger-lab3-api-2,13.78%,10.88MiB / 384MiB +2026-10-16T18:30:25Z,mtusi-messenger-lab3-lb-1,10.15%,16.29MiB / 64MiB +2026-10-16T18:30:25Z,mtusi-messenger-lab3-postgres-1,35.67%,270.7MiB / 384MiB +2026-10-16T18:30:25Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:25Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:25Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:28Z,mtusi-messenger-lab3-api-1,6.47%,10.95MiB / 384MiB +2026-10-16T18:30:28Z,mtusi-messenger-lab3-api-2,6.53%,11MiB / 384MiB +2026-10-16T18:30:28Z,mtusi-messenger-lab3-lb-1,4.60%,16.24MiB / 64MiB +2026-10-16T18:30:28Z,mtusi-messenger-lab3-postgres-1,38.82%,274MiB / 384MiB +2026-10-16T18:30:28Z,mtusi-messenger-lab2-postgres-1,0.63%,34.82MiB / 1.913GiB +2026-10-16T18:30:28Z,mtusi-messenger-lab2-redis-1,0.67%,4.199MiB / 1.913GiB +2026-10-16T18:30:28Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB diff --git a/evidence/track1/stats-g15.csv b/evidence/track1/stats-g15.csv new file mode 100644 index 00000000..057497ab --- /dev/null +++ b/evidence/track1/stats-g15.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:30:48Z,mtusi-messenger-lab3-api-1,13.05%,157.7MiB / 384MiB +2026-10-16T18:30:48Z,mtusi-messenger-lab3-api-2,13.63%,158.1MiB / 384MiB +2026-10-16T18:30:48Z,mtusi-messenger-lab3-lb-1,10.21%,16.27MiB / 64MiB +2026-10-16T18:30:48Z,mtusi-messenger-lab3-postgres-1,35.35%,269.4MiB / 384MiB +2026-10-16T18:30:48Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:48Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:48Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:48Z,nostalgic_bohr,28.36%,21.96MiB / 1.913GiB +2026-10-16T18:30:51Z,nostalgic_bohr,27.97%,22.16MiB / 1.913GiB +2026-10-16T18:30:51Z,mtusi-messenger-lab3-api-1,13.70%,11.84MiB / 384MiB +2026-10-16T18:30:51Z,mtusi-messenger-lab3-api-2,13.70%,83.12MiB / 384MiB +2026-10-16T18:30:51Z,mtusi-messenger-lab3-lb-1,10.10%,16.25MiB / 64MiB +2026-10-16T18:30:51Z,mtusi-messenger-lab3-postgres-1,35.03%,269.7MiB / 384MiB +2026-10-16T18:30:51Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:30:51Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:51Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:30:54Z,nostalgic_bohr,28.52%,22.34MiB / 1.913GiB +2026-10-16T18:30:54Z,mtusi-messenger-lab3-api-1,14.15%,10.91MiB / 384MiB +2026-10-16T18:30:54Z,mtusi-messenger-lab3-api-2,14.12%,11.01MiB / 384MiB +2026-10-16T18:30:54Z,mtusi-messenger-lab3-lb-1,10.43%,16.26MiB / 64MiB +2026-10-16T18:30:54Z,mtusi-messenger-lab3-postgres-1,36.90%,270.3MiB / 384MiB +2026-10-16T18:30:54Z,mtusi-messenger-lab2-postgres-1,0.69%,34.82MiB / 1.913GiB +2026-10-16T18:30:54Z,mtusi-messenger-lab2-redis-1,0.63%,4.199MiB / 1.913GiB +2026-10-16T18:30:54Z,mtusi-messenger-lab3-redis-1,0.65%,6.977MiB / 192MiB +2026-10-16T18:30:57Z,nostalgic_bohr,29.00%,22.3MiB / 1.913GiB +2026-10-16T18:30:57Z,mtusi-messenger-lab3-api-1,13.68%,10.88MiB / 384MiB +2026-10-16T18:30:57Z,mtusi-messenger-lab3-api-2,14.13%,10.98MiB / 384MiB +2026-10-16T18:30:57Z,mtusi-messenger-lab3-lb-1,10.44%,16.52MiB / 64MiB +2026-10-16T18:30:57Z,mtusi-messenger-lab3-postgres-1,35.70%,270.3MiB / 384MiB +2026-10-16T18:30:57Z,mtusi-messenger-lab2-postgres-1,0.18%,34.82MiB / 1.913GiB +2026-10-16T18:30:57Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:30:57Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:00Z,nostalgic_bohr,28.76%,22.51MiB / 1.913GiB +2026-10-16T18:31:00Z,mtusi-messenger-lab3-api-1,14.63%,10.96MiB / 384MiB +2026-10-16T18:31:00Z,mtusi-messenger-lab3-api-2,14.11%,10.9MiB / 384MiB +2026-10-16T18:31:00Z,mtusi-messenger-lab3-lb-1,10.60%,16.52MiB / 64MiB +2026-10-16T18:31:00Z,mtusi-messenger-lab3-postgres-1,35.71%,270.5MiB / 384MiB +2026-10-16T18:31:00Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:00Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:00Z,mtusi-messenger-lab3-redis-1,0.20%,6.977MiB / 192MiB +2026-10-16T18:31:03Z,nostalgic_bohr,28.57%,22.95MiB / 1.913GiB +2026-10-16T18:31:03Z,mtusi-messenger-lab3-api-1,14.31%,10.88MiB / 384MiB +2026-10-16T18:31:03Z,mtusi-messenger-lab3-api-2,14.16%,11.11MiB / 384MiB +2026-10-16T18:31:03Z,mtusi-messenger-lab3-lb-1,10.39%,16.27MiB / 64MiB +2026-10-16T18:31:03Z,mtusi-messenger-lab3-postgres-1,35.77%,270.9MiB / 384MiB +2026-10-16T18:31:03Z,mtusi-messenger-lab2-postgres-1,0.80%,34.82MiB / 1.913GiB +2026-10-16T18:31:03Z,mtusi-messenger-lab2-redis-1,0.65%,4.199MiB / 1.913GiB +2026-10-16T18:31:03Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:07Z,nostalgic_bohr,29.23%,22.95MiB / 1.913GiB +2026-10-16T18:31:07Z,mtusi-messenger-lab3-api-1,13.99%,10.75MiB / 384MiB +2026-10-16T18:31:07Z,mtusi-messenger-lab3-api-2,13.96%,10.87MiB / 384MiB +2026-10-16T18:31:07Z,mtusi-messenger-lab3-lb-1,10.50%,16.26MiB / 64MiB +2026-10-16T18:31:07Z,mtusi-messenger-lab3-postgres-1,36.27%,271.2MiB / 384MiB +2026-10-16T18:31:07Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:07Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:07Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:10Z,nostalgic_bohr,29.05%,23.11MiB / 1.913GiB +2026-10-16T18:31:10Z,mtusi-messenger-lab3-api-1,14.81%,10.84MiB / 384MiB +2026-10-16T18:31:10Z,mtusi-messenger-lab3-api-2,14.19%,10.84MiB / 384MiB +2026-10-16T18:31:10Z,mtusi-messenger-lab3-lb-1,10.63%,16.29MiB / 64MiB +2026-10-16T18:31:10Z,mtusi-messenger-lab3-postgres-1,37.51%,271.2MiB / 384MiB +2026-10-16T18:31:10Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:10Z,mtusi-messenger-lab2-redis-1,0.67%,4.199MiB / 1.913GiB +2026-10-16T18:31:10Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:13Z,nostalgic_bohr,27.47%,23.59MiB / 1.913GiB +2026-10-16T18:31:13Z,mtusi-messenger-lab3-api-1,13.85%,10.91MiB / 384MiB +2026-10-16T18:31:13Z,mtusi-messenger-lab3-api-2,13.46%,10.91MiB / 384MiB +2026-10-16T18:31:13Z,mtusi-messenger-lab3-lb-1,10.33%,16.28MiB / 64MiB +2026-10-16T18:31:13Z,mtusi-messenger-lab3-postgres-1,35.35%,271.2MiB / 384MiB +2026-10-16T18:31:13Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:13Z,mtusi-messenger-lab2-redis-1,0.17%,4.199MiB / 1.913GiB +2026-10-16T18:31:13Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:16Z,nostalgic_bohr,28.93%,23.78MiB / 1.913GiB +2026-10-16T18:31:16Z,mtusi-messenger-lab3-api-1,14.61%,10.91MiB / 384MiB +2026-10-16T18:31:16Z,mtusi-messenger-lab3-api-2,15.05%,10.85MiB / 384MiB +2026-10-16T18:31:16Z,mtusi-messenger-lab3-lb-1,10.58%,16.27MiB / 64MiB +2026-10-16T18:31:16Z,mtusi-messenger-lab3-postgres-1,36.66%,271.2MiB / 384MiB +2026-10-16T18:31:16Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:16Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:16Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:19Z,nostalgic_bohr,28.96%,23.73MiB / 1.913GiB +2026-10-16T18:31:19Z,mtusi-messenger-lab3-api-1,14.13%,10.89MiB / 384MiB +2026-10-16T18:31:19Z,mtusi-messenger-lab3-api-2,13.85%,10.94MiB / 384MiB +2026-10-16T18:31:19Z,mtusi-messenger-lab3-lb-1,10.59%,16.27MiB / 64MiB +2026-10-16T18:31:19Z,mtusi-messenger-lab3-postgres-1,36.80%,272.3MiB / 384MiB +2026-10-16T18:31:19Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:19Z,mtusi-messenger-lab2-redis-1,0.68%,4.199MiB / 1.913GiB +2026-10-16T18:31:19Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:22Z,nostalgic_bohr,28.30%,23.98MiB / 1.913GiB +2026-10-16T18:31:22Z,mtusi-messenger-lab3-api-1,14.29%,10.91MiB / 384MiB +2026-10-16T18:31:22Z,mtusi-messenger-lab3-api-2,13.84%,10.85MiB / 384MiB +2026-10-16T18:31:22Z,mtusi-messenger-lab3-lb-1,10.25%,16.29MiB / 64MiB +2026-10-16T18:31:22Z,mtusi-messenger-lab3-postgres-1,36.33%,271.3MiB / 384MiB +2026-10-16T18:31:22Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:22Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:22Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:25Z,nostalgic_bohr,29.00%,24.13MiB / 1.913GiB +2026-10-16T18:31:25Z,mtusi-messenger-lab3-api-1,14.33%,10.9MiB / 384MiB +2026-10-16T18:31:25Z,mtusi-messenger-lab3-api-2,14.14%,10.81MiB / 384MiB +2026-10-16T18:31:25Z,mtusi-messenger-lab3-lb-1,10.54%,16.29MiB / 64MiB +2026-10-16T18:31:25Z,mtusi-messenger-lab3-postgres-1,36.05%,271.3MiB / 384MiB +2026-10-16T18:31:25Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:25Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:25Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:28Z,nostalgic_bohr,27.74%,24.36MiB / 1.913GiB +2026-10-16T18:31:28Z,mtusi-messenger-lab3-api-1,13.83%,10.89MiB / 384MiB +2026-10-16T18:31:28Z,mtusi-messenger-lab3-api-2,13.64%,10.8MiB / 384MiB +2026-10-16T18:31:28Z,mtusi-messenger-lab3-lb-1,10.18%,16.29MiB / 64MiB +2026-10-16T18:31:28Z,mtusi-messenger-lab3-postgres-1,35.61%,271.3MiB / 384MiB +2026-10-16T18:31:28Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:28Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:31:28Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:31Z,nostalgic_bohr,27.71%,24.55MiB / 1.913GiB +2026-10-16T18:31:31Z,mtusi-messenger-lab3-api-1,13.75%,10.92MiB / 384MiB +2026-10-16T18:31:31Z,mtusi-messenger-lab3-api-2,14.39%,10.82MiB / 384MiB +2026-10-16T18:31:31Z,mtusi-messenger-lab3-lb-1,10.32%,16.28MiB / 64MiB +2026-10-16T18:31:31Z,mtusi-messenger-lab3-postgres-1,36.72%,271.4MiB / 384MiB +2026-10-16T18:31:31Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:31Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:31Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:35Z,nostalgic_bohr,28.40%,24.79MiB / 1.913GiB +2026-10-16T18:31:35Z,mtusi-messenger-lab3-api-1,14.00%,10.88MiB / 384MiB +2026-10-16T18:31:35Z,mtusi-messenger-lab3-api-2,13.70%,10.98MiB / 384MiB +2026-10-16T18:31:35Z,mtusi-messenger-lab3-lb-1,10.43%,16.28MiB / 64MiB +2026-10-16T18:31:35Z,mtusi-messenger-lab3-postgres-1,36.84%,271.6MiB / 384MiB +2026-10-16T18:31:35Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:35Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:35Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:38Z,nostalgic_bohr,28.18%,24.99MiB / 1.913GiB +2026-10-16T18:31:38Z,mtusi-messenger-lab3-api-1,14.56%,10.88MiB / 384MiB +2026-10-16T18:31:38Z,mtusi-messenger-lab3-api-2,13.58%,10.95MiB / 384MiB +2026-10-16T18:31:38Z,mtusi-messenger-lab3-lb-1,10.38%,16.27MiB / 64MiB +2026-10-16T18:31:38Z,mtusi-messenger-lab3-postgres-1,36.42%,271.4MiB / 384MiB +2026-10-16T18:31:38Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:38Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:38Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:41Z,nostalgic_bohr,28.57%,25.2MiB / 1.913GiB +2026-10-16T18:31:41Z,mtusi-messenger-lab3-api-1,13.96%,10.88MiB / 384MiB +2026-10-16T18:31:41Z,mtusi-messenger-lab3-api-2,13.79%,11.06MiB / 384MiB +2026-10-16T18:31:41Z,mtusi-messenger-lab3-lb-1,10.58%,16.26MiB / 64MiB +2026-10-16T18:31:41Z,mtusi-messenger-lab3-postgres-1,36.29%,271.4MiB / 384MiB +2026-10-16T18:31:41Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:41Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:31:41Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB +2026-10-16T18:31:44Z,nostalgic_bohr,28.68%,25.64MiB / 1.913GiB +2026-10-16T18:31:44Z,mtusi-messenger-lab3-api-1,14.63%,10.87MiB / 384MiB +2026-10-16T18:31:44Z,mtusi-messenger-lab3-api-2,14.32%,10.93MiB / 384MiB +2026-10-16T18:31:44Z,mtusi-messenger-lab3-lb-1,10.54%,16.26MiB / 64MiB +2026-10-16T18:31:44Z,mtusi-messenger-lab3-postgres-1,35.55%,271.4MiB / 384MiB +2026-10-16T18:31:44Z,mtusi-messenger-lab2-postgres-1,0.67%,34.82MiB / 1.913GiB +2026-10-16T18:31:44Z,mtusi-messenger-lab2-redis-1,0.66%,4.199MiB / 1.913GiB +2026-10-16T18:31:44Z,mtusi-messenger-lab3-redis-1,0.64%,6.977MiB / 192MiB +2026-10-16T18:31:47Z,mtusi-messenger-lab3-api-1,6.21%,10.92MiB / 384MiB +2026-10-16T18:31:47Z,mtusi-messenger-lab3-api-2,6.37%,10.85MiB / 384MiB +2026-10-16T18:31:47Z,mtusi-messenger-lab3-lb-1,10.34%,16.3MiB / 64MiB +2026-10-16T18:31:47Z,mtusi-messenger-lab3-postgres-1,32.91%,276.2MiB / 384MiB +2026-10-16T18:31:47Z,mtusi-messenger-lab2-postgres-1,0.00%,34.82MiB / 1.913GiB +2026-10-16T18:31:47Z,mtusi-messenger-lab2-redis-1,0.19%,4.199MiB / 1.913GiB +2026-10-16T18:31:47Z,mtusi-messenger-lab3-redis-1,0.19%,6.977MiB / 192MiB diff --git a/evidence/track1/stats-lb1cpu.csv b/evidence/track1/stats-lb1cpu.csv new file mode 100644 index 00000000..6d9f4334 --- /dev/null +++ b/evidence/track1/stats-lb1cpu.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:36:10Z,mtusi-messenger-lab3-lb-1,10.68%,12.61MiB / 64MiB +2026-10-16T18:36:10Z,mtusi-messenger-lab3-postgres-1,37.45%,60.41MiB / 384MiB +2026-10-16T18:36:10Z,mtusi-messenger-lab3-api-2,13.99%,155.2MiB / 384MiB +2026-10-16T18:36:10Z,mtusi-messenger-lab3-api-1,13.95%,155.1MiB / 384MiB +2026-10-16T18:36:10Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:10Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:10Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:36:10Z,competent_morse,29.10%,21.96MiB / 1.913GiB +2026-10-16T18:36:13Z,competent_morse,29.27%,22.02MiB / 1.913GiB +2026-10-16T18:36:13Z,mtusi-messenger-lab3-lb-1,10.44%,12.6MiB / 64MiB +2026-10-16T18:36:13Z,mtusi-messenger-lab3-postgres-1,37.12%,62.95MiB / 384MiB +2026-10-16T18:36:13Z,mtusi-messenger-lab3-api-2,13.36%,144.7MiB / 384MiB +2026-10-16T18:36:13Z,mtusi-messenger-lab3-api-1,13.65%,134.2MiB / 384MiB +2026-10-16T18:36:13Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:13Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:36:13Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:36:16Z,competent_morse,28.58%,22.08MiB / 1.913GiB +2026-10-16T18:36:16Z,mtusi-messenger-lab3-lb-1,10.38%,12.59MiB / 64MiB +2026-10-16T18:36:16Z,mtusi-messenger-lab3-postgres-1,36.00%,65.33MiB / 384MiB +2026-10-16T18:36:16Z,mtusi-messenger-lab3-api-2,13.86%,11.06MiB / 384MiB +2026-10-16T18:36:16Z,mtusi-messenger-lab3-api-1,13.75%,11.3MiB / 384MiB +2026-10-16T18:36:16Z,mtusi-messenger-lab2-postgres-1,0.68%,29.5MiB / 1.913GiB +2026-10-16T18:36:16Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:36:16Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:36:19Z,competent_morse,27.22%,22.23MiB / 1.913GiB +2026-10-16T18:36:19Z,mtusi-messenger-lab3-lb-1,9.95%,12.59MiB / 64MiB +2026-10-16T18:36:19Z,mtusi-messenger-lab3-postgres-1,34.26%,68.4MiB / 384MiB +2026-10-16T18:36:19Z,mtusi-messenger-lab3-api-2,13.58%,11.1MiB / 384MiB +2026-10-16T18:36:19Z,mtusi-messenger-lab3-api-1,13.66%,11.29MiB / 384MiB +2026-10-16T18:36:19Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:19Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:36:19Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:36:22Z,competent_morse,28.96%,22.45MiB / 1.913GiB +2026-10-16T18:36:22Z,mtusi-messenger-lab3-lb-1,10.42%,12.59MiB / 64MiB +2026-10-16T18:36:22Z,mtusi-messenger-lab3-postgres-1,36.06%,73.57MiB / 384MiB +2026-10-16T18:36:22Z,mtusi-messenger-lab3-api-2,13.04%,11.1MiB / 384MiB +2026-10-16T18:36:22Z,mtusi-messenger-lab3-api-1,14.30%,11.35MiB / 384MiB +2026-10-16T18:36:22Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:22Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:36:22Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:36:26Z,competent_morse,27.84%,22.63MiB / 1.913GiB +2026-10-16T18:36:26Z,mtusi-messenger-lab3-lb-1,10.39%,12.61MiB / 64MiB +2026-10-16T18:36:26Z,mtusi-messenger-lab3-postgres-1,35.44%,75.64MiB / 384MiB +2026-10-16T18:36:26Z,mtusi-messenger-lab3-api-2,14.22%,10.96MiB / 384MiB +2026-10-16T18:36:26Z,mtusi-messenger-lab3-api-1,14.70%,11.32MiB / 384MiB +2026-10-16T18:36:26Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:26Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:36:26Z,mtusi-messenger-lab3-redis-1,0.75%,6.965MiB / 192MiB +2026-10-16T18:36:29Z,competent_morse,29.29%,22.8MiB / 1.913GiB +2026-10-16T18:36:29Z,mtusi-messenger-lab3-lb-1,10.75%,12.57MiB / 64MiB +2026-10-16T18:36:29Z,mtusi-messenger-lab3-postgres-1,37.59%,78.05MiB / 384MiB +2026-10-16T18:36:29Z,mtusi-messenger-lab3-api-2,14.29%,10.98MiB / 384MiB +2026-10-16T18:36:29Z,mtusi-messenger-lab3-api-1,14.54%,11.35MiB / 384MiB +2026-10-16T18:36:29Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:29Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:36:29Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:36:32Z,competent_morse,27.82%,22.97MiB / 1.913GiB +2026-10-16T18:36:32Z,mtusi-messenger-lab3-lb-1,10.10%,12.57MiB / 64MiB +2026-10-16T18:36:32Z,mtusi-messenger-lab3-postgres-1,38.08%,84.9MiB / 384MiB +2026-10-16T18:36:32Z,mtusi-messenger-lab3-api-2,13.70%,10.97MiB / 384MiB +2026-10-16T18:36:32Z,mtusi-messenger-lab3-api-1,13.99%,11.38MiB / 384MiB +2026-10-16T18:36:32Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:32Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:32Z,mtusi-messenger-lab3-redis-1,0.65%,6.965MiB / 192MiB +2026-10-16T18:36:35Z,competent_morse,23.90%,23.12MiB / 1.913GiB +2026-10-16T18:36:35Z,mtusi-messenger-lab3-lb-1,8.95%,12.59MiB / 64MiB +2026-10-16T18:36:35Z,mtusi-messenger-lab3-postgres-1,47.44%,93MiB / 384MiB +2026-10-16T18:36:35Z,mtusi-messenger-lab3-api-2,11.75%,10.88MiB / 384MiB +2026-10-16T18:36:35Z,mtusi-messenger-lab3-api-1,11.31%,11.34MiB / 384MiB +2026-10-16T18:36:35Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:35Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:35Z,mtusi-messenger-lab3-redis-1,0.20%,6.965MiB / 192MiB +2026-10-16T18:36:38Z,competent_morse,28.22%,23.34MiB / 1.913GiB +2026-10-16T18:36:38Z,mtusi-messenger-lab3-lb-1,10.19%,12.54MiB / 64MiB +2026-10-16T18:36:38Z,mtusi-messenger-lab3-postgres-1,35.08%,88.29MiB / 384MiB +2026-10-16T18:36:38Z,mtusi-messenger-lab3-api-2,14.10%,10.91MiB / 384MiB +2026-10-16T18:36:38Z,mtusi-messenger-lab3-api-1,13.73%,11.36MiB / 384MiB +2026-10-16T18:36:38Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:38Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:38Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:36:41Z,competent_morse,26.94%,23.49MiB / 1.913GiB +2026-10-16T18:36:41Z,mtusi-messenger-lab3-lb-1,10.00%,12.57MiB / 64MiB +2026-10-16T18:36:41Z,mtusi-messenger-lab3-postgres-1,34.08%,90.51MiB / 384MiB +2026-10-16T18:36:41Z,mtusi-messenger-lab3-api-2,13.56%,10.91MiB / 384MiB +2026-10-16T18:36:41Z,mtusi-messenger-lab3-api-1,13.57%,11.35MiB / 384MiB +2026-10-16T18:36:41Z,mtusi-messenger-lab2-postgres-1,0.74%,29.5MiB / 1.913GiB +2026-10-16T18:36:41Z,mtusi-messenger-lab2-redis-1,0.68%,4.785MiB / 1.913GiB +2026-10-16T18:36:41Z,mtusi-messenger-lab3-redis-1,0.23%,7.215MiB / 192MiB +2026-10-16T18:36:44Z,competent_morse,28.93%,23.71MiB / 1.913GiB +2026-10-16T18:36:44Z,mtusi-messenger-lab3-lb-1,10.54%,12.58MiB / 64MiB +2026-10-16T18:36:44Z,mtusi-messenger-lab3-postgres-1,36.30%,92.4MiB / 384MiB +2026-10-16T18:36:44Z,mtusi-messenger-lab3-api-2,14.44%,10.91MiB / 384MiB +2026-10-16T18:36:44Z,mtusi-messenger-lab3-api-1,14.15%,11.35MiB / 384MiB +2026-10-16T18:36:44Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:44Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:36:44Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:36:47Z,competent_morse,28.39%,23.82MiB / 1.913GiB +2026-10-16T18:36:47Z,mtusi-messenger-lab3-lb-1,10.36%,12.58MiB / 64MiB +2026-10-16T18:36:47Z,mtusi-messenger-lab3-postgres-1,36.03%,94.74MiB / 384MiB +2026-10-16T18:36:47Z,mtusi-messenger-lab3-api-2,13.93%,10.93MiB / 384MiB +2026-10-16T18:36:47Z,mtusi-messenger-lab3-api-1,13.65%,11.27MiB / 384MiB +2026-10-16T18:36:47Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:47Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:47Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:36:50Z,competent_morse,26.82%,24.04MiB / 1.913GiB +2026-10-16T18:36:50Z,mtusi-messenger-lab3-lb-1,9.92%,12.59MiB / 64MiB +2026-10-16T18:36:50Z,mtusi-messenger-lab3-postgres-1,34.47%,96.18MiB / 384MiB +2026-10-16T18:36:50Z,mtusi-messenger-lab3-api-2,13.41%,10.92MiB / 384MiB +2026-10-16T18:36:50Z,mtusi-messenger-lab3-api-1,12.69%,11.34MiB / 384MiB +2026-10-16T18:36:50Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:50Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:50Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:36:54Z,competent_morse,27.94%,24.31MiB / 1.913GiB +2026-10-16T18:36:54Z,mtusi-messenger-lab3-lb-1,10.36%,12.57MiB / 64MiB +2026-10-16T18:36:54Z,mtusi-messenger-lab3-postgres-1,36.27%,99.13MiB / 384MiB +2026-10-16T18:36:54Z,mtusi-messenger-lab3-api-2,14.32%,10.92MiB / 384MiB +2026-10-16T18:36:54Z,mtusi-messenger-lab3-api-1,14.10%,11.35MiB / 384MiB +2026-10-16T18:36:54Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:54Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:36:54Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:36:57Z,competent_morse,28.14%,24.42MiB / 1.913GiB +2026-10-16T18:36:57Z,mtusi-messenger-lab3-lb-1,10.47%,12.57MiB / 64MiB +2026-10-16T18:36:57Z,mtusi-messenger-lab3-postgres-1,36.26%,101.3MiB / 384MiB +2026-10-16T18:36:57Z,mtusi-messenger-lab3-api-2,14.19%,10.92MiB / 384MiB +2026-10-16T18:36:57Z,mtusi-messenger-lab3-api-1,13.86%,11.29MiB / 384MiB +2026-10-16T18:36:57Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:36:57Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:36:57Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:37:00Z,competent_morse,27.89%,24.63MiB / 1.913GiB +2026-10-16T18:37:00Z,mtusi-messenger-lab3-lb-1,10.30%,12.57MiB / 64MiB +2026-10-16T18:37:00Z,mtusi-messenger-lab3-postgres-1,36.10%,103.8MiB / 384MiB +2026-10-16T18:37:00Z,mtusi-messenger-lab3-api-2,13.80%,10.9MiB / 384MiB +2026-10-16T18:37:00Z,mtusi-messenger-lab3-api-1,14.19%,11.32MiB / 384MiB +2026-10-16T18:37:00Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:37:00Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:37:00Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:37:03Z,competent_morse,28.92%,24.8MiB / 1.913GiB +2026-10-16T18:37:03Z,mtusi-messenger-lab3-lb-1,10.61%,12.57MiB / 64MiB +2026-10-16T18:37:03Z,mtusi-messenger-lab3-postgres-1,36.46%,107.9MiB / 384MiB +2026-10-16T18:37:03Z,mtusi-messenger-lab3-api-2,13.73%,10.98MiB / 384MiB +2026-10-16T18:37:03Z,mtusi-messenger-lab3-api-1,14.49%,11.34MiB / 384MiB +2026-10-16T18:37:03Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:37:03Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:37:03Z,mtusi-messenger-lab3-redis-1,0.19%,6.965MiB / 192MiB +2026-10-16T18:37:06Z,competent_morse,28.23%,25MiB / 1.913GiB +2026-10-16T18:37:06Z,mtusi-messenger-lab3-lb-1,10.36%,12.58MiB / 64MiB +2026-10-16T18:37:06Z,mtusi-messenger-lab3-postgres-1,35.83%,107.9MiB / 384MiB +2026-10-16T18:37:06Z,mtusi-messenger-lab3-api-2,13.86%,10.84MiB / 384MiB +2026-10-16T18:37:06Z,mtusi-messenger-lab3-api-1,13.94%,11.21MiB / 384MiB +2026-10-16T18:37:06Z,mtusi-messenger-lab2-postgres-1,0.72%,29.5MiB / 1.913GiB +2026-10-16T18:37:06Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:37:06Z,mtusi-messenger-lab3-redis-1,0.18%,6.965MiB / 192MiB +2026-10-16T18:37:09Z,mtusi-messenger-lab3-lb-1,5.20%,12.53MiB / 64MiB +2026-10-16T18:37:09Z,mtusi-messenger-lab3-postgres-1,36.01%,118MiB / 384MiB +2026-10-16T18:37:09Z,mtusi-messenger-lab3-api-2,6.70%,11.03MiB / 384MiB +2026-10-16T18:37:09Z,mtusi-messenger-lab3-api-1,14.22%,11.14MiB / 384MiB +2026-10-16T18:37:09Z,mtusi-messenger-lab2-postgres-1,0.21%,29.5MiB / 1.913GiB +2026-10-16T18:37:09Z,mtusi-messenger-lab2-redis-1,0.17%,4.785MiB / 1.913GiB +2026-10-16T18:37:09Z,mtusi-messenger-lab3-redis-1,0.21%,6.965MiB / 192MiB diff --git a/evidence/track1/stats-pool10.csv b/evidence/track1/stats-pool10.csv new file mode 100644 index 00000000..34edfb35 --- /dev/null +++ b/evidence/track1/stats-pool10.csv @@ -0,0 +1,200 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:32:07Z,mtusi-messenger-lab3-api-4,9.93%,77.56MiB / 192MiB +2026-10-16T18:32:07Z,mtusi-messenger-lab3-api-3,7.65%,141.6MiB / 192MiB +2026-10-16T18:32:07Z,mtusi-messenger-lab3-api-1,6.23%,141.9MiB / 192MiB +2026-10-16T18:32:07Z,mtusi-messenger-lab3-api-2,6.00%,77.55MiB / 192MiB +2026-10-16T18:32:07Z,mtusi-messenger-lab3-lb-1,8.16%,16.29MiB / 64MiB +2026-10-16T18:32:07Z,mtusi-messenger-lab3-postgres-1,26.90%,271.7MiB / 384MiB +2026-10-16T18:32:07Z,mtusi-messenger-lab2-postgres-1,0.00%,34.89MiB / 1.913GiB +2026-10-16T18:32:07Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:32:07Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:32:07Z,upbeat_lewin,29.30%,21.94MiB / 1.913GiB +2026-10-16T18:32:10Z,upbeat_lewin,28.24%,22.05MiB / 1.913GiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-api-4,7.91%,100.2MiB / 192MiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-api-3,7.90%,164.5MiB / 192MiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-api-1,7.73%,165MiB / 192MiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-api-2,7.85%,99.74MiB / 192MiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-lb-1,10.44%,16.3MiB / 64MiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-postgres-1,35.70%,271.7MiB / 384MiB +2026-10-16T18:32:10Z,mtusi-messenger-lab2-postgres-1,0.00%,34.89MiB / 1.913GiB +2026-10-16T18:32:10Z,mtusi-messenger-lab2-redis-1,0.18%,4.199MiB / 1.913GiB +2026-10-16T18:32:10Z,mtusi-messenger-lab3-redis-1,0.66%,6.98MiB / 192MiB +2026-10-16T18:32:13Z,upbeat_lewin,28.29%,22MiB / 1.913GiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-api-4,7.80%,123.7MiB / 192MiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-api-3,7.80%,188MiB / 192MiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-api-1,7.64%,188.7MiB / 192MiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-api-2,7.95%,123.6MiB / 192MiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-lb-1,10.69%,13.82MiB / 64MiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-postgres-1,35.72%,274MiB / 384MiB +2026-10-16T18:32:13Z,mtusi-messenger-lab2-postgres-1,0.00%,34.93MiB / 1.913GiB +2026-10-16T18:32:13Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:13Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:16Z,upbeat_lewin,27.40%,22.18MiB / 1.913GiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-api-4,8.43%,13.52MiB / 192MiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-api-3,7.85%,7.758MiB / 192MiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-api-1,8.20%,8.09MiB / 192MiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-api-2,8.07%,11.43MiB / 192MiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-lb-1,10.37%,13.87MiB / 64MiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-postgres-1,36.07%,270.9MiB / 384MiB +2026-10-16T18:32:16Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:16Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:16Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:19Z,upbeat_lewin,25.37%,22.36MiB / 1.913GiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-api-4,7.83%,13.45MiB / 192MiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-api-3,7.77%,8.004MiB / 192MiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-api-1,7.84%,8.141MiB / 192MiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-api-2,7.58%,11.26MiB / 192MiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-lb-1,9.67%,13.86MiB / 64MiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-postgres-1,32.88%,273.8MiB / 384MiB +2026-10-16T18:32:19Z,mtusi-messenger-lab2-postgres-1,0.65%,38.59MiB / 1.913GiB +2026-10-16T18:32:19Z,mtusi-messenger-lab2-redis-1,0.63%,4.785MiB / 1.913GiB +2026-10-16T18:32:19Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:23Z,upbeat_lewin,28.27%,22.55MiB / 1.913GiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-api-4,7.89%,13.45MiB / 192MiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-api-3,7.71%,8.043MiB / 192MiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-api-1,8.03%,8.164MiB / 192MiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-api-2,7.50%,10.86MiB / 192MiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-lb-1,10.64%,13.87MiB / 64MiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-postgres-1,35.26%,274.2MiB / 384MiB +2026-10-16T18:32:23Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:23Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:23Z,mtusi-messenger-lab3-redis-1,0.20%,6.973MiB / 192MiB +2026-10-16T18:32:26Z,upbeat_lewin,27.59%,22.75MiB / 1.913GiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-api-4,8.04%,13.39MiB / 192MiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-api-3,7.60%,8.047MiB / 192MiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-api-1,7.46%,8.184MiB / 192MiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-api-2,7.87%,10.88MiB / 192MiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-lb-1,10.70%,13.87MiB / 64MiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-postgres-1,34.27%,274.5MiB / 384MiB +2026-10-16T18:32:26Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:26Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:26Z,mtusi-messenger-lab3-redis-1,0.18%,6.973MiB / 192MiB +2026-10-16T18:32:29Z,upbeat_lewin,26.72%,23.21MiB / 1.913GiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-api-4,8.03%,13.44MiB / 192MiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-api-3,7.92%,8.039MiB / 192MiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-api-1,7.39%,8.238MiB / 192MiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-api-2,7.60%,10.69MiB / 192MiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-lb-1,10.27%,13.86MiB / 64MiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-postgres-1,36.18%,274.7MiB / 384MiB +2026-10-16T18:32:29Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:29Z,mtusi-messenger-lab2-redis-1,0.63%,4.785MiB / 1.913GiB +2026-10-16T18:32:29Z,mtusi-messenger-lab3-redis-1,0.63%,6.973MiB / 192MiB +2026-10-16T18:32:32Z,upbeat_lewin,27.91%,23.15MiB / 1.913GiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-api-4,7.94%,13.47MiB / 192MiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-api-3,7.66%,7.934MiB / 192MiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-api-1,8.01%,8.375MiB / 192MiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-api-2,8.21%,11.02MiB / 192MiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-lb-1,10.58%,13.86MiB / 64MiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-postgres-1,35.39%,277.7MiB / 384MiB +2026-10-16T18:32:32Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:32Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:32Z,mtusi-messenger-lab3-redis-1,0.18%,6.973MiB / 192MiB +2026-10-16T18:32:35Z,upbeat_lewin,28.50%,23.38MiB / 1.913GiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-api-4,8.12%,13.66MiB / 192MiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-api-3,8.20%,7.934MiB / 192MiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-api-1,8.13%,8.242MiB / 192MiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-api-2,8.55%,10.98MiB / 192MiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-lb-1,10.79%,13.85MiB / 64MiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-postgres-1,36.83%,278MiB / 384MiB +2026-10-16T18:32:35Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:35Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:35Z,mtusi-messenger-lab3-redis-1,0.64%,6.973MiB / 192MiB +2026-10-16T18:32:38Z,upbeat_lewin,26.87%,23.55MiB / 1.913GiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-api-4,7.94%,13.72MiB / 192MiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-api-3,8.36%,8.137MiB / 192MiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-api-1,7.57%,8.355MiB / 192MiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-api-2,7.63%,11.05MiB / 192MiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-lb-1,10.07%,13.86MiB / 64MiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-postgres-1,34.30%,278.2MiB / 384MiB +2026-10-16T18:32:38Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:38Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:38Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:41Z,upbeat_lewin,28.95%,23.71MiB / 1.913GiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-api-4,8.19%,13.72MiB / 192MiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-api-3,7.92%,8.02MiB / 192MiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-api-1,8.05%,8.414MiB / 192MiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-api-2,8.33%,10.81MiB / 192MiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-lb-1,10.91%,13.84MiB / 64MiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-postgres-1,36.52%,278.3MiB / 384MiB +2026-10-16T18:32:41Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:41Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:41Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:44Z,upbeat_lewin,27.14%,23.93MiB / 1.913GiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-api-4,9.02%,13.82MiB / 192MiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-api-3,7.75%,8.027MiB / 192MiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-api-1,7.37%,8.383MiB / 192MiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-api-2,8.20%,11.21MiB / 192MiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-lb-1,10.23%,13.85MiB / 64MiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-postgres-1,34.39%,278.4MiB / 384MiB +2026-10-16T18:32:44Z,mtusi-messenger-lab2-postgres-1,1.02%,38.59MiB / 1.913GiB +2026-10-16T18:32:44Z,mtusi-messenger-lab2-redis-1,0.84%,4.785MiB / 1.913GiB +2026-10-16T18:32:44Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:48Z,upbeat_lewin,28.08%,24.07MiB / 1.913GiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-api-4,7.43%,13.68MiB / 192MiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-api-3,7.58%,8.156MiB / 192MiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-api-1,7.36%,8.465MiB / 192MiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-api-2,7.73%,10.98MiB / 192MiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-lb-1,10.71%,13.86MiB / 64MiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-postgres-1,35.30%,278.5MiB / 384MiB +2026-10-16T18:32:48Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:48Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:48Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:51Z,upbeat_lewin,26.98%,24.28MiB / 1.913GiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-api-4,7.87%,13.7MiB / 192MiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-api-3,7.58%,8.199MiB / 192MiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-api-1,8.05%,8.492MiB / 192MiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-api-2,7.50%,10.93MiB / 192MiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-lb-1,10.29%,13.86MiB / 64MiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-postgres-1,35.39%,278.8MiB / 384MiB +2026-10-16T18:32:51Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:51Z,mtusi-messenger-lab2-redis-1,0.17%,4.785MiB / 1.913GiB +2026-10-16T18:32:51Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:32:54Z,upbeat_lewin,27.58%,24.46MiB / 1.913GiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-api-4,8.31%,13.67MiB / 192MiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-api-3,7.67%,8.199MiB / 192MiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-api-1,7.89%,8.496MiB / 192MiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-api-2,8.42%,11.02MiB / 192MiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-lb-1,10.40%,13.87MiB / 64MiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-postgres-1,35.34%,278.8MiB / 384MiB +2026-10-16T18:32:54Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:32:54Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:54Z,mtusi-messenger-lab3-redis-1,0.67%,6.973MiB / 192MiB +2026-10-16T18:32:57Z,upbeat_lewin,27.20%,24.64MiB / 1.913GiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-api-4,7.54%,13.68MiB / 192MiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-api-3,7.54%,8.199MiB / 192MiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-api-1,7.87%,8.492MiB / 192MiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-api-2,7.94%,11.09MiB / 192MiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-lb-1,10.40%,13.89MiB / 64MiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-postgres-1,35.46%,278.9MiB / 384MiB +2026-10-16T18:32:57Z,mtusi-messenger-lab2-postgres-1,0.18%,38.59MiB / 1.913GiB +2026-10-16T18:32:57Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:32:57Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:33:00Z,upbeat_lewin,26.94%,24.82MiB / 1.913GiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-api-4,7.69%,13.71MiB / 192MiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-api-3,8.12%,8.199MiB / 192MiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-api-1,7.58%,8.398MiB / 192MiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-api-2,8.34%,11.1MiB / 192MiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-lb-1,10.42%,13.87MiB / 64MiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-postgres-1,35.60%,279MiB / 384MiB +2026-10-16T18:33:00Z,mtusi-messenger-lab2-postgres-1,0.71%,38.59MiB / 1.913GiB +2026-10-16T18:33:00Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:33:00Z,mtusi-messenger-lab3-redis-1,0.68%,6.973MiB / 192MiB +2026-10-16T18:33:03Z,upbeat_lewin,27.82%,24.97MiB / 1.913GiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-api-4,7.93%,13.7MiB / 192MiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-api-3,7.67%,8.074MiB / 192MiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-api-1,7.66%,8.34MiB / 192MiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-api-2,8.49%,11.02MiB / 192MiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-lb-1,10.47%,13.87MiB / 64MiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-postgres-1,35.10%,279.2MiB / 384MiB +2026-10-16T18:33:03Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:33:03Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:33:03Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-api-4,5.62%,13.7MiB / 192MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-api-3,5.29%,8.156MiB / 192MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-api-1,5.37%,8.457MiB / 192MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-api-2,5.48%,11.13MiB / 192MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-lb-1,7.61%,13.83MiB / 64MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-postgres-1,35.18%,284.4MiB / 384MiB +2026-10-16T18:33:06Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:33:06Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:33:06Z,mtusi-messenger-lab3-redis-1,0.20%,6.973MiB / 192MiB diff --git a/evidence/track1/stats-pool5.csv b/evidence/track1/stats-pool5.csv new file mode 100644 index 00000000..46262411 --- /dev/null +++ b/evidence/track1/stats-pool5.csv @@ -0,0 +1,200 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:33:27Z,mtusi-messenger-lab3-api-3,6.72%,142.5MiB / 192MiB +2026-10-16T18:33:27Z,mtusi-messenger-lab3-api-4,7.17%,78.55MiB / 192MiB +2026-10-16T18:33:27Z,mtusi-messenger-lab3-api-1,7.10%,78.64MiB / 192MiB +2026-10-16T18:33:27Z,mtusi-messenger-lab3-api-2,7.74%,142.7MiB / 192MiB +2026-10-16T18:33:27Z,mtusi-messenger-lab3-lb-1,9.95%,13.85MiB / 64MiB +2026-10-16T18:33:27Z,mtusi-messenger-lab3-postgres-1,33.25%,274.7MiB / 384MiB +2026-10-16T18:33:27Z,mtusi-messenger-lab2-postgres-1,0.00%,38.59MiB / 1.913GiB +2026-10-16T18:33:27Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:33:27Z,mtusi-messenger-lab3-redis-1,0.20%,6.973MiB / 192MiB +2026-10-16T18:33:27Z,beautiful_jackson,29.33%,21.93MiB / 1.913GiB +2026-10-16T18:33:30Z,beautiful_jackson,27.63%,22.04MiB / 1.913GiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-api-3,7.32%,163.6MiB / 192MiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-api-4,7.85%,99.53MiB / 192MiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-api-1,7.48%,99.84MiB / 192MiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-api-2,7.37%,164MiB / 192MiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-lb-1,10.15%,13.87MiB / 64MiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-postgres-1,33.61%,275MiB / 384MiB +2026-10-16T18:33:30Z,mtusi-messenger-lab2-postgres-1,0.65%,38.59MiB / 1.913GiB +2026-10-16T18:33:30Z,mtusi-messenger-lab2-redis-1,0.65%,4.785MiB / 1.913GiB +2026-10-16T18:33:30Z,mtusi-messenger-lab3-redis-1,0.20%,6.973MiB / 192MiB +2026-10-16T18:33:33Z,beautiful_jackson,28.74%,22.07MiB / 1.913GiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-api-3,7.87%,185.2MiB / 192MiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-api-4,7.47%,120.7MiB / 192MiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-api-1,7.66%,121.2MiB / 192MiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-api-2,7.59%,178.4MiB / 192MiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-lb-1,10.60%,13.85MiB / 64MiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-postgres-1,34.64%,275.3MiB / 384MiB +2026-10-16T18:33:33Z,mtusi-messenger-lab2-postgres-1,0.18%,29.5MiB / 1.913GiB +2026-10-16T18:33:33Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:33:33Z,mtusi-messenger-lab3-redis-1,0.18%,6.973MiB / 192MiB +2026-10-16T18:33:36Z,beautiful_jackson,26.88%,22.16MiB / 1.913GiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-api-4,7.17%,10.71MiB / 192MiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-api-1,11.61%,64.34MiB / 192MiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-api-2,7.37%,7.516MiB / 192MiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-lb-1,10.01%,13.85MiB / 64MiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-postgres-1,34.89%,269.5MiB / 384MiB +2026-10-16T18:33:36Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:33:36Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:33:36Z,mtusi-messenger-lab3-api-3,7.21%,7.629MiB / 192MiB +2026-10-16T18:33:39Z,beautiful_jackson,28.43%,22.34MiB / 1.913GiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-api-3,8.29%,8.004MiB / 192MiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-api-4,7.99%,10.87MiB / 192MiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-api-1,7.75%,11.03MiB / 192MiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-api-2,8.62%,7.859MiB / 192MiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-lb-1,10.73%,13.89MiB / 64MiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-postgres-1,35.19%,275MiB / 384MiB +2026-10-16T18:33:39Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:33:39Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:33:39Z,mtusi-messenger-lab3-redis-1,0.65%,6.973MiB / 192MiB +2026-10-16T18:33:42Z,beautiful_jackson,27.34%,22.54MiB / 1.913GiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-api-3,8.15%,8.051MiB / 192MiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-api-4,7.58%,10.95MiB / 192MiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-api-1,7.70%,10.92MiB / 192MiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-api-2,7.32%,7.883MiB / 192MiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-lb-1,10.31%,13.89MiB / 64MiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-postgres-1,33.88%,275.4MiB / 384MiB +2026-10-16T18:33:42Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:33:42Z,mtusi-messenger-lab2-redis-1,0.17%,4.785MiB / 1.913GiB +2026-10-16T18:33:42Z,mtusi-messenger-lab3-redis-1,0.18%,6.973MiB / 192MiB +2026-10-16T18:33:46Z,beautiful_jackson,26.93%,22.76MiB / 1.913GiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-api-3,7.76%,8.09MiB / 192MiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-api-4,7.60%,10.75MiB / 192MiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-api-1,8.09%,10.89MiB / 192MiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-api-2,8.00%,7.879MiB / 192MiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-lb-1,10.07%,13.87MiB / 64MiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-postgres-1,34.08%,275.8MiB / 384MiB +2026-10-16T18:33:46Z,mtusi-messenger-lab2-postgres-1,0.67%,29.5MiB / 1.913GiB +2026-10-16T18:33:46Z,mtusi-messenger-lab2-redis-1,0.17%,4.785MiB / 1.913GiB +2026-10-16T18:33:46Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:33:49Z,beautiful_jackson,28.34%,22.9MiB / 1.913GiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-api-3,8.00%,8.094MiB / 192MiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-api-4,7.93%,10.75MiB / 192MiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-api-1,8.10%,10.89MiB / 192MiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-api-2,7.93%,8.02MiB / 192MiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-lb-1,10.74%,13.88MiB / 64MiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-postgres-1,34.98%,275.9MiB / 384MiB +2026-10-16T18:33:49Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:33:49Z,mtusi-messenger-lab2-redis-1,0.17%,4.785MiB / 1.913GiB +2026-10-16T18:33:49Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:33:52Z,beautiful_jackson,27.94%,23.32MiB / 1.913GiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-api-3,7.87%,8.086MiB / 192MiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-api-4,8.71%,10.75MiB / 192MiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-api-1,8.52%,11MiB / 192MiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-api-2,8.20%,8.02MiB / 192MiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-lb-1,10.77%,13.88MiB / 64MiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-postgres-1,35.90%,276.2MiB / 384MiB +2026-10-16T18:33:52Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:33:52Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:33:52Z,mtusi-messenger-lab3-redis-1,0.18%,6.973MiB / 192MiB +2026-10-16T18:33:55Z,beautiful_jackson,26.74%,23.3MiB / 1.913GiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-api-3,7.51%,8.086MiB / 192MiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-api-4,7.55%,10.75MiB / 192MiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-api-1,7.46%,10.81MiB / 192MiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-api-2,7.52%,8.02MiB / 192MiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-lb-1,10.21%,13.88MiB / 64MiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-postgres-1,33.78%,276.5MiB / 384MiB +2026-10-16T18:33:55Z,mtusi-messenger-lab2-postgres-1,0.70%,29.5MiB / 1.913GiB +2026-10-16T18:33:55Z,mtusi-messenger-lab2-redis-1,0.66%,4.785MiB / 1.913GiB +2026-10-16T18:33:55Z,mtusi-messenger-lab3-redis-1,0.20%,6.973MiB / 192MiB +2026-10-16T18:33:58Z,beautiful_jackson,27.14%,23.48MiB / 1.913GiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-api-3,7.48%,8.098MiB / 192MiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-api-4,7.77%,10.74MiB / 192MiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-api-1,7.73%,10.92MiB / 192MiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-api-2,7.84%,7.961MiB / 192MiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-lb-1,10.54%,13.88MiB / 64MiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-postgres-1,35.26%,276.7MiB / 384MiB +2026-10-16T18:33:58Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:33:58Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:33:58Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:34:01Z,beautiful_jackson,27.37%,23.62MiB / 1.913GiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-api-3,7.97%,8.164MiB / 192MiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-api-4,7.75%,10.73MiB / 192MiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-api-1,7.96%,10.92MiB / 192MiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-api-2,8.46%,8.277MiB / 192MiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-lb-1,10.42%,13.89MiB / 64MiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-postgres-1,36.09%,276.6MiB / 384MiB +2026-10-16T18:34:01Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:01Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:34:01Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:34:04Z,beautiful_jackson,27.40%,23.74MiB / 1.913GiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-api-3,8.23%,8.168MiB / 192MiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-api-4,8.18%,10.78MiB / 192MiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-api-1,8.75%,10.84MiB / 192MiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-api-2,7.48%,7.973MiB / 192MiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-lb-1,10.40%,13.89MiB / 64MiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-postgres-1,34.86%,276.3MiB / 384MiB +2026-10-16T18:34:04Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:04Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:34:04Z,mtusi-messenger-lab3-redis-1,0.65%,6.973MiB / 192MiB +2026-10-16T18:34:07Z,beautiful_jackson,27.75%,24MiB / 1.913GiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-api-3,8.37%,8.156MiB / 192MiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-api-4,7.51%,10.64MiB / 192MiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-api-1,7.93%,10.77MiB / 192MiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-api-2,7.83%,8.082MiB / 192MiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-lb-1,10.52%,13.89MiB / 64MiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-postgres-1,35.59%,276.4MiB / 384MiB +2026-10-16T18:34:07Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:07Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:34:07Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:34:11Z,beautiful_jackson,29.38%,24.15MiB / 1.913GiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-api-3,7.58%,8.168MiB / 192MiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-api-4,7.92%,10.73MiB / 192MiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-api-1,8.12%,10.77MiB / 192MiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-api-2,7.90%,8.031MiB / 192MiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-lb-1,10.88%,13.89MiB / 64MiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-postgres-1,37.44%,276.5MiB / 384MiB +2026-10-16T18:34:11Z,mtusi-messenger-lab2-postgres-1,0.69%,29.5MiB / 1.913GiB +2026-10-16T18:34:11Z,mtusi-messenger-lab2-redis-1,0.20%,4.785MiB / 1.913GiB +2026-10-16T18:34:11Z,mtusi-messenger-lab3-redis-1,0.74%,6.973MiB / 192MiB +2026-10-16T18:34:14Z,beautiful_jackson,25.89%,24.32MiB / 1.913GiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-api-3,8.02%,8.035MiB / 192MiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-api-4,8.42%,10.75MiB / 192MiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-api-1,8.40%,10.86MiB / 192MiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-api-2,7.59%,7.973MiB / 192MiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-lb-1,10.12%,13.88MiB / 64MiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-postgres-1,34.42%,276.6MiB / 384MiB +2026-10-16T18:34:14Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:14Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:34:14Z,mtusi-messenger-lab3-redis-1,0.19%,6.973MiB / 192MiB +2026-10-16T18:34:17Z,beautiful_jackson,27.17%,24.41MiB / 1.913GiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-api-3,7.75%,8.172MiB / 192MiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-api-4,7.80%,10.73MiB / 192MiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-api-1,7.67%,10.87MiB / 192MiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-api-2,7.80%,8.223MiB / 192MiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-lb-1,10.31%,13.9MiB / 64MiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-postgres-1,35.10%,276.9MiB / 384MiB +2026-10-16T18:34:17Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:17Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:34:17Z,mtusi-messenger-lab3-redis-1,0.20%,6.973MiB / 192MiB +2026-10-16T18:34:20Z,beautiful_jackson,26.53%,24.65MiB / 1.913GiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-api-3,8.23%,8.195MiB / 192MiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-api-4,7.20%,10.73MiB / 192MiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-api-1,7.60%,10.87MiB / 192MiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-api-2,7.61%,8.035MiB / 192MiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-lb-1,10.07%,13.88MiB / 64MiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-postgres-1,33.21%,276.7MiB / 384MiB +2026-10-16T18:34:20Z,mtusi-messenger-lab2-postgres-1,0.68%,29.5MiB / 1.913GiB +2026-10-16T18:34:20Z,mtusi-messenger-lab2-redis-1,0.68%,4.785MiB / 1.913GiB +2026-10-16T18:34:20Z,mtusi-messenger-lab3-redis-1,0.70%,6.969MiB / 192MiB +2026-10-16T18:34:23Z,beautiful_jackson,26.57%,24.81MiB / 1.913GiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-api-3,6.97%,8.195MiB / 192MiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-api-4,7.55%,10.6MiB / 192MiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-api-1,7.21%,10.86MiB / 192MiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-api-2,7.08%,8.109MiB / 192MiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-lb-1,9.93%,13.88MiB / 64MiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-postgres-1,33.52%,276.7MiB / 384MiB +2026-10-16T18:34:23Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:23Z,mtusi-messenger-lab2-redis-1,0.19%,4.785MiB / 1.913GiB +2026-10-16T18:34:23Z,mtusi-messenger-lab3-redis-1,0.20%,6.969MiB / 192MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-api-3,2.14%,8.188MiB / 192MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-api-4,2.50%,10.6MiB / 192MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-api-1,2.31%,10.86MiB / 192MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-api-2,1.94%,8.098MiB / 192MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-lb-1,3.10%,13.84MiB / 64MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-postgres-1,34.51%,276.8MiB / 384MiB +2026-10-16T18:34:26Z,mtusi-messenger-lab2-postgres-1,0.00%,29.5MiB / 1.913GiB +2026-10-16T18:34:26Z,mtusi-messenger-lab2-redis-1,0.18%,4.785MiB / 1.913GiB +2026-10-16T18:34:26Z,mtusi-messenger-lab3-redis-1,0.20%,6.969MiB / 192MiB diff --git a/evidence/track1/stats-r1.csv b/evidence/track1/stats-r1.csv new file mode 100644 index 00000000..a2431d09 --- /dev/null +++ b/evidence/track1/stats-r1.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:23:34Z,mtusi-messenger-lab3-api-1,22.80%,185.2MiB / 768MiB +2026-10-16T18:23:34Z,mtusi-messenger-lab3-lb-1,4.65%,16.5MiB / 64MiB +2026-10-16T18:23:34Z,mtusi-messenger-lab3-postgres-1,37.45%,68.79MiB / 384MiB +2026-10-16T18:23:34Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:23:34Z,mtusi-messenger-lab2-redis-1,0.19%,4.215MiB / 1.913GiB +2026-10-16T18:23:34Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:23:34Z,xenodochial_carson,28.86%,24.26MiB / 1.913GiB +2026-10-16T18:23:37Z,xenodochial_carson,28.67%,23.46MiB / 1.913GiB +2026-10-16T18:23:37Z,mtusi-messenger-lab3-api-1,23.96%,12.59MiB / 768MiB +2026-10-16T18:23:37Z,mtusi-messenger-lab3-lb-1,10.21%,16.26MiB / 64MiB +2026-10-16T18:23:37Z,mtusi-messenger-lab3-postgres-1,36.18%,70.56MiB / 384MiB +2026-10-16T18:23:37Z,mtusi-messenger-lab2-postgres-1,0.74%,34.32MiB / 1.913GiB +2026-10-16T18:23:37Z,mtusi-messenger-lab2-redis-1,0.61%,4.215MiB / 1.913GiB +2026-10-16T18:23:37Z,mtusi-messenger-lab3-redis-1,0.64%,6.891MiB / 192MiB +2026-10-16T18:23:39Z,xenodochial_carson,30.01%,22.12MiB / 1.913GiB +2026-10-16T18:23:39Z,mtusi-messenger-lab3-api-1,24.79%,12.67MiB / 768MiB +2026-10-16T18:23:39Z,mtusi-messenger-lab3-lb-1,10.66%,16.23MiB / 64MiB +2026-10-16T18:23:39Z,mtusi-messenger-lab3-postgres-1,37.17%,73.38MiB / 384MiB +2026-10-16T18:23:39Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:23:39Z,mtusi-messenger-lab2-redis-1,0.19%,4.215MiB / 1.913GiB +2026-10-16T18:23:39Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:23:42Z,xenodochial_carson,30.02%,22.26MiB / 1.913GiB +2026-10-16T18:23:42Z,mtusi-messenger-lab3-api-1,24.50%,15MiB / 768MiB +2026-10-16T18:23:42Z,mtusi-messenger-lab3-lb-1,10.37%,16.27MiB / 64MiB +2026-10-16T18:23:42Z,mtusi-messenger-lab3-postgres-1,37.60%,76.21MiB / 384MiB +2026-10-16T18:23:42Z,mtusi-messenger-lab2-postgres-1,0.00%,34.32MiB / 1.913GiB +2026-10-16T18:23:42Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:23:42Z,mtusi-messenger-lab3-redis-1,0.18%,6.891MiB / 192MiB +2026-10-16T18:23:45Z,xenodochial_carson,28.26%,22.51MiB / 1.913GiB +2026-10-16T18:23:45Z,mtusi-messenger-lab3-api-1,23.88%,14.8MiB / 768MiB +2026-10-16T18:23:45Z,mtusi-messenger-lab3-lb-1,10.14%,16.24MiB / 64MiB +2026-10-16T18:23:45Z,mtusi-messenger-lab3-postgres-1,35.72%,78.81MiB / 384MiB +2026-10-16T18:23:45Z,mtusi-messenger-lab2-postgres-1,0.20%,34.32MiB / 1.913GiB +2026-10-16T18:23:45Z,mtusi-messenger-lab2-redis-1,0.64%,4.324MiB / 1.913GiB +2026-10-16T18:23:45Z,mtusi-messenger-lab3-redis-1,0.63%,6.895MiB / 192MiB +2026-10-16T18:23:48Z,xenodochial_carson,30.47%,23.01MiB / 1.913GiB +2026-10-16T18:23:48Z,mtusi-messenger-lab3-api-1,25.57%,14.91MiB / 768MiB +2026-10-16T18:23:48Z,mtusi-messenger-lab3-lb-1,11.05%,16.26MiB / 64MiB +2026-10-16T18:23:48Z,mtusi-messenger-lab3-postgres-1,38.58%,81.71MiB / 384MiB +2026-10-16T18:23:48Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:23:48Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:23:48Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:23:51Z,xenodochial_carson,29.29%,23.03MiB / 1.913GiB +2026-10-16T18:23:51Z,mtusi-messenger-lab3-api-1,24.35%,14.91MiB / 768MiB +2026-10-16T18:23:51Z,mtusi-messenger-lab3-lb-1,10.54%,16.26MiB / 64MiB +2026-10-16T18:23:51Z,mtusi-messenger-lab3-postgres-1,36.93%,84.77MiB / 384MiB +2026-10-16T18:23:51Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:23:51Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:23:51Z,mtusi-messenger-lab3-redis-1,0.68%,6.891MiB / 192MiB +2026-10-16T18:23:55Z,xenodochial_carson,30.89%,23.24MiB / 1.913GiB +2026-10-16T18:23:55Z,mtusi-messenger-lab3-api-1,23.78%,14.78MiB / 768MiB +2026-10-16T18:23:55Z,mtusi-messenger-lab3-lb-1,10.88%,16.27MiB / 64MiB +2026-10-16T18:23:55Z,mtusi-messenger-lab3-postgres-1,36.62%,87.25MiB / 384MiB +2026-10-16T18:23:55Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:23:55Z,mtusi-messenger-lab2-redis-1,0.20%,4.215MiB / 1.913GiB +2026-10-16T18:23:55Z,mtusi-messenger-lab3-redis-1,0.20%,6.891MiB / 192MiB +2026-10-16T18:23:58Z,xenodochial_carson,29.51%,23.45MiB / 1.913GiB +2026-10-16T18:23:58Z,mtusi-messenger-lab3-api-1,24.46%,14.47MiB / 768MiB +2026-10-16T18:23:58Z,mtusi-messenger-lab3-lb-1,10.60%,16.25MiB / 64MiB +2026-10-16T18:23:58Z,mtusi-messenger-lab3-postgres-1,37.91%,90.16MiB / 384MiB +2026-10-16T18:23:58Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:23:58Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:23:58Z,mtusi-messenger-lab3-redis-1,0.18%,6.891MiB / 192MiB +2026-10-16T18:24:01Z,xenodochial_carson,26.63%,23.67MiB / 1.913GiB +2026-10-16T18:24:01Z,mtusi-messenger-lab3-api-1,23.86%,14.79MiB / 768MiB +2026-10-16T18:24:01Z,mtusi-messenger-lab3-lb-1,9.68%,16.26MiB / 64MiB +2026-10-16T18:24:01Z,mtusi-messenger-lab3-postgres-1,39.50%,97.22MiB / 384MiB +2026-10-16T18:24:01Z,mtusi-messenger-lab2-postgres-1,0.73%,34.32MiB / 1.913GiB +2026-10-16T18:24:01Z,mtusi-messenger-lab2-redis-1,0.69%,4.215MiB / 1.913GiB +2026-10-16T18:24:01Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:04Z,xenodochial_carson,27.99%,24.1MiB / 1.913GiB +2026-10-16T18:24:04Z,mtusi-messenger-lab3-api-1,23.35%,14.56MiB / 768MiB +2026-10-16T18:24:04Z,mtusi-messenger-lab3-lb-1,10.12%,16.26MiB / 64MiB +2026-10-16T18:24:04Z,mtusi-messenger-lab3-postgres-1,40.09%,108.1MiB / 384MiB +2026-10-16T18:24:04Z,mtusi-messenger-lab2-postgres-1,0.01%,34.32MiB / 1.913GiB +2026-10-16T18:24:04Z,mtusi-messenger-lab2-redis-1,0.20%,4.215MiB / 1.913GiB +2026-10-16T18:24:04Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:07Z,xenodochial_carson,27.87%,24.12MiB / 1.913GiB +2026-10-16T18:24:07Z,mtusi-messenger-lab3-api-1,22.59%,14.54MiB / 768MiB +2026-10-16T18:24:07Z,mtusi-messenger-lab3-lb-1,10.01%,16.25MiB / 64MiB +2026-10-16T18:24:07Z,mtusi-messenger-lab3-postgres-1,39.54%,113.6MiB / 384MiB +2026-10-16T18:24:07Z,mtusi-messenger-lab2-postgres-1,0.01%,34.73MiB / 1.913GiB +2026-10-16T18:24:07Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:07Z,mtusi-messenger-lab3-redis-1,0.18%,6.891MiB / 192MiB +2026-10-16T18:24:10Z,xenodochial_carson,26.44%,24.3MiB / 1.913GiB +2026-10-16T18:24:10Z,mtusi-messenger-lab3-api-1,23.67%,14.62MiB / 768MiB +2026-10-16T18:24:10Z,mtusi-messenger-lab3-lb-1,9.69%,16.26MiB / 64MiB +2026-10-16T18:24:10Z,mtusi-messenger-lab3-postgres-1,43.91%,144.1MiB / 384MiB +2026-10-16T18:24:10Z,mtusi-messenger-lab2-postgres-1,0.01%,34.73MiB / 1.913GiB +2026-10-16T18:24:10Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:10Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:13Z,xenodochial_carson,27.88%,24.5MiB / 1.913GiB +2026-10-16T18:24:13Z,mtusi-messenger-lab3-api-1,22.84%,14.53MiB / 768MiB +2026-10-16T18:24:13Z,mtusi-messenger-lab3-lb-1,9.89%,16.26MiB / 64MiB +2026-10-16T18:24:13Z,mtusi-messenger-lab3-postgres-1,42.37%,117MiB / 384MiB +2026-10-16T18:24:13Z,mtusi-messenger-lab2-postgres-1,0.01%,34.73MiB / 1.913GiB +2026-10-16T18:24:13Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:13Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:16Z,xenodochial_carson,23.62%,24.71MiB / 1.913GiB +2026-10-16T18:24:16Z,mtusi-messenger-lab3-api-1,20.06%,14.86MiB / 768MiB +2026-10-16T18:24:16Z,mtusi-messenger-lab3-lb-1,8.61%,16.26MiB / 64MiB +2026-10-16T18:24:16Z,mtusi-messenger-lab3-postgres-1,47.13%,137.4MiB / 384MiB +2026-10-16T18:24:16Z,mtusi-messenger-lab2-postgres-1,0.70%,34.73MiB / 1.913GiB +2026-10-16T18:24:16Z,mtusi-messenger-lab2-redis-1,0.69%,4.215MiB / 1.913GiB +2026-10-16T18:24:16Z,mtusi-messenger-lab3-redis-1,0.66%,6.891MiB / 192MiB +2026-10-16T18:24:19Z,xenodochial_carson,27.08%,24.94MiB / 1.913GiB +2026-10-16T18:24:19Z,mtusi-messenger-lab3-api-1,23.55%,14.86MiB / 768MiB +2026-10-16T18:24:19Z,mtusi-messenger-lab3-lb-1,9.89%,16.27MiB / 64MiB +2026-10-16T18:24:19Z,mtusi-messenger-lab3-postgres-1,39.29%,194.7MiB / 384MiB +2026-10-16T18:24:19Z,mtusi-messenger-lab2-postgres-1,0.01%,34.73MiB / 1.913GiB +2026-10-16T18:24:19Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:19Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:23Z,xenodochial_carson,29.84%,25.14MiB / 1.913GiB +2026-10-16T18:24:23Z,mtusi-messenger-lab3-api-1,23.99%,14.63MiB / 768MiB +2026-10-16T18:24:23Z,mtusi-messenger-lab3-lb-1,10.87%,16.27MiB / 64MiB +2026-10-16T18:24:23Z,mtusi-messenger-lab3-postgres-1,38.59%,195.3MiB / 384MiB +2026-10-16T18:24:23Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:24:23Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:23Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:26Z,xenodochial_carson,28.70%,25.3MiB / 1.913GiB +2026-10-16T18:24:26Z,mtusi-messenger-lab3-api-1,23.46%,14.6MiB / 768MiB +2026-10-16T18:24:26Z,mtusi-messenger-lab3-lb-1,10.43%,16.25MiB / 64MiB +2026-10-16T18:24:26Z,mtusi-messenger-lab3-postgres-1,39.78%,195.9MiB / 384MiB +2026-10-16T18:24:26Z,mtusi-messenger-lab2-postgres-1,0.31%,35.82MiB / 1.913GiB +2026-10-16T18:24:26Z,mtusi-messenger-lab2-redis-1,0.67%,5.113MiB / 1.913GiB +2026-10-16T18:24:26Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:29Z,xenodochial_carson,29.94%,25.59MiB / 1.913GiB +2026-10-16T18:24:29Z,mtusi-messenger-lab3-api-1,24.68%,14.82MiB / 768MiB +2026-10-16T18:24:29Z,mtusi-messenger-lab3-lb-1,10.74%,16.28MiB / 64MiB +2026-10-16T18:24:29Z,mtusi-messenger-lab3-postgres-1,37.55%,196.3MiB / 384MiB +2026-10-16T18:24:29Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:24:29Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:29Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:32Z,xenodochial_carson,29.50%,25.79MiB / 1.913GiB +2026-10-16T18:24:32Z,mtusi-messenger-lab3-api-1,24.62%,14.71MiB / 768MiB +2026-10-16T18:24:32Z,mtusi-messenger-lab3-lb-1,10.73%,16.24MiB / 64MiB +2026-10-16T18:24:32Z,mtusi-messenger-lab3-postgres-1,37.66%,196.4MiB / 384MiB +2026-10-16T18:24:32Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:24:32Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:32Z,mtusi-messenger-lab3-redis-1,0.74%,6.891MiB / 192MiB diff --git a/evidence/track1/stats-r2.csv b/evidence/track1/stats-r2.csv new file mode 100644 index 00000000..f3474505 --- /dev/null +++ b/evidence/track1/stats-r2.csv @@ -0,0 +1,160 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:24:53Z,mtusi-messenger-lab3-api-1,13.54%,156.4MiB / 384MiB +2026-10-16T18:24:53Z,mtusi-messenger-lab3-api-2,13.81%,156.6MiB / 384MiB +2026-10-16T18:24:53Z,mtusi-messenger-lab3-lb-1,10.56%,16.27MiB / 64MiB +2026-10-16T18:24:53Z,mtusi-messenger-lab3-postgres-1,36.16%,200.1MiB / 384MiB +2026-10-16T18:24:53Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:24:53Z,mtusi-messenger-lab2-redis-1,0.19%,4.215MiB / 1.913GiB +2026-10-16T18:24:53Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:24:53Z,gracious_cerf,29.46%,22.35MiB / 1.913GiB +2026-10-16T18:24:56Z,gracious_cerf,27.85%,24.04MiB / 1.913GiB +2026-10-16T18:24:56Z,mtusi-messenger-lab3-api-1,13.16%,188.4MiB / 384MiB +2026-10-16T18:24:56Z,mtusi-messenger-lab3-api-2,13.72%,109.5MiB / 384MiB +2026-10-16T18:24:56Z,mtusi-messenger-lab3-lb-1,10.16%,16.28MiB / 64MiB +2026-10-16T18:24:56Z,mtusi-messenger-lab3-postgres-1,35.45%,200.2MiB / 384MiB +2026-10-16T18:24:56Z,mtusi-messenger-lab2-postgres-1,0.88%,34.73MiB / 1.913GiB +2026-10-16T18:24:56Z,mtusi-messenger-lab2-redis-1,0.69%,4.215MiB / 1.913GiB +2026-10-16T18:24:56Z,mtusi-messenger-lab3-redis-1,0.65%,6.891MiB / 192MiB +2026-10-16T18:24:59Z,gracious_cerf,27.83%,22.14MiB / 1.913GiB +2026-10-16T18:24:59Z,mtusi-messenger-lab3-api-1,13.86%,11.88MiB / 384MiB +2026-10-16T18:24:59Z,mtusi-messenger-lab3-api-2,13.55%,10.96MiB / 384MiB +2026-10-16T18:24:59Z,mtusi-messenger-lab3-lb-1,10.23%,16.27MiB / 64MiB +2026-10-16T18:24:59Z,mtusi-messenger-lab3-postgres-1,35.93%,200.3MiB / 384MiB +2026-10-16T18:24:59Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:24:59Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:24:59Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:02Z,gracious_cerf,28.96%,22.27MiB / 1.913GiB +2026-10-16T18:25:02Z,mtusi-messenger-lab3-api-1,13.83%,11.43MiB / 384MiB +2026-10-16T18:25:02Z,mtusi-messenger-lab3-api-2,14.35%,10.99MiB / 384MiB +2026-10-16T18:25:02Z,mtusi-messenger-lab3-lb-1,10.50%,16.25MiB / 64MiB +2026-10-16T18:25:02Z,mtusi-messenger-lab3-postgres-1,36.21%,200.5MiB / 384MiB +2026-10-16T18:25:02Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:02Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:02Z,mtusi-messenger-lab3-redis-1,0.66%,6.891MiB / 192MiB +2026-10-16T18:25:06Z,gracious_cerf,29.22%,22.5MiB / 1.913GiB +2026-10-16T18:25:06Z,mtusi-messenger-lab3-api-1,14.29%,11.05MiB / 384MiB +2026-10-16T18:25:06Z,mtusi-messenger-lab3-api-2,14.08%,11.11MiB / 384MiB +2026-10-16T18:25:06Z,mtusi-messenger-lab3-lb-1,10.69%,16.27MiB / 64MiB +2026-10-16T18:25:06Z,mtusi-messenger-lab3-postgres-1,36.45%,200.9MiB / 384MiB +2026-10-16T18:25:06Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:06Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:06Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:09Z,gracious_cerf,30.30%,22.71MiB / 1.913GiB +2026-10-16T18:25:09Z,mtusi-messenger-lab3-api-1,14.34%,11.02MiB / 384MiB +2026-10-16T18:25:09Z,mtusi-messenger-lab3-api-2,14.08%,11.06MiB / 384MiB +2026-10-16T18:25:09Z,mtusi-messenger-lab3-lb-1,10.86%,16.28MiB / 64MiB +2026-10-16T18:25:09Z,mtusi-messenger-lab3-postgres-1,36.89%,200.7MiB / 384MiB +2026-10-16T18:25:09Z,mtusi-messenger-lab2-postgres-1,0.20%,34.73MiB / 1.913GiB +2026-10-16T18:25:09Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:09Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:12Z,gracious_cerf,28.04%,22.95MiB / 1.913GiB +2026-10-16T18:25:12Z,mtusi-messenger-lab3-api-1,13.75%,11.18MiB / 384MiB +2026-10-16T18:25:12Z,mtusi-messenger-lab3-api-2,13.30%,11.02MiB / 384MiB +2026-10-16T18:25:12Z,mtusi-messenger-lab3-lb-1,10.28%,16.29MiB / 64MiB +2026-10-16T18:25:12Z,mtusi-messenger-lab3-postgres-1,35.91%,201.1MiB / 384MiB +2026-10-16T18:25:12Z,mtusi-messenger-lab2-postgres-1,0.66%,34.73MiB / 1.913GiB +2026-10-16T18:25:12Z,mtusi-messenger-lab2-redis-1,0.62%,4.215MiB / 1.913GiB +2026-10-16T18:25:12Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:15Z,gracious_cerf,28.67%,23.14MiB / 1.913GiB +2026-10-16T18:25:15Z,mtusi-messenger-lab3-api-1,13.85%,11.1MiB / 384MiB +2026-10-16T18:25:15Z,mtusi-messenger-lab3-api-2,14.53%,10.84MiB / 384MiB +2026-10-16T18:25:15Z,mtusi-messenger-lab3-lb-1,10.52%,16.29MiB / 64MiB +2026-10-16T18:25:15Z,mtusi-messenger-lab3-postgres-1,35.89%,201.7MiB / 384MiB +2026-10-16T18:25:15Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:15Z,mtusi-messenger-lab2-redis-1,0.20%,4.215MiB / 1.913GiB +2026-10-16T18:25:15Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:18Z,gracious_cerf,27.97%,23.34MiB / 1.913GiB +2026-10-16T18:25:18Z,mtusi-messenger-lab3-api-1,14.20%,11.52MiB / 384MiB +2026-10-16T18:25:18Z,mtusi-messenger-lab3-api-2,13.94%,11.04MiB / 384MiB +2026-10-16T18:25:18Z,mtusi-messenger-lab3-lb-1,10.48%,16.27MiB / 64MiB +2026-10-16T18:25:18Z,mtusi-messenger-lab3-postgres-1,36.59%,202.2MiB / 384MiB +2026-10-16T18:25:18Z,mtusi-messenger-lab2-postgres-1,0.65%,34.73MiB / 1.913GiB +2026-10-16T18:25:18Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:18Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:21Z,gracious_cerf,27.47%,23.54MiB / 1.913GiB +2026-10-16T18:25:21Z,mtusi-messenger-lab3-api-1,14.10%,11.25MiB / 384MiB +2026-10-16T18:25:21Z,mtusi-messenger-lab3-api-2,14.20%,11.04MiB / 384MiB +2026-10-16T18:25:21Z,mtusi-messenger-lab3-lb-1,10.12%,16.25MiB / 64MiB +2026-10-16T18:25:21Z,mtusi-messenger-lab3-postgres-1,35.18%,202.5MiB / 384MiB +2026-10-16T18:25:21Z,mtusi-messenger-lab2-postgres-1,0.19%,34.73MiB / 1.913GiB +2026-10-16T18:25:21Z,mtusi-messenger-lab2-redis-1,0.57%,5.5MiB / 1.913GiB +2026-10-16T18:25:21Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:24Z,gracious_cerf,28.78%,23.73MiB / 1.913GiB +2026-10-16T18:25:24Z,mtusi-messenger-lab3-api-1,13.84%,11.18MiB / 384MiB +2026-10-16T18:25:24Z,mtusi-messenger-lab3-api-2,13.44%,11.07MiB / 384MiB +2026-10-16T18:25:24Z,mtusi-messenger-lab3-lb-1,10.65%,16.28MiB / 64MiB +2026-10-16T18:25:24Z,mtusi-messenger-lab3-postgres-1,36.35%,202.8MiB / 384MiB +2026-10-16T18:25:24Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:24Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:24Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:27Z,gracious_cerf,27.51%,23.87MiB / 1.913GiB +2026-10-16T18:25:27Z,mtusi-messenger-lab3-api-1,14.37%,11.2MiB / 384MiB +2026-10-16T18:25:27Z,mtusi-messenger-lab3-api-2,13.94%,11.05MiB / 384MiB +2026-10-16T18:25:27Z,mtusi-messenger-lab3-lb-1,10.69%,16.27MiB / 64MiB +2026-10-16T18:25:27Z,mtusi-messenger-lab3-postgres-1,36.82%,203.1MiB / 384MiB +2026-10-16T18:25:27Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:27Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:27Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:30Z,gracious_cerf,28.69%,24.12MiB / 1.913GiB +2026-10-16T18:25:30Z,mtusi-messenger-lab3-api-1,14.61%,11.19MiB / 384MiB +2026-10-16T18:25:30Z,mtusi-messenger-lab3-api-2,14.76%,11.06MiB / 384MiB +2026-10-16T18:25:30Z,mtusi-messenger-lab3-lb-1,10.46%,16.28MiB / 64MiB +2026-10-16T18:25:30Z,mtusi-messenger-lab3-postgres-1,36.48%,203.7MiB / 384MiB +2026-10-16T18:25:30Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:30Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:30Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:34Z,gracious_cerf,30.64%,24.37MiB / 1.913GiB +2026-10-16T18:25:34Z,mtusi-messenger-lab3-api-1,14.47%,11.16MiB / 384MiB +2026-10-16T18:25:34Z,mtusi-messenger-lab3-api-2,14.77%,11.05MiB / 384MiB +2026-10-16T18:25:34Z,mtusi-messenger-lab3-lb-1,11.01%,16.26MiB / 64MiB +2026-10-16T18:25:34Z,mtusi-messenger-lab3-postgres-1,38.29%,203.8MiB / 384MiB +2026-10-16T18:25:34Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:34Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:34Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:37Z,gracious_cerf,28.31%,24.55MiB / 1.913GiB +2026-10-16T18:25:37Z,mtusi-messenger-lab3-api-1,13.32%,11.25MiB / 384MiB +2026-10-16T18:25:37Z,mtusi-messenger-lab3-api-2,13.12%,11.04MiB / 384MiB +2026-10-16T18:25:37Z,mtusi-messenger-lab3-lb-1,10.32%,16.28MiB / 64MiB +2026-10-16T18:25:37Z,mtusi-messenger-lab3-postgres-1,35.67%,203.8MiB / 384MiB +2026-10-16T18:25:37Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:37Z,mtusi-messenger-lab2-redis-1,0.64%,4.215MiB / 1.913GiB +2026-10-16T18:25:37Z,mtusi-messenger-lab3-redis-1,0.67%,6.891MiB / 192MiB +2026-10-16T18:25:40Z,gracious_cerf,30.10%,24.79MiB / 1.913GiB +2026-10-16T18:25:40Z,mtusi-messenger-lab3-api-1,14.75%,11.59MiB / 384MiB +2026-10-16T18:25:40Z,mtusi-messenger-lab3-api-2,14.65%,11.03MiB / 384MiB +2026-10-16T18:25:40Z,mtusi-messenger-lab3-lb-1,11.06%,16.27MiB / 64MiB +2026-10-16T18:25:40Z,mtusi-messenger-lab3-postgres-1,38.18%,203.9MiB / 384MiB +2026-10-16T18:25:40Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:40Z,mtusi-messenger-lab2-redis-1,0.20%,4.215MiB / 1.913GiB +2026-10-16T18:25:40Z,mtusi-messenger-lab3-redis-1,0.19%,6.891MiB / 192MiB +2026-10-16T18:25:43Z,gracious_cerf,29.34%,25MiB / 1.913GiB +2026-10-16T18:25:43Z,mtusi-messenger-lab3-api-1,14.50%,11.44MiB / 384MiB +2026-10-16T18:25:43Z,mtusi-messenger-lab3-api-2,14.33%,11.02MiB / 384MiB +2026-10-16T18:25:43Z,mtusi-messenger-lab3-lb-1,10.48%,16.29MiB / 64MiB +2026-10-16T18:25:43Z,mtusi-messenger-lab3-postgres-1,35.44%,204MiB / 384MiB +2026-10-16T18:25:43Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:43Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:43Z,mtusi-messenger-lab3-redis-1,0.65%,6.891MiB / 192MiB +2026-10-16T18:25:46Z,gracious_cerf,28.96%,25.12MiB / 1.913GiB +2026-10-16T18:25:46Z,mtusi-messenger-lab3-api-1,13.45%,11.3MiB / 384MiB +2026-10-16T18:25:46Z,mtusi-messenger-lab3-api-2,14.34%,11.04MiB / 384MiB +2026-10-16T18:25:46Z,mtusi-messenger-lab3-lb-1,10.52%,16.25MiB / 64MiB +2026-10-16T18:25:46Z,mtusi-messenger-lab3-postgres-1,36.51%,204.1MiB / 384MiB +2026-10-16T18:25:46Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:46Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:46Z,mtusi-messenger-lab3-redis-1,0.18%,6.891MiB / 192MiB +2026-10-16T18:25:49Z,gracious_cerf,29.13%,25.4MiB / 1.913GiB +2026-10-16T18:25:49Z,mtusi-messenger-lab3-api-1,14.18%,11.3MiB / 384MiB +2026-10-16T18:25:49Z,mtusi-messenger-lab3-api-2,14.35%,11.02MiB / 384MiB +2026-10-16T18:25:49Z,mtusi-messenger-lab3-lb-1,10.57%,16.26MiB / 64MiB +2026-10-16T18:25:49Z,mtusi-messenger-lab3-postgres-1,36.54%,204.2MiB / 384MiB +2026-10-16T18:25:49Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:49Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:25:49Z,mtusi-messenger-lab3-redis-1,0.18%,6.891MiB / 192MiB +2026-10-16T18:25:52Z,mtusi-messenger-lab3-api-1,8.63%,11.45MiB / 384MiB +2026-10-16T18:25:52Z,mtusi-messenger-lab3-api-2,8.27%,11.02MiB / 384MiB +2026-10-16T18:25:52Z,mtusi-messenger-lab3-lb-1,6.30%,16.23MiB / 64MiB +2026-10-16T18:25:52Z,mtusi-messenger-lab3-postgres-1,35.94%,207.4MiB / 384MiB +2026-10-16T18:25:52Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:25:52Z,mtusi-messenger-lab2-redis-1,0.63%,4.215MiB / 1.913GiB +2026-10-16T18:25:52Z,mtusi-messenger-lab3-redis-1,0.19%,6.961MiB / 192MiB diff --git a/evidence/track1/stats-r4.csv b/evidence/track1/stats-r4.csv new file mode 100644 index 00000000..6a3d43b9 --- /dev/null +++ b/evidence/track1/stats-r4.csv @@ -0,0 +1,200 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:26:13Z,mtusi-messenger-lab3-api-4,8.00%,79.91MiB / 192MiB +2026-10-16T18:26:13Z,mtusi-messenger-lab3-api-1,8.00%,138.5MiB / 192MiB +2026-10-16T18:26:13Z,mtusi-messenger-lab3-api-2,7.55%,136.9MiB / 192MiB +2026-10-16T18:26:13Z,mtusi-messenger-lab3-api-3,8.24%,10.38MiB / 192MiB +2026-10-16T18:26:13Z,mtusi-messenger-lab3-lb-1,10.50%,16.28MiB / 64MiB +2026-10-16T18:26:13Z,mtusi-messenger-lab3-postgres-1,35.29%,209.7MiB / 384MiB +2026-10-16T18:26:13Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:13Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:13Z,mtusi-messenger-lab3-redis-1,0.67%,6.98MiB / 192MiB +2026-10-16T18:26:13Z,pensive_babbage,28.55%,21.95MiB / 1.913GiB +2026-10-16T18:26:16Z,pensive_babbage,27.98%,24.31MiB / 1.913GiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-api-4,7.82%,103MiB / 192MiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-api-1,8.33%,138.5MiB / 192MiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-api-2,7.48%,137.4MiB / 192MiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-api-3,8.16%,10.4MiB / 192MiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-lb-1,10.61%,16.27MiB / 64MiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-postgres-1,35.06%,209.7MiB / 384MiB +2026-10-16T18:26:16Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:16Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:16Z,mtusi-messenger-lab3-redis-1,0.18%,6.98MiB / 192MiB +2026-10-16T18:26:19Z,pensive_babbage,28.21%,22.07MiB / 1.913GiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-api-4,7.66%,126MiB / 192MiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-api-1,7.60%,138.5MiB / 192MiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-api-2,7.51%,137.8MiB / 192MiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-api-3,7.74%,10.32MiB / 192MiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-lb-1,10.72%,16.28MiB / 64MiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-postgres-1,34.76%,210.1MiB / 384MiB +2026-10-16T18:26:19Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:19Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:19Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:22Z,pensive_babbage,27.49%,22.19MiB / 1.913GiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-api-4,7.70%,12.83MiB / 192MiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-api-1,7.69%,10.92MiB / 192MiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-api-2,7.91%,12.29MiB / 192MiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-api-3,7.81%,10.33MiB / 192MiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-lb-1,10.37%,16.29MiB / 64MiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-postgres-1,34.81%,210.5MiB / 384MiB +2026-10-16T18:26:22Z,mtusi-messenger-lab2-postgres-1,0.66%,34.73MiB / 1.913GiB +2026-10-16T18:26:22Z,mtusi-messenger-lab2-redis-1,0.66%,4.215MiB / 1.913GiB +2026-10-16T18:26:22Z,mtusi-messenger-lab3-redis-1,0.49%,8.055MiB / 192MiB +2026-10-16T18:26:25Z,pensive_babbage,26.66%,22.68MiB / 1.913GiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-api-4,8.10%,12.58MiB / 192MiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-api-1,8.10%,10.99MiB / 192MiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-api-2,7.81%,12.18MiB / 192MiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-api-3,7.84%,10.41MiB / 192MiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-lb-1,10.27%,16.27MiB / 64MiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-postgres-1,33.67%,210.8MiB / 384MiB +2026-10-16T18:26:25Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:25Z,mtusi-messenger-lab2-redis-1,0.20%,4.215MiB / 1.913GiB +2026-10-16T18:26:25Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:28Z,pensive_babbage,27.12%,22.61MiB / 1.913GiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-api-4,7.28%,12.58MiB / 192MiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-api-1,7.68%,10.81MiB / 192MiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-api-2,7.66%,12.29MiB / 192MiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-api-3,7.69%,10.42MiB / 192MiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-lb-1,10.20%,16.27MiB / 64MiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-postgres-1,35.48%,211.1MiB / 384MiB +2026-10-16T18:26:28Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:28Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:28Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:32Z,pensive_babbage,28.95%,22.81MiB / 1.913GiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-api-4,8.17%,12.57MiB / 192MiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-api-1,8.55%,10.9MiB / 192MiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-api-2,7.80%,12.25MiB / 192MiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-api-3,8.65%,10.32MiB / 192MiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-lb-1,11.10%,16.28MiB / 64MiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-postgres-1,35.61%,211.8MiB / 384MiB +2026-10-16T18:26:32Z,mtusi-messenger-lab2-postgres-1,0.68%,34.73MiB / 1.913GiB +2026-10-16T18:26:32Z,mtusi-messenger-lab2-redis-1,0.70%,4.215MiB / 1.913GiB +2026-10-16T18:26:32Z,mtusi-messenger-lab3-redis-1,0.65%,6.98MiB / 192MiB +2026-10-16T18:26:35Z,pensive_babbage,28.37%,22.99MiB / 1.913GiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-api-4,8.33%,12.71MiB / 192MiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-api-1,7.60%,10.88MiB / 192MiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-api-2,8.24%,12.55MiB / 192MiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-api-3,7.84%,10.41MiB / 192MiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-lb-1,10.58%,16.26MiB / 64MiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-postgres-1,35.20%,211.9MiB / 384MiB +2026-10-16T18:26:35Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:35Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:35Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:38Z,pensive_babbage,28.95%,23.24MiB / 1.913GiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-api-4,7.97%,12.82MiB / 192MiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-api-1,8.29%,10.87MiB / 192MiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-api-2,8.00%,12.1MiB / 192MiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-api-3,7.98%,10.41MiB / 192MiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-lb-1,10.76%,16.25MiB / 64MiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-postgres-1,35.98%,212.3MiB / 384MiB +2026-10-16T18:26:38Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:38Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:38Z,mtusi-messenger-lab3-redis-1,0.67%,6.98MiB / 192MiB +2026-10-16T18:26:41Z,pensive_babbage,28.35%,23.45MiB / 1.913GiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-api-4,7.47%,12.63MiB / 192MiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-api-1,7.66%,10.87MiB / 192MiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-api-2,7.60%,12.16MiB / 192MiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-api-3,8.40%,10.41MiB / 192MiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-lb-1,10.43%,16.25MiB / 64MiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-postgres-1,34.35%,212.6MiB / 384MiB +2026-10-16T18:26:41Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:41Z,mtusi-messenger-lab2-redis-1,0.19%,4.215MiB / 1.913GiB +2026-10-16T18:26:41Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:44Z,pensive_babbage,28.75%,23.55MiB / 1.913GiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-api-4,7.65%,13MiB / 192MiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-api-1,8.13%,10.75MiB / 192MiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-api-2,7.74%,12.13MiB / 192MiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-api-3,7.56%,10.42MiB / 192MiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-lb-1,10.53%,16.29MiB / 64MiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-postgres-1,34.64%,212.9MiB / 384MiB +2026-10-16T18:26:44Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:44Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:44Z,mtusi-messenger-lab3-redis-1,0.18%,6.98MiB / 192MiB +2026-10-16T18:26:47Z,pensive_babbage,28.04%,23.71MiB / 1.913GiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-api-4,8.01%,12.79MiB / 192MiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-api-1,7.96%,10.79MiB / 192MiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-api-2,7.92%,12.14MiB / 192MiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-api-3,7.63%,10.41MiB / 192MiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-lb-1,10.11%,16.27MiB / 64MiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-postgres-1,34.53%,213.4MiB / 384MiB +2026-10-16T18:26:47Z,mtusi-messenger-lab2-postgres-1,0.68%,34.73MiB / 1.913GiB +2026-10-16T18:26:47Z,mtusi-messenger-lab2-redis-1,0.66%,4.215MiB / 1.913GiB +2026-10-16T18:26:47Z,mtusi-messenger-lab3-redis-1,0.70%,6.98MiB / 192MiB +2026-10-16T18:26:50Z,pensive_babbage,28.44%,23.97MiB / 1.913GiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-api-4,7.95%,12.99MiB / 192MiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-api-1,8.02%,10.78MiB / 192MiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-api-2,7.97%,12.31MiB / 192MiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-api-3,8.90%,10.41MiB / 192MiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-lb-1,10.66%,16.29MiB / 64MiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-postgres-1,35.47%,213.8MiB / 384MiB +2026-10-16T18:26:50Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:50Z,mtusi-messenger-lab2-redis-1,0.21%,4.215MiB / 1.913GiB +2026-10-16T18:26:50Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:54Z,pensive_babbage,27.72%,24.15MiB / 1.913GiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-api-4,7.82%,12.55MiB / 192MiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-api-1,7.75%,10.79MiB / 192MiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-api-2,7.52%,12.2MiB / 192MiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-api-3,7.72%,10.42MiB / 192MiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-lb-1,10.27%,16.27MiB / 64MiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-postgres-1,33.86%,214.2MiB / 384MiB +2026-10-16T18:26:54Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:26:54Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:26:54Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:26:57Z,pensive_babbage,27.86%,24.34MiB / 1.913GiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-api-4,7.85%,13.07MiB / 192MiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-api-1,7.72%,10.79MiB / 192MiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-api-2,8.42%,12.52MiB / 192MiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-api-3,7.66%,10.42MiB / 192MiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-lb-1,10.52%,16.28MiB / 64MiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-postgres-1,34.51%,214.7MiB / 384MiB +2026-10-16T18:26:57Z,mtusi-messenger-lab2-postgres-1,0.19%,34.73MiB / 1.913GiB +2026-10-16T18:26:57Z,mtusi-messenger-lab2-redis-1,0.19%,4.215MiB / 1.913GiB +2026-10-16T18:26:57Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:27:00Z,pensive_babbage,26.94%,24.53MiB / 1.913GiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-api-4,7.95%,12.93MiB / 192MiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-api-1,8.42%,10.79MiB / 192MiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-api-2,8.26%,12.25MiB / 192MiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-api-3,8.13%,10.35MiB / 192MiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-lb-1,10.28%,16.29MiB / 64MiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-postgres-1,33.75%,214.9MiB / 384MiB +2026-10-16T18:27:00Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:27:00Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:27:00Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:27:03Z,pensive_babbage,25.91%,24.71MiB / 1.913GiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-api-4,7.75%,12.81MiB / 192MiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-api-1,7.40%,10.78MiB / 192MiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-api-2,7.96%,12.11MiB / 192MiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-api-3,7.34%,10.36MiB / 192MiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-lb-1,9.81%,16.27MiB / 64MiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-postgres-1,35.89%,215.7MiB / 384MiB +2026-10-16T18:27:03Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:27:03Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:27:03Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:27:06Z,pensive_babbage,28.65%,25.12MiB / 1.913GiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-api-4,7.16%,12.48MiB / 192MiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-api-1,7.37%,10.78MiB / 192MiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-api-2,7.48%,12.19MiB / 192MiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-api-3,7.61%,10.37MiB / 192MiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-lb-1,10.51%,16.28MiB / 64MiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-postgres-1,34.44%,215.7MiB / 384MiB +2026-10-16T18:27:06Z,mtusi-messenger-lab2-postgres-1,0.00%,34.73MiB / 1.913GiB +2026-10-16T18:27:06Z,mtusi-messenger-lab2-redis-1,0.18%,4.215MiB / 1.913GiB +2026-10-16T18:27:06Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:27:09Z,pensive_babbage,29.40%,25.13MiB / 1.913GiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-api-4,7.60%,13.1MiB / 192MiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-api-1,7.70%,10.79MiB / 192MiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-api-2,8.14%,12.36MiB / 192MiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-api-3,8.06%,10.37MiB / 192MiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-lb-1,10.87%,16.27MiB / 64MiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-postgres-1,35.72%,216MiB / 384MiB +2026-10-16T18:27:09Z,mtusi-messenger-lab2-postgres-1,0.19%,34.73MiB / 1.913GiB +2026-10-16T18:27:09Z,mtusi-messenger-lab2-redis-1,0.20%,4.215MiB / 1.913GiB +2026-10-16T18:27:09Z,mtusi-messenger-lab3-redis-1,0.19%,6.98MiB / 192MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-api-4,7.96%,12.62MiB / 192MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-api-1,3.49%,10.77MiB / 192MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-api-2,3.56%,12.19MiB / 192MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-api-3,3.63%,10.32MiB / 192MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-lb-1,4.64%,16.23MiB / 64MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-postgres-1,35.73%,218.5MiB / 384MiB +2026-10-16T18:27:12Z,mtusi-messenger-lab2-postgres-1,0.66%,34.73MiB / 1.913GiB +2026-10-16T18:27:12Z,mtusi-messenger-lab2-redis-1,0.61%,4.215MiB / 1.913GiB +2026-10-16T18:27:12Z,mtusi-messenger-lab3-redis-1,0.66%,6.98MiB / 192MiB diff --git a/evidence/track1/summary.md b/evidence/track1/summary.md new file mode 100644 index 00000000..c906a35e --- /dev/null +++ b/evidence/track1/summary.md @@ -0,0 +1,19 @@ +# Трек 1: цена масштабирования + +| профиль | реплик | бюджет CPU API | CPU/реплика | бюджет PG CPU/RAM | пул | LB CPU (лимит) | успешный RPS | p50 мс | p95 мс | p99 мс | ошибки | API CPU (сумма) | API RAM max (сумма, MiB) | PG CPU | LB CPU | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| ctl1base | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1391.108 | 5.571 | 9.03 | 11.692 | 0 | 27.3 | 310.2 | 36.06 | 10.47 | +| ctl2pg | 2 | 1.0 | 0.5 | 1.00/384M | 10 | 0.25 | 1391.647 | 5.575 | 8.994 | 11.512 | 0 | 27.32 | 310.8 | 35.94 | 10.16 | +| ctl3base | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1360.087 | 5.664 | 9.482 | 12.322 | 0 | 27.91 | 255.8 | 35.9 | 10.44 | +| ctl4lb | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 1.00 | 1359.794 | 5.688 | 9.37 | 12.032 | 0 | 26.92 | 394.4 | 37.22 | 9.95 | +| d2 | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1389.179 | 5.585 | 9.054 | 11.711 | 0 | 27.36 | 381.9 | 36.18 | 10.07 | +| db1cpu | 2 | 1.0 | 0.5 | 1.00/384M | 10 | 0.25 | 1270.045 | 6.057 | 10.141 | 13.724 | 0 | 25.43 | 387.9 | 38.39 | 9.46 | +| g05 | 2 | 0.5 | 0.25 | 0.50/384M | 10 | 0.25 | 1489.856 | 5.238 | 8.245 | 10.54 | 0 | 28.11 | 267.1 | 36.26 | 10.39 | +| g10 | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1496.325 | 5.207 | 8.221 | 10.508 | 0 | 27.44 | 313.2 | 36.86 | 10.18 | +| g15 | 2 | 1.5 | 0.75 | 0.50/384M | 10 | 0.25 | 1491.252 | 5.251 | 8.176 | 10.209 | 0 | 27.33 | 315.8 | 35.99 | 10.42 | +| lb1cpu | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 1.00 | 1367.357 | 5.67 | 9.26 | 12.055 | 0 | 27.21 | 310.3 | 36.62 | 10.02 | +| pool10 | 4 | 1.0 | 0.25 | 0.50/384M | 10 | 0.25 | 1398.951 | 5.556 | 8.741 | 11.048 | 4 | 30.98 | 624.0 | 34.89 | 10.19 | +| pool5 | 4 | 1.0 | 0.25 | 0.50/384M | 5 | 0.25 | 1299.617 | 5.957 | 9.594 | 12.386 | 4 | 30.17 | 605.5 | 34.71 | 9.99 | +| r1 | 1 | 1.0 | 1.0 | 0.50/384M | 10 | 0.25 | 1542.892 | 5.047 | 8.006 | 10.239 | 0 | 23.74 | 185.2 | 38.98 | 9.99 | +| r2 | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1491.325 | 5.245 | 8.225 | 10.303 | 0 | 27.53 | 313.0 | 36.34 | 10.32 | +| r4 | 4 | 1.0 | 0.25 | 0.50/384M | 10 | 0.25 | 1415.713 | 5.538 | 8.614 | 10.749 | 0 | 30.84 | 412.6 | 34.94 | 10.19 | diff --git a/evidence/track1/summary.txt b/evidence/track1/summary.txt new file mode 100644 index 00000000..edc92a12 --- /dev/null +++ b/evidence/track1/summary.txt @@ -0,0 +1,411 @@ +# Track 1: the price of scaling +# generated: 2026-10-16T18:23:17Z +# host: Darwin arm64 +# cpu: Apple M5 Pro +# ram bytes: 51539607552 +# load: tests/load.py closed loop; postgres/lb budgets are recreated and verified per profile +# each profile line below records the budget it was run with +docker engine 29.5.2 +Docker Compose version 5.5.1 + +=== invocation 2026-10-16T18:23:17Z: REPLICAS="1" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r1 replicas=1 cpu=1.00 mem=768M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=r1 replicas=1 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.075, + "concurrency": 8, + "successful_requests": 92690, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1542.892, + "successful_latency_ms": { + "p50": 5.047, + "p95": 8.006, + "p99": 10.239 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=18 +postgres_max_connections=100 +messages_rows=3599617 +idempotency_rows=3599617 + +=== invocation 2026-10-16T18:24:37Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r2 replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=r2 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.073, + "concurrency": 8, + "successful_requests": 89588, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1491.325, + "successful_latency_ms": { + "p50": 5.245, + "p95": 8.225, + "p99": 10.303 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=3712180 +idempotency_rows=3712180 + +=== invocation 2026-10-16T18:25:56Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r4 replicas=4 cpu=0.25 mem=192M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=r4 replicas=4 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.069, + "concurrency": 8, + "successful_requests": 85041, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1415.713, + "successful_latency_ms": { + "p50": 5.538, + "p95": 8.614, + "p99": 10.749 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=22 +postgres_max_connections=100 +messages_rows=3818387 +idempotency_rows=3818387 + +=== invocation 2026-10-16T18:27:15Z: REPLICAS="2" TOTAL_CPU=0.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g05 replicas=2 cpu=0.25 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== invocation 2026-10-16T18:27:48Z: REPLICAS="2" TOTAL_CPU=0.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g05 replicas=2 cpu=0.25 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=g05 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.064, + "concurrency": 8, + "successful_requests": 89486, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1489.856, + "successful_latency_ms": { + "p50": 5.238, + "p95": 8.245, + "p99": 10.54 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=3938460 +idempotency_rows=3938460 + +=== invocation 2026-10-16T18:29:13Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g10 replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=g10 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.071, + "concurrency": 8, + "successful_requests": 89886, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1496.325, + "successful_latency_ms": { + "p50": 5.207, + "p95": 8.221, + "p99": 10.508 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4050874 +idempotency_rows=4050874 + +=== invocation 2026-10-16T18:30:31Z: REPLICAS="2" TOTAL_CPU=1.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g15 replicas=2 cpu=0.75 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=g15 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.061, + "concurrency": 8, + "successful_requests": 89566, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1491.252, + "successful_latency_ms": { + "p50": 5.251, + "p95": 8.176, + "p99": 10.209 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4163465 +idempotency_rows=4163465 + +=== invocation 2026-10-16T18:31:50Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool10 replicas=4 cpu=0.25 mem=192M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=pool10 replicas=4 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.074, + "concurrency": 8, + "successful_requests": 84040, + "failed_requests": 4, + "error_ratio": 4.8e-05, + "successful_rps": 1398.951, + "successful_latency_ms": { + "p50": 5.556, + "p95": 8.741, + "p99": 11.048 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=22 +postgres_max_connections=100 +messages_rows=4269081 +idempotency_rows=4269081 + +=== invocation 2026-10-16T18:33:10Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool5 replicas=4 cpu=0.25 mem=192M postgres=0.50/384M lb_cpu=0.25 max_conns=5 client=vm === +=== applied label=pool5 replicas=4 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.078, + "concurrency": 8, + "successful_requests": 78078, + "failed_requests": 4, + "error_ratio": 5.1e-05, + "successful_rps": 1299.617, + "successful_latency_ms": { + "p50": 5.957, + "p95": 9.594, + "p99": 12.386 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=21 +postgres_max_connections=100 +messages_rows=4367896 +idempotency_rows=4367896 + +=== invocation 2026-10-16T18:34:29Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=db1cpu replicas=2 cpu=0.50 mem=384M postgres=1.00/384M lb_cpu=0.25 max_conns=10 client=vm === +=== PostgreSQL: бюджет 0.50/384M -> 1.00/384M, пересоздаю контейнер === +=== applied label=db1cpu replicas=2 postgres=1.00/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.077, + "concurrency": 8, + "successful_requests": 76301, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1270.045, + "successful_latency_ms": { + "p50": 6.057, + "p95": 10.141, + "p99": 13.724 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4463395 +idempotency_rows=4463395 + +=== возвращаю PostgreSQL к бюджету 0.50/384M === +=== invocation 2026-10-16T18:35:53Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=lb1cpu replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=1.00 max_conns=10 client=vm === +=== LB: бюджет CPU 0.25 -> 1.00, пересоздаю контейнер === +=== applied label=lb1cpu replicas=2 postgres=0.50/384M lb_cpu=1.00 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.071, + "concurrency": 8, + "successful_requests": 82138, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1367.357, + "successful_latency_ms": { + "p50": 5.67, + "p95": 9.26, + "p99": 12.055 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4566754 +idempotency_rows=4566754 + +=== возвращаю LB к бюджету CPU 0.25 === +=== invocation 2026-10-16T18:37:30Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=d2 replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=d2 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.068, + "concurrency": 8, + "successful_requests": 83445, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1389.179, + "successful_latency_ms": { + "p50": 5.585, + "p95": 9.054, + "p99": 11.711 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4671368 +idempotency_rows=4671368 + +=== invocation 2026-10-16T18:38:55Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=ctl1base replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=ctl1base replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.082, + "concurrency": 8, + "successful_requests": 83581, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1391.108, + "successful_latency_ms": { + "p50": 5.571, + "p95": 9.03, + "p99": 11.692 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4776213 +idempotency_rows=4776213 + +=== invocation 2026-10-16T18:40:14Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=ctl2pg replicas=2 cpu=0.50 mem=384M postgres=1.00/384M lb_cpu=0.25 max_conns=10 client=vm === +=== PostgreSQL: бюджет 0.50/384M -> 1.00/384M, пересоздаю контейнер === +=== applied label=ctl2pg replicas=2 postgres=1.00/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.072, + "concurrency": 8, + "successful_requests": 83599, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1391.647, + "successful_latency_ms": { + "p50": 5.575, + "p95": 8.994, + "p99": 11.512 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4881024 +idempotency_rows=4881024 + +=== возвращаю PostgreSQL к бюджету 0.50/384M === +=== invocation 2026-10-16T18:41:33Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=ctl3base replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 client=vm === +=== applied label=ctl3base replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.078, + "concurrency": 8, + "successful_requests": 81711, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1360.087, + "successful_latency_ms": { + "p50": 5.664, + "p95": 9.482, + "p99": 12.322 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=4983558 +idempotency_rows=4983558 + +=== invocation 2026-10-16T18:42:51Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=ctl4lb replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=1.00 max_conns=10 client=vm === +=== LB: бюджет CPU 0.25 -> 1.00, пересоздаю контейнер === +=== applied label=ctl4lb replicas=2 postgres=0.50/384M lb_cpu=1.00 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.074, + "concurrency": 8, + "successful_requests": 81688, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1359.794, + "successful_latency_ms": { + "p50": 5.688, + "p95": 9.37, + "p99": 12.032 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=5086444 +idempotency_rows=5086444 + +=== возвращаю LB к бюджету CPU 0.25 === diff --git a/evidence/track1/superseded/README.md b/evidence/track1/superseded/README.md new file mode 100644 index 00000000..824326b1 --- /dev/null +++ b/evidence/track1/superseded/README.md @@ -0,0 +1,22 @@ +# Заменённые прогоны серии трека 1 + +Оба каталога сохранены как история: в них видны дефекты, которые нашло ревью. +Действующие артефакты лежат в `evidence/track1/` и воспроизводятся +`scripts/track1_series.sh`. + +## run1-wrong-budgets — бюджеты хранилищ записаны, но не применены + +`scripts/track1_scaling.sh` перенастраивал только API (`compose up -d --no-deps api`), +поэтому PostgreSQL продолжал работать с действующими 0.50 CPU / 384 MiB, тогда как в +`profile-*.json` попадало `512M` (серии `r`/`g`/`pool`) и `1.00` CPU (контроль +`db1cpu`). Контроль удвоения CPU БД в этом прогоне измерением не был. + +## run2-host-client — клиент на хосте терял соединения + +Бюджеты здесь уже применялись и проверялись по `docker inspect`, но генератор +работал на хосте через проброс порта. Под шквалом новых соединений forwarder хоста +отклонял их: 4 450-26 520 отказов на профиль (4-22 %), при этом в статистике HAProxy +`hrsp_5xx=0`, а в логах API нет ошибок — то есть отказы клиентские, а не от стенда +(разбор и контроль: `evidence/path-overhead/`). Из-за разного числа успешных запросов +загрузка PostgreSQL по профилям несопоставима, поэтому прогон заменён серией с +клиентом внутри VM (`CLIENT=vm`), где отказов нет. diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-db1cpu.json b/evidence/track1/superseded/run1-wrong-budgets/load-db1cpu.json new file mode 100644 index 00000000..e13e6eea --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-db1cpu.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 98492, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1641.212, + "successful_latency_ms": { + "p50": 4.085, + "p95": 8.787, + "p99": 23.973 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-g05.json b/evidence/track1/superseded/run1-wrong-budgets/load-g05.json new file mode 100644 index 00000000..fcc536e8 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-g05.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.01, + "concurrency": 8, + "successful_requests": 96941, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1615.408, + "successful_latency_ms": { + "p50": 4.348, + "p95": 8.823, + "p99": 20.46 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-g10.json b/evidence/track1/superseded/run1-wrong-budgets/load-g10.json new file mode 100644 index 00000000..79a7ea08 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-g10.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 99970, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1665.873, + "successful_latency_ms": { + "p50": 4.168, + "p95": 8.323, + "p99": 21.636 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-g15.json b/evidence/track1/superseded/run1-wrong-budgets/load-g15.json new file mode 100644 index 00000000..27369309 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-g15.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.017, + "concurrency": 8, + "successful_requests": 99132, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1651.746, + "successful_latency_ms": { + "p50": 4.094, + "p95": 8.631, + "p99": 24.272 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-pool10.json b/evidence/track1/superseded/run1-wrong-budgets/load-pool10.json new file mode 100644 index 00000000..e8af33d2 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-pool10.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 97133, + "failed_requests": 222, + "error_ratio": 0.00228, + "successful_rps": 1618.552, + "successful_latency_ms": { + "p50": 4.394, + "p95": 8.205, + "p99": 20.61 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-pool5.json b/evidence/track1/superseded/run1-wrong-budgets/load-pool5.json new file mode 100644 index 00000000..6133963f --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-pool5.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.027, + "concurrency": 8, + "successful_requests": 93849, + "failed_requests": 2, + "error_ratio": 2.1e-05, + "successful_rps": 1563.449, + "successful_latency_ms": { + "p50": 4.464, + "p95": 8.965, + "p99": 22.758 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-r1.json b/evidence/track1/superseded/run1-wrong-budgets/load-r1.json new file mode 100644 index 00000000..5c1fe718 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-r1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.015, + "concurrency": 8, + "successful_requests": 100860, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1680.576, + "successful_latency_ms": { + "p50": 4.005, + "p95": 8.354, + "p99": 22.526 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-r2.json b/evidence/track1/superseded/run1-wrong-budgets/load-r2.json new file mode 100644 index 00000000..1aaf6840 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-r2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 94054, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1567.279, + "successful_latency_ms": { + "p50": 4.474, + "p95": 9.495, + "p99": 20.649 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/load-r4.json b/evidence/track1/superseded/run1-wrong-budgets/load-r4.json new file mode 100644 index 00000000..e6e824e0 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/load-r4.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 92928, + "failed_requests": 178, + "error_ratio": 0.001912, + "successful_rps": 1548.476, + "successful_latency_ms": { + "p50": 4.633, + "p95": 8.8, + "p99": 18.978 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-db1cpu.json b/evidence/track1/superseded/run1-wrong-budgets/profile-db1cpu.json new file mode 100644 index 00000000..83ee4ba8 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-db1cpu.json @@ -0,0 +1 @@ +{"label":"db1cpu","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"1.0","postgres_mem_limit":"384M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-g05.json b/evidence/track1/superseded/run1-wrong-budgets/profile-g05.json new file mode 100644 index 00000000..4f8b438b --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-g05.json @@ -0,0 +1 @@ +{"label":"g05","replicas":2,"total_cpu":0.5,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-g10.json b/evidence/track1/superseded/run1-wrong-budgets/profile-g10.json new file mode 100644 index 00000000..173884f6 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-g10.json @@ -0,0 +1 @@ +{"label":"g10","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-g15.json b/evidence/track1/superseded/run1-wrong-budgets/profile-g15.json new file mode 100644 index 00000000..33c3500a --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-g15.json @@ -0,0 +1 @@ +{"label":"g15","replicas":2,"total_cpu":1.5,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-pool10.json b/evidence/track1/superseded/run1-wrong-budgets/profile-pool10.json new file mode 100644 index 00000000..6e3246e2 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-pool10.json @@ -0,0 +1 @@ +{"label":"pool10","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-pool5.json b/evidence/track1/superseded/run1-wrong-budgets/profile-pool5.json new file mode 100644 index 00000000..374b1fd3 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-pool5.json @@ -0,0 +1 @@ +{"label":"pool5","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":5} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-r1.json b/evidence/track1/superseded/run1-wrong-budgets/profile-r1.json new file mode 100644 index 00000000..e46b48b5 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-r1.json @@ -0,0 +1 @@ +{"label":"r1","replicas":1,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-r2.json b/evidence/track1/superseded/run1-wrong-budgets/profile-r2.json new file mode 100644 index 00000000..4bb29e76 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-r2.json @@ -0,0 +1 @@ +{"label":"r2","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/profile-r4.json b/evidence/track1/superseded/run1-wrong-budgets/profile-r4.json new file mode 100644 index 00000000..379dfd0b --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/profile-r4.json @@ -0,0 +1 @@ +{"label":"r4","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"512M","postgres_max_conns":10} diff --git a/evidence/track1/superseded/run1-wrong-budgets/scaling-fixed-budget.png b/evidence/track1/superseded/run1-wrong-budgets/scaling-fixed-budget.png new file mode 100644 index 00000000..10f0bfa4 Binary files /dev/null and b/evidence/track1/superseded/run1-wrong-budgets/scaling-fixed-budget.png differ diff --git a/evidence/track1/superseded/run1-wrong-budgets/scaling-growth.png b/evidence/track1/superseded/run1-wrong-budgets/scaling-growth.png new file mode 100644 index 00000000..e9ed6a29 Binary files /dev/null and b/evidence/track1/superseded/run1-wrong-budgets/scaling-growth.png differ diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-db1cpu.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-db1cpu.csv new file mode 100644 index 00000000..ae4b7d33 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-db1cpu.csv @@ -0,0 +1,101 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:23:04Z,mtusi-messenger-lab3-api-1,18.81%,164MiB / 384MiB +2026-10-16T14:23:04Z,mtusi-messenger-lab3-api-2,19.49%,165.3MiB / 384MiB +2026-10-16T14:23:04Z,mtusi-messenger-lab3-lb-1,14.54%,13.11MiB / 64MiB +2026-10-16T14:23:04Z,mtusi-messenger-lab3-postgres-1,50.60%,326MiB / 384MiB +2026-10-16T14:23:04Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:23:07Z,mtusi-messenger-lab3-api-1,18.29%,197MiB / 384MiB +2026-10-16T14:23:07Z,mtusi-messenger-lab3-api-2,20.02%,11.13MiB / 384MiB +2026-10-16T14:23:07Z,mtusi-messenger-lab3-lb-1,14.47%,13.11MiB / 64MiB +2026-10-16T14:23:07Z,mtusi-messenger-lab3-postgres-1,50.84%,326MiB / 384MiB +2026-10-16T14:23:07Z,mtusi-messenger-lab3-redis-1,0.69%,6.289MiB / 192MiB +2026-10-16T14:23:10Z,mtusi-messenger-lab3-api-1,19.38%,10.8MiB / 384MiB +2026-10-16T14:23:10Z,mtusi-messenger-lab3-api-2,19.18%,11.07MiB / 384MiB +2026-10-16T14:23:10Z,mtusi-messenger-lab3-lb-1,14.39%,13.11MiB / 64MiB +2026-10-16T14:23:10Z,mtusi-messenger-lab3-postgres-1,49.50%,326MiB / 384MiB +2026-10-16T14:23:10Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:23:13Z,mtusi-messenger-lab3-api-1,19.36%,10.93MiB / 384MiB +2026-10-16T14:23:13Z,mtusi-messenger-lab3-api-2,19.41%,10.99MiB / 384MiB +2026-10-16T14:23:13Z,mtusi-messenger-lab3-lb-1,14.65%,13.12MiB / 64MiB +2026-10-16T14:23:13Z,mtusi-messenger-lab3-postgres-1,50.39%,326MiB / 384MiB +2026-10-16T14:23:13Z,mtusi-messenger-lab3-redis-1,0.77%,6.289MiB / 192MiB +2026-10-16T14:23:16Z,mtusi-messenger-lab3-api-1,19.61%,10.75MiB / 384MiB +2026-10-16T14:23:16Z,mtusi-messenger-lab3-api-2,19.36%,11MiB / 384MiB +2026-10-16T14:23:16Z,mtusi-messenger-lab3-lb-1,14.68%,13.11MiB / 64MiB +2026-10-16T14:23:16Z,mtusi-messenger-lab3-postgres-1,50.43%,326MiB / 384MiB +2026-10-16T14:23:16Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:23:19Z,mtusi-messenger-lab3-api-1,19.50%,10.77MiB / 384MiB +2026-10-16T14:23:19Z,mtusi-messenger-lab3-api-2,19.22%,10.9MiB / 384MiB +2026-10-16T14:23:19Z,mtusi-messenger-lab3-lb-1,14.41%,13.12MiB / 64MiB +2026-10-16T14:23:19Z,mtusi-messenger-lab3-postgres-1,49.90%,328.8MiB / 384MiB +2026-10-16T14:23:19Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:23:22Z,mtusi-messenger-lab3-api-1,18.97%,10.8MiB / 384MiB +2026-10-16T14:23:22Z,mtusi-messenger-lab3-api-2,19.32%,10.95MiB / 384MiB +2026-10-16T14:23:22Z,mtusi-messenger-lab3-lb-1,14.53%,13.12MiB / 64MiB +2026-10-16T14:23:22Z,mtusi-messenger-lab3-postgres-1,50.35%,331.3MiB / 384MiB +2026-10-16T14:23:22Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:23:25Z,mtusi-messenger-lab3-api-1,19.07%,10.8MiB / 384MiB +2026-10-16T14:23:25Z,mtusi-messenger-lab3-api-2,19.85%,10.91MiB / 384MiB +2026-10-16T14:23:25Z,mtusi-messenger-lab3-lb-1,14.57%,13.12MiB / 64MiB +2026-10-16T14:23:25Z,mtusi-messenger-lab3-postgres-1,50.64%,328MiB / 384MiB +2026-10-16T14:23:25Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:23:28Z,mtusi-messenger-lab3-api-1,19.71%,10.8MiB / 384MiB +2026-10-16T14:23:28Z,mtusi-messenger-lab3-api-2,19.40%,10.82MiB / 384MiB +2026-10-16T14:23:28Z,mtusi-messenger-lab3-lb-1,14.78%,13.11MiB / 64MiB +2026-10-16T14:23:28Z,mtusi-messenger-lab3-postgres-1,50.66%,328.7MiB / 384MiB +2026-10-16T14:23:28Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:23:31Z,mtusi-messenger-lab3-api-1,18.84%,10.82MiB / 384MiB +2026-10-16T14:23:31Z,mtusi-messenger-lab3-api-2,18.99%,10.87MiB / 384MiB +2026-10-16T14:23:31Z,mtusi-messenger-lab3-lb-1,14.23%,13.37MiB / 64MiB +2026-10-16T14:23:31Z,mtusi-messenger-lab3-postgres-1,49.69%,326.9MiB / 384MiB +2026-10-16T14:23:31Z,mtusi-messenger-lab3-redis-1,0.26%,6.289MiB / 192MiB +2026-10-16T14:23:34Z,mtusi-messenger-lab3-api-1,19.13%,10.82MiB / 384MiB +2026-10-16T14:23:34Z,mtusi-messenger-lab3-api-2,20.01%,10.86MiB / 384MiB +2026-10-16T14:23:34Z,mtusi-messenger-lab3-lb-1,15.00%,13.12MiB / 64MiB +2026-10-16T14:23:34Z,mtusi-messenger-lab3-postgres-1,50.67%,326.8MiB / 384MiB +2026-10-16T14:23:34Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:23:37Z,mtusi-messenger-lab3-api-1,19.61%,10.93MiB / 384MiB +2026-10-16T14:23:37Z,mtusi-messenger-lab3-api-2,20.35%,10.9MiB / 384MiB +2026-10-16T14:23:37Z,mtusi-messenger-lab3-lb-1,14.03%,13.13MiB / 64MiB +2026-10-16T14:23:37Z,mtusi-messenger-lab3-postgres-1,49.51%,326.7MiB / 384MiB +2026-10-16T14:23:37Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:23:40Z,mtusi-messenger-lab3-api-1,19.56%,10.83MiB / 384MiB +2026-10-16T14:23:40Z,mtusi-messenger-lab3-api-2,19.18%,10.86MiB / 384MiB +2026-10-16T14:23:40Z,mtusi-messenger-lab3-lb-1,14.56%,13.36MiB / 64MiB +2026-10-16T14:23:40Z,mtusi-messenger-lab3-postgres-1,51.07%,328.8MiB / 384MiB +2026-10-16T14:23:40Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:23:44Z,mtusi-messenger-lab3-api-1,19.15%,10.86MiB / 384MiB +2026-10-16T14:23:44Z,mtusi-messenger-lab3-api-2,19.13%,10.8MiB / 384MiB +2026-10-16T14:23:44Z,mtusi-messenger-lab3-lb-1,14.26%,13.13MiB / 64MiB +2026-10-16T14:23:44Z,mtusi-messenger-lab3-postgres-1,49.93%,331.9MiB / 384MiB +2026-10-16T14:23:44Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:23:47Z,mtusi-messenger-lab3-api-1,13.80%,10.69MiB / 384MiB +2026-10-16T14:23:47Z,mtusi-messenger-lab3-api-2,14.11%,10.84MiB / 384MiB +2026-10-16T14:23:47Z,mtusi-messenger-lab3-lb-1,9.99%,13.11MiB / 64MiB +2026-10-16T14:23:47Z,mtusi-messenger-lab3-postgres-1,50.42%,350.8MiB / 384MiB +2026-10-16T14:23:47Z,mtusi-messenger-lab3-redis-1,0.68%,6.289MiB / 192MiB +2026-10-16T14:23:50Z,mtusi-messenger-lab3-api-1,19.38%,10.73MiB / 384MiB +2026-10-16T14:23:50Z,mtusi-messenger-lab3-api-2,17.91%,10.84MiB / 384MiB +2026-10-16T14:23:50Z,mtusi-messenger-lab3-lb-1,14.14%,13.11MiB / 64MiB +2026-10-16T14:23:50Z,mtusi-messenger-lab3-postgres-1,49.93%,325.9MiB / 384MiB +2026-10-16T14:23:50Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:23:53Z,mtusi-messenger-lab3-api-1,19.90%,10.81MiB / 384MiB +2026-10-16T14:23:53Z,mtusi-messenger-lab3-api-2,19.36%,10.84MiB / 384MiB +2026-10-16T14:23:53Z,mtusi-messenger-lab3-lb-1,14.86%,13.13MiB / 64MiB +2026-10-16T14:23:53Z,mtusi-messenger-lab3-postgres-1,51.01%,325.7MiB / 384MiB +2026-10-16T14:23:53Z,mtusi-messenger-lab3-redis-1,0.81%,6.289MiB / 192MiB +2026-10-16T14:23:56Z,mtusi-messenger-lab3-api-1,19.40%,10.82MiB / 384MiB +2026-10-16T14:23:56Z,mtusi-messenger-lab3-api-2,19.04%,10.83MiB / 384MiB +2026-10-16T14:23:56Z,mtusi-messenger-lab3-lb-1,14.42%,13.12MiB / 64MiB +2026-10-16T14:23:56Z,mtusi-messenger-lab3-postgres-1,49.73%,325.8MiB / 384MiB +2026-10-16T14:23:56Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:23:59Z,mtusi-messenger-lab3-api-1,20.10%,10.84MiB / 384MiB +2026-10-16T14:23:59Z,mtusi-messenger-lab3-api-2,18.83%,11.03MiB / 384MiB +2026-10-16T14:23:59Z,mtusi-messenger-lab3-lb-1,14.25%,13.37MiB / 64MiB +2026-10-16T14:23:59Z,mtusi-messenger-lab3-postgres-1,50.85%,326.1MiB / 384MiB +2026-10-16T14:23:59Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:24:02Z,mtusi-messenger-lab3-api-1,20.06%,10.83MiB / 384MiB +2026-10-16T14:24:02Z,mtusi-messenger-lab3-api-2,19.40%,10.79MiB / 384MiB +2026-10-16T14:24:02Z,mtusi-messenger-lab3-lb-1,14.37%,13.36MiB / 64MiB +2026-10-16T14:24:02Z,mtusi-messenger-lab3-postgres-1,49.78%,326.3MiB / 384MiB +2026-10-16T14:24:02Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-g05.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-g05.csv new file mode 100644 index 00000000..0cc8981f --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-g05.csv @@ -0,0 +1,101 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:16:30Z,mtusi-messenger-lab3-api-1,20.21%,90.41MiB / 384MiB +2026-10-16T14:16:30Z,mtusi-messenger-lab3-api-2,19.72%,153.9MiB / 384MiB +2026-10-16T14:16:30Z,mtusi-messenger-lab3-lb-1,15.56%,13.11MiB / 64MiB +2026-10-16T14:16:30Z,mtusi-messenger-lab3-postgres-1,50.96%,228.8MiB / 384MiB +2026-10-16T14:16:30Z,mtusi-messenger-lab3-redis-1,0.76%,6.289MiB / 192MiB +2026-10-16T14:16:33Z,mtusi-messenger-lab3-api-1,20.72%,14.09MiB / 384MiB +2026-10-16T14:16:33Z,mtusi-messenger-lab3-api-2,21.56%,12.55MiB / 384MiB +2026-10-16T14:16:33Z,mtusi-messenger-lab3-lb-1,15.16%,13.37MiB / 64MiB +2026-10-16T14:16:33Z,mtusi-messenger-lab3-postgres-1,50.88%,228.8MiB / 384MiB +2026-10-16T14:16:33Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:16:36Z,mtusi-messenger-lab3-api-1,20.66%,14.26MiB / 384MiB +2026-10-16T14:16:36Z,mtusi-messenger-lab3-api-2,20.61%,11.88MiB / 384MiB +2026-10-16T14:16:36Z,mtusi-messenger-lab3-lb-1,15.51%,13.12MiB / 64MiB +2026-10-16T14:16:36Z,mtusi-messenger-lab3-postgres-1,51.15%,229.1MiB / 384MiB +2026-10-16T14:16:36Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:16:39Z,mtusi-messenger-lab3-api-1,19.97%,14.26MiB / 384MiB +2026-10-16T14:16:39Z,mtusi-messenger-lab3-api-2,19.42%,11.7MiB / 384MiB +2026-10-16T14:16:39Z,mtusi-messenger-lab3-lb-1,15.25%,13.13MiB / 64MiB +2026-10-16T14:16:39Z,mtusi-messenger-lab3-postgres-1,50.31%,229.5MiB / 384MiB +2026-10-16T14:16:39Z,mtusi-messenger-lab3-redis-1,0.72%,6.289MiB / 192MiB +2026-10-16T14:16:42Z,mtusi-messenger-lab3-api-1,19.00%,14.26MiB / 384MiB +2026-10-16T14:16:42Z,mtusi-messenger-lab3-api-2,20.19%,11.16MiB / 384MiB +2026-10-16T14:16:42Z,mtusi-messenger-lab3-lb-1,14.57%,13.12MiB / 64MiB +2026-10-16T14:16:42Z,mtusi-messenger-lab3-postgres-1,50.26%,230.3MiB / 384MiB +2026-10-16T14:16:42Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:16:45Z,mtusi-messenger-lab3-api-1,17.32%,14.52MiB / 384MiB +2026-10-16T14:16:45Z,mtusi-messenger-lab3-api-2,17.50%,11.19MiB / 384MiB +2026-10-16T14:16:45Z,mtusi-messenger-lab3-lb-1,13.00%,13.12MiB / 64MiB +2026-10-16T14:16:45Z,mtusi-messenger-lab3-postgres-1,50.46%,238.5MiB / 384MiB +2026-10-16T14:16:45Z,mtusi-messenger-lab3-redis-1,0.79%,6.289MiB / 192MiB +2026-10-16T14:16:49Z,mtusi-messenger-lab3-api-1,20.93%,14.16MiB / 384MiB +2026-10-16T14:16:49Z,mtusi-messenger-lab3-api-2,19.78%,11.34MiB / 384MiB +2026-10-16T14:16:49Z,mtusi-messenger-lab3-lb-1,15.39%,13.11MiB / 64MiB +2026-10-16T14:16:49Z,mtusi-messenger-lab3-postgres-1,50.65%,229.3MiB / 384MiB +2026-10-16T14:16:49Z,mtusi-messenger-lab3-redis-1,0.19%,6.289MiB / 192MiB +2026-10-16T14:16:52Z,mtusi-messenger-lab3-api-1,19.56%,13.57MiB / 384MiB +2026-10-16T14:16:52Z,mtusi-messenger-lab3-api-2,19.14%,11.27MiB / 384MiB +2026-10-16T14:16:52Z,mtusi-messenger-lab3-lb-1,14.31%,13.12MiB / 64MiB +2026-10-16T14:16:52Z,mtusi-messenger-lab3-postgres-1,50.27%,229.5MiB / 384MiB +2026-10-16T14:16:52Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:16:55Z,mtusi-messenger-lab3-api-1,19.72%,14.32MiB / 384MiB +2026-10-16T14:16:55Z,mtusi-messenger-lab3-api-2,20.01%,11.28MiB / 384MiB +2026-10-16T14:16:55Z,mtusi-messenger-lab3-lb-1,15.03%,13.38MiB / 64MiB +2026-10-16T14:16:55Z,mtusi-messenger-lab3-postgres-1,50.64%,229.6MiB / 384MiB +2026-10-16T14:16:55Z,mtusi-messenger-lab3-redis-1,0.80%,6.289MiB / 192MiB +2026-10-16T14:16:58Z,mtusi-messenger-lab3-api-1,19.63%,13.89MiB / 384MiB +2026-10-16T14:16:58Z,mtusi-messenger-lab3-api-2,20.79%,11.27MiB / 384MiB +2026-10-16T14:16:58Z,mtusi-messenger-lab3-lb-1,15.33%,13.12MiB / 64MiB +2026-10-16T14:16:58Z,mtusi-messenger-lab3-postgres-1,50.90%,229.7MiB / 384MiB +2026-10-16T14:16:58Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:17:01Z,mtusi-messenger-lab3-api-1,19.82%,14.15MiB / 384MiB +2026-10-16T14:17:01Z,mtusi-messenger-lab3-api-2,19.81%,11.28MiB / 384MiB +2026-10-16T14:17:01Z,mtusi-messenger-lab3-lb-1,15.12%,13.12MiB / 64MiB +2026-10-16T14:17:01Z,mtusi-messenger-lab3-postgres-1,51.04%,230MiB / 384MiB +2026-10-16T14:17:01Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:17:04Z,mtusi-messenger-lab3-api-1,20.03%,13.73MiB / 384MiB +2026-10-16T14:17:04Z,mtusi-messenger-lab3-api-2,20.48%,11.23MiB / 384MiB +2026-10-16T14:17:04Z,mtusi-messenger-lab3-lb-1,14.84%,13.11MiB / 64MiB +2026-10-16T14:17:04Z,mtusi-messenger-lab3-postgres-1,49.99%,230.1MiB / 384MiB +2026-10-16T14:17:04Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:17:07Z,mtusi-messenger-lab3-api-1,20.83%,13.68MiB / 384MiB +2026-10-16T14:17:07Z,mtusi-messenger-lab3-api-2,20.17%,11.3MiB / 384MiB +2026-10-16T14:17:07Z,mtusi-messenger-lab3-lb-1,15.42%,13.11MiB / 64MiB +2026-10-16T14:17:07Z,mtusi-messenger-lab3-postgres-1,50.48%,230.1MiB / 384MiB +2026-10-16T14:17:07Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:17:10Z,mtusi-messenger-lab3-api-1,20.59%,13.52MiB / 384MiB +2026-10-16T14:17:10Z,mtusi-messenger-lab3-api-2,20.87%,11.3MiB / 384MiB +2026-10-16T14:17:10Z,mtusi-messenger-lab3-lb-1,15.42%,13.12MiB / 64MiB +2026-10-16T14:17:10Z,mtusi-messenger-lab3-postgres-1,50.57%,230.2MiB / 384MiB +2026-10-16T14:17:10Z,mtusi-messenger-lab3-redis-1,0.86%,6.289MiB / 192MiB +2026-10-16T14:17:13Z,mtusi-messenger-lab3-api-1,20.25%,14.21MiB / 384MiB +2026-10-16T14:17:13Z,mtusi-messenger-lab3-api-2,20.40%,11.3MiB / 384MiB +2026-10-16T14:17:13Z,mtusi-messenger-lab3-lb-1,15.61%,13.12MiB / 64MiB +2026-10-16T14:17:13Z,mtusi-messenger-lab3-postgres-1,49.60%,230.7MiB / 384MiB +2026-10-16T14:17:13Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:17:16Z,mtusi-messenger-lab3-api-1,20.79%,14.28MiB / 384MiB +2026-10-16T14:17:16Z,mtusi-messenger-lab3-api-2,20.63%,11.21MiB / 384MiB +2026-10-16T14:17:16Z,mtusi-messenger-lab3-lb-1,15.57%,13.11MiB / 64MiB +2026-10-16T14:17:16Z,mtusi-messenger-lab3-postgres-1,50.94%,230.6MiB / 384MiB +2026-10-16T14:17:16Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:17:19Z,mtusi-messenger-lab3-api-1,20.22%,14.14MiB / 384MiB +2026-10-16T14:17:19Z,mtusi-messenger-lab3-api-2,19.84%,11.18MiB / 384MiB +2026-10-16T14:17:19Z,mtusi-messenger-lab3-lb-1,15.03%,13.11MiB / 64MiB +2026-10-16T14:17:19Z,mtusi-messenger-lab3-postgres-1,49.91%,231.1MiB / 384MiB +2026-10-16T14:17:19Z,mtusi-messenger-lab3-redis-1,0.77%,6.289MiB / 192MiB +2026-10-16T14:17:22Z,mtusi-messenger-lab3-api-1,20.21%,14.02MiB / 384MiB +2026-10-16T14:17:22Z,mtusi-messenger-lab3-api-2,20.30%,11.25MiB / 384MiB +2026-10-16T14:17:22Z,mtusi-messenger-lab3-lb-1,15.50%,13.11MiB / 64MiB +2026-10-16T14:17:22Z,mtusi-messenger-lab3-postgres-1,50.05%,231.2MiB / 384MiB +2026-10-16T14:17:22Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:17:25Z,mtusi-messenger-lab3-api-1,21.31%,14.12MiB / 384MiB +2026-10-16T14:17:25Z,mtusi-messenger-lab3-api-2,19.67%,11.2MiB / 384MiB +2026-10-16T14:17:25Z,mtusi-messenger-lab3-lb-1,14.78%,13.11MiB / 64MiB +2026-10-16T14:17:25Z,mtusi-messenger-lab3-postgres-1,49.24%,231.4MiB / 384MiB +2026-10-16T14:17:25Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:17:28Z,mtusi-messenger-lab3-api-1,19.89%,14.02MiB / 384MiB +2026-10-16T14:17:28Z,mtusi-messenger-lab3-api-2,20.58%,11.19MiB / 384MiB +2026-10-16T14:17:28Z,mtusi-messenger-lab3-lb-1,14.93%,13.11MiB / 64MiB +2026-10-16T14:17:28Z,mtusi-messenger-lab3-postgres-1,50.55%,231.6MiB / 384MiB +2026-10-16T14:17:28Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-g10.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-g10.csv new file mode 100644 index 00000000..d213bb02 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-g10.csv @@ -0,0 +1,101 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:17:48Z,mtusi-messenger-lab3-api-1,19.02%,163.2MiB / 384MiB +2026-10-16T14:17:48Z,mtusi-messenger-lab3-api-2,19.12%,162.9MiB / 384MiB +2026-10-16T14:17:48Z,mtusi-messenger-lab3-lb-1,15.00%,13.12MiB / 64MiB +2026-10-16T14:17:48Z,mtusi-messenger-lab3-postgres-1,50.80%,284.3MiB / 384MiB +2026-10-16T14:17:48Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:17:51Z,mtusi-messenger-lab3-api-1,21.12%,13.22MiB / 384MiB +2026-10-16T14:17:51Z,mtusi-messenger-lab3-api-2,21.10%,37.39MiB / 384MiB +2026-10-16T14:17:51Z,mtusi-messenger-lab3-lb-1,14.86%,13.12MiB / 64MiB +2026-10-16T14:17:51Z,mtusi-messenger-lab3-postgres-1,49.89%,284.7MiB / 384MiB +2026-10-16T14:17:51Z,mtusi-messenger-lab3-redis-1,0.72%,6.289MiB / 192MiB +2026-10-16T14:17:54Z,mtusi-messenger-lab3-api-1,19.02%,12.97MiB / 384MiB +2026-10-16T14:17:54Z,mtusi-messenger-lab3-api-2,19.00%,11.07MiB / 384MiB +2026-10-16T14:17:54Z,mtusi-messenger-lab3-lb-1,14.34%,13.11MiB / 64MiB +2026-10-16T14:17:54Z,mtusi-messenger-lab3-postgres-1,49.20%,285.2MiB / 384MiB +2026-10-16T14:17:54Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:17:57Z,mtusi-messenger-lab3-api-1,20.42%,13.18MiB / 384MiB +2026-10-16T14:17:57Z,mtusi-messenger-lab3-api-2,19.98%,11.2MiB / 384MiB +2026-10-16T14:17:57Z,mtusi-messenger-lab3-lb-1,15.21%,13.38MiB / 64MiB +2026-10-16T14:17:57Z,mtusi-messenger-lab3-postgres-1,51.20%,285.7MiB / 384MiB +2026-10-16T14:17:57Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:18:00Z,mtusi-messenger-lab3-api-1,19.88%,12.91MiB / 384MiB +2026-10-16T14:18:00Z,mtusi-messenger-lab3-api-2,19.42%,11.15MiB / 384MiB +2026-10-16T14:18:00Z,mtusi-messenger-lab3-lb-1,14.57%,13.13MiB / 64MiB +2026-10-16T14:18:00Z,mtusi-messenger-lab3-postgres-1,50.93%,285.7MiB / 384MiB +2026-10-16T14:18:00Z,mtusi-messenger-lab3-redis-1,0.75%,6.289MiB / 192MiB +2026-10-16T14:18:03Z,mtusi-messenger-lab3-api-1,20.34%,12.64MiB / 384MiB +2026-10-16T14:18:03Z,mtusi-messenger-lab3-api-2,20.46%,11.13MiB / 384MiB +2026-10-16T14:18:03Z,mtusi-messenger-lab3-lb-1,15.18%,13.11MiB / 64MiB +2026-10-16T14:18:03Z,mtusi-messenger-lab3-postgres-1,51.35%,286.1MiB / 384MiB +2026-10-16T14:18:03Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:18:06Z,mtusi-messenger-lab3-api-1,19.79%,12.71MiB / 384MiB +2026-10-16T14:18:06Z,mtusi-messenger-lab3-api-2,19.59%,11.3MiB / 384MiB +2026-10-16T14:18:06Z,mtusi-messenger-lab3-lb-1,14.29%,13.11MiB / 64MiB +2026-10-16T14:18:06Z,mtusi-messenger-lab3-postgres-1,49.24%,286.2MiB / 384MiB +2026-10-16T14:18:06Z,mtusi-messenger-lab3-redis-1,0.72%,6.289MiB / 192MiB +2026-10-16T14:18:09Z,mtusi-messenger-lab3-api-1,19.59%,12.46MiB / 384MiB +2026-10-16T14:18:09Z,mtusi-messenger-lab3-api-2,20.28%,11.04MiB / 384MiB +2026-10-16T14:18:09Z,mtusi-messenger-lab3-lb-1,14.20%,13.12MiB / 64MiB +2026-10-16T14:18:09Z,mtusi-messenger-lab3-postgres-1,49.58%,286.5MiB / 384MiB +2026-10-16T14:18:09Z,mtusi-messenger-lab3-redis-1,0.26%,6.289MiB / 192MiB +2026-10-16T14:18:12Z,mtusi-messenger-lab3-api-1,19.85%,12.8MiB / 384MiB +2026-10-16T14:18:12Z,mtusi-messenger-lab3-api-2,19.74%,11.24MiB / 384MiB +2026-10-16T14:18:12Z,mtusi-messenger-lab3-lb-1,14.95%,13.11MiB / 64MiB +2026-10-16T14:18:12Z,mtusi-messenger-lab3-postgres-1,51.16%,286.6MiB / 384MiB +2026-10-16T14:18:12Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:18:15Z,mtusi-messenger-lab3-api-1,20.79%,12.46MiB / 384MiB +2026-10-16T14:18:15Z,mtusi-messenger-lab3-api-2,19.53%,11.12MiB / 384MiB +2026-10-16T14:18:15Z,mtusi-messenger-lab3-lb-1,14.79%,13.1MiB / 64MiB +2026-10-16T14:18:15Z,mtusi-messenger-lab3-postgres-1,49.91%,286.6MiB / 384MiB +2026-10-16T14:18:15Z,mtusi-messenger-lab3-redis-1,0.72%,6.289MiB / 192MiB +2026-10-16T14:18:18Z,mtusi-messenger-lab3-api-1,20.26%,12.9MiB / 384MiB +2026-10-16T14:18:18Z,mtusi-messenger-lab3-api-2,19.49%,11.18MiB / 384MiB +2026-10-16T14:18:18Z,mtusi-messenger-lab3-lb-1,14.65%,13.12MiB / 64MiB +2026-10-16T14:18:18Z,mtusi-messenger-lab3-postgres-1,50.53%,286.9MiB / 384MiB +2026-10-16T14:18:18Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:18:21Z,mtusi-messenger-lab3-api-1,19.72%,12.96MiB / 384MiB +2026-10-16T14:18:21Z,mtusi-messenger-lab3-api-2,18.76%,11.21MiB / 384MiB +2026-10-16T14:18:21Z,mtusi-messenger-lab3-lb-1,14.93%,13.1MiB / 64MiB +2026-10-16T14:18:21Z,mtusi-messenger-lab3-postgres-1,49.35%,287MiB / 384MiB +2026-10-16T14:18:21Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:18:24Z,mtusi-messenger-lab3-api-1,20.39%,12.59MiB / 384MiB +2026-10-16T14:18:24Z,mtusi-messenger-lab3-api-2,20.29%,11.21MiB / 384MiB +2026-10-16T14:18:24Z,mtusi-messenger-lab3-lb-1,15.17%,13.12MiB / 64MiB +2026-10-16T14:18:24Z,mtusi-messenger-lab3-postgres-1,49.73%,287MiB / 384MiB +2026-10-16T14:18:24Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:18:27Z,mtusi-messenger-lab3-api-1,20.71%,12.79MiB / 384MiB +2026-10-16T14:18:27Z,mtusi-messenger-lab3-api-2,19.85%,11.21MiB / 384MiB +2026-10-16T14:18:27Z,mtusi-messenger-lab3-lb-1,14.84%,13.12MiB / 64MiB +2026-10-16T14:18:27Z,mtusi-messenger-lab3-postgres-1,50.63%,287MiB / 384MiB +2026-10-16T14:18:27Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:18:31Z,mtusi-messenger-lab3-api-1,19.13%,12.54MiB / 384MiB +2026-10-16T14:18:31Z,mtusi-messenger-lab3-api-2,19.53%,11.22MiB / 384MiB +2026-10-16T14:18:31Z,mtusi-messenger-lab3-lb-1,14.50%,13.12MiB / 64MiB +2026-10-16T14:18:31Z,mtusi-messenger-lab3-postgres-1,50.83%,287.1MiB / 384MiB +2026-10-16T14:18:31Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:18:34Z,mtusi-messenger-lab3-api-1,19.67%,12.66MiB / 384MiB +2026-10-16T14:18:34Z,mtusi-messenger-lab3-api-2,20.05%,11.12MiB / 384MiB +2026-10-16T14:18:34Z,mtusi-messenger-lab3-lb-1,14.70%,13.12MiB / 64MiB +2026-10-16T14:18:34Z,mtusi-messenger-lab3-postgres-1,50.17%,287.1MiB / 384MiB +2026-10-16T14:18:34Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:18:37Z,mtusi-messenger-lab3-api-1,20.01%,12.61MiB / 384MiB +2026-10-16T14:18:37Z,mtusi-messenger-lab3-api-2,20.25%,11.04MiB / 384MiB +2026-10-16T14:18:37Z,mtusi-messenger-lab3-lb-1,15.12%,13.11MiB / 64MiB +2026-10-16T14:18:37Z,mtusi-messenger-lab3-postgres-1,50.58%,287.2MiB / 384MiB +2026-10-16T14:18:37Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:18:40Z,mtusi-messenger-lab3-api-1,19.75%,12.68MiB / 384MiB +2026-10-16T14:18:40Z,mtusi-messenger-lab3-api-2,20.04%,11.21MiB / 384MiB +2026-10-16T14:18:40Z,mtusi-messenger-lab3-lb-1,14.71%,13.12MiB / 64MiB +2026-10-16T14:18:40Z,mtusi-messenger-lab3-postgres-1,51.15%,287.4MiB / 384MiB +2026-10-16T14:18:40Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:18:43Z,mtusi-messenger-lab3-api-1,20.06%,12.67MiB / 384MiB +2026-10-16T14:18:43Z,mtusi-messenger-lab3-api-2,18.55%,11.22MiB / 384MiB +2026-10-16T14:18:43Z,mtusi-messenger-lab3-lb-1,14.38%,13.11MiB / 64MiB +2026-10-16T14:18:43Z,mtusi-messenger-lab3-postgres-1,49.84%,287.4MiB / 384MiB +2026-10-16T14:18:43Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:18:46Z,mtusi-messenger-lab3-api-1,18.02%,12.73MiB / 384MiB +2026-10-16T14:18:46Z,mtusi-messenger-lab3-api-2,17.16%,11.17MiB / 384MiB +2026-10-16T14:18:46Z,mtusi-messenger-lab3-lb-1,14.63%,13.12MiB / 64MiB +2026-10-16T14:18:46Z,mtusi-messenger-lab3-postgres-1,50.43%,288.9MiB / 384MiB +2026-10-16T14:18:46Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-g15.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-g15.csv new file mode 100644 index 00000000..bc1328c5 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-g15.csv @@ -0,0 +1,101 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:19:04Z,mtusi-messenger-lab3-api-2,19.13%,167.4MiB / 384MiB +2026-10-16T14:19:04Z,mtusi-messenger-lab3-api-1,18.67%,167.2MiB / 384MiB +2026-10-16T14:19:04Z,mtusi-messenger-lab3-lb-1,14.49%,13.11MiB / 64MiB +2026-10-16T14:19:04Z,mtusi-messenger-lab3-postgres-1,49.27%,300.4MiB / 384MiB +2026-10-16T14:19:04Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:19:07Z,mtusi-messenger-lab3-api-2,19.67%,11.5MiB / 384MiB +2026-10-16T14:19:07Z,mtusi-messenger-lab3-api-1,19.73%,11.44MiB / 384MiB +2026-10-16T14:19:07Z,mtusi-messenger-lab3-lb-1,14.74%,13.12MiB / 64MiB +2026-10-16T14:19:07Z,mtusi-messenger-lab3-postgres-1,49.44%,300.6MiB / 384MiB +2026-10-16T14:19:07Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:19:10Z,mtusi-messenger-lab3-api-2,19.06%,11.34MiB / 384MiB +2026-10-16T14:19:10Z,mtusi-messenger-lab3-api-1,20.05%,11.44MiB / 384MiB +2026-10-16T14:19:10Z,mtusi-messenger-lab3-lb-1,14.75%,13.12MiB / 64MiB +2026-10-16T14:19:10Z,mtusi-messenger-lab3-postgres-1,49.83%,300.7MiB / 384MiB +2026-10-16T14:19:10Z,mtusi-messenger-lab3-redis-1,0.71%,6.289MiB / 192MiB +2026-10-16T14:19:14Z,mtusi-messenger-lab3-api-2,20.38%,11.3MiB / 384MiB +2026-10-16T14:19:14Z,mtusi-messenger-lab3-api-1,19.71%,11.28MiB / 384MiB +2026-10-16T14:19:14Z,mtusi-messenger-lab3-lb-1,15.02%,13.12MiB / 64MiB +2026-10-16T14:19:14Z,mtusi-messenger-lab3-postgres-1,50.17%,303MiB / 384MiB +2026-10-16T14:19:14Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:19:17Z,mtusi-messenger-lab3-api-2,19.69%,11.28MiB / 384MiB +2026-10-16T14:19:17Z,mtusi-messenger-lab3-api-1,19.95%,11.11MiB / 384MiB +2026-10-16T14:19:17Z,mtusi-messenger-lab3-lb-1,14.69%,13.12MiB / 64MiB +2026-10-16T14:19:17Z,mtusi-messenger-lab3-postgres-1,50.28%,303.6MiB / 384MiB +2026-10-16T14:19:17Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:19:20Z,mtusi-messenger-lab3-api-2,19.06%,11.26MiB / 384MiB +2026-10-16T14:19:20Z,mtusi-messenger-lab3-api-1,19.32%,11.01MiB / 384MiB +2026-10-16T14:19:20Z,mtusi-messenger-lab3-lb-1,14.66%,13.12MiB / 64MiB +2026-10-16T14:19:20Z,mtusi-messenger-lab3-postgres-1,49.41%,300.8MiB / 384MiB +2026-10-16T14:19:20Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:19:23Z,mtusi-messenger-lab3-api-2,19.83%,11.26MiB / 384MiB +2026-10-16T14:19:23Z,mtusi-messenger-lab3-api-1,19.78%,11.02MiB / 384MiB +2026-10-16T14:19:23Z,mtusi-messenger-lab3-lb-1,14.62%,13.11MiB / 64MiB +2026-10-16T14:19:23Z,mtusi-messenger-lab3-postgres-1,49.73%,300.9MiB / 384MiB +2026-10-16T14:19:23Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:19:26Z,mtusi-messenger-lab3-api-2,19.05%,11.11MiB / 384MiB +2026-10-16T14:19:26Z,mtusi-messenger-lab3-api-1,20.03%,11.19MiB / 384MiB +2026-10-16T14:19:26Z,mtusi-messenger-lab3-lb-1,15.06%,13.1MiB / 64MiB +2026-10-16T14:19:26Z,mtusi-messenger-lab3-postgres-1,50.18%,301MiB / 384MiB +2026-10-16T14:19:26Z,mtusi-messenger-lab3-redis-1,1.04%,6.289MiB / 192MiB +2026-10-16T14:19:29Z,mtusi-messenger-lab3-api-2,19.15%,11.14MiB / 384MiB +2026-10-16T14:19:29Z,mtusi-messenger-lab3-api-1,18.77%,11.08MiB / 384MiB +2026-10-16T14:19:29Z,mtusi-messenger-lab3-lb-1,14.46%,13.11MiB / 64MiB +2026-10-16T14:19:29Z,mtusi-messenger-lab3-postgres-1,50.42%,300.9MiB / 384MiB +2026-10-16T14:19:29Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:19:32Z,mtusi-messenger-lab3-api-2,19.69%,11.17MiB / 384MiB +2026-10-16T14:19:32Z,mtusi-messenger-lab3-api-1,19.42%,11.1MiB / 384MiB +2026-10-16T14:19:32Z,mtusi-messenger-lab3-lb-1,14.80%,13.11MiB / 64MiB +2026-10-16T14:19:32Z,mtusi-messenger-lab3-postgres-1,49.92%,301MiB / 384MiB +2026-10-16T14:19:32Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:19:35Z,mtusi-messenger-lab3-api-2,19.16%,11.16MiB / 384MiB +2026-10-16T14:19:35Z,mtusi-messenger-lab3-api-1,19.73%,11.16MiB / 384MiB +2026-10-16T14:19:35Z,mtusi-messenger-lab3-lb-1,14.79%,13.1MiB / 64MiB +2026-10-16T14:19:35Z,mtusi-messenger-lab3-postgres-1,48.75%,301.8MiB / 384MiB +2026-10-16T14:19:35Z,mtusi-messenger-lab3-redis-1,0.69%,6.289MiB / 192MiB +2026-10-16T14:19:38Z,mtusi-messenger-lab3-api-2,18.98%,11.2MiB / 384MiB +2026-10-16T14:19:38Z,mtusi-messenger-lab3-api-1,20.01%,11.07MiB / 384MiB +2026-10-16T14:19:38Z,mtusi-messenger-lab3-lb-1,15.28%,13.11MiB / 64MiB +2026-10-16T14:19:38Z,mtusi-messenger-lab3-postgres-1,50.46%,305.4MiB / 384MiB +2026-10-16T14:19:38Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:19:41Z,mtusi-messenger-lab3-api-2,19.37%,11.23MiB / 384MiB +2026-10-16T14:19:41Z,mtusi-messenger-lab3-api-1,19.27%,11.11MiB / 384MiB +2026-10-16T14:19:41Z,mtusi-messenger-lab3-lb-1,14.78%,13.11MiB / 64MiB +2026-10-16T14:19:41Z,mtusi-messenger-lab3-postgres-1,49.90%,308.3MiB / 384MiB +2026-10-16T14:19:41Z,mtusi-messenger-lab3-redis-1,0.69%,6.289MiB / 192MiB +2026-10-16T14:19:44Z,mtusi-messenger-lab3-api-2,19.79%,11.13MiB / 384MiB +2026-10-16T14:19:44Z,mtusi-messenger-lab3-api-1,19.87%,11.1MiB / 384MiB +2026-10-16T14:19:44Z,mtusi-messenger-lab3-lb-1,14.84%,13.11MiB / 64MiB +2026-10-16T14:19:44Z,mtusi-messenger-lab3-postgres-1,50.75%,301MiB / 384MiB +2026-10-16T14:19:44Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:19:47Z,mtusi-messenger-lab3-api-2,14.59%,11.13MiB / 384MiB +2026-10-16T14:19:47Z,mtusi-messenger-lab3-api-1,16.07%,11.41MiB / 384MiB +2026-10-16T14:19:47Z,mtusi-messenger-lab3-lb-1,12.04%,13.11MiB / 64MiB +2026-10-16T14:19:47Z,mtusi-messenger-lab3-postgres-1,50.81%,311.8MiB / 384MiB +2026-10-16T14:19:47Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:19:50Z,mtusi-messenger-lab3-api-2,19.80%,11.24MiB / 384MiB +2026-10-16T14:19:50Z,mtusi-messenger-lab3-api-1,19.73%,11.23MiB / 384MiB +2026-10-16T14:19:50Z,mtusi-messenger-lab3-lb-1,14.74%,13.1MiB / 64MiB +2026-10-16T14:19:50Z,mtusi-messenger-lab3-postgres-1,50.18%,312.1MiB / 384MiB +2026-10-16T14:19:50Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:19:53Z,mtusi-messenger-lab3-api-2,19.81%,11.11MiB / 384MiB +2026-10-16T14:19:53Z,mtusi-messenger-lab3-api-1,19.03%,11.3MiB / 384MiB +2026-10-16T14:19:53Z,mtusi-messenger-lab3-lb-1,14.61%,13.11MiB / 64MiB +2026-10-16T14:19:53Z,mtusi-messenger-lab3-postgres-1,50.02%,312.3MiB / 384MiB +2026-10-16T14:19:53Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:19:56Z,mtusi-messenger-lab3-api-2,18.78%,11.23MiB / 384MiB +2026-10-16T14:19:56Z,mtusi-messenger-lab3-api-1,19.33%,10.95MiB / 384MiB +2026-10-16T14:19:56Z,mtusi-messenger-lab3-lb-1,14.39%,13.11MiB / 64MiB +2026-10-16T14:19:56Z,mtusi-messenger-lab3-postgres-1,49.49%,312.7MiB / 384MiB +2026-10-16T14:19:56Z,mtusi-messenger-lab3-redis-1,0.75%,6.289MiB / 192MiB +2026-10-16T14:20:00Z,mtusi-messenger-lab3-api-2,19.53%,11.17MiB / 384MiB +2026-10-16T14:20:00Z,mtusi-messenger-lab3-api-1,19.27%,10.97MiB / 384MiB +2026-10-16T14:20:00Z,mtusi-messenger-lab3-lb-1,14.51%,13.11MiB / 64MiB +2026-10-16T14:20:00Z,mtusi-messenger-lab3-postgres-1,49.69%,308.9MiB / 384MiB +2026-10-16T14:20:00Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:20:03Z,mtusi-messenger-lab3-api-2,18.09%,11.18MiB / 384MiB +2026-10-16T14:20:03Z,mtusi-messenger-lab3-api-1,17.68%,11.05MiB / 384MiB +2026-10-16T14:20:03Z,mtusi-messenger-lab3-lb-1,14.74%,13.1MiB / 64MiB +2026-10-16T14:20:03Z,mtusi-messenger-lab3-postgres-1,45.37%,308.8MiB / 384MiB +2026-10-16T14:20:03Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-pool10.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-pool10.csv new file mode 100644 index 00000000..e28c3a61 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-pool10.csv @@ -0,0 +1,137 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:20:22Z,mtusi-messenger-lab3-api-1,11.69%,10.29MiB / 192MiB +2026-10-16T14:20:22Z,mtusi-messenger-lab3-api-4,12.38%,144.1MiB / 192MiB +2026-10-16T14:20:22Z,mtusi-messenger-lab3-api-3,11.03%,144.7MiB / 192MiB +2026-10-16T14:20:22Z,mtusi-messenger-lab3-api-2,11.07%,8.109MiB / 192MiB +2026-10-16T14:20:22Z,mtusi-messenger-lab3-lb-1,0.22%,13.07MiB / 64MiB +2026-10-16T14:20:22Z,mtusi-messenger-lab3-postgres-1,49.53%,317.8MiB / 384MiB +2026-10-16T14:20:22Z,mtusi-messenger-lab3-redis-1,0.23%,6.297MiB / 192MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-api-1,11.18%,10.32MiB / 192MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-api-4,11.12%,171.1MiB / 192MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-api-3,11.35%,171.2MiB / 192MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-api-2,11.68%,8.109MiB / 192MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-lb-1,14.94%,13.13MiB / 64MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-postgres-1,49.28%,318.6MiB / 384MiB +2026-10-16T14:20:25Z,mtusi-messenger-lab3-redis-1,0.23%,6.297MiB / 192MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-api-1,12.12%,10.5MiB / 192MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-api-2,12.46%,7.996MiB / 192MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-lb-1,12.62%,13.12MiB / 64MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-postgres-1,37.86%,307.3MiB / 384MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-redis-1,0.21%,6.297MiB / 192MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-api-3,5.07%,7.156MiB / 192MiB +2026-10-16T14:20:28Z,mtusi-messenger-lab3-api-4,4.56%,6.973MiB / 192MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-api-1,11.23%,10.55MiB / 192MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-api-4,11.62%,7.871MiB / 192MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-api-3,11.03%,7.93MiB / 192MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-api-2,11.67%,8.086MiB / 192MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-lb-1,14.65%,13.12MiB / 64MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-postgres-1,50.84%,321.6MiB / 384MiB +2026-10-16T14:20:33Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-api-1,11.70%,10.55MiB / 192MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-api-4,10.65%,8.129MiB / 192MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-api-3,11.47%,7.965MiB / 192MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-api-2,11.14%,7.914MiB / 192MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-lb-1,15.01%,13.13MiB / 64MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-postgres-1,49.83%,322.5MiB / 384MiB +2026-10-16T14:20:36Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-api-1,12.07%,10.43MiB / 192MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-api-4,11.05%,8.391MiB / 192MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-api-3,11.02%,8.023MiB / 192MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-api-2,10.99%,7.918MiB / 192MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-lb-1,14.88%,13.12MiB / 64MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-postgres-1,49.28%,322.6MiB / 384MiB +2026-10-16T14:20:39Z,mtusi-messenger-lab3-redis-1,0.24%,6.297MiB / 192MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-api-1,11.41%,10.56MiB / 192MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-api-4,11.05%,8.145MiB / 192MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-api-3,11.23%,8.039MiB / 192MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-api-2,11.45%,8.066MiB / 192MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-lb-1,15.58%,13.14MiB / 64MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-postgres-1,49.83%,325.2MiB / 384MiB +2026-10-16T14:20:42Z,mtusi-messenger-lab3-redis-1,0.21%,6.297MiB / 192MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-api-1,10.95%,10.59MiB / 192MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-api-4,11.07%,8.152MiB / 192MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-api-3,11.31%,8.195MiB / 192MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-api-2,11.84%,8.246MiB / 192MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-lb-1,14.90%,13.11MiB / 64MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-postgres-1,50.36%,337MiB / 384MiB +2026-10-16T14:20:45Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-api-1,11.59%,10.59MiB / 192MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-api-4,11.54%,8.156MiB / 192MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-api-3,11.87%,8.105MiB / 192MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-api-2,11.50%,8.059MiB / 192MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-lb-1,14.95%,13.14MiB / 64MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-postgres-1,49.99%,337MiB / 384MiB +2026-10-16T14:20:48Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-api-1,11.46%,10.59MiB / 192MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-api-4,10.91%,8.164MiB / 192MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-api-3,11.63%,7.98MiB / 192MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-api-2,11.78%,8.152MiB / 192MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-lb-1,15.06%,13.12MiB / 64MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-postgres-1,49.42%,337.4MiB / 384MiB +2026-10-16T14:20:51Z,mtusi-messenger-lab3-redis-1,0.23%,6.297MiB / 192MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-api-1,11.60%,10.56MiB / 192MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-api-4,11.98%,8.172MiB / 192MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-api-3,10.85%,7.98MiB / 192MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-api-2,11.20%,8.152MiB / 192MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-lb-1,15.03%,13.14MiB / 64MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-postgres-1,50.40%,322.9MiB / 384MiB +2026-10-16T14:20:54Z,mtusi-messenger-lab3-redis-1,0.24%,6.297MiB / 192MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-api-1,11.62%,10.56MiB / 192MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-api-4,11.65%,8.164MiB / 192MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-api-3,11.68%,8.066MiB / 192MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-api-2,11.40%,8.277MiB / 192MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-lb-1,15.11%,13.15MiB / 64MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-postgres-1,50.36%,322.7MiB / 384MiB +2026-10-16T14:20:57Z,mtusi-messenger-lab3-redis-1,0.24%,6.297MiB / 192MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-api-1,11.72%,10.8MiB / 192MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-api-4,11.67%,8.199MiB / 192MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-api-3,11.02%,8.172MiB / 192MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-api-2,11.06%,8.273MiB / 192MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-lb-1,14.94%,13.14MiB / 64MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-postgres-1,49.67%,322.9MiB / 384MiB +2026-10-16T14:21:00Z,mtusi-messenger-lab3-redis-1,0.74%,6.297MiB / 192MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-api-1,10.97%,10.56MiB / 192MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-api-4,10.95%,8.227MiB / 192MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-api-3,11.52%,8.039MiB / 192MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-api-2,11.06%,8.156MiB / 192MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-lb-1,14.85%,13.11MiB / 64MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-postgres-1,48.72%,323.2MiB / 384MiB +2026-10-16T14:21:03Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-api-1,11.35%,10.56MiB / 192MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-api-4,11.26%,8.223MiB / 192MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-api-3,11.11%,8.16MiB / 192MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-api-2,11.82%,8.219MiB / 192MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-lb-1,15.32%,13.13MiB / 64MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-postgres-1,50.19%,323.6MiB / 384MiB +2026-10-16T14:21:07Z,mtusi-messenger-lab3-redis-1,0.70%,6.297MiB / 192MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-api-1,11.44%,10.56MiB / 192MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-api-4,11.25%,8.227MiB / 192MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-api-3,10.86%,8.172MiB / 192MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-api-2,11.62%,8.27MiB / 192MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-lb-1,14.48%,13.12MiB / 64MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-postgres-1,49.48%,323.7MiB / 384MiB +2026-10-16T14:21:10Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-api-1,11.79%,10.56MiB / 192MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-api-4,11.36%,8.23MiB / 192MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-api-3,10.80%,8.039MiB / 192MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-api-2,11.34%,8.281MiB / 192MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-lb-1,15.10%,13.12MiB / 64MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-postgres-1,50.17%,323.8MiB / 384MiB +2026-10-16T14:21:13Z,mtusi-messenger-lab3-redis-1,0.22%,6.297MiB / 192MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-api-1,11.06%,10.56MiB / 192MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-api-4,11.63%,8.191MiB / 192MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-api-3,11.32%,8.168MiB / 192MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-api-2,11.19%,8.273MiB / 192MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-lb-1,14.70%,13.12MiB / 64MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-postgres-1,48.53%,323.9MiB / 384MiB +2026-10-16T14:21:16Z,mtusi-messenger-lab3-redis-1,0.69%,6.293MiB / 192MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-api-1,11.02%,10.56MiB / 192MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-api-4,11.65%,8.02MiB / 192MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-api-3,11.41%,8.043MiB / 192MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-api-2,11.47%,8.16MiB / 192MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-lb-1,15.42%,13.12MiB / 64MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-postgres-1,50.02%,324MiB / 384MiB +2026-10-16T14:21:19Z,mtusi-messenger-lab3-redis-1,0.24%,6.293MiB / 192MiB +2026-10-16T14:21:22Z,mtusi-messenger-lab3-lb-1,4.33%,13.03MiB / 64MiB +2026-10-16T14:21:22Z,mtusi-messenger-lab3-postgres-1,37.32%,285.3MiB / 384MiB +2026-10-16T14:21:22Z,mtusi-messenger-lab3-redis-1,0.68%,6.293MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-pool5.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-pool5.csv new file mode 100644 index 00000000..a2cb6478 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-pool5.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:21:41Z,mtusi-messenger-lab3-api-3,8.75%,136.5MiB / 192MiB +2026-10-16T14:21:41Z,mtusi-messenger-lab3-api-2,9.53%,142.8MiB / 192MiB +2026-10-16T14:21:41Z,mtusi-messenger-lab3-api-4,9.25%,78.34MiB / 192MiB +2026-10-16T14:21:41Z,mtusi-messenger-lab3-api-1,15.85%,78.51MiB / 192MiB +2026-10-16T14:21:41Z,mtusi-messenger-lab3-lb-1,12.37%,13.12MiB / 64MiB +2026-10-16T14:21:41Z,mtusi-messenger-lab3-postgres-1,39.89%,319.3MiB / 384MiB +2026-10-16T14:21:41Z,mtusi-messenger-lab3-redis-1,0.34%,6.293MiB / 192MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-api-3,11.46%,136.9MiB / 192MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-api-2,11.52%,168.8MiB / 192MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-api-4,11.69%,104.4MiB / 192MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-api-1,10.95%,103.8MiB / 192MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-lb-1,15.50%,13.13MiB / 64MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-postgres-1,50.48%,319.9MiB / 384MiB +2026-10-16T14:21:44Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-api-3,9.40%,137.6MiB / 192MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-api-2,10.02%,191.3MiB / 192MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-api-4,10.51%,127.2MiB / 192MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-api-1,9.98%,126MiB / 192MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-lb-1,13.14%,13.14MiB / 64MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-postgres-1,49.32%,321MiB / 384MiB +2026-10-16T14:21:47Z,mtusi-messenger-lab3-redis-1,0.90%,6.293MiB / 192MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-api-3,9.62%,13.63MiB / 192MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-api-2,8.82%,7.617MiB / 192MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-api-4,9.77%,10.69MiB / 192MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-api-1,10.06%,11.79MiB / 192MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-lb-1,13.01%,13.13MiB / 64MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-postgres-1,50.46%,327.4MiB / 384MiB +2026-10-16T14:21:50Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-api-3,8.26%,14.18MiB / 192MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-api-2,9.00%,7.98MiB / 192MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-api-4,7.52%,10.63MiB / 192MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-api-1,8.35%,11.36MiB / 192MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-lb-1,11.11%,13.13MiB / 64MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-postgres-1,50.25%,330.1MiB / 384MiB +2026-10-16T14:21:54Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-api-3,11.09%,13.86MiB / 192MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-api-2,11.17%,8.016MiB / 192MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-api-4,11.23%,10.56MiB / 192MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-api-1,10.76%,11.33MiB / 192MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-lb-1,14.26%,13.12MiB / 64MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-postgres-1,49.88%,332MiB / 384MiB +2026-10-16T14:21:57Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-api-3,11.48%,13.18MiB / 192MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-api-2,10.83%,8.223MiB / 192MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-api-4,11.31%,10.62MiB / 192MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-api-1,11.62%,11.27MiB / 192MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-lb-1,14.98%,13.12MiB / 64MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-postgres-1,49.69%,335.2MiB / 384MiB +2026-10-16T14:22:00Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-api-3,11.53%,12.96MiB / 192MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-api-2,11.62%,8.094MiB / 192MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-api-4,11.20%,10.56MiB / 192MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-api-1,11.88%,11.67MiB / 192MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-lb-1,14.86%,13.13MiB / 64MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-postgres-1,49.00%,335.7MiB / 384MiB +2026-10-16T14:22:03Z,mtusi-messenger-lab3-redis-1,0.22%,6.293MiB / 192MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-api-3,11.21%,12.97MiB / 192MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-api-2,10.96%,8.246MiB / 192MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-api-4,10.52%,10.67MiB / 192MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-api-1,10.90%,11.13MiB / 192MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-lb-1,14.37%,13.13MiB / 64MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-postgres-1,48.07%,330.7MiB / 384MiB +2026-10-16T14:22:06Z,mtusi-messenger-lab3-redis-1,0.25%,6.293MiB / 192MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-api-3,11.81%,13.76MiB / 192MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-api-2,10.98%,8.234MiB / 192MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-api-4,11.31%,10.62MiB / 192MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-api-1,11.25%,11.29MiB / 192MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-lb-1,14.92%,13.12MiB / 64MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-postgres-1,50.27%,330.7MiB / 384MiB +2026-10-16T14:22:09Z,mtusi-messenger-lab3-redis-1,0.22%,6.293MiB / 192MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-api-3,11.67%,14.15MiB / 192MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-api-2,11.52%,8.23MiB / 192MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-api-4,11.05%,10.63MiB / 192MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-api-1,11.42%,11.45MiB / 192MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-lb-1,14.85%,13.12MiB / 64MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-postgres-1,49.68%,330.8MiB / 384MiB +2026-10-16T14:22:12Z,mtusi-messenger-lab3-redis-1,0.67%,6.293MiB / 192MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-api-3,10.56%,13.84MiB / 192MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-api-2,10.53%,8.113MiB / 192MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-api-4,11.45%,10.55MiB / 192MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-api-1,10.96%,11.77MiB / 192MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-lb-1,14.46%,13.12MiB / 64MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-postgres-1,49.01%,330.8MiB / 384MiB +2026-10-16T14:22:15Z,mtusi-messenger-lab3-redis-1,0.21%,6.293MiB / 192MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-api-3,12.23%,13.79MiB / 192MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-api-2,11.14%,8.113MiB / 192MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-api-4,11.57%,10.59MiB / 192MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-api-1,11.67%,11.12MiB / 192MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-lb-1,14.67%,13.14MiB / 64MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-postgres-1,49.35%,330.9MiB / 384MiB +2026-10-16T14:22:18Z,mtusi-messenger-lab3-redis-1,0.25%,6.293MiB / 192MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-api-3,11.89%,13.62MiB / 192MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-api-2,11.52%,8.105MiB / 192MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-api-4,11.64%,10.61MiB / 192MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-api-1,11.27%,11.11MiB / 192MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-lb-1,14.77%,13.09MiB / 64MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-postgres-1,49.41%,330.9MiB / 384MiB +2026-10-16T14:22:21Z,mtusi-messenger-lab3-redis-1,0.76%,6.293MiB / 192MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-api-3,11.08%,14.01MiB / 192MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-api-2,10.75%,8.52MiB / 192MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-api-4,11.17%,10.62MiB / 192MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-api-1,12.34%,11.2MiB / 192MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-lb-1,14.89%,13.13MiB / 64MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-postgres-1,49.88%,330.9MiB / 384MiB +2026-10-16T14:22:24Z,mtusi-messenger-lab3-redis-1,0.22%,6.293MiB / 192MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-api-3,11.38%,13.76MiB / 192MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-api-2,11.53%,8.305MiB / 192MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-api-4,11.26%,10.61MiB / 192MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-api-1,11.58%,11.3MiB / 192MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-lb-1,15.19%,13.12MiB / 64MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-postgres-1,50.06%,330.9MiB / 384MiB +2026-10-16T14:22:27Z,mtusi-messenger-lab3-redis-1,0.71%,6.293MiB / 192MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-api-3,11.66%,13.88MiB / 192MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-api-2,11.17%,8.305MiB / 192MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-api-4,11.37%,10.61MiB / 192MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-api-1,11.04%,11.11MiB / 192MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-lb-1,15.20%,13.13MiB / 64MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-postgres-1,50.03%,330.9MiB / 384MiB +2026-10-16T14:22:31Z,mtusi-messenger-lab3-redis-1,0.27%,6.293MiB / 192MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-api-3,11.15%,13.77MiB / 192MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-api-2,11.95%,8.305MiB / 192MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-api-4,11.55%,10.62MiB / 192MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-api-1,11.35%,11.47MiB / 192MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-lb-1,14.79%,13.13MiB / 64MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-postgres-1,50.14%,330.9MiB / 384MiB +2026-10-16T14:22:34Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-api-3,11.38%,13.73MiB / 192MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-api-2,11.40%,8.305MiB / 192MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-api-4,11.56%,10.61MiB / 192MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-api-1,11.60%,11.41MiB / 192MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-lb-1,15.12%,13.12MiB / 64MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-postgres-1,49.26%,330.9MiB / 384MiB +2026-10-16T14:22:37Z,mtusi-messenger-lab3-redis-1,0.74%,6.293MiB / 192MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-api-3,11.59%,13.3MiB / 192MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-api-2,11.41%,8.309MiB / 192MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-api-4,11.24%,10.61MiB / 192MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-api-1,10.87%,11.18MiB / 192MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-lb-1,14.79%,13.12MiB / 64MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-postgres-1,49.86%,331MiB / 384MiB +2026-10-16T14:22:40Z,mtusi-messenger-lab3-redis-1,0.22%,6.293MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-r1.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-r1.csv new file mode 100644 index 00000000..5779807e --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-r1.csv @@ -0,0 +1,81 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:12:34Z,mtusi-messenger-lab3-api-1,32.74%,198.7MiB / 768MiB +2026-10-16T14:12:34Z,mtusi-messenger-lab3-lb-1,11.77%,11.01MiB / 64MiB +2026-10-16T14:12:34Z,mtusi-messenger-lab3-postgres-1,50.98%,106.1MiB / 384MiB +2026-10-16T14:12:34Z,mtusi-messenger-lab3-redis-1,0.76%,6.586MiB / 192MiB +2026-10-16T14:12:37Z,mtusi-messenger-lab3-api-1,33.66%,15.4MiB / 768MiB +2026-10-16T14:12:37Z,mtusi-messenger-lab3-lb-1,14.75%,11.07MiB / 64MiB +2026-10-16T14:12:37Z,mtusi-messenger-lab3-postgres-1,51.20%,109MiB / 384MiB +2026-10-16T14:12:37Z,mtusi-messenger-lab3-redis-1,0.23%,6.586MiB / 192MiB +2026-10-16T14:12:40Z,mtusi-messenger-lab3-api-1,33.08%,15.4MiB / 768MiB +2026-10-16T14:12:40Z,mtusi-messenger-lab3-lb-1,14.49%,11.07MiB / 64MiB +2026-10-16T14:12:40Z,mtusi-messenger-lab3-postgres-1,51.05%,112MiB / 384MiB +2026-10-16T14:12:40Z,mtusi-messenger-lab3-redis-1,0.23%,6.586MiB / 192MiB +2026-10-16T14:12:43Z,mtusi-messenger-lab3-api-1,32.89%,15.52MiB / 768MiB +2026-10-16T14:12:43Z,mtusi-messenger-lab3-lb-1,14.20%,11.07MiB / 64MiB +2026-10-16T14:12:43Z,mtusi-messenger-lab3-postgres-1,50.82%,115.1MiB / 384MiB +2026-10-16T14:12:43Z,mtusi-messenger-lab3-redis-1,0.72%,6.586MiB / 192MiB +2026-10-16T14:12:46Z,mtusi-messenger-lab3-api-1,22.99%,15.57MiB / 768MiB +2026-10-16T14:12:46Z,mtusi-messenger-lab3-lb-1,9.59%,11.07MiB / 64MiB +2026-10-16T14:12:46Z,mtusi-messenger-lab3-postgres-1,50.66%,126.2MiB / 384MiB +2026-10-16T14:12:46Z,mtusi-messenger-lab3-redis-1,0.23%,6.586MiB / 192MiB +2026-10-16T14:12:49Z,mtusi-messenger-lab3-api-1,33.56%,15.51MiB / 768MiB +2026-10-16T14:12:49Z,mtusi-messenger-lab3-lb-1,14.89%,11.07MiB / 64MiB +2026-10-16T14:12:49Z,mtusi-messenger-lab3-postgres-1,51.26%,122.7MiB / 384MiB +2026-10-16T14:12:49Z,mtusi-messenger-lab3-redis-1,0.79%,6.586MiB / 192MiB +2026-10-16T14:12:52Z,mtusi-messenger-lab3-api-1,32.37%,15.52MiB / 768MiB +2026-10-16T14:12:52Z,mtusi-messenger-lab3-lb-1,13.89%,11.05MiB / 64MiB +2026-10-16T14:12:52Z,mtusi-messenger-lab3-postgres-1,51.56%,125.5MiB / 384MiB +2026-10-16T14:12:52Z,mtusi-messenger-lab3-redis-1,0.25%,6.586MiB / 192MiB +2026-10-16T14:12:55Z,mtusi-messenger-lab3-api-1,32.46%,15.52MiB / 768MiB +2026-10-16T14:12:55Z,mtusi-messenger-lab3-lb-1,14.56%,11.04MiB / 64MiB +2026-10-16T14:12:55Z,mtusi-messenger-lab3-postgres-1,51.06%,128.4MiB / 384MiB +2026-10-16T14:12:55Z,mtusi-messenger-lab3-redis-1,0.22%,6.586MiB / 192MiB +2026-10-16T14:12:58Z,mtusi-messenger-lab3-api-1,33.12%,15.57MiB / 768MiB +2026-10-16T14:12:58Z,mtusi-messenger-lab3-lb-1,14.57%,11.06MiB / 64MiB +2026-10-16T14:12:58Z,mtusi-messenger-lab3-postgres-1,50.34%,139.5MiB / 384MiB +2026-10-16T14:12:58Z,mtusi-messenger-lab3-redis-1,0.25%,6.586MiB / 192MiB +2026-10-16T14:13:01Z,mtusi-messenger-lab3-api-1,32.06%,15.82MiB / 768MiB +2026-10-16T14:13:01Z,mtusi-messenger-lab3-lb-1,14.18%,11.07MiB / 64MiB +2026-10-16T14:13:01Z,mtusi-messenger-lab3-postgres-1,49.27%,142.6MiB / 384MiB +2026-10-16T14:13:01Z,mtusi-messenger-lab3-redis-1,0.23%,6.586MiB / 192MiB +2026-10-16T14:13:04Z,mtusi-messenger-lab3-api-1,33.16%,15.56MiB / 768MiB +2026-10-16T14:13:04Z,mtusi-messenger-lab3-lb-1,14.07%,11.05MiB / 64MiB +2026-10-16T14:13:04Z,mtusi-messenger-lab3-postgres-1,49.42%,144.4MiB / 384MiB +2026-10-16T14:13:04Z,mtusi-messenger-lab3-redis-1,0.25%,6.586MiB / 192MiB +2026-10-16T14:13:07Z,mtusi-messenger-lab3-api-1,33.54%,15.54MiB / 768MiB +2026-10-16T14:13:07Z,mtusi-messenger-lab3-lb-1,14.34%,11.05MiB / 64MiB +2026-10-16T14:13:07Z,mtusi-messenger-lab3-postgres-1,50.96%,148MiB / 384MiB +2026-10-16T14:13:07Z,mtusi-messenger-lab3-redis-1,0.22%,6.586MiB / 192MiB +2026-10-16T14:13:10Z,mtusi-messenger-lab3-api-1,32.24%,15.54MiB / 768MiB +2026-10-16T14:13:10Z,mtusi-messenger-lab3-lb-1,13.94%,11.05MiB / 64MiB +2026-10-16T14:13:10Z,mtusi-messenger-lab3-postgres-1,50.75%,150.5MiB / 384MiB +2026-10-16T14:13:10Z,mtusi-messenger-lab3-redis-1,0.23%,6.586MiB / 192MiB +2026-10-16T14:13:13Z,mtusi-messenger-lab3-api-1,32.62%,15.51MiB / 768MiB +2026-10-16T14:13:13Z,mtusi-messenger-lab3-lb-1,14.23%,11.07MiB / 64MiB +2026-10-16T14:13:13Z,mtusi-messenger-lab3-postgres-1,50.81%,152.6MiB / 384MiB +2026-10-16T14:13:13Z,mtusi-messenger-lab3-redis-1,0.78%,6.586MiB / 192MiB +2026-10-16T14:13:16Z,mtusi-messenger-lab3-api-1,32.42%,15.59MiB / 768MiB +2026-10-16T14:13:16Z,mtusi-messenger-lab3-lb-1,14.22%,11.08MiB / 64MiB +2026-10-16T14:13:16Z,mtusi-messenger-lab3-postgres-1,50.73%,155.7MiB / 384MiB +2026-10-16T14:13:16Z,mtusi-messenger-lab3-redis-1,0.25%,6.586MiB / 192MiB +2026-10-16T14:13:19Z,mtusi-messenger-lab3-api-1,32.57%,15.57MiB / 768MiB +2026-10-16T14:13:19Z,mtusi-messenger-lab3-lb-1,14.45%,11.06MiB / 64MiB +2026-10-16T14:13:19Z,mtusi-messenger-lab3-postgres-1,50.45%,158.4MiB / 384MiB +2026-10-16T14:13:19Z,mtusi-messenger-lab3-redis-1,0.74%,6.586MiB / 192MiB +2026-10-16T14:13:22Z,mtusi-messenger-lab3-api-1,31.82%,15.58MiB / 768MiB +2026-10-16T14:13:22Z,mtusi-messenger-lab3-lb-1,14.21%,11.07MiB / 64MiB +2026-10-16T14:13:22Z,mtusi-messenger-lab3-postgres-1,49.57%,161.1MiB / 384MiB +2026-10-16T14:13:22Z,mtusi-messenger-lab3-redis-1,0.24%,6.586MiB / 192MiB +2026-10-16T14:13:26Z,mtusi-messenger-lab3-api-1,33.40%,15.62MiB / 768MiB +2026-10-16T14:13:26Z,mtusi-messenger-lab3-lb-1,15.05%,11.05MiB / 64MiB +2026-10-16T14:13:26Z,mtusi-messenger-lab3-postgres-1,49.75%,163.3MiB / 384MiB +2026-10-16T14:13:26Z,mtusi-messenger-lab3-redis-1,0.27%,6.586MiB / 192MiB +2026-10-16T14:13:29Z,mtusi-messenger-lab3-api-1,31.80%,15.66MiB / 768MiB +2026-10-16T14:13:29Z,mtusi-messenger-lab3-lb-1,14.22%,11.07MiB / 64MiB +2026-10-16T14:13:29Z,mtusi-messenger-lab3-postgres-1,50.65%,165.9MiB / 384MiB +2026-10-16T14:13:29Z,mtusi-messenger-lab3-redis-1,0.25%,6.711MiB / 192MiB +2026-10-16T14:13:32Z,mtusi-messenger-lab3-api-1,33.93%,15.82MiB / 768MiB +2026-10-16T14:13:32Z,mtusi-messenger-lab3-lb-1,14.70%,11.07MiB / 64MiB +2026-10-16T14:13:32Z,mtusi-messenger-lab3-postgres-1,50.69%,168.6MiB / 384MiB +2026-10-16T14:13:32Z,mtusi-messenger-lab3-redis-1,0.26%,6.711MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-r2.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-r2.csv new file mode 100644 index 00000000..c2eca6f1 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-r2.csv @@ -0,0 +1,101 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:13:50Z,mtusi-messenger-lab3-api-2,20.08%,162.4MiB / 384MiB +2026-10-16T14:13:50Z,mtusi-messenger-lab3-api-1,19.77%,162.5MiB / 384MiB +2026-10-16T14:13:50Z,mtusi-messenger-lab3-lb-1,15.68%,11.08MiB / 64MiB +2026-10-16T14:13:50Z,mtusi-messenger-lab3-postgres-1,50.89%,230.6MiB / 384MiB +2026-10-16T14:13:50Z,mtusi-messenger-lab3-redis-1,0.23%,6.715MiB / 192MiB +2026-10-16T14:13:53Z,mtusi-messenger-lab3-api-2,20.21%,195.2MiB / 384MiB +2026-10-16T14:13:53Z,mtusi-messenger-lab3-api-1,21.25%,14.04MiB / 384MiB +2026-10-16T14:13:53Z,mtusi-messenger-lab3-lb-1,15.36%,13.09MiB / 64MiB +2026-10-16T14:13:53Z,mtusi-messenger-lab3-postgres-1,50.03%,236.4MiB / 384MiB +2026-10-16T14:13:53Z,mtusi-messenger-lab3-redis-1,0.75%,6.289MiB / 192MiB +2026-10-16T14:13:56Z,mtusi-messenger-lab3-api-2,20.33%,11.11MiB / 384MiB +2026-10-16T14:13:56Z,mtusi-messenger-lab3-api-1,20.04%,14.42MiB / 384MiB +2026-10-16T14:13:56Z,mtusi-messenger-lab3-lb-1,15.72%,13.11MiB / 64MiB +2026-10-16T14:13:56Z,mtusi-messenger-lab3-postgres-1,50.21%,240.5MiB / 384MiB +2026-10-16T14:13:56Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:13:59Z,mtusi-messenger-lab3-api-2,20.65%,13.14MiB / 384MiB +2026-10-16T14:13:59Z,mtusi-messenger-lab3-api-1,19.74%,14.37MiB / 384MiB +2026-10-16T14:13:59Z,mtusi-messenger-lab3-lb-1,15.27%,13.09MiB / 64MiB +2026-10-16T14:13:59Z,mtusi-messenger-lab3-postgres-1,50.67%,232.9MiB / 384MiB +2026-10-16T14:13:59Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:14:02Z,mtusi-messenger-lab3-api-2,19.46%,13.22MiB / 384MiB +2026-10-16T14:14:02Z,mtusi-messenger-lab3-api-1,20.79%,13.88MiB / 384MiB +2026-10-16T14:14:02Z,mtusi-messenger-lab3-lb-1,15.35%,13.08MiB / 64MiB +2026-10-16T14:14:02Z,mtusi-messenger-lab3-postgres-1,49.48%,235.2MiB / 384MiB +2026-10-16T14:14:02Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:14:05Z,mtusi-messenger-lab3-api-2,19.56%,13.03MiB / 384MiB +2026-10-16T14:14:05Z,mtusi-messenger-lab3-api-1,19.84%,14.45MiB / 384MiB +2026-10-16T14:14:05Z,mtusi-messenger-lab3-lb-1,15.18%,13.33MiB / 64MiB +2026-10-16T14:14:05Z,mtusi-messenger-lab3-postgres-1,49.93%,235.3MiB / 384MiB +2026-10-16T14:14:05Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:14:08Z,mtusi-messenger-lab3-api-2,21.44%,13MiB / 384MiB +2026-10-16T14:14:08Z,mtusi-messenger-lab3-api-1,20.61%,14.43MiB / 384MiB +2026-10-16T14:14:08Z,mtusi-messenger-lab3-lb-1,15.37%,13.08MiB / 64MiB +2026-10-16T14:14:08Z,mtusi-messenger-lab3-postgres-1,49.82%,235.9MiB / 384MiB +2026-10-16T14:14:08Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:14:12Z,mtusi-messenger-lab3-api-2,19.38%,13.05MiB / 384MiB +2026-10-16T14:14:12Z,mtusi-messenger-lab3-api-1,20.24%,14.04MiB / 384MiB +2026-10-16T14:14:12Z,mtusi-messenger-lab3-lb-1,15.38%,13.33MiB / 64MiB +2026-10-16T14:14:12Z,mtusi-messenger-lab3-postgres-1,50.67%,236.1MiB / 384MiB +2026-10-16T14:14:12Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:14:15Z,mtusi-messenger-lab3-api-2,20.07%,12.96MiB / 384MiB +2026-10-16T14:14:15Z,mtusi-messenger-lab3-api-1,19.67%,14.73MiB / 384MiB +2026-10-16T14:14:15Z,mtusi-messenger-lab3-lb-1,15.22%,13.09MiB / 64MiB +2026-10-16T14:14:15Z,mtusi-messenger-lab3-postgres-1,49.58%,236.2MiB / 384MiB +2026-10-16T14:14:15Z,mtusi-messenger-lab3-redis-1,0.21%,6.289MiB / 192MiB +2026-10-16T14:14:18Z,mtusi-messenger-lab3-api-2,20.92%,13.02MiB / 384MiB +2026-10-16T14:14:18Z,mtusi-messenger-lab3-api-1,20.75%,14.74MiB / 384MiB +2026-10-16T14:14:18Z,mtusi-messenger-lab3-lb-1,15.19%,13.09MiB / 64MiB +2026-10-16T14:14:18Z,mtusi-messenger-lab3-postgres-1,49.80%,236.8MiB / 384MiB +2026-10-16T14:14:18Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:14:21Z,mtusi-messenger-lab3-api-2,20.85%,13.16MiB / 384MiB +2026-10-16T14:14:21Z,mtusi-messenger-lab3-api-1,20.08%,14.48MiB / 384MiB +2026-10-16T14:14:21Z,mtusi-messenger-lab3-lb-1,15.24%,13.1MiB / 64MiB +2026-10-16T14:14:21Z,mtusi-messenger-lab3-postgres-1,50.14%,237.3MiB / 384MiB +2026-10-16T14:14:21Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:14:24Z,mtusi-messenger-lab3-api-2,20.58%,13.19MiB / 384MiB +2026-10-16T14:14:24Z,mtusi-messenger-lab3-api-1,19.75%,13.8MiB / 384MiB +2026-10-16T14:14:24Z,mtusi-messenger-lab3-lb-1,15.53%,13.09MiB / 64MiB +2026-10-16T14:14:24Z,mtusi-messenger-lab3-postgres-1,50.14%,237.2MiB / 384MiB +2026-10-16T14:14:24Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:14:27Z,mtusi-messenger-lab3-api-2,20.52%,12.88MiB / 384MiB +2026-10-16T14:14:27Z,mtusi-messenger-lab3-api-1,20.06%,14.38MiB / 384MiB +2026-10-16T14:14:27Z,mtusi-messenger-lab3-lb-1,15.34%,13.09MiB / 64MiB +2026-10-16T14:14:27Z,mtusi-messenger-lab3-postgres-1,50.63%,238MiB / 384MiB +2026-10-16T14:14:27Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB +2026-10-16T14:14:30Z,mtusi-messenger-lab3-api-2,20.82%,13.18MiB / 384MiB +2026-10-16T14:14:30Z,mtusi-messenger-lab3-api-1,20.80%,14.64MiB / 384MiB +2026-10-16T14:14:30Z,mtusi-messenger-lab3-lb-1,15.51%,13.11MiB / 64MiB +2026-10-16T14:14:30Z,mtusi-messenger-lab3-postgres-1,50.50%,237.8MiB / 384MiB +2026-10-16T14:14:30Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:14:33Z,mtusi-messenger-lab3-api-2,20.03%,13.03MiB / 384MiB +2026-10-16T14:14:33Z,mtusi-messenger-lab3-api-1,20.43%,14.37MiB / 384MiB +2026-10-16T14:14:33Z,mtusi-messenger-lab3-lb-1,14.68%,13.1MiB / 64MiB +2026-10-16T14:14:33Z,mtusi-messenger-lab3-postgres-1,49.35%,237.8MiB / 384MiB +2026-10-16T14:14:33Z,mtusi-messenger-lab3-redis-1,0.22%,6.289MiB / 192MiB +2026-10-16T14:14:36Z,mtusi-messenger-lab3-api-2,20.67%,13.41MiB / 384MiB +2026-10-16T14:14:36Z,mtusi-messenger-lab3-api-1,20.32%,14.5MiB / 384MiB +2026-10-16T14:14:36Z,mtusi-messenger-lab3-lb-1,15.40%,13.09MiB / 64MiB +2026-10-16T14:14:36Z,mtusi-messenger-lab3-postgres-1,49.70%,238.2MiB / 384MiB +2026-10-16T14:14:36Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:14:39Z,mtusi-messenger-lab3-api-2,20.33%,13.16MiB / 384MiB +2026-10-16T14:14:39Z,mtusi-messenger-lab3-api-1,19.97%,14.35MiB / 384MiB +2026-10-16T14:14:39Z,mtusi-messenger-lab3-lb-1,15.47%,13.09MiB / 64MiB +2026-10-16T14:14:39Z,mtusi-messenger-lab3-postgres-1,50.78%,238.3MiB / 384MiB +2026-10-16T14:14:39Z,mtusi-messenger-lab3-redis-1,0.25%,6.289MiB / 192MiB +2026-10-16T14:14:42Z,mtusi-messenger-lab3-api-2,19.91%,13.19MiB / 384MiB +2026-10-16T14:14:42Z,mtusi-messenger-lab3-api-1,20.24%,14.25MiB / 384MiB +2026-10-16T14:14:42Z,mtusi-messenger-lab3-lb-1,15.05%,13.09MiB / 64MiB +2026-10-16T14:14:42Z,mtusi-messenger-lab3-postgres-1,50.54%,238.7MiB / 384MiB +2026-10-16T14:14:42Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:14:45Z,mtusi-messenger-lab3-api-2,17.04%,13.13MiB / 384MiB +2026-10-16T14:14:45Z,mtusi-messenger-lab3-api-1,16.74%,14.36MiB / 384MiB +2026-10-16T14:14:45Z,mtusi-messenger-lab3-lb-1,12.77%,13.09MiB / 64MiB +2026-10-16T14:14:45Z,mtusi-messenger-lab3-postgres-1,49.53%,247.4MiB / 384MiB +2026-10-16T14:14:45Z,mtusi-messenger-lab3-redis-1,0.24%,6.289MiB / 192MiB +2026-10-16T14:14:48Z,mtusi-messenger-lab3-api-2,19.78%,13.09MiB / 384MiB +2026-10-16T14:14:48Z,mtusi-messenger-lab3-api-1,19.66%,14.34MiB / 384MiB +2026-10-16T14:14:48Z,mtusi-messenger-lab3-lb-1,14.56%,13.04MiB / 64MiB +2026-10-16T14:14:48Z,mtusi-messenger-lab3-postgres-1,47.34%,236.9MiB / 384MiB +2026-10-16T14:14:48Z,mtusi-messenger-lab3-redis-1,0.23%,6.289MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/stats-r4.csv b/evidence/track1/superseded/run1-wrong-budgets/stats-r4.csv new file mode 100644 index 00000000..a94b4221 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/stats-r4.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T14:15:08Z,mtusi-messenger-lab3-api-1,10.59%,79.44MiB / 192MiB +2026-10-16T14:15:08Z,mtusi-messenger-lab3-api-2,10.88%,143.2MiB / 192MiB +2026-10-16T14:15:08Z,mtusi-messenger-lab3-api-3,11.78%,143.4MiB / 192MiB +2026-10-16T14:15:08Z,mtusi-messenger-lab3-api-4,11.04%,77.16MiB / 192MiB +2026-10-16T14:15:08Z,mtusi-messenger-lab3-lb-1,14.81%,13.11MiB / 64MiB +2026-10-16T14:15:08Z,mtusi-messenger-lab3-postgres-1,46.14%,307.7MiB / 384MiB +2026-10-16T14:15:08Z,mtusi-messenger-lab3-redis-1,0.27%,6.293MiB / 192MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-api-1,11.90%,102.7MiB / 192MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-api-2,11.46%,166.1MiB / 192MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-api-3,11.71%,158.9MiB / 192MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-api-4,11.77%,101MiB / 192MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-lb-1,15.67%,13.11MiB / 64MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-postgres-1,48.22%,198.6MiB / 384MiB +2026-10-16T14:15:11Z,mtusi-messenger-lab3-redis-1,0.27%,6.293MiB / 192MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-api-1,11.72%,125.9MiB / 192MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-api-2,12.03%,189.6MiB / 192MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-api-3,11.46%,189.9MiB / 192MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-api-4,12.04%,125MiB / 192MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-lb-1,15.60%,13.11MiB / 64MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-postgres-1,49.66%,199.1MiB / 384MiB +2026-10-16T14:15:14Z,mtusi-messenger-lab3-redis-1,0.85%,6.293MiB / 192MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-api-1,11.56%,11.51MiB / 192MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-api-2,11.86%,7.742MiB / 192MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-api-3,11.37%,7.895MiB / 192MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-api-4,11.86%,10.71MiB / 192MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-lb-1,15.61%,13.13MiB / 64MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-postgres-1,50.01%,197.7MiB / 384MiB +2026-10-16T14:15:17Z,mtusi-messenger-lab3-redis-1,0.24%,6.293MiB / 192MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-api-1,11.77%,11.32MiB / 192MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-api-2,12.63%,7.957MiB / 192MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-api-3,12.15%,7.953MiB / 192MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-api-4,11.76%,10.74MiB / 192MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-lb-1,15.78%,13.12MiB / 64MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-postgres-1,49.82%,200.2MiB / 384MiB +2026-10-16T14:15:20Z,mtusi-messenger-lab3-redis-1,0.21%,6.293MiB / 192MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-api-1,11.99%,11MiB / 192MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-api-2,11.25%,8.031MiB / 192MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-api-3,11.27%,7.984MiB / 192MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-api-4,11.73%,10.57MiB / 192MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-lb-1,14.70%,13.14MiB / 64MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-postgres-1,50.04%,200.4MiB / 384MiB +2026-10-16T14:15:23Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-api-1,11.74%,11.08MiB / 192MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-api-2,11.84%,8.047MiB / 192MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-api-3,12.02%,7.949MiB / 192MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-api-4,11.50%,10.59MiB / 192MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-lb-1,15.92%,13.14MiB / 64MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-postgres-1,50.17%,201.6MiB / 384MiB +2026-10-16T14:15:26Z,mtusi-messenger-lab3-redis-1,0.25%,6.293MiB / 192MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-api-1,11.93%,11.28MiB / 192MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-api-2,11.71%,8.121MiB / 192MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-api-3,12.26%,8.164MiB / 192MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-api-4,11.98%,10.48MiB / 192MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-lb-1,16.06%,13.14MiB / 64MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-postgres-1,50.21%,201.6MiB / 384MiB +2026-10-16T14:15:29Z,mtusi-messenger-lab3-redis-1,0.84%,6.293MiB / 192MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-api-1,11.12%,11.39MiB / 192MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-api-2,11.09%,7.988MiB / 192MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-api-3,11.34%,8.078MiB / 192MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-api-4,12.02%,10.54MiB / 192MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-lb-1,15.50%,13.12MiB / 64MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-postgres-1,50.63%,202.3MiB / 384MiB +2026-10-16T14:15:33Z,mtusi-messenger-lab3-redis-1,0.24%,6.293MiB / 192MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-api-1,12.39%,11.24MiB / 192MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-api-2,11.14%,8.051MiB / 192MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-api-3,11.98%,8.086MiB / 192MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-api-4,12.42%,10.59MiB / 192MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-lb-1,15.56%,13.14MiB / 64MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-postgres-1,49.70%,218.3MiB / 384MiB +2026-10-16T14:15:36Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-api-1,12.05%,11.16MiB / 192MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-api-2,12.05%,8.051MiB / 192MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-api-3,11.55%,8.137MiB / 192MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-api-4,11.79%,10.61MiB / 192MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-lb-1,15.81%,13.12MiB / 64MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-postgres-1,49.95%,218.5MiB / 384MiB +2026-10-16T14:15:39Z,mtusi-messenger-lab3-redis-1,0.85%,6.293MiB / 192MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-api-1,11.39%,11.18MiB / 192MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-api-2,10.89%,8.059MiB / 192MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-api-3,12.18%,8.035MiB / 192MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-api-4,11.71%,10.61MiB / 192MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-lb-1,15.14%,13.12MiB / 64MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-postgres-1,49.42%,226.3MiB / 384MiB +2026-10-16T14:15:42Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-api-1,11.37%,11.24MiB / 192MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-api-2,11.56%,8.086MiB / 192MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-api-3,11.54%,7.969MiB / 192MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-api-4,12.19%,10.61MiB / 192MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-lb-1,15.53%,13.12MiB / 64MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-postgres-1,50.54%,227.9MiB / 384MiB +2026-10-16T14:15:45Z,mtusi-messenger-lab3-redis-1,0.22%,6.293MiB / 192MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-api-1,9.12%,11.23MiB / 192MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-api-2,9.00%,8.145MiB / 192MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-api-3,9.21%,7.961MiB / 192MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-api-4,8.99%,10.54MiB / 192MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-lb-1,11.68%,13.12MiB / 64MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-postgres-1,50.19%,245.5MiB / 384MiB +2026-10-16T14:15:48Z,mtusi-messenger-lab3-redis-1,0.21%,6.293MiB / 192MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-api-1,11.23%,11.11MiB / 192MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-api-2,12.16%,8.086MiB / 192MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-api-3,9.18%,7.973MiB / 192MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-api-4,11.76%,10.51MiB / 192MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-lb-1,15.52%,13.12MiB / 64MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-postgres-1,49.99%,235.3MiB / 384MiB +2026-10-16T14:15:51Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-api-1,12.17%,11.16MiB / 192MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-api-2,12.05%,8.078MiB / 192MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-api-3,11.38%,8.008MiB / 192MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-api-4,11.61%,10.58MiB / 192MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-lb-1,15.84%,13.13MiB / 64MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-postgres-1,50.16%,235.8MiB / 384MiB +2026-10-16T14:15:54Z,mtusi-messenger-lab3-redis-1,0.22%,6.293MiB / 192MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-api-1,11.28%,11.16MiB / 192MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-api-2,10.89%,8.152MiB / 192MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-api-3,11.65%,8.027MiB / 192MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-api-4,11.40%,10.39MiB / 192MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-lb-1,15.10%,13.12MiB / 64MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-postgres-1,49.98%,235.9MiB / 384MiB +2026-10-16T14:15:57Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-api-1,12.52%,11.19MiB / 192MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-api-2,12.01%,8.027MiB / 192MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-api-3,11.52%,8.262MiB / 192MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-api-4,11.23%,10.39MiB / 192MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-lb-1,15.56%,13.12MiB / 64MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-postgres-1,49.54%,236MiB / 384MiB +2026-10-16T14:16:00Z,mtusi-messenger-lab3-redis-1,0.72%,6.293MiB / 192MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-api-1,11.46%,11.2MiB / 192MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-api-2,11.21%,8.125MiB / 192MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-api-3,11.23%,8.148MiB / 192MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-api-4,11.61%,10.36MiB / 192MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-lb-1,15.56%,13.13MiB / 64MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-postgres-1,50.05%,236.9MiB / 384MiB +2026-10-16T14:16:03Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-api-1,11.62%,11.23MiB / 192MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-api-2,11.86%,8.137MiB / 192MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-api-3,11.52%,8.281MiB / 192MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-api-4,11.73%,10.36MiB / 192MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-lb-1,15.51%,13.12MiB / 64MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-postgres-1,50.60%,236.7MiB / 384MiB +2026-10-16T14:16:07Z,mtusi-messenger-lab3-redis-1,0.23%,6.293MiB / 192MiB diff --git a/evidence/track1/superseded/run1-wrong-budgets/summary.md b/evidence/track1/superseded/run1-wrong-budgets/summary.md new file mode 100644 index 00000000..ee55c591 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/summary.md @@ -0,0 +1,13 @@ +# Трек 1: цена масштабирования + +| профиль | реплик | бюджет CPU | CPU/реплика | успешный RPS | p50 мс | p95 мс | p99 мс | ошибки | API CPU (сумма) | API RAM max (сумма, MiB) | PG CPU | LB CPU | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| db1cpu | 2 | 1.0 | 0.5 | 1641.212 | 4.085 | 8.787 | 23.973 | 0 | 38.16 | 329.3 | 50.3 | 14.26 | +| g05 | 2 | 0.5 | 0.25 | 1615.408 | 4.348 | 8.823 | 20.46 | 0 | 40.16 | 244.3 | 50.44 | 15.07 | +| g10 | 2 | 1.0 | 0.5 | 1665.873 | 4.168 | 8.323 | 21.636 | 0 | 39.49 | 326.1 | 50.33 | 14.75 | +| g15 | 2 | 1.5 | 0.75 | 1651.746 | 4.094 | 8.631 | 24.272 | 0 | 38.4 | 334.6 | 49.7 | 14.6 | +| pool10 | 4 | 1.0 | 0.25 | 1618.552 | 4.394 | 8.205 | 20.61 | 222 | 44.88 | 360.7 | 48.55 | 13.6 | +| pool5 | 4 | 1.0 | 0.25 | 1563.449 | 4.464 | 8.965 | 22.758 | 2 | 44.02 | 582.1 | 49.2 | 14.36 | +| r1 | 1 | 1.0 | 1.0 | 1680.576 | 4.005 | 8.354 | 22.526 | 0 | 32.32 | 198.7 | 50.6 | 14.02 | +| r2 | 2 | 1.0 | 0.5 | 1567.279 | 4.474 | 9.495 | 20.649 | 0 | 40.17 | 324.9 | 49.99 | 15.16 | +| r4 | 4 | 1.0 | 0.25 | 1548.476 | 4.633 | 8.8 | 18.978 | 178 | 46.05 | 630.4 | 49.75 | 15.32 | diff --git a/evidence/track1/superseded/run1-wrong-budgets/summary.txt b/evidence/track1/superseded/run1-wrong-budgets/summary.txt new file mode 100644 index 00000000..956b4bc5 --- /dev/null +++ b/evidence/track1/superseded/run1-wrong-budgets/summary.txt @@ -0,0 +1,455 @@ +# Track 1: the price of scaling +# generated: 2026-10-15T18:47:12Z +# host: Darwin arm64 +# cpu: Apple M5 Pro +# ram bytes: 51539607552 +# load: tests/load.py closed loop; postgres/redis/lb limits are fixed in compose.yaml +# each profile line below records the budget it was run with +docker engine 29.5.2 +Docker Compose version 5.5.1 + +=== invocation 2026-10-15T18:47:12Z: REPLICAS="1 2 4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r1 replicas=1 cpu=1.00 mem=768M === +=== invocation 2026-10-15T18:47:37Z: REPLICAS="1 2 4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r1 replicas=1 cpu=1.00 mem=768M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.02, + "concurrency": 8, + "successful_requests": 113740, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1895.027, + "successful_latency_ms": { + "p50": 4.031, + "p95": 6.507, + "p99": 8.906 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=368298 +idempotency_rows=368298 + +=== profile label=r2 replicas=2 cpu=0.50 mem=384M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.023, + "concurrency": 8, + "successful_requests": 117433, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1956.481, + "successful_latency_ms": { + "p50": 3.957, + "p95": 6.18, + "p99": 8.499 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=516197 +idempotency_rows=516197 + +=== profile label=r4 replicas=4 cpu=0.25 mem=192M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.014, + "concurrency": 8, + "successful_requests": 107236, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1786.838, + "successful_latency_ms": { + "p50": 4.288, + "p95": 7.051, + "p99": 10.001 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=652759 +idempotency_rows=652759 + +=== invocation 2026-10-15T18:51:38Z: REPLICAS="2" TOTAL_CPU=0.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g05 replicas=2 cpu=0.25 mem=384M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.02, + "concurrency": 8, + "successful_requests": 114389, + "failed_requests": 340, + "error_ratio": 0.002964, + "successful_rps": 1905.841, + "successful_latency_ms": { + "p50": 4.032, + "p95": 6.456, + "p99": 9.098 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=797321 +idempotency_rows=797321 + +=== invocation 2026-10-15T18:53:02Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g10 replicas=2 cpu=0.50 mem=384M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.02, + "concurrency": 8, + "successful_requests": 117266, + "failed_requests": 1984, + "error_ratio": 0.016637, + "successful_rps": 1953.781, + "successful_latency_ms": { + "p50": 3.923, + "p95": 6.062, + "p99": 8.041 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=944961 +idempotency_rows=944961 + +=== invocation 2026-10-15T18:54:19Z: REPLICAS="2" TOTAL_CPU=1.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g15 replicas=2 cpu=0.75 mem=384M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.018, + "concurrency": 8, + "successful_requests": 111442, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1856.809, + "successful_latency_ms": { + "p50": 4.132, + "p95": 6.761, + "p99": 9.34 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=1086579 +idempotency_rows=1086579 + +=== invocation 2026-10-15T18:55:35Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool10 replicas=4 cpu=0.25 mem=192M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.016, + "concurrency": 8, + "successful_requests": 113438, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1890.142, + "successful_latency_ms": { + "p50": 4.133, + "p95": 6.416, + "p99": 8.487 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=1229412 +idempotency_rows=1229412 + +=== invocation 2026-10-15T18:56:54Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool5 replicas=4 cpu=0.25 mem=192M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.023, + "concurrency": 8, + "successful_requests": 109073, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1817.2, + "successful_latency_ms": { + "p50": 4.258, + "p95": 6.758, + "p99": 9.171 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=1366625 +idempotency_rows=1366625 + +=== invocation 2026-10-15T19:05:27Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=db1cpu replicas=2 cpu=0.50 mem=384M === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.02, + "concurrency": 8, + "successful_requests": 117712, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1961.212, + "successful_latency_ms": { + "p50": 3.984, + "p95": 6.09, + "p99": 8.13 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=1722748 +idempotency_rows=1722748 + +=== invocation 2026-10-16T14:12:13Z: REPLICAS="1 2 4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r1 replicas=1 cpu=1.00 mem=768M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.015, + "concurrency": 8, + "successful_requests": 100860, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1680.576, + "successful_latency_ms": { + "p50": 4.005, + "p95": 8.354, + "p99": 22.526 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=18 +postgres_max_connections=100 +messages_rows=631570 +idempotency_rows=631570 + +=== profile label=r2 replicas=2 cpu=0.50 mem=384M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 94054, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1567.279, + "successful_latency_ms": { + "p50": 4.474, + "p95": 9.495, + "p99": 20.649 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=747548 +idempotency_rows=747548 + +=== profile label=r4 replicas=4 cpu=0.25 mem=192M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 92928, + "failed_requests": 178, + "error_ratio": 0.001912, + "successful_rps": 1548.476, + "successful_latency_ms": { + "p50": 4.633, + "p95": 8.8, + "p99": 18.978 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=22 +postgres_max_connections=100 +messages_rows=863510 +idempotency_rows=863510 + +=== invocation 2026-10-16T14:16:09Z: REPLICAS="2" TOTAL_CPU=0.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g05 replicas=2 cpu=0.25 mem=384M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.01, + "concurrency": 8, + "successful_requests": 96941, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1615.408, + "successful_latency_ms": { + "p50": 4.348, + "p95": 8.823, + "p99": 20.46 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=984900 +idempotency_rows=984900 + +=== invocation 2026-10-16T14:17:32Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g10 replicas=2 cpu=0.50 mem=384M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 99970, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1665.873, + "successful_latency_ms": { + "p50": 4.168, + "p95": 8.323, + "p99": 21.636 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=20 +postgres_max_connections=100 +messages_rows=1110124 +idempotency_rows=1110124 + +=== invocation 2026-10-16T14:18:48Z: REPLICAS="2" TOTAL_CPU=1.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g15 replicas=2 cpu=0.75 mem=384M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.017, + "concurrency": 8, + "successful_requests": 99132, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1651.746, + "successful_latency_ms": { + "p50": 4.094, + "p95": 8.631, + "p99": 24.272 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=1233101 +idempotency_rows=1233101 + +=== invocation 2026-10-16T14:20:05Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool10 replicas=4 cpu=0.25 mem=192M postgres=0.50/512M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 97133, + "failed_requests": 222, + "error_ratio": 0.00228, + "successful_rps": 1618.552, + "successful_latency_ms": { + "p50": 4.394, + "p95": 8.205, + "p99": 20.61 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=1355629 +idempotency_rows=1355629 + +=== invocation 2026-10-16T14:21:24Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool5 replicas=4 cpu=0.25 mem=192M postgres=0.50/512M max_conns=5 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.027, + "concurrency": 8, + "successful_requests": 93849, + "failed_requests": 2, + "error_ratio": 2.1e-05, + "successful_rps": 1563.449, + "successful_latency_ms": { + "p50": 4.464, + "p95": 8.965, + "p99": 22.758 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=21 +postgres_max_connections=100 +messages_rows=1474222 +idempotency_rows=1474222 + +=== invocation 2026-10-16T14:22:43Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=db1cpu replicas=2 cpu=0.50 mem=384M postgres=1.0/384M max_conns=10 === +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 98492, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1641.212, + "successful_latency_ms": { + "p50": 4.085, + "p95": 8.787, + "p99": 23.973 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=1597333 +idempotency_rows=1597333 + diff --git a/evidence/track1/superseded/run2-host-client/load-db1cpu.json b/evidence/track1/superseded/run2-host-client/load-db1cpu.json new file mode 100644 index 00000000..6ca275ad --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-db1cpu.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.83, + "concurrency": 8, + "successful_requests": 96094, + "failed_requests": 26520, + "error_ratio": 0.216289, + "successful_rps": 1579.722, + "successful_latency_ms": { + "p50": 4.033, + "p95": 6.236, + "p99": 8.668 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-g05.json b/evidence/track1/superseded/run2-host-client/load-g05.json new file mode 100644 index 00000000..2f58bd37 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-g05.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 95087, + "failed_requests": 2845, + "error_ratio": 0.029051, + "successful_rps": 1584.428, + "successful_latency_ms": { + "p50": 4.042, + "p95": 9.331, + "p99": 27.665 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-g10.json b/evidence/track1/superseded/run2-host-client/load-g10.json new file mode 100644 index 00000000..985b67a2 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-g10.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 95841, + "failed_requests": 13795, + "error_ratio": 0.125825, + "successful_rps": 1597.028, + "successful_latency_ms": { + "p50": 3.927, + "p95": 7.67, + "p99": 21.91 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-g15.json b/evidence/track1/superseded/run2-host-client/load-g15.json new file mode 100644 index 00000000..e696f35b --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-g15.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 98411, + "failed_requests": 6960, + "error_ratio": 0.066052, + "successful_rps": 1639.884, + "successful_latency_ms": { + "p50": 3.963, + "p95": 7.721, + "p99": 23.6 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-lb1cpu.json b/evidence/track1/superseded/run2-host-client/load-lb1cpu.json new file mode 100644 index 00000000..b98c3264 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-lb1cpu.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.01, + "concurrency": 8, + "successful_requests": 97901, + "failed_requests": 15652, + "error_ratio": 0.137839, + "successful_rps": 1631.408, + "successful_latency_ms": { + "p50": 3.894, + "p95": 6.989, + "p99": 20.148 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-pool10.json b/evidence/track1/superseded/run2-host-client/load-pool10.json new file mode 100644 index 00000000..33256178 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-pool10.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.014, + "concurrency": 8, + "successful_requests": 94995, + "failed_requests": 11008, + "error_ratio": 0.103846, + "successful_rps": 1582.872, + "successful_latency_ms": { + "p50": 4.156, + "p95": 7.798, + "p99": 19.723 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-pool5.json b/evidence/track1/superseded/run2-host-client/load-pool5.json new file mode 100644 index 00000000..a5a19fed --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-pool5.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.016, + "concurrency": 8, + "successful_requests": 93110, + "failed_requests": 13051, + "error_ratio": 0.122936, + "successful_rps": 1551.419, + "successful_latency_ms": { + "p50": 4.125, + "p95": 7.868, + "p99": 21.268 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-r1.json b/evidence/track1/superseded/run2-host-client/load-r1.json new file mode 100644 index 00000000..788d729e --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-r1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 103077, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1717.626, + "successful_latency_ms": { + "p50": 3.85, + "p95": 7.538, + "p99": 25.045 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-r2.json b/evidence/track1/superseded/run2-host-client/load-r2.json new file mode 100644 index 00000000..43961f61 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-r2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 97973, + "failed_requests": 9791, + "error_ratio": 0.090856, + "successful_rps": 1632.545, + "successful_latency_ms": { + "p50": 3.959, + "p95": 7.508, + "p99": 22.12 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/load-r4.json b/evidence/track1/superseded/run2-host-client/load-r4.json new file mode 100644 index 00000000..1a94233d --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/load-r4.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 92161, + "failed_requests": 11454, + "error_ratio": 0.110544, + "successful_rps": 1535.673, + "successful_latency_ms": { + "p50": 4.184, + "p95": 8.208, + "p99": 22.167 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/track1/superseded/run2-host-client/profile-db1cpu.json b/evidence/track1/superseded/run2-host-client/profile-db1cpu.json new file mode 100644 index 00000000..71f95f98 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-db1cpu.json @@ -0,0 +1 @@ +{"label":"db1cpu","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"1.00","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-g05.json b/evidence/track1/superseded/run2-host-client/profile-g05.json new file mode 100644 index 00000000..8e96a6f9 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-g05.json @@ -0,0 +1 @@ +{"label":"g05","replicas":2,"total_cpu":0.5,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-g10.json b/evidence/track1/superseded/run2-host-client/profile-g10.json new file mode 100644 index 00000000..e8223f75 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-g10.json @@ -0,0 +1 @@ +{"label":"g10","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-g15.json b/evidence/track1/superseded/run2-host-client/profile-g15.json new file mode 100644 index 00000000..7acdf277 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-g15.json @@ -0,0 +1 @@ +{"label":"g15","replicas":2,"total_cpu":1.5,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-lb1cpu.json b/evidence/track1/superseded/run2-host-client/profile-lb1cpu.json new file mode 100644 index 00000000..9a24d7fb --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-lb1cpu.json @@ -0,0 +1 @@ +{"label":"lb1cpu","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"1.00"} diff --git a/evidence/track1/superseded/run2-host-client/profile-pool10.json b/evidence/track1/superseded/run2-host-client/profile-pool10.json new file mode 100644 index 00000000..0ec200df --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-pool10.json @@ -0,0 +1 @@ +{"label":"pool10","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-pool5.json b/evidence/track1/superseded/run2-host-client/profile-pool5.json new file mode 100644 index 00000000..032ed563 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-pool5.json @@ -0,0 +1 @@ +{"label":"pool5","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":5,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-r1.json b/evidence/track1/superseded/run2-host-client/profile-r1.json new file mode 100644 index 00000000..2c96e28e --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-r1.json @@ -0,0 +1 @@ +{"label":"r1","replicas":1,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-r2.json b/evidence/track1/superseded/run2-host-client/profile-r2.json new file mode 100644 index 00000000..10661ad5 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-r2.json @@ -0,0 +1 @@ +{"label":"r2","replicas":2,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/profile-r4.json b/evidence/track1/superseded/run2-host-client/profile-r4.json new file mode 100644 index 00000000..fde157cc --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/profile-r4.json @@ -0,0 +1 @@ +{"label":"r4","replicas":4,"total_cpu":1.0,"total_mem_mb":768,"duration":60,"concurrency":8,"warmup":15,"postgres_cpu_limit":"0.50","postgres_mem_limit":"384M","postgres_max_conns":10,"lb_cpu_limit":"0.25"} diff --git a/evidence/track1/superseded/run2-host-client/scaling-fixed-budget.png b/evidence/track1/superseded/run2-host-client/scaling-fixed-budget.png new file mode 100644 index 00000000..8c258650 Binary files /dev/null and b/evidence/track1/superseded/run2-host-client/scaling-fixed-budget.png differ diff --git a/evidence/track1/superseded/run2-host-client/scaling-growth.png b/evidence/track1/superseded/run2-host-client/scaling-growth.png new file mode 100644 index 00000000..4c205040 Binary files /dev/null and b/evidence/track1/superseded/run2-host-client/scaling-growth.png differ diff --git a/evidence/track1/superseded/run2-host-client/stats-db1cpu.csv b/evidence/track1/superseded/run2-host-client/stats-db1cpu.csv new file mode 100644 index 00000000..622f33ca --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-db1cpu.csv @@ -0,0 +1,148 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:09:18Z,mtusi-messenger-lab3-api-1,20.75%,170.2MiB / 384MiB +2026-10-16T18:09:18Z,mtusi-messenger-lab3-api-2,20.69%,169.8MiB / 384MiB +2026-10-16T18:09:18Z,mtusi-messenger-lab3-postgres-1,54.39%,78.59MiB / 384MiB +2026-10-16T18:09:18Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:18Z,mtusi-messenger-lab2-redis-1,0.64%,9.004MiB / 1.913GiB +2026-10-16T18:09:18Z,mtusi-messenger-lab3-lb-1,16.76%,11.65MiB / 64MiB +2026-10-16T18:09:18Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:09:21Z,mtusi-messenger-lab3-api-1,21.82%,17.21MiB / 384MiB +2026-10-16T18:09:21Z,mtusi-messenger-lab3-api-2,22.12%,11.14MiB / 384MiB +2026-10-16T18:09:21Z,mtusi-messenger-lab3-postgres-1,53.73%,80.95MiB / 384MiB +2026-10-16T18:09:21Z,mtusi-messenger-lab2-postgres-1,0.68%,178.3MiB / 1.913GiB +2026-10-16T18:09:21Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:09:21Z,mtusi-messenger-lab3-lb-1,16.45%,11.64MiB / 64MiB +2026-10-16T18:09:21Z,mtusi-messenger-lab3-redis-1,0.75%,3.863MiB / 192MiB +2026-10-16T18:09:24Z,mtusi-messenger-lab3-api-1,22.20%,11.01MiB / 384MiB +2026-10-16T18:09:24Z,mtusi-messenger-lab3-api-2,21.88%,10.99MiB / 384MiB +2026-10-16T18:09:24Z,mtusi-messenger-lab3-postgres-1,56.71%,84.23MiB / 384MiB +2026-10-16T18:09:24Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:24Z,mtusi-messenger-lab2-redis-1,0.70%,9.004MiB / 1.913GiB +2026-10-16T18:09:24Z,mtusi-messenger-lab3-lb-1,17.04%,11.64MiB / 64MiB +2026-10-16T18:09:24Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:09:27Z,mtusi-messenger-lab3-api-1,21.73%,10.91MiB / 384MiB +2026-10-16T18:09:27Z,mtusi-messenger-lab3-api-2,22.04%,10.89MiB / 384MiB +2026-10-16T18:09:27Z,mtusi-messenger-lab3-postgres-1,56.87%,86.43MiB / 384MiB +2026-10-16T18:09:27Z,mtusi-messenger-lab2-postgres-1,0.20%,178.3MiB / 1.913GiB +2026-10-16T18:09:27Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:09:27Z,mtusi-messenger-lab3-lb-1,16.74%,11.66MiB / 64MiB +2026-10-16T18:09:27Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:09:30Z,mtusi-messenger-lab3-api-1,0.04%,10.88MiB / 384MiB +2026-10-16T18:09:30Z,mtusi-messenger-lab3-api-2,0.03%,10.88MiB / 384MiB +2026-10-16T18:09:30Z,mtusi-messenger-lab3-postgres-1,0.04%,88.96MiB / 384MiB +2026-10-16T18:09:30Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:30Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:09:30Z,mtusi-messenger-lab3-lb-1,0.05%,11.59MiB / 64MiB +2026-10-16T18:09:30Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:09:33Z,mtusi-messenger-lab3-api-1,0.00%,10.88MiB / 384MiB +2026-10-16T18:09:33Z,mtusi-messenger-lab3-api-2,0.00%,10.87MiB / 384MiB +2026-10-16T18:09:33Z,mtusi-messenger-lab3-postgres-1,0.02%,88.96MiB / 384MiB +2026-10-16T18:09:33Z,mtusi-messenger-lab2-postgres-1,0.01%,178.3MiB / 1.913GiB +2026-10-16T18:09:33Z,mtusi-messenger-lab2-redis-1,0.71%,9.004MiB / 1.913GiB +2026-10-16T18:09:33Z,mtusi-messenger-lab3-lb-1,0.70%,11.59MiB / 64MiB +2026-10-16T18:09:33Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:09:36Z,mtusi-messenger-lab3-api-1,21.93%,11.05MiB / 384MiB +2026-10-16T18:09:36Z,mtusi-messenger-lab3-api-2,21.72%,10.93MiB / 384MiB +2026-10-16T18:09:36Z,mtusi-messenger-lab3-postgres-1,54.56%,92MiB / 384MiB +2026-10-16T18:09:36Z,mtusi-messenger-lab2-postgres-1,0.74%,178.3MiB / 1.913GiB +2026-10-16T18:09:36Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:09:36Z,mtusi-messenger-lab3-lb-1,16.85%,11.64MiB / 64MiB +2026-10-16T18:09:36Z,mtusi-messenger-lab3-redis-1,0.65%,3.863MiB / 192MiB +2026-10-16T18:09:39Z,mtusi-messenger-lab3-api-1,20.64%,10.93MiB / 384MiB +2026-10-16T18:09:39Z,mtusi-messenger-lab3-api-2,21.08%,10.86MiB / 384MiB +2026-10-16T18:09:39Z,mtusi-messenger-lab3-postgres-1,62.54%,99.2MiB / 384MiB +2026-10-16T18:09:39Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:39Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:09:39Z,mtusi-messenger-lab3-lb-1,15.84%,11.64MiB / 64MiB +2026-10-16T18:09:39Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:09:42Z,mtusi-messenger-lab3-api-1,20.93%,10.97MiB / 384MiB +2026-10-16T18:09:42Z,mtusi-messenger-lab3-api-2,20.85%,10.86MiB / 384MiB +2026-10-16T18:09:42Z,mtusi-messenger-lab3-postgres-1,58.24%,105MiB / 384MiB +2026-10-16T18:09:42Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:42Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:09:42Z,mtusi-messenger-lab3-lb-1,15.45%,11.65MiB / 64MiB +2026-10-16T18:09:42Z,mtusi-messenger-lab3-redis-1,0.68%,3.863MiB / 192MiB +2026-10-16T18:09:45Z,mtusi-messenger-lab3-api-1,19.36%,10.96MiB / 384MiB +2026-10-16T18:09:45Z,mtusi-messenger-lab3-api-2,18.97%,10.88MiB / 384MiB +2026-10-16T18:09:45Z,mtusi-messenger-lab3-postgres-1,68.62%,203.6MiB / 384MiB +2026-10-16T18:09:45Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:45Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:09:45Z,mtusi-messenger-lab3-lb-1,14.00%,11.64MiB / 64MiB +2026-10-16T18:09:45Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:09:48Z,mtusi-messenger-lab3-api-1,19.91%,10.95MiB / 384MiB +2026-10-16T18:09:48Z,mtusi-messenger-lab3-api-2,19.97%,10.84MiB / 384MiB +2026-10-16T18:09:48Z,mtusi-messenger-lab3-postgres-1,56.90%,204.4MiB / 384MiB +2026-10-16T18:09:48Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:48Z,mtusi-messenger-lab2-redis-1,0.72%,9.004MiB / 1.913GiB +2026-10-16T18:09:48Z,mtusi-messenger-lab3-lb-1,15.67%,11.65MiB / 64MiB +2026-10-16T18:09:48Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:09:51Z,mtusi-messenger-lab3-api-1,20.80%,10.99MiB / 384MiB +2026-10-16T18:09:51Z,mtusi-messenger-lab3-api-2,19.52%,10.74MiB / 384MiB +2026-10-16T18:09:51Z,mtusi-messenger-lab3-postgres-1,55.90%,206.1MiB / 384MiB +2026-10-16T18:09:51Z,mtusi-messenger-lab2-postgres-1,1.01%,178.3MiB / 1.913GiB +2026-10-16T18:09:51Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:09:51Z,mtusi-messenger-lab3-lb-1,14.89%,11.65MiB / 64MiB +2026-10-16T18:09:51Z,mtusi-messenger-lab3-redis-1,0.75%,3.863MiB / 192MiB +2026-10-16T18:09:54Z,mtusi-messenger-lab3-api-1,20.93%,10.93MiB / 384MiB +2026-10-16T18:09:54Z,mtusi-messenger-lab3-api-2,21.59%,10.89MiB / 384MiB +2026-10-16T18:09:54Z,mtusi-messenger-lab3-postgres-1,57.25%,206.4MiB / 384MiB +2026-10-16T18:09:54Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:54Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:09:54Z,mtusi-messenger-lab3-lb-1,16.65%,11.64MiB / 64MiB +2026-10-16T18:09:54Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:09:57Z,mtusi-messenger-lab3-api-1,21.66%,10.96MiB / 384MiB +2026-10-16T18:09:57Z,mtusi-messenger-lab3-api-2,21.80%,10.9MiB / 384MiB +2026-10-16T18:09:57Z,mtusi-messenger-lab3-postgres-1,55.22%,206.5MiB / 384MiB +2026-10-16T18:09:57Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:09:57Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:09:57Z,mtusi-messenger-lab3-lb-1,16.30%,11.65MiB / 64MiB +2026-10-16T18:09:57Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:10:01Z,mtusi-messenger-lab3-api-1,21.62%,10.78MiB / 384MiB +2026-10-16T18:10:01Z,mtusi-messenger-lab3-api-2,21.19%,10.71MiB / 384MiB +2026-10-16T18:10:01Z,mtusi-messenger-lab3-postgres-1,54.76%,206.6MiB / 384MiB +2026-10-16T18:10:01Z,mtusi-messenger-lab2-postgres-1,0.68%,178.3MiB / 1.913GiB +2026-10-16T18:10:01Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:10:01Z,mtusi-messenger-lab3-lb-1,16.24%,11.64MiB / 64MiB +2026-10-16T18:10:01Z,mtusi-messenger-lab3-redis-1,0.70%,3.863MiB / 192MiB +2026-10-16T18:10:04Z,mtusi-messenger-lab3-api-1,1.05%,10.79MiB / 384MiB +2026-10-16T18:10:04Z,mtusi-messenger-lab3-api-2,0.79%,10.69MiB / 384MiB +2026-10-16T18:10:04Z,mtusi-messenger-lab3-postgres-1,2.03%,206.5MiB / 384MiB +2026-10-16T18:10:04Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:04Z,mtusi-messenger-lab2-redis-1,0.79%,9.004MiB / 1.913GiB +2026-10-16T18:10:04Z,mtusi-messenger-lab3-lb-1,0.70%,11.59MiB / 64MiB +2026-10-16T18:10:04Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:10:07Z,mtusi-messenger-lab3-api-1,21.30%,10.8MiB / 384MiB +2026-10-16T18:10:07Z,mtusi-messenger-lab3-api-2,20.71%,11.06MiB / 384MiB +2026-10-16T18:10:07Z,mtusi-messenger-lab3-postgres-1,55.48%,206.8MiB / 384MiB +2026-10-16T18:10:07Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:07Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:10:07Z,mtusi-messenger-lab3-lb-1,16.17%,11.65MiB / 64MiB +2026-10-16T18:10:07Z,mtusi-messenger-lab3-redis-1,0.78%,3.863MiB / 192MiB +2026-10-16T18:10:10Z,mtusi-messenger-lab3-api-1,22.12%,10.81MiB / 384MiB +2026-10-16T18:10:10Z,mtusi-messenger-lab3-api-2,21.77%,10.84MiB / 384MiB +2026-10-16T18:10:10Z,mtusi-messenger-lab3-postgres-1,55.82%,206.7MiB / 384MiB +2026-10-16T18:10:10Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:10Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:10:10Z,mtusi-messenger-lab3-lb-1,16.80%,11.66MiB / 64MiB +2026-10-16T18:10:10Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:10:13Z,mtusi-messenger-lab3-api-1,21.75%,10.93MiB / 384MiB +2026-10-16T18:10:13Z,mtusi-messenger-lab3-api-2,20.98%,10.83MiB / 384MiB +2026-10-16T18:10:13Z,mtusi-messenger-lab3-postgres-1,52.41%,206.9MiB / 384MiB +2026-10-16T18:10:13Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:13Z,mtusi-messenger-lab2-redis-1,0.70%,9.004MiB / 1.913GiB +2026-10-16T18:10:13Z,mtusi-messenger-lab3-lb-1,16.23%,11.64MiB / 64MiB +2026-10-16T18:10:13Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:10:16Z,mtusi-messenger-lab3-api-1,21.86%,10.93MiB / 384MiB +2026-10-16T18:10:16Z,mtusi-messenger-lab3-api-2,21.38%,10.86MiB / 384MiB +2026-10-16T18:10:16Z,mtusi-messenger-lab3-postgres-1,55.63%,206.7MiB / 384MiB +2026-10-16T18:10:16Z,mtusi-messenger-lab2-postgres-1,0.74%,178.3MiB / 1.913GiB +2026-10-16T18:10:16Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:10:16Z,mtusi-messenger-lab3-lb-1,16.62%,11.65MiB / 64MiB +2026-10-16T18:10:16Z,mtusi-messenger-lab3-redis-1,0.70%,3.863MiB / 192MiB +2026-10-16T18:10:19Z,mtusi-messenger-lab3-api-1,0.16%,10.78MiB / 384MiB +2026-10-16T18:10:19Z,mtusi-messenger-lab3-api-2,0.13%,10.85MiB / 384MiB +2026-10-16T18:10:19Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:19Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:10:19Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:10:19Z,mtusi-messenger-lab3-postgres-1,0.63%,27.27MiB / 384MiB +2026-10-16T18:10:19Z,mtusi-messenger-lab3-lb-1,12.40%,13.32MiB / 64MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-g05.csv b/evidence/track1/superseded/run2-host-client/stats-g05.csv new file mode 100644 index 00000000..b6c31647 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-g05.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:02:39Z,mtusi-messenger-lab3-api-2,17.79%,81.74MiB / 384MiB +2026-10-16T18:02:39Z,mtusi-messenger-lab3-api-1,14.52%,146.2MiB / 384MiB +2026-10-16T18:02:39Z,mtusi-messenger-lab3-postgres-1,26.96%,182MiB / 384MiB +2026-10-16T18:02:39Z,mtusi-messenger-lab2-postgres-1,0.83%,240.6MiB / 1.913GiB +2026-10-16T18:02:39Z,mtusi-messenger-lab2-redis-1,0.30%,9.004MiB / 1.913GiB +2026-10-16T18:02:39Z,mtusi-messenger-lab3-lb-1,7.91%,11.58MiB / 64MiB +2026-10-16T18:02:39Z,mtusi-messenger-lab3-redis-1,0.43%,3.863MiB / 192MiB +2026-10-16T18:02:42Z,mtusi-messenger-lab3-api-2,19.58%,133.9MiB / 384MiB +2026-10-16T18:02:42Z,mtusi-messenger-lab3-api-1,18.81%,130.7MiB / 384MiB +2026-10-16T18:02:42Z,mtusi-messenger-lab3-postgres-1,50.34%,182.1MiB / 384MiB +2026-10-16T18:02:42Z,mtusi-messenger-lab2-postgres-1,0.00%,240.6MiB / 1.913GiB +2026-10-16T18:02:42Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:02:42Z,mtusi-messenger-lab3-lb-1,14.39%,11.58MiB / 64MiB +2026-10-16T18:02:42Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:02:45Z,mtusi-messenger-lab3-api-2,18.45%,13.5MiB / 384MiB +2026-10-16T18:02:45Z,mtusi-messenger-lab3-api-1,17.91%,11.21MiB / 384MiB +2026-10-16T18:02:45Z,mtusi-messenger-lab3-postgres-1,49.64%,182.3MiB / 384MiB +2026-10-16T18:02:45Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:02:45Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:02:45Z,mtusi-messenger-lab3-lb-1,14.37%,11.57MiB / 64MiB +2026-10-16T18:02:45Z,mtusi-messenger-lab3-redis-1,0.66%,3.863MiB / 192MiB +2026-10-16T18:02:48Z,mtusi-messenger-lab3-api-2,17.88%,13.57MiB / 384MiB +2026-10-16T18:02:48Z,mtusi-messenger-lab3-api-1,17.90%,11.23MiB / 384MiB +2026-10-16T18:02:48Z,mtusi-messenger-lab3-postgres-1,50.01%,184.2MiB / 384MiB +2026-10-16T18:02:48Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:02:48Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:02:48Z,mtusi-messenger-lab3-lb-1,14.38%,11.54MiB / 64MiB +2026-10-16T18:02:48Z,mtusi-messenger-lab3-redis-1,0.64%,3.863MiB / 192MiB +2026-10-16T18:02:51Z,mtusi-messenger-lab3-api-2,16.80%,13.45MiB / 384MiB +2026-10-16T18:02:51Z,mtusi-messenger-lab3-api-1,15.83%,11.26MiB / 384MiB +2026-10-16T18:02:51Z,mtusi-messenger-lab3-postgres-1,49.20%,185.6MiB / 384MiB +2026-10-16T18:02:51Z,mtusi-messenger-lab2-postgres-1,0.22%,240.5MiB / 1.913GiB +2026-10-16T18:02:51Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:02:51Z,mtusi-messenger-lab3-lb-1,12.11%,11.57MiB / 64MiB +2026-10-16T18:02:51Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:02:54Z,mtusi-messenger-lab3-api-2,15.10%,13.66MiB / 384MiB +2026-10-16T18:02:54Z,mtusi-messenger-lab3-api-1,15.35%,11.18MiB / 384MiB +2026-10-16T18:02:54Z,mtusi-messenger-lab3-postgres-1,49.94%,195.8MiB / 384MiB +2026-10-16T18:02:54Z,mtusi-messenger-lab2-postgres-1,0.74%,240.5MiB / 1.913GiB +2026-10-16T18:02:54Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:02:54Z,mtusi-messenger-lab3-lb-1,11.04%,11.57MiB / 64MiB +2026-10-16T18:02:54Z,mtusi-messenger-lab3-redis-1,0.19%,3.863MiB / 192MiB +2026-10-16T18:02:57Z,mtusi-messenger-lab3-api-2,16.69%,13.17MiB / 384MiB +2026-10-16T18:02:57Z,mtusi-messenger-lab3-api-1,16.46%,11.18MiB / 384MiB +2026-10-16T18:02:57Z,mtusi-messenger-lab3-postgres-1,50.32%,187.2MiB / 384MiB +2026-10-16T18:02:57Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:02:57Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:02:57Z,mtusi-messenger-lab3-lb-1,12.14%,11.57MiB / 64MiB +2026-10-16T18:02:57Z,mtusi-messenger-lab3-redis-1,0.19%,3.863MiB / 192MiB +2026-10-16T18:03:00Z,mtusi-messenger-lab3-api-2,14.82%,13.5MiB / 384MiB +2026-10-16T18:03:00Z,mtusi-messenger-lab3-api-1,13.04%,11.27MiB / 384MiB +2026-10-16T18:03:00Z,mtusi-messenger-lab3-postgres-1,49.80%,195.5MiB / 384MiB +2026-10-16T18:03:00Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:00Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:03:00Z,mtusi-messenger-lab3-lb-1,9.39%,11.57MiB / 64MiB +2026-10-16T18:03:00Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:03:04Z,mtusi-messenger-lab3-api-2,17.88%,13.25MiB / 384MiB +2026-10-16T18:03:04Z,mtusi-messenger-lab3-api-1,17.71%,11.2MiB / 384MiB +2026-10-16T18:03:04Z,mtusi-messenger-lab3-postgres-1,48.96%,186.1MiB / 384MiB +2026-10-16T18:03:04Z,mtusi-messenger-lab2-postgres-1,0.70%,240.5MiB / 1.913GiB +2026-10-16T18:03:04Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:03:04Z,mtusi-messenger-lab3-lb-1,13.68%,11.57MiB / 64MiB +2026-10-16T18:03:04Z,mtusi-messenger-lab3-redis-1,0.71%,3.863MiB / 192MiB +2026-10-16T18:03:07Z,mtusi-messenger-lab3-api-2,17.74%,13.3MiB / 384MiB +2026-10-16T18:03:07Z,mtusi-messenger-lab3-api-1,18.10%,11.32MiB / 384MiB +2026-10-16T18:03:07Z,mtusi-messenger-lab3-postgres-1,49.83%,186.6MiB / 384MiB +2026-10-16T18:03:07Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:07Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:03:07Z,mtusi-messenger-lab3-lb-1,13.22%,11.56MiB / 64MiB +2026-10-16T18:03:07Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:03:10Z,mtusi-messenger-lab3-api-2,19.22%,13.18MiB / 384MiB +2026-10-16T18:03:10Z,mtusi-messenger-lab3-api-1,18.91%,10.92MiB / 384MiB +2026-10-16T18:03:10Z,mtusi-messenger-lab3-postgres-1,50.71%,187.1MiB / 384MiB +2026-10-16T18:03:10Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:10Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:03:10Z,mtusi-messenger-lab3-lb-1,14.24%,11.57MiB / 64MiB +2026-10-16T18:03:10Z,mtusi-messenger-lab3-redis-1,0.73%,3.863MiB / 192MiB +2026-10-16T18:03:13Z,mtusi-messenger-lab3-api-2,17.91%,13.36MiB / 384MiB +2026-10-16T18:03:13Z,mtusi-messenger-lab3-api-1,18.45%,11.18MiB / 384MiB +2026-10-16T18:03:13Z,mtusi-messenger-lab3-postgres-1,49.05%,187.4MiB / 384MiB +2026-10-16T18:03:13Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:13Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:03:13Z,mtusi-messenger-lab3-lb-1,13.90%,11.57MiB / 64MiB +2026-10-16T18:03:13Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:03:16Z,mtusi-messenger-lab3-api-2,18.09%,13.3MiB / 384MiB +2026-10-16T18:03:16Z,mtusi-messenger-lab3-api-1,18.66%,11.28MiB / 384MiB +2026-10-16T18:03:16Z,mtusi-messenger-lab3-postgres-1,48.96%,187.9MiB / 384MiB +2026-10-16T18:03:16Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:16Z,mtusi-messenger-lab2-redis-1,0.72%,9.004MiB / 1.913GiB +2026-10-16T18:03:16Z,mtusi-messenger-lab3-lb-1,13.32%,11.8MiB / 64MiB +2026-10-16T18:03:16Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:03:19Z,mtusi-messenger-lab3-api-2,18.19%,13.39MiB / 384MiB +2026-10-16T18:03:19Z,mtusi-messenger-lab3-api-1,18.10%,11.25MiB / 384MiB +2026-10-16T18:03:19Z,mtusi-messenger-lab3-postgres-1,49.45%,188MiB / 384MiB +2026-10-16T18:03:19Z,mtusi-messenger-lab2-postgres-1,0.73%,240.5MiB / 1.913GiB +2026-10-16T18:03:19Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:03:19Z,mtusi-messenger-lab3-lb-1,13.70%,11.57MiB / 64MiB +2026-10-16T18:03:19Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:03:22Z,mtusi-messenger-lab3-api-2,18.66%,13.22MiB / 384MiB +2026-10-16T18:03:22Z,mtusi-messenger-lab3-api-1,19.62%,11.25MiB / 384MiB +2026-10-16T18:03:22Z,mtusi-messenger-lab3-postgres-1,49.69%,188.3MiB / 384MiB +2026-10-16T18:03:22Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:22Z,mtusi-messenger-lab2-redis-1,0.76%,9.004MiB / 1.913GiB +2026-10-16T18:03:22Z,mtusi-messenger-lab3-lb-1,14.28%,11.56MiB / 64MiB +2026-10-16T18:03:22Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:03:25Z,mtusi-messenger-lab3-api-2,18.62%,13.34MiB / 384MiB +2026-10-16T18:03:25Z,mtusi-messenger-lab3-api-1,18.39%,11.25MiB / 384MiB +2026-10-16T18:03:25Z,mtusi-messenger-lab3-postgres-1,50.11%,188.4MiB / 384MiB +2026-10-16T18:03:25Z,mtusi-messenger-lab2-postgres-1,0.00%,240.6MiB / 1.913GiB +2026-10-16T18:03:25Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:03:25Z,mtusi-messenger-lab3-lb-1,14.14%,11.57MiB / 64MiB +2026-10-16T18:03:25Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:03:28Z,mtusi-messenger-lab3-api-2,16.59%,13.24MiB / 384MiB +2026-10-16T18:03:28Z,mtusi-messenger-lab3-api-1,15.98%,11.23MiB / 384MiB +2026-10-16T18:03:28Z,mtusi-messenger-lab3-postgres-1,43.46%,188.6MiB / 384MiB +2026-10-16T18:03:28Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:28Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:03:28Z,mtusi-messenger-lab3-lb-1,12.25%,11.57MiB / 64MiB +2026-10-16T18:03:28Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:03:31Z,mtusi-messenger-lab3-api-2,18.66%,13.45MiB / 384MiB +2026-10-16T18:03:31Z,mtusi-messenger-lab3-api-1,19.18%,13.6MiB / 384MiB +2026-10-16T18:03:31Z,mtusi-messenger-lab3-postgres-1,49.64%,188.8MiB / 384MiB +2026-10-16T18:03:31Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:31Z,mtusi-messenger-lab2-redis-1,0.66%,9.004MiB / 1.913GiB +2026-10-16T18:03:31Z,mtusi-messenger-lab3-lb-1,14.05%,11.58MiB / 64MiB +2026-10-16T18:03:31Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:03:34Z,mtusi-messenger-lab3-api-2,19.13%,13.44MiB / 384MiB +2026-10-16T18:03:34Z,mtusi-messenger-lab3-api-1,18.16%,11.23MiB / 384MiB +2026-10-16T18:03:34Z,mtusi-messenger-lab3-postgres-1,48.37%,188.8MiB / 384MiB +2026-10-16T18:03:34Z,mtusi-messenger-lab2-postgres-1,0.79%,240.5MiB / 1.913GiB +2026-10-16T18:03:34Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:03:34Z,mtusi-messenger-lab3-lb-1,13.94%,11.57MiB / 64MiB +2026-10-16T18:03:34Z,mtusi-messenger-lab3-redis-1,0.70%,3.863MiB / 192MiB +2026-10-16T18:03:37Z,mtusi-messenger-lab3-api-2,17.44%,13.33MiB / 384MiB +2026-10-16T18:03:37Z,mtusi-messenger-lab3-api-1,18.33%,11.23MiB / 384MiB +2026-10-16T18:03:37Z,mtusi-messenger-lab3-postgres-1,47.73%,189.2MiB / 384MiB +2026-10-16T18:03:37Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:37Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:03:37Z,mtusi-messenger-lab3-lb-1,13.68%,11.57MiB / 64MiB +2026-10-16T18:03:37Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-g10.csv b/evidence/track1/superseded/run2-host-client/stats-g10.csv new file mode 100644 index 00000000..aa406191 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-g10.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:03:58Z,mtusi-messenger-lab3-api-2,18.80%,168.3MiB / 384MiB +2026-10-16T18:03:58Z,mtusi-messenger-lab3-api-1,19.24%,168.4MiB / 384MiB +2026-10-16T18:03:58Z,mtusi-messenger-lab3-postgres-1,50.84%,197.8MiB / 384MiB +2026-10-16T18:03:58Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:03:58Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:03:58Z,mtusi-messenger-lab3-lb-1,10.95%,11.57MiB / 64MiB +2026-10-16T18:03:58Z,mtusi-messenger-lab3-redis-1,0.81%,3.863MiB / 192MiB +2026-10-16T18:04:02Z,mtusi-messenger-lab3-api-2,19.42%,11.03MiB / 384MiB +2026-10-16T18:04:02Z,mtusi-messenger-lab3-api-1,19.30%,11.29MiB / 384MiB +2026-10-16T18:04:02Z,mtusi-messenger-lab3-postgres-1,50.68%,192.2MiB / 384MiB +2026-10-16T18:04:02Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:02Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:04:02Z,mtusi-messenger-lab3-lb-1,14.56%,11.57MiB / 64MiB +2026-10-16T18:04:02Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:04:05Z,mtusi-messenger-lab3-api-2,19.04%,10.98MiB / 384MiB +2026-10-16T18:04:05Z,mtusi-messenger-lab3-api-1,19.86%,11.09MiB / 384MiB +2026-10-16T18:04:05Z,mtusi-messenger-lab3-postgres-1,50.45%,192.2MiB / 384MiB +2026-10-16T18:04:05Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:05Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:05Z,mtusi-messenger-lab3-lb-1,14.70%,11.58MiB / 64MiB +2026-10-16T18:04:05Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:04:08Z,mtusi-messenger-lab3-api-2,19.61%,11.22MiB / 384MiB +2026-10-16T18:04:08Z,mtusi-messenger-lab3-api-1,19.10%,11.06MiB / 384MiB +2026-10-16T18:04:08Z,mtusi-messenger-lab3-postgres-1,49.85%,192.4MiB / 384MiB +2026-10-16T18:04:08Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:08Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:04:08Z,mtusi-messenger-lab3-lb-1,14.61%,11.57MiB / 64MiB +2026-10-16T18:04:08Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:04:11Z,mtusi-messenger-lab3-api-2,19.50%,11.04MiB / 384MiB +2026-10-16T18:04:11Z,mtusi-messenger-lab3-api-1,19.18%,11MiB / 384MiB +2026-10-16T18:04:11Z,mtusi-messenger-lab3-postgres-1,50.13%,192.8MiB / 384MiB +2026-10-16T18:04:11Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:11Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:04:11Z,mtusi-messenger-lab3-lb-1,14.52%,11.57MiB / 64MiB +2026-10-16T18:04:11Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:04:14Z,mtusi-messenger-lab3-api-2,14.52%,11.29MiB / 384MiB +2026-10-16T18:04:14Z,mtusi-messenger-lab3-api-1,15.10%,11MiB / 384MiB +2026-10-16T18:04:14Z,mtusi-messenger-lab3-postgres-1,37.84%,193MiB / 384MiB +2026-10-16T18:04:14Z,mtusi-messenger-lab2-postgres-1,0.80%,240.5MiB / 1.913GiB +2026-10-16T18:04:14Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:14Z,mtusi-messenger-lab3-lb-1,11.29%,11.57MiB / 64MiB +2026-10-16T18:04:14Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:04:17Z,mtusi-messenger-lab3-api-2,20.19%,11.09MiB / 384MiB +2026-10-16T18:04:17Z,mtusi-messenger-lab3-api-1,19.71%,11MiB / 384MiB +2026-10-16T18:04:17Z,mtusi-messenger-lab3-postgres-1,50.46%,193.5MiB / 384MiB +2026-10-16T18:04:17Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:17Z,mtusi-messenger-lab2-redis-1,0.71%,9.004MiB / 1.913GiB +2026-10-16T18:04:17Z,mtusi-messenger-lab3-lb-1,14.72%,11.58MiB / 64MiB +2026-10-16T18:04:17Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:04:20Z,mtusi-messenger-lab3-api-2,19.00%,11.19MiB / 384MiB +2026-10-16T18:04:20Z,mtusi-messenger-lab3-api-1,18.60%,11.09MiB / 384MiB +2026-10-16T18:04:20Z,mtusi-messenger-lab3-postgres-1,48.99%,193.5MiB / 384MiB +2026-10-16T18:04:20Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:20Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:20Z,mtusi-messenger-lab3-lb-1,14.50%,11.57MiB / 64MiB +2026-10-16T18:04:20Z,mtusi-messenger-lab3-redis-1,0.74%,3.863MiB / 192MiB +2026-10-16T18:04:23Z,mtusi-messenger-lab3-api-2,17.52%,11.46MiB / 384MiB +2026-10-16T18:04:23Z,mtusi-messenger-lab3-api-1,19.76%,11.11MiB / 384MiB +2026-10-16T18:04:23Z,mtusi-messenger-lab3-postgres-1,43.80%,193.8MiB / 384MiB +2026-10-16T18:04:23Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:23Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:23Z,mtusi-messenger-lab3-lb-1,13.19%,11.52MiB / 64MiB +2026-10-16T18:04:23Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:04:26Z,mtusi-messenger-lab3-api-2,19.86%,10.97MiB / 384MiB +2026-10-16T18:04:26Z,mtusi-messenger-lab3-api-1,19.28%,11.01MiB / 384MiB +2026-10-16T18:04:26Z,mtusi-messenger-lab3-postgres-1,50.53%,194MiB / 384MiB +2026-10-16T18:04:26Z,mtusi-messenger-lab2-postgres-1,0.24%,240.5MiB / 1.913GiB +2026-10-16T18:04:26Z,mtusi-messenger-lab2-redis-1,0.68%,9.004MiB / 1.913GiB +2026-10-16T18:04:26Z,mtusi-messenger-lab3-lb-1,14.46%,11.57MiB / 64MiB +2026-10-16T18:04:26Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:04:29Z,mtusi-messenger-lab3-api-2,18.86%,11.22MiB / 384MiB +2026-10-16T18:04:29Z,mtusi-messenger-lab3-api-1,19.31%,11.09MiB / 384MiB +2026-10-16T18:04:29Z,mtusi-messenger-lab3-postgres-1,49.22%,194.2MiB / 384MiB +2026-10-16T18:04:29Z,mtusi-messenger-lab2-postgres-1,0.73%,240.5MiB / 1.913GiB +2026-10-16T18:04:29Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:29Z,mtusi-messenger-lab3-lb-1,14.58%,11.57MiB / 64MiB +2026-10-16T18:04:29Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:04:32Z,mtusi-messenger-lab3-api-2,17.91%,11.14MiB / 384MiB +2026-10-16T18:04:32Z,mtusi-messenger-lab3-api-1,14.49%,11.06MiB / 384MiB +2026-10-16T18:04:32Z,mtusi-messenger-lab3-postgres-1,36.01%,194.8MiB / 384MiB +2026-10-16T18:04:32Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:32Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:04:32Z,mtusi-messenger-lab3-lb-1,10.69%,11.58MiB / 64MiB +2026-10-16T18:04:32Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:04:35Z,mtusi-messenger-lab3-api-2,19.32%,11.29MiB / 384MiB +2026-10-16T18:04:35Z,mtusi-messenger-lab3-api-1,19.87%,11.05MiB / 384MiB +2026-10-16T18:04:35Z,mtusi-messenger-lab3-postgres-1,49.86%,194.8MiB / 384MiB +2026-10-16T18:04:35Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:35Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:35Z,mtusi-messenger-lab3-lb-1,14.82%,11.58MiB / 64MiB +2026-10-16T18:04:35Z,mtusi-messenger-lab3-redis-1,0.69%,3.863MiB / 192MiB +2026-10-16T18:04:38Z,mtusi-messenger-lab3-api-2,19.18%,11.07MiB / 384MiB +2026-10-16T18:04:38Z,mtusi-messenger-lab3-api-1,19.71%,11.13MiB / 384MiB +2026-10-16T18:04:38Z,mtusi-messenger-lab3-postgres-1,49.73%,195.1MiB / 384MiB +2026-10-16T18:04:38Z,mtusi-messenger-lab2-postgres-1,0.21%,240.5MiB / 1.913GiB +2026-10-16T18:04:38Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:04:38Z,mtusi-messenger-lab3-lb-1,14.71%,11.57MiB / 64MiB +2026-10-16T18:04:38Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:04:42Z,mtusi-messenger-lab3-api-2,19.16%,11.25MiB / 384MiB +2026-10-16T18:04:42Z,mtusi-messenger-lab3-api-1,18.94%,11.12MiB / 384MiB +2026-10-16T18:04:42Z,mtusi-messenger-lab3-postgres-1,50.58%,195.7MiB / 384MiB +2026-10-16T18:04:42Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:42Z,mtusi-messenger-lab2-redis-1,0.70%,9.004MiB / 1.913GiB +2026-10-16T18:04:42Z,mtusi-messenger-lab3-lb-1,14.56%,11.57MiB / 64MiB +2026-10-16T18:04:42Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:04:45Z,mtusi-messenger-lab3-api-2,15.05%,11.41MiB / 384MiB +2026-10-16T18:04:45Z,mtusi-messenger-lab3-api-1,14.81%,11.14MiB / 384MiB +2026-10-16T18:04:45Z,mtusi-messenger-lab3-postgres-1,38.51%,195.9MiB / 384MiB +2026-10-16T18:04:45Z,mtusi-messenger-lab2-postgres-1,0.78%,240.5MiB / 1.913GiB +2026-10-16T18:04:45Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:04:45Z,mtusi-messenger-lab3-lb-1,2.96%,11.52MiB / 64MiB +2026-10-16T18:04:45Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:04:48Z,mtusi-messenger-lab3-api-2,19.00%,11.06MiB / 384MiB +2026-10-16T18:04:48Z,mtusi-messenger-lab3-api-1,18.90%,11.26MiB / 384MiB +2026-10-16T18:04:48Z,mtusi-messenger-lab3-postgres-1,49.71%,196MiB / 384MiB +2026-10-16T18:04:48Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:48Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:04:48Z,mtusi-messenger-lab3-lb-1,14.63%,11.57MiB / 64MiB +2026-10-16T18:04:48Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:04:51Z,mtusi-messenger-lab3-api-2,0.69%,11.42MiB / 384MiB +2026-10-16T18:04:51Z,mtusi-messenger-lab3-api-1,0.60%,10.98MiB / 384MiB +2026-10-16T18:04:51Z,mtusi-messenger-lab3-postgres-1,50.55%,196.3MiB / 384MiB +2026-10-16T18:04:51Z,mtusi-messenger-lab2-postgres-1,0.23%,240.5MiB / 1.913GiB +2026-10-16T18:04:51Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:04:51Z,mtusi-messenger-lab3-lb-1,0.47%,11.52MiB / 64MiB +2026-10-16T18:04:51Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:04:54Z,mtusi-messenger-lab3-api-2,19.30%,11.42MiB / 384MiB +2026-10-16T18:04:54Z,mtusi-messenger-lab3-api-1,19.42%,11.04MiB / 384MiB +2026-10-16T18:04:54Z,mtusi-messenger-lab3-postgres-1,50.00%,196.3MiB / 384MiB +2026-10-16T18:04:54Z,mtusi-messenger-lab2-postgres-1,0.68%,240.5MiB / 1.913GiB +2026-10-16T18:04:54Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:04:54Z,mtusi-messenger-lab3-lb-1,14.52%,11.57MiB / 64MiB +2026-10-16T18:04:54Z,mtusi-messenger-lab3-redis-1,0.71%,3.863MiB / 192MiB +2026-10-16T18:04:57Z,mtusi-messenger-lab3-api-2,11.32%,11MiB / 384MiB +2026-10-16T18:04:57Z,mtusi-messenger-lab3-api-1,11.02%,11.1MiB / 384MiB +2026-10-16T18:04:57Z,mtusi-messenger-lab3-postgres-1,39.14%,207.5MiB / 384MiB +2026-10-16T18:04:57Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:04:57Z,mtusi-messenger-lab2-redis-1,0.70%,9.004MiB / 1.913GiB +2026-10-16T18:04:57Z,mtusi-messenger-lab3-lb-1,8.16%,11.52MiB / 64MiB +2026-10-16T18:04:57Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-g15.csv b/evidence/track1/superseded/run2-host-client/stats-g15.csv new file mode 100644 index 00000000..2bd6d5fb --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-g15.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:05:16Z,mtusi-messenger-lab3-api-2,18.49%,168MiB / 384MiB +2026-10-16T18:05:16Z,mtusi-messenger-lab3-api-1,18.28%,103.5MiB / 384MiB +2026-10-16T18:05:16Z,mtusi-messenger-lab3-postgres-1,49.31%,191.3MiB / 384MiB +2026-10-16T18:05:16Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:16Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:05:16Z,mtusi-messenger-lab3-lb-1,14.57%,11.57MiB / 64MiB +2026-10-16T18:05:16Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:05:19Z,mtusi-messenger-lab3-api-2,19.49%,11.12MiB / 384MiB +2026-10-16T18:05:19Z,mtusi-messenger-lab3-api-1,19.62%,10.96MiB / 384MiB +2026-10-16T18:05:19Z,mtusi-messenger-lab3-postgres-1,49.52%,192.3MiB / 384MiB +2026-10-16T18:05:19Z,mtusi-messenger-lab2-postgres-1,0.79%,240.5MiB / 1.913GiB +2026-10-16T18:05:19Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:05:19Z,mtusi-messenger-lab3-lb-1,13.96%,11.59MiB / 64MiB +2026-10-16T18:05:19Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:05:22Z,mtusi-messenger-lab3-api-2,19.25%,11.14MiB / 384MiB +2026-10-16T18:05:22Z,mtusi-messenger-lab3-api-1,18.85%,11MiB / 384MiB +2026-10-16T18:05:22Z,mtusi-messenger-lab3-postgres-1,50.12%,192.2MiB / 384MiB +2026-10-16T18:05:22Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:22Z,mtusi-messenger-lab2-redis-1,0.68%,9.004MiB / 1.913GiB +2026-10-16T18:05:22Z,mtusi-messenger-lab3-lb-1,14.28%,11.59MiB / 64MiB +2026-10-16T18:05:22Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:05:25Z,mtusi-messenger-lab3-api-2,19.31%,10.96MiB / 384MiB +2026-10-16T18:05:25Z,mtusi-messenger-lab3-api-1,19.62%,10.82MiB / 384MiB +2026-10-16T18:05:25Z,mtusi-messenger-lab3-postgres-1,50.26%,192.5MiB / 384MiB +2026-10-16T18:05:25Z,mtusi-messenger-lab2-postgres-1,0.71%,240.5MiB / 1.913GiB +2026-10-16T18:05:25Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:05:25Z,mtusi-messenger-lab3-lb-1,14.36%,11.57MiB / 64MiB +2026-10-16T18:05:25Z,mtusi-messenger-lab3-redis-1,0.19%,3.863MiB / 192MiB +2026-10-16T18:05:28Z,mtusi-messenger-lab3-api-2,15.99%,11.09MiB / 384MiB +2026-10-16T18:05:28Z,mtusi-messenger-lab3-api-1,16.11%,10.94MiB / 384MiB +2026-10-16T18:05:28Z,mtusi-messenger-lab3-postgres-1,40.57%,192.7MiB / 384MiB +2026-10-16T18:05:28Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:28Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:05:28Z,mtusi-messenger-lab3-lb-1,12.21%,11.52MiB / 64MiB +2026-10-16T18:05:28Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:05:31Z,mtusi-messenger-lab3-api-2,19.42%,11.04MiB / 384MiB +2026-10-16T18:05:31Z,mtusi-messenger-lab3-api-1,19.63%,10.88MiB / 384MiB +2026-10-16T18:05:31Z,mtusi-messenger-lab3-postgres-1,49.72%,193MiB / 384MiB +2026-10-16T18:05:31Z,mtusi-messenger-lab2-postgres-1,0.00%,240.6MiB / 1.913GiB +2026-10-16T18:05:31Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:05:31Z,mtusi-messenger-lab3-lb-1,15.01%,11.57MiB / 64MiB +2026-10-16T18:05:31Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:05:34Z,mtusi-messenger-lab3-api-2,19.30%,11.1MiB / 384MiB +2026-10-16T18:05:34Z,mtusi-messenger-lab3-api-1,20.91%,11.06MiB / 384MiB +2026-10-16T18:05:34Z,mtusi-messenger-lab3-postgres-1,50.90%,193.3MiB / 384MiB +2026-10-16T18:05:34Z,mtusi-messenger-lab2-postgres-1,0.74%,240.5MiB / 1.913GiB +2026-10-16T18:05:34Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:05:34Z,mtusi-messenger-lab3-lb-1,15.15%,11.55MiB / 64MiB +2026-10-16T18:05:34Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:05:38Z,mtusi-messenger-lab3-api-2,19.89%,11.09MiB / 384MiB +2026-10-16T18:05:38Z,mtusi-messenger-lab3-api-1,19.51%,11.32MiB / 384MiB +2026-10-16T18:05:38Z,mtusi-messenger-lab3-postgres-1,49.76%,193.5MiB / 384MiB +2026-10-16T18:05:38Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:38Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:05:38Z,mtusi-messenger-lab3-lb-1,15.10%,11.57MiB / 64MiB +2026-10-16T18:05:38Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:05:41Z,mtusi-messenger-lab3-api-2,19.05%,11.04MiB / 384MiB +2026-10-16T18:05:41Z,mtusi-messenger-lab3-api-1,18.38%,10.95MiB / 384MiB +2026-10-16T18:05:41Z,mtusi-messenger-lab3-postgres-1,49.61%,193.9MiB / 384MiB +2026-10-16T18:05:41Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:41Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:05:41Z,mtusi-messenger-lab3-lb-1,14.29%,11.58MiB / 64MiB +2026-10-16T18:05:41Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:05:44Z,mtusi-messenger-lab3-api-2,13.40%,11.05MiB / 384MiB +2026-10-16T18:05:44Z,mtusi-messenger-lab3-api-1,13.86%,11.02MiB / 384MiB +2026-10-16T18:05:44Z,mtusi-messenger-lab3-postgres-1,33.98%,194.2MiB / 384MiB +2026-10-16T18:05:44Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:44Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:05:44Z,mtusi-messenger-lab3-lb-1,9.91%,11.56MiB / 64MiB +2026-10-16T18:05:44Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:05:47Z,mtusi-messenger-lab3-api-2,19.23%,11MiB / 384MiB +2026-10-16T18:05:47Z,mtusi-messenger-lab3-api-1,19.00%,10.95MiB / 384MiB +2026-10-16T18:05:47Z,mtusi-messenger-lab3-postgres-1,50.21%,194.5MiB / 384MiB +2026-10-16T18:05:47Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:47Z,mtusi-messenger-lab2-redis-1,0.69%,9.004MiB / 1.913GiB +2026-10-16T18:05:47Z,mtusi-messenger-lab3-lb-1,14.64%,11.57MiB / 64MiB +2026-10-16T18:05:47Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:05:50Z,mtusi-messenger-lab3-api-2,14.06%,10.88MiB / 384MiB +2026-10-16T18:05:50Z,mtusi-messenger-lab3-api-1,13.96%,10.86MiB / 384MiB +2026-10-16T18:05:50Z,mtusi-messenger-lab3-postgres-1,49.22%,202.6MiB / 384MiB +2026-10-16T18:05:50Z,mtusi-messenger-lab2-postgres-1,0.84%,240.5MiB / 1.913GiB +2026-10-16T18:05:50Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:05:50Z,mtusi-messenger-lab3-lb-1,10.07%,11.57MiB / 64MiB +2026-10-16T18:05:50Z,mtusi-messenger-lab3-redis-1,0.85%,3.863MiB / 192MiB +2026-10-16T18:05:53Z,mtusi-messenger-lab3-api-2,18.04%,10.99MiB / 384MiB +2026-10-16T18:05:53Z,mtusi-messenger-lab3-api-1,18.24%,10.95MiB / 384MiB +2026-10-16T18:05:53Z,mtusi-messenger-lab3-postgres-1,48.45%,195.2MiB / 384MiB +2026-10-16T18:05:53Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:53Z,mtusi-messenger-lab2-redis-1,0.19%,9.004MiB / 1.913GiB +2026-10-16T18:05:53Z,mtusi-messenger-lab3-lb-1,13.54%,11.56MiB / 64MiB +2026-10-16T18:05:53Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:05:56Z,mtusi-messenger-lab3-api-2,19.10%,10.99MiB / 384MiB +2026-10-16T18:05:56Z,mtusi-messenger-lab3-api-1,19.42%,10.86MiB / 384MiB +2026-10-16T18:05:56Z,mtusi-messenger-lab3-postgres-1,49.58%,195.9MiB / 384MiB +2026-10-16T18:05:56Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:56Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:05:56Z,mtusi-messenger-lab3-lb-1,14.43%,11.58MiB / 64MiB +2026-10-16T18:05:56Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:05:59Z,mtusi-messenger-lab3-api-2,19.82%,10.98MiB / 384MiB +2026-10-16T18:05:59Z,mtusi-messenger-lab3-api-1,19.00%,10.85MiB / 384MiB +2026-10-16T18:05:59Z,mtusi-messenger-lab3-postgres-1,50.02%,195.8MiB / 384MiB +2026-10-16T18:05:59Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:05:59Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:05:59Z,mtusi-messenger-lab3-lb-1,14.60%,11.82MiB / 64MiB +2026-10-16T18:05:59Z,mtusi-messenger-lab3-redis-1,0.64%,3.863MiB / 192MiB +2026-10-16T18:06:02Z,mtusi-messenger-lab3-api-2,19.59%,11MiB / 384MiB +2026-10-16T18:06:02Z,mtusi-messenger-lab3-api-1,19.24%,10.87MiB / 384MiB +2026-10-16T18:06:02Z,mtusi-messenger-lab3-postgres-1,50.63%,196.2MiB / 384MiB +2026-10-16T18:06:02Z,mtusi-messenger-lab2-postgres-1,0.22%,240.6MiB / 1.913GiB +2026-10-16T18:06:02Z,mtusi-messenger-lab2-redis-1,0.65%,9.004MiB / 1.913GiB +2026-10-16T18:06:02Z,mtusi-messenger-lab3-lb-1,14.53%,11.57MiB / 64MiB +2026-10-16T18:06:02Z,mtusi-messenger-lab3-redis-1,0.19%,3.863MiB / 192MiB +2026-10-16T18:06:05Z,mtusi-messenger-lab3-api-2,19.83%,11.03MiB / 384MiB +2026-10-16T18:06:05Z,mtusi-messenger-lab3-api-1,19.97%,10.84MiB / 384MiB +2026-10-16T18:06:05Z,mtusi-messenger-lab3-postgres-1,52.01%,196.7MiB / 384MiB +2026-10-16T18:06:05Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:06:05Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:06:05Z,mtusi-messenger-lab3-lb-1,15.34%,11.57MiB / 64MiB +2026-10-16T18:06:05Z,mtusi-messenger-lab3-redis-1,0.66%,3.863MiB / 192MiB +2026-10-16T18:06:08Z,mtusi-messenger-lab3-api-2,19.37%,11.02MiB / 384MiB +2026-10-16T18:06:08Z,mtusi-messenger-lab3-api-1,19.61%,11.07MiB / 384MiB +2026-10-16T18:06:08Z,mtusi-messenger-lab3-postgres-1,50.26%,193.7MiB / 384MiB +2026-10-16T18:06:08Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:06:08Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:06:08Z,mtusi-messenger-lab3-lb-1,14.62%,11.58MiB / 64MiB +2026-10-16T18:06:08Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:06:11Z,mtusi-messenger-lab3-api-2,19.75%,10.96MiB / 384MiB +2026-10-16T18:06:11Z,mtusi-messenger-lab3-api-1,19.44%,10.75MiB / 384MiB +2026-10-16T18:06:11Z,mtusi-messenger-lab3-postgres-1,51.10%,194MiB / 384MiB +2026-10-16T18:06:11Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:06:11Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:06:11Z,mtusi-messenger-lab3-lb-1,15.00%,11.82MiB / 64MiB +2026-10-16T18:06:11Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:06:15Z,mtusi-messenger-lab3-api-2,14.85%,11.04MiB / 384MiB +2026-10-16T18:06:15Z,mtusi-messenger-lab3-api-1,14.65%,10.85MiB / 384MiB +2026-10-16T18:06:15Z,mtusi-messenger-lab3-postgres-1,52.78%,205.6MiB / 384MiB +2026-10-16T18:06:15Z,mtusi-messenger-lab2-postgres-1,0.94%,240.5MiB / 1.913GiB +2026-10-16T18:06:15Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:06:15Z,mtusi-messenger-lab3-lb-1,10.93%,11.52MiB / 64MiB +2026-10-16T18:06:15Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-lb1cpu.csv b/evidence/track1/superseded/run2-host-client/stats-lb1cpu.csv new file mode 100644 index 00000000..14875f01 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-lb1cpu.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:10:38Z,mtusi-messenger-lab3-lb-1,15.35%,13.64MiB / 64MiB +2026-10-16T18:10:38Z,mtusi-messenger-lab3-postgres-1,50.53%,66.22MiB / 384MiB +2026-10-16T18:10:38Z,mtusi-messenger-lab3-api-1,19.61%,168.2MiB / 384MiB +2026-10-16T18:10:38Z,mtusi-messenger-lab3-api-2,19.66%,168MiB / 384MiB +2026-10-16T18:10:38Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:38Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:10:38Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:10:41Z,mtusi-messenger-lab3-lb-1,15.06%,13.86MiB / 64MiB +2026-10-16T18:10:41Z,mtusi-messenger-lab3-postgres-1,49.35%,70.21MiB / 384MiB +2026-10-16T18:10:41Z,mtusi-messenger-lab3-api-1,20.32%,11.48MiB / 384MiB +2026-10-16T18:10:41Z,mtusi-messenger-lab3-api-2,20.48%,11.02MiB / 384MiB +2026-10-16T18:10:41Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:41Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:10:41Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:10:44Z,mtusi-messenger-lab3-lb-1,14.88%,13.63MiB / 64MiB +2026-10-16T18:10:44Z,mtusi-messenger-lab3-postgres-1,49.88%,73.32MiB / 384MiB +2026-10-16T18:10:44Z,mtusi-messenger-lab3-api-1,20.41%,11.41MiB / 384MiB +2026-10-16T18:10:44Z,mtusi-messenger-lab3-api-2,20.09%,10.93MiB / 384MiB +2026-10-16T18:10:44Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:44Z,mtusi-messenger-lab2-redis-1,0.71%,9.004MiB / 1.913GiB +2026-10-16T18:10:44Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:10:47Z,mtusi-messenger-lab3-lb-1,15.15%,13.6MiB / 64MiB +2026-10-16T18:10:47Z,mtusi-messenger-lab3-postgres-1,51.17%,76.41MiB / 384MiB +2026-10-16T18:10:47Z,mtusi-messenger-lab3-api-1,20.41%,11.36MiB / 384MiB +2026-10-16T18:10:47Z,mtusi-messenger-lab3-api-2,20.17%,10.95MiB / 384MiB +2026-10-16T18:10:47Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:47Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:10:47Z,mtusi-messenger-lab3-redis-1,0.76%,3.863MiB / 192MiB +2026-10-16T18:10:50Z,mtusi-messenger-lab3-lb-1,2.68%,13.57MiB / 64MiB +2026-10-16T18:10:50Z,mtusi-messenger-lab3-postgres-1,9.63%,78.66MiB / 384MiB +2026-10-16T18:10:50Z,mtusi-messenger-lab3-api-1,3.77%,10.86MiB / 384MiB +2026-10-16T18:10:50Z,mtusi-messenger-lab3-api-2,19.88%,10.99MiB / 384MiB +2026-10-16T18:10:50Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:50Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:10:50Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:10:53Z,mtusi-messenger-lab3-lb-1,4.85%,13.61MiB / 64MiB +2026-10-16T18:10:53Z,mtusi-messenger-lab3-postgres-1,16.27%,79.33MiB / 384MiB +2026-10-16T18:10:53Z,mtusi-messenger-lab3-api-1,6.22%,10.78MiB / 384MiB +2026-10-16T18:10:53Z,mtusi-messenger-lab3-api-2,6.51%,11MiB / 384MiB +2026-10-16T18:10:53Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:53Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:10:53Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:10:56Z,mtusi-messenger-lab3-lb-1,14.37%,13.61MiB / 64MiB +2026-10-16T18:10:56Z,mtusi-messenger-lab3-postgres-1,48.63%,82.38MiB / 384MiB +2026-10-16T18:10:56Z,mtusi-messenger-lab3-api-1,19.18%,10.95MiB / 384MiB +2026-10-16T18:10:56Z,mtusi-messenger-lab3-api-2,19.41%,10.99MiB / 384MiB +2026-10-16T18:10:56Z,mtusi-messenger-lab2-postgres-1,0.78%,178.3MiB / 1.913GiB +2026-10-16T18:10:56Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:10:56Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:10:59Z,mtusi-messenger-lab3-lb-1,15.17%,13.61MiB / 64MiB +2026-10-16T18:10:59Z,mtusi-messenger-lab3-postgres-1,51.39%,85.64MiB / 384MiB +2026-10-16T18:10:59Z,mtusi-messenger-lab3-api-1,19.70%,10.92MiB / 384MiB +2026-10-16T18:10:59Z,mtusi-messenger-lab3-api-2,20.50%,11.01MiB / 384MiB +2026-10-16T18:10:59Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:10:59Z,mtusi-messenger-lab2-redis-1,0.68%,9.004MiB / 1.913GiB +2026-10-16T18:10:59Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:11:02Z,mtusi-messenger-lab3-lb-1,14.52%,13.6MiB / 64MiB +2026-10-16T18:11:02Z,mtusi-messenger-lab3-postgres-1,49.76%,88.94MiB / 384MiB +2026-10-16T18:11:02Z,mtusi-messenger-lab3-api-1,20.07%,10.92MiB / 384MiB +2026-10-16T18:11:02Z,mtusi-messenger-lab3-api-2,20.40%,10.93MiB / 384MiB +2026-10-16T18:11:02Z,mtusi-messenger-lab2-postgres-1,0.25%,178.3MiB / 1.913GiB +2026-10-16T18:11:02Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:11:02Z,mtusi-messenger-lab3-redis-1,0.90%,3.863MiB / 192MiB +2026-10-16T18:11:05Z,mtusi-messenger-lab3-lb-1,14.73%,13.59MiB / 64MiB +2026-10-16T18:11:05Z,mtusi-messenger-lab3-postgres-1,49.78%,91.99MiB / 384MiB +2026-10-16T18:11:05Z,mtusi-messenger-lab3-api-1,19.20%,10.96MiB / 384MiB +2026-10-16T18:11:05Z,mtusi-messenger-lab3-api-2,19.93%,10.95MiB / 384MiB +2026-10-16T18:11:05Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:05Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:11:05Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:11:08Z,mtusi-messenger-lab3-lb-1,14.36%,13.61MiB / 64MiB +2026-10-16T18:11:08Z,mtusi-messenger-lab3-postgres-1,49.09%,94.57MiB / 384MiB +2026-10-16T18:11:08Z,mtusi-messenger-lab3-api-1,19.05%,10.96MiB / 384MiB +2026-10-16T18:11:08Z,mtusi-messenger-lab3-api-2,18.56%,10.93MiB / 384MiB +2026-10-16T18:11:08Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:08Z,mtusi-messenger-lab2-redis-1,0.66%,9.004MiB / 1.913GiB +2026-10-16T18:11:08Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:11:11Z,mtusi-messenger-lab3-lb-1,14.11%,13.6MiB / 64MiB +2026-10-16T18:11:11Z,mtusi-messenger-lab3-postgres-1,49.63%,97.64MiB / 384MiB +2026-10-16T18:11:11Z,mtusi-messenger-lab3-api-1,19.19%,10.96MiB / 384MiB +2026-10-16T18:11:11Z,mtusi-messenger-lab3-api-2,19.29%,10.78MiB / 384MiB +2026-10-16T18:11:11Z,mtusi-messenger-lab2-postgres-1,0.82%,178.3MiB / 1.913GiB +2026-10-16T18:11:11Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:11:11Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:11:14Z,mtusi-messenger-lab3-lb-1,14.69%,13.61MiB / 64MiB +2026-10-16T18:11:14Z,mtusi-messenger-lab3-postgres-1,50.77%,99.91MiB / 384MiB +2026-10-16T18:11:14Z,mtusi-messenger-lab3-api-1,18.81%,10.9MiB / 384MiB +2026-10-16T18:11:14Z,mtusi-messenger-lab3-api-2,19.43%,10.91MiB / 384MiB +2026-10-16T18:11:14Z,mtusi-messenger-lab2-postgres-1,0.26%,178.3MiB / 1.913GiB +2026-10-16T18:11:14Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:11:14Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:11:18Z,mtusi-messenger-lab3-lb-1,15.49%,13.61MiB / 64MiB +2026-10-16T18:11:18Z,mtusi-messenger-lab3-postgres-1,50.30%,103.9MiB / 384MiB +2026-10-16T18:11:18Z,mtusi-messenger-lab3-api-1,19.87%,10.9MiB / 384MiB +2026-10-16T18:11:18Z,mtusi-messenger-lab3-api-2,20.26%,10.93MiB / 384MiB +2026-10-16T18:11:18Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:18Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:11:18Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:11:21Z,mtusi-messenger-lab3-lb-1,15.27%,13.6MiB / 64MiB +2026-10-16T18:11:21Z,mtusi-messenger-lab3-postgres-1,50.49%,108.1MiB / 384MiB +2026-10-16T18:11:21Z,mtusi-messenger-lab3-api-1,20.18%,10.84MiB / 384MiB +2026-10-16T18:11:21Z,mtusi-messenger-lab3-api-2,19.75%,11.02MiB / 384MiB +2026-10-16T18:11:21Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:21Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:11:21Z,mtusi-messenger-lab3-redis-1,0.70%,3.863MiB / 192MiB +2026-10-16T18:11:24Z,mtusi-messenger-lab3-lb-1,7.36%,13.62MiB / 64MiB +2026-10-16T18:11:24Z,mtusi-messenger-lab3-postgres-1,24.14%,109.7MiB / 384MiB +2026-10-16T18:11:24Z,mtusi-messenger-lab3-api-1,9.76%,10.86MiB / 384MiB +2026-10-16T18:11:24Z,mtusi-messenger-lab3-api-2,9.91%,11.16MiB / 384MiB +2026-10-16T18:11:24Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:24Z,mtusi-messenger-lab2-redis-1,0.70%,9.004MiB / 1.913GiB +2026-10-16T18:11:24Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:11:27Z,mtusi-messenger-lab3-lb-1,15.08%,13.6MiB / 64MiB +2026-10-16T18:11:27Z,mtusi-messenger-lab3-postgres-1,50.21%,111.3MiB / 384MiB +2026-10-16T18:11:27Z,mtusi-messenger-lab3-api-1,20.56%,10.86MiB / 384MiB +2026-10-16T18:11:27Z,mtusi-messenger-lab3-api-2,19.86%,11.02MiB / 384MiB +2026-10-16T18:11:27Z,mtusi-messenger-lab2-postgres-1,0.93%,178.3MiB / 1.913GiB +2026-10-16T18:11:27Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:11:27Z,mtusi-messenger-lab3-redis-1,0.68%,3.863MiB / 192MiB +2026-10-16T18:11:30Z,mtusi-messenger-lab3-lb-1,12.01%,13.87MiB / 64MiB +2026-10-16T18:11:30Z,mtusi-messenger-lab3-postgres-1,39.96%,114MiB / 384MiB +2026-10-16T18:11:30Z,mtusi-messenger-lab3-api-1,16.60%,10.86MiB / 384MiB +2026-10-16T18:11:30Z,mtusi-messenger-lab3-api-2,15.80%,11.3MiB / 384MiB +2026-10-16T18:11:30Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:30Z,mtusi-messenger-lab2-redis-1,0.67%,9.004MiB / 1.913GiB +2026-10-16T18:11:30Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:11:33Z,mtusi-messenger-lab3-lb-1,15.18%,13.61MiB / 64MiB +2026-10-16T18:11:33Z,mtusi-messenger-lab3-postgres-1,50.47%,117.3MiB / 384MiB +2026-10-16T18:11:33Z,mtusi-messenger-lab3-api-1,20.23%,10.86MiB / 384MiB +2026-10-16T18:11:33Z,mtusi-messenger-lab3-api-2,19.97%,11.04MiB / 384MiB +2026-10-16T18:11:33Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:33Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:11:33Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:11:36Z,mtusi-messenger-lab3-lb-1,12.36%,13.56MiB / 64MiB +2026-10-16T18:11:36Z,mtusi-messenger-lab3-postgres-1,51.73%,128MiB / 384MiB +2026-10-16T18:11:36Z,mtusi-messenger-lab3-api-1,16.83%,10.84MiB / 384MiB +2026-10-16T18:11:36Z,mtusi-messenger-lab3-api-2,16.52%,11.18MiB / 384MiB +2026-10-16T18:11:36Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:11:36Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:11:36Z,mtusi-messenger-lab3-redis-1,0.69%,3.863MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-pool10.csv b/evidence/track1/superseded/run2-host-client/stats-pool10.csv new file mode 100644 index 00000000..69c9aa83 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-pool10.csv @@ -0,0 +1,181 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:06:34Z,mtusi-messenger-lab3-api-2,7.60%,77.38MiB / 192MiB +2026-10-16T18:06:34Z,mtusi-messenger-lab3-api-1,6.91%,141.8MiB / 192MiB +2026-10-16T18:06:34Z,mtusi-messenger-lab3-api-4,13.44%,141.3MiB / 192MiB +2026-10-16T18:06:34Z,mtusi-messenger-lab3-api-3,14.02%,75.73MiB / 192MiB +2026-10-16T18:06:34Z,mtusi-messenger-lab3-postgres-1,0.51%,197.8MiB / 384MiB +2026-10-16T18:06:34Z,mtusi-messenger-lab2-postgres-1,0.81%,241.2MiB / 1.913GiB +2026-10-16T18:06:34Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:06:34Z,mtusi-messenger-lab3-lb-1,9.46%,11.58MiB / 64MiB +2026-10-16T18:06:34Z,mtusi-messenger-lab3-redis-1,0.77%,3.867MiB / 192MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-api-2,11.20%,104.1MiB / 192MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-api-1,10.90%,169.1MiB / 192MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-api-4,10.90%,168.1MiB / 192MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-api-3,10.75%,94.62MiB / 192MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-postgres-1,50.28%,199.5MiB / 384MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:06:38Z,mtusi-messenger-lab2-redis-1,0.66%,9.004MiB / 1.913GiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-lb-1,14.75%,11.59MiB / 64MiB +2026-10-16T18:06:38Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-api-2,11.70%,132.6MiB / 192MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-api-3,11.24%,132.3MiB / 192MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-postgres-1,38.75%,194.8MiB / 384MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:06:41Z,mtusi-messenger-lab2-redis-1,0.19%,9.004MiB / 1.913GiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-lb-1,11.96%,11.64MiB / 64MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-redis-1,0.69%,3.867MiB / 192MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-api-1,5.99%,7.691MiB / 192MiB +2026-10-16T18:06:41Z,mtusi-messenger-lab3-api-4,3.47%,6.445MiB / 192MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-api-2,12.06%,10.94MiB / 192MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-api-1,10.93%,8.141MiB / 192MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-api-4,11.89%,7.922MiB / 192MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-api-3,11.44%,10.61MiB / 192MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-postgres-1,50.14%,204.5MiB / 384MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab2-postgres-1,0.71%,178.3MiB / 1.913GiB +2026-10-16T18:06:45Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-lb-1,15.37%,11.66MiB / 64MiB +2026-10-16T18:06:45Z,mtusi-messenger-lab3-redis-1,0.23%,3.867MiB / 192MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-api-2,1.48%,10.88MiB / 192MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-api-1,1.49%,8.031MiB / 192MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-api-4,1.27%,8.121MiB / 192MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-api-3,11.29%,10.56MiB / 192MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-postgres-1,6.89%,204.6MiB / 384MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:06:48Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-lb-1,1.97%,11.61MiB / 64MiB +2026-10-16T18:06:48Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-api-2,12.24%,10.84MiB / 192MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-api-1,11.27%,8.055MiB / 192MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-api-4,11.09%,8.086MiB / 192MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-api-3,11.05%,10.48MiB / 192MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-postgres-1,49.63%,204.9MiB / 384MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab2-postgres-1,0.20%,178.3MiB / 1.913GiB +2026-10-16T18:06:51Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-lb-1,14.89%,11.64MiB / 64MiB +2026-10-16T18:06:51Z,mtusi-messenger-lab3-redis-1,0.74%,3.867MiB / 192MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-api-2,11.02%,10.82MiB / 192MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-api-1,11.03%,7.945MiB / 192MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-api-4,10.92%,8.086MiB / 192MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-api-3,11.53%,10.39MiB / 192MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-postgres-1,49.96%,205.3MiB / 384MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:06:54Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-lb-1,14.46%,11.64MiB / 64MiB +2026-10-16T18:06:54Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-api-2,11.75%,10.88MiB / 192MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-api-1,11.03%,7.949MiB / 192MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-api-4,11.09%,8.094MiB / 192MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-api-3,10.89%,10.47MiB / 192MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-postgres-1,50.91%,205.7MiB / 384MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:06:57Z,mtusi-messenger-lab2-redis-1,0.65%,9.004MiB / 1.913GiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-lb-1,14.81%,11.64MiB / 64MiB +2026-10-16T18:06:57Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-api-2,11.69%,10.75MiB / 192MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-api-1,11.00%,8.066MiB / 192MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-api-4,11.17%,8.188MiB / 192MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-api-3,11.12%,10.43MiB / 192MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-postgres-1,49.69%,206.3MiB / 384MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:00Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-lb-1,15.04%,11.63MiB / 64MiB +2026-10-16T18:07:00Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-api-2,11.12%,10.82MiB / 192MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-api-1,11.11%,8.074MiB / 192MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-api-4,10.90%,8.18MiB / 192MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-api-3,10.77%,10.41MiB / 192MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-postgres-1,49.10%,206.3MiB / 384MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab2-postgres-1,0.18%,178.3MiB / 1.913GiB +2026-10-16T18:07:03Z,mtusi-messenger-lab2-redis-1,0.19%,9.004MiB / 1.913GiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-lb-1,14.88%,11.89MiB / 64MiB +2026-10-16T18:07:03Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-api-2,8.72%,10.83MiB / 192MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-api-1,9.99%,8.07MiB / 192MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-api-4,9.48%,8.125MiB / 192MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-api-3,9.36%,10.41MiB / 192MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-postgres-1,41.13%,206.4MiB / 384MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:07Z,mtusi-messenger-lab2-redis-1,0.25%,9.004MiB / 1.913GiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-lb-1,12.41%,11.64MiB / 64MiB +2026-10-16T18:07:07Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-api-2,11.21%,10.83MiB / 192MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-api-1,10.80%,8.086MiB / 192MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-api-4,10.83%,8.121MiB / 192MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-api-3,11.23%,10.46MiB / 192MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-postgres-1,49.24%,206.4MiB / 384MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab2-postgres-1,0.65%,178.3MiB / 1.913GiB +2026-10-16T18:07:10Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-lb-1,14.54%,11.66MiB / 64MiB +2026-10-16T18:07:10Z,mtusi-messenger-lab3-redis-1,0.75%,3.867MiB / 192MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-api-2,11.79%,10.78MiB / 192MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-api-1,11.27%,8.02MiB / 192MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-api-4,10.55%,8.184MiB / 192MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-api-3,11.22%,10.56MiB / 192MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-postgres-1,50.42%,206.4MiB / 384MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:13Z,mtusi-messenger-lab2-redis-1,0.82%,9.004MiB / 1.913GiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-lb-1,15.18%,11.63MiB / 64MiB +2026-10-16T18:07:13Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-api-2,11.48%,10.74MiB / 192MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-api-1,11.02%,8.086MiB / 192MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-api-4,10.68%,8.195MiB / 192MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-api-3,11.19%,10.37MiB / 192MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-postgres-1,48.93%,206.5MiB / 384MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:16Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-lb-1,14.74%,11.65MiB / 64MiB +2026-10-16T18:07:16Z,mtusi-messenger-lab3-redis-1,0.75%,3.867MiB / 192MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-api-2,11.21%,10.6MiB / 192MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-api-1,11.45%,8.082MiB / 192MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-api-4,11.86%,8.18MiB / 192MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-api-3,11.08%,10.41MiB / 192MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-postgres-1,51.21%,206.6MiB / 384MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:19Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-lb-1,15.33%,11.62MiB / 64MiB +2026-10-16T18:07:19Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-api-2,12.08%,10.61MiB / 192MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-api-1,11.88%,8.148MiB / 192MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-api-4,10.72%,8.109MiB / 192MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-api-3,12.01%,10.41MiB / 192MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-postgres-1,50.29%,206.9MiB / 384MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:22Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-lb-1,15.36%,11.62MiB / 64MiB +2026-10-16T18:07:22Z,mtusi-messenger-lab3-redis-1,0.23%,3.867MiB / 192MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-api-2,11.15%,10.6MiB / 192MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-api-1,10.99%,8.023MiB / 192MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-api-4,11.57%,8.184MiB / 192MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-api-3,11.08%,10.41MiB / 192MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-postgres-1,50.30%,206.9MiB / 384MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab2-postgres-1,0.73%,178.3MiB / 1.913GiB +2026-10-16T18:07:25Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-lb-1,15.18%,11.67MiB / 64MiB +2026-10-16T18:07:25Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-api-2,9.99%,10.61MiB / 192MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-api-1,10.96%,8.02MiB / 192MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-api-4,10.04%,8.133MiB / 192MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-api-3,10.38%,10.36MiB / 192MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-postgres-1,46.74%,206.9MiB / 384MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:28Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-lb-1,15.22%,11.66MiB / 64MiB +2026-10-16T18:07:28Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-api-2,12.08%,10.64MiB / 192MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-api-1,11.55%,8.023MiB / 192MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-api-4,11.41%,8.195MiB / 192MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-api-3,11.05%,10.29MiB / 192MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-postgres-1,50.41%,206.7MiB / 384MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:31Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-lb-1,15.24%,11.63MiB / 64MiB +2026-10-16T18:07:31Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-api-2,4.62%,10.62MiB / 192MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-api-1,11.06%,8.047MiB / 192MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-api-4,4.84%,8.121MiB / 192MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-api-3,4.64%,10.28MiB / 192MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-postgres-1,46.24%,216.8MiB / 384MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:34Z,mtusi-messenger-lab2-redis-1,0.26%,9.004MiB / 1.913GiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-lb-1,6.42%,11.59MiB / 64MiB +2026-10-16T18:07:34Z,mtusi-messenger-lab3-redis-1,0.27%,3.867MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-pool5.csv b/evidence/track1/superseded/run2-host-client/stats-pool5.csv new file mode 100644 index 00000000..89f4caf6 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-pool5.csv @@ -0,0 +1,181 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:07:55Z,mtusi-messenger-lab3-api-2,14.91%,141.5MiB / 192MiB +2026-10-16T18:07:55Z,mtusi-messenger-lab3-api-1,10.62%,141.6MiB / 192MiB +2026-10-16T18:07:55Z,mtusi-messenger-lab3-api-4,7.08%,77.1MiB / 192MiB +2026-10-16T18:07:55Z,mtusi-messenger-lab3-api-3,7.65%,10.7MiB / 192MiB +2026-10-16T18:07:55Z,mtusi-messenger-lab3-postgres-1,32.81%,198MiB / 384MiB +2026-10-16T18:07:55Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:55Z,mtusi-messenger-lab2-redis-1,0.27%,9.004MiB / 1.913GiB +2026-10-16T18:07:55Z,mtusi-messenger-lab3-lb-1,9.88%,11.65MiB / 64MiB +2026-10-16T18:07:55Z,mtusi-messenger-lab3-redis-1,0.39%,3.867MiB / 192MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-api-2,10.66%,168MiB / 192MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-api-1,11.16%,168.7MiB / 192MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-api-4,10.28%,103.8MiB / 192MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-api-3,10.99%,10.77MiB / 192MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-postgres-1,49.15%,199MiB / 384MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:07:58Z,mtusi-messenger-lab2-redis-1,0.68%,9.004MiB / 1.913GiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-lb-1,14.80%,11.66MiB / 64MiB +2026-10-16T18:07:58Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-api-4,10.66%,133.2MiB / 192MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-api-3,10.68%,10.55MiB / 192MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-postgres-1,38.21%,185.5MiB / 384MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab2-postgres-1,0.70%,178.3MiB / 1.913GiB +2026-10-16T18:08:01Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-lb-1,12.01%,11.66MiB / 64MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-redis-1,0.69%,3.867MiB / 192MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-api-1,3.28%,6.367MiB / 192MiB +2026-10-16T18:08:01Z,mtusi-messenger-lab3-api-2,5.83%,7.684MiB / 192MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-api-2,11.16%,7.949MiB / 192MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-api-1,10.74%,7.957MiB / 192MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-api-4,11.76%,11.31MiB / 192MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-api-3,11.29%,10.51MiB / 192MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-postgres-1,50.95%,200.8MiB / 384MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab2-postgres-1,0.78%,178.3MiB / 1.913GiB +2026-10-16T18:08:05Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-lb-1,14.65%,11.64MiB / 64MiB +2026-10-16T18:08:05Z,mtusi-messenger-lab3-redis-1,0.68%,3.867MiB / 192MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-api-2,10.87%,8.117MiB / 192MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-api-1,11.68%,7.918MiB / 192MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-api-4,11.18%,11.12MiB / 192MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-api-3,10.31%,10.44MiB / 192MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-postgres-1,50.09%,202.4MiB / 384MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:08Z,mtusi-messenger-lab2-redis-1,0.73%,9.004MiB / 1.913GiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-lb-1,15.09%,11.65MiB / 64MiB +2026-10-16T18:08:08Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-api-2,10.80%,8.125MiB / 192MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-api-1,11.04%,8.07MiB / 192MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-api-4,12.08%,11.03MiB / 192MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-api-3,11.93%,10.5MiB / 192MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-postgres-1,49.92%,202.6MiB / 384MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:11Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-lb-1,15.22%,11.65MiB / 64MiB +2026-10-16T18:08:11Z,mtusi-messenger-lab3-redis-1,0.79%,3.867MiB / 192MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-api-2,10.96%,8.141MiB / 192MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-api-1,10.62%,8.195MiB / 192MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-api-4,11.01%,11.14MiB / 192MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-api-3,11.27%,10.46MiB / 192MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-postgres-1,49.26%,202.9MiB / 384MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab2-postgres-1,0.24%,178.3MiB / 1.913GiB +2026-10-16T18:08:14Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-lb-1,15.17%,11.63MiB / 64MiB +2026-10-16T18:08:14Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-api-2,11.39%,7.898MiB / 192MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-api-1,11.25%,8.141MiB / 192MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-api-4,11.62%,11.34MiB / 192MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-api-3,11.38%,10.5MiB / 192MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-postgres-1,50.33%,203.3MiB / 384MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:17Z,mtusi-messenger-lab2-redis-1,0.75%,9.004MiB / 1.913GiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-lb-1,14.83%,11.65MiB / 64MiB +2026-10-16T18:08:17Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-api-2,11.86%,7.961MiB / 192MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-api-1,11.40%,8.129MiB / 192MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-api-4,10.84%,11.09MiB / 192MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-api-3,11.03%,10.49MiB / 192MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-postgres-1,50.72%,203.7MiB / 384MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab2-postgres-1,0.73%,178.3MiB / 1.913GiB +2026-10-16T18:08:21Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-lb-1,15.10%,11.66MiB / 64MiB +2026-10-16T18:08:21Z,mtusi-messenger-lab3-redis-1,0.69%,3.867MiB / 192MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-api-2,10.53%,8.027MiB / 192MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-api-1,10.90%,8.141MiB / 192MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-api-4,10.28%,11.14MiB / 192MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-api-3,11.17%,10.49MiB / 192MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-postgres-1,49.23%,204.3MiB / 384MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:24Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-lb-1,14.51%,11.65MiB / 64MiB +2026-10-16T18:08:24Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-api-2,9.35%,7.973MiB / 192MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-api-1,9.88%,8.133MiB / 192MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-api-4,9.36%,11.11MiB / 192MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-api-3,8.77%,10.5MiB / 192MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-postgres-1,40.77%,204.3MiB / 384MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab2-postgres-1,0.20%,178.3MiB / 1.913GiB +2026-10-16T18:08:27Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-lb-1,12.20%,11.67MiB / 64MiB +2026-10-16T18:08:27Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-api-2,9.13%,8.023MiB / 192MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-api-1,9.52%,8.129MiB / 192MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-api-4,8.93%,11.04MiB / 192MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-api-3,9.47%,10.59MiB / 192MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-postgres-1,41.32%,204.3MiB / 384MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:30Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-lb-1,12.68%,11.62MiB / 64MiB +2026-10-16T18:08:30Z,mtusi-messenger-lab3-redis-1,0.73%,3.867MiB / 192MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-api-2,10.80%,8.035MiB / 192MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-api-1,11.71%,8.145MiB / 192MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-api-4,10.90%,11.05MiB / 192MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-api-3,11.65%,10.61MiB / 192MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-postgres-1,50.25%,204.3MiB / 384MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:33Z,mtusi-messenger-lab2-redis-1,0.76%,9.004MiB / 1.913GiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-lb-1,14.80%,11.68MiB / 64MiB +2026-10-16T18:08:33Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-api-2,10.88%,8.035MiB / 192MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-api-1,10.69%,8.156MiB / 192MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-api-4,11.22%,11.05MiB / 192MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-api-3,10.68%,10.54MiB / 192MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-postgres-1,48.84%,204.4MiB / 384MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab2-postgres-1,0.71%,178.3MiB / 1.913GiB +2026-10-16T18:08:36Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-lb-1,14.51%,11.66MiB / 64MiB +2026-10-16T18:08:36Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-api-2,11.02%,8.164MiB / 192MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-api-1,11.15%,8.207MiB / 192MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-api-4,11.03%,10.81MiB / 192MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-api-3,11.59%,10.59MiB / 192MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-postgres-1,49.74%,204.4MiB / 384MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:39Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-lb-1,15.01%,11.65MiB / 64MiB +2026-10-16T18:08:39Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-api-2,0.41%,8.148MiB / 192MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-api-1,0.41%,8.117MiB / 192MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-api-4,0.30%,10.6MiB / 192MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-api-3,0.40%,10.52MiB / 192MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-postgres-1,1.30%,204.4MiB / 384MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:42Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-lb-1,0.49%,11.6MiB / 64MiB +2026-10-16T18:08:42Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-api-2,10.56%,8.156MiB / 192MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-api-1,11.52%,8.148MiB / 192MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-api-4,10.93%,10.85MiB / 192MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-api-3,11.28%,10.53MiB / 192MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-postgres-1,48.72%,204.7MiB / 384MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab2-postgres-1,0.71%,178.3MiB / 1.913GiB +2026-10-16T18:08:45Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-lb-1,15.05%,11.65MiB / 64MiB +2026-10-16T18:08:45Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-api-2,10.40%,8.191MiB / 192MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-api-1,10.26%,8.078MiB / 192MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-api-4,10.25%,10.78MiB / 192MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-api-3,10.48%,10.59MiB / 192MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-postgres-1,51.50%,205.4MiB / 384MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:48Z,mtusi-messenger-lab2-redis-1,0.71%,9.004MiB / 1.913GiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-lb-1,14.02%,11.64MiB / 64MiB +2026-10-16T18:08:48Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-api-2,9.83%,8.121MiB / 192MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-api-1,9.89%,8.266MiB / 192MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-api-4,10.60%,10.84MiB / 192MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-api-3,10.31%,10.59MiB / 192MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-postgres-1,50.52%,205.1MiB / 384MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:52Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-lb-1,13.49%,11.65MiB / 64MiB +2026-10-16T18:08:52Z,mtusi-messenger-lab3-redis-1,0.65%,3.867MiB / 192MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-api-2,3.17%,8.18MiB / 192MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-api-1,3.50%,8.074MiB / 192MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-api-4,3.35%,10.83MiB / 192MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-api-3,3.19%,10.57MiB / 192MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-postgres-1,50.88%,205.7MiB / 384MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:08:55Z,mtusi-messenger-lab2-redis-1,0.26%,9.004MiB / 1.913GiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-lb-1,4.53%,11.61MiB / 64MiB +2026-10-16T18:08:55Z,mtusi-messenger-lab3-redis-1,0.27%,3.867MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-r1.csv b/evidence/track1/superseded/run2-host-client/stats-r1.csv new file mode 100644 index 00000000..397ce0be --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-r1.csv @@ -0,0 +1,121 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T17:58:39Z,mtusi-messenger-lab3-api-1,29.66%,197.9MiB / 768MiB +2026-10-16T17:58:39Z,mtusi-messenger-lab3-postgres-1,50.18%,61.14MiB / 384MiB +2026-10-16T17:58:39Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:58:39Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T17:58:39Z,mtusi-messenger-lab3-lb-1,13.20%,11.56MiB / 64MiB +2026-10-16T17:58:39Z,mtusi-messenger-lab3-redis-1,0.70%,3.863MiB / 192MiB +2026-10-16T17:58:42Z,mtusi-messenger-lab3-api-1,31.33%,12.33MiB / 768MiB +2026-10-16T17:58:42Z,mtusi-messenger-lab3-postgres-1,50.69%,63.97MiB / 384MiB +2026-10-16T17:58:42Z,mtusi-messenger-lab2-postgres-1,0.65%,167.4MiB / 1.913GiB +2026-10-16T17:58:42Z,mtusi-messenger-lab2-redis-1,0.25%,9.004MiB / 1.913GiB +2026-10-16T17:58:42Z,mtusi-messenger-lab3-lb-1,13.46%,11.54MiB / 64MiB +2026-10-16T17:58:42Z,mtusi-messenger-lab3-redis-1,0.74%,3.887MiB / 192MiB +2026-10-16T17:58:45Z,mtusi-messenger-lab3-api-1,30.06%,12.39MiB / 768MiB +2026-10-16T17:58:45Z,mtusi-messenger-lab3-postgres-1,49.51%,66.85MiB / 384MiB +2026-10-16T17:58:45Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:58:45Z,mtusi-messenger-lab2-redis-1,0.78%,9.004MiB / 1.913GiB +2026-10-16T17:58:45Z,mtusi-messenger-lab3-lb-1,13.24%,11.56MiB / 64MiB +2026-10-16T17:58:45Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T17:58:48Z,mtusi-messenger-lab3-api-1,31.54%,12.25MiB / 768MiB +2026-10-16T17:58:48Z,mtusi-messenger-lab3-postgres-1,49.51%,72.35MiB / 384MiB +2026-10-16T17:58:48Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:58:48Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T17:58:48Z,mtusi-messenger-lab3-lb-1,13.41%,11.57MiB / 64MiB +2026-10-16T17:58:48Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T17:58:51Z,mtusi-messenger-lab3-api-1,31.17%,12.2MiB / 768MiB +2026-10-16T17:58:51Z,mtusi-messenger-lab3-postgres-1,51.27%,76.55MiB / 384MiB +2026-10-16T17:58:51Z,mtusi-messenger-lab2-postgres-1,0.29%,166.1MiB / 1.913GiB +2026-10-16T17:58:51Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T17:58:51Z,mtusi-messenger-lab3-lb-1,13.83%,11.58MiB / 64MiB +2026-10-16T17:58:51Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T17:58:54Z,mtusi-messenger-lab3-api-1,31.27%,12.54MiB / 768MiB +2026-10-16T17:58:54Z,mtusi-messenger-lab3-postgres-1,50.28%,82.17MiB / 384MiB +2026-10-16T17:58:54Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:58:54Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T17:58:54Z,mtusi-messenger-lab3-lb-1,13.23%,11.58MiB / 64MiB +2026-10-16T17:58:54Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T17:58:57Z,mtusi-messenger-lab3-api-1,30.65%,12.57MiB / 768MiB +2026-10-16T17:58:57Z,mtusi-messenger-lab3-postgres-1,50.20%,85.07MiB / 384MiB +2026-10-16T17:58:57Z,mtusi-messenger-lab2-postgres-1,0.76%,166.1MiB / 1.913GiB +2026-10-16T17:58:57Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T17:58:57Z,mtusi-messenger-lab3-lb-1,13.46%,11.57MiB / 64MiB +2026-10-16T17:58:57Z,mtusi-messenger-lab3-redis-1,0.75%,3.863MiB / 192MiB +2026-10-16T17:59:00Z,mtusi-messenger-lab3-api-1,29.86%,12.33MiB / 768MiB +2026-10-16T17:59:00Z,mtusi-messenger-lab3-postgres-1,50.29%,87.65MiB / 384MiB +2026-10-16T17:59:00Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:59:00Z,mtusi-messenger-lab2-redis-1,0.67%,9.004MiB / 1.913GiB +2026-10-16T17:59:00Z,mtusi-messenger-lab3-lb-1,12.62%,11.57MiB / 64MiB +2026-10-16T17:59:00Z,mtusi-messenger-lab3-redis-1,0.18%,3.863MiB / 192MiB +2026-10-16T17:59:03Z,mtusi-messenger-lab3-api-1,30.59%,12.54MiB / 768MiB +2026-10-16T17:59:03Z,mtusi-messenger-lab3-postgres-1,50.38%,90.58MiB / 384MiB +2026-10-16T17:59:03Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:59:03Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T17:59:03Z,mtusi-messenger-lab3-lb-1,14.15%,11.56MiB / 64MiB +2026-10-16T17:59:03Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T17:59:06Z,mtusi-messenger-lab3-api-1,32.47%,12.66MiB / 768MiB +2026-10-16T17:59:06Z,mtusi-messenger-lab3-postgres-1,49.93%,92.53MiB / 384MiB +2026-10-16T17:59:06Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:59:06Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T17:59:06Z,mtusi-messenger-lab3-lb-1,14.85%,11.56MiB / 64MiB +2026-10-16T17:59:06Z,mtusi-messenger-lab3-redis-1,0.19%,3.863MiB / 192MiB +2026-10-16T17:59:09Z,mtusi-messenger-lab3-api-1,30.75%,12.21MiB / 768MiB +2026-10-16T17:59:09Z,mtusi-messenger-lab3-postgres-1,51.03%,97.3MiB / 384MiB +2026-10-16T17:59:09Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:59:09Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T17:59:09Z,mtusi-messenger-lab3-lb-1,13.27%,11.55MiB / 64MiB +2026-10-16T17:59:09Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T17:59:13Z,mtusi-messenger-lab3-api-1,30.72%,12.3MiB / 768MiB +2026-10-16T17:59:13Z,mtusi-messenger-lab3-postgres-1,50.00%,100.3MiB / 384MiB +2026-10-16T17:59:13Z,mtusi-messenger-lab2-postgres-1,0.80%,166.1MiB / 1.913GiB +2026-10-16T17:59:13Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T17:59:13Z,mtusi-messenger-lab3-lb-1,13.42%,11.56MiB / 64MiB +2026-10-16T17:59:13Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T17:59:16Z,mtusi-messenger-lab3-api-1,31.41%,12.27MiB / 768MiB +2026-10-16T17:59:16Z,mtusi-messenger-lab3-postgres-1,50.85%,103.1MiB / 384MiB +2026-10-16T17:59:16Z,mtusi-messenger-lab2-postgres-1,0.00%,166.1MiB / 1.913GiB +2026-10-16T17:59:16Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T17:59:16Z,mtusi-messenger-lab3-lb-1,13.48%,11.58MiB / 64MiB +2026-10-16T17:59:16Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T17:59:19Z,mtusi-messenger-lab3-api-1,30.55%,12.33MiB / 768MiB +2026-10-16T17:59:19Z,mtusi-messenger-lab3-postgres-1,50.99%,106MiB / 384MiB +2026-10-16T17:59:19Z,mtusi-messenger-lab2-postgres-1,0.00%,165.9MiB / 1.913GiB +2026-10-16T17:59:19Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T17:59:19Z,mtusi-messenger-lab3-lb-1,13.36%,11.57MiB / 64MiB +2026-10-16T17:59:19Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T17:59:22Z,mtusi-messenger-lab3-api-1,31.55%,12.49MiB / 768MiB +2026-10-16T17:59:22Z,mtusi-messenger-lab3-postgres-1,50.55%,108.7MiB / 384MiB +2026-10-16T17:59:22Z,mtusi-messenger-lab2-postgres-1,0.00%,165.9MiB / 1.913GiB +2026-10-16T17:59:22Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T17:59:22Z,mtusi-messenger-lab3-lb-1,13.60%,11.57MiB / 64MiB +2026-10-16T17:59:22Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T17:59:25Z,mtusi-messenger-lab3-api-1,31.15%,12.47MiB / 768MiB +2026-10-16T17:59:25Z,mtusi-messenger-lab3-postgres-1,49.63%,111.7MiB / 384MiB +2026-10-16T17:59:25Z,mtusi-messenger-lab2-postgres-1,0.00%,165.9MiB / 1.913GiB +2026-10-16T17:59:25Z,mtusi-messenger-lab2-redis-1,0.65%,9.004MiB / 1.913GiB +2026-10-16T17:59:25Z,mtusi-messenger-lab3-lb-1,13.45%,11.57MiB / 64MiB +2026-10-16T17:59:25Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T17:59:28Z,mtusi-messenger-lab3-api-1,31.17%,12.38MiB / 768MiB +2026-10-16T17:59:28Z,mtusi-messenger-lab3-postgres-1,50.44%,114.9MiB / 384MiB +2026-10-16T17:59:28Z,mtusi-messenger-lab2-postgres-1,0.81%,165.9MiB / 1.913GiB +2026-10-16T17:59:28Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T17:59:28Z,mtusi-messenger-lab3-lb-1,13.48%,11.55MiB / 64MiB +2026-10-16T17:59:28Z,mtusi-messenger-lab3-redis-1,0.19%,3.863MiB / 192MiB +2026-10-16T17:59:31Z,mtusi-messenger-lab3-api-1,29.99%,12.48MiB / 768MiB +2026-10-16T17:59:31Z,mtusi-messenger-lab3-postgres-1,50.19%,117.4MiB / 384MiB +2026-10-16T17:59:31Z,mtusi-messenger-lab2-postgres-1,0.00%,165.9MiB / 1.913GiB +2026-10-16T17:59:31Z,mtusi-messenger-lab2-redis-1,0.72%,9.004MiB / 1.913GiB +2026-10-16T17:59:31Z,mtusi-messenger-lab3-lb-1,13.26%,11.57MiB / 64MiB +2026-10-16T17:59:31Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T17:59:34Z,mtusi-messenger-lab3-api-1,30.03%,12.28MiB / 768MiB +2026-10-16T17:59:34Z,mtusi-messenger-lab3-postgres-1,50.77%,120.6MiB / 384MiB +2026-10-16T17:59:34Z,mtusi-messenger-lab2-postgres-1,0.00%,165.7MiB / 1.913GiB +2026-10-16T17:59:34Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T17:59:34Z,mtusi-messenger-lab3-lb-1,13.42%,11.57MiB / 64MiB +2026-10-16T17:59:34Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T17:59:37Z,mtusi-messenger-lab3-api-1,21.59%,12.02MiB / 768MiB +2026-10-16T17:59:37Z,mtusi-messenger-lab3-postgres-1,46.38%,129MiB / 384MiB +2026-10-16T17:59:37Z,mtusi-messenger-lab2-postgres-1,0.77%,165.7MiB / 1.913GiB +2026-10-16T17:59:37Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T17:59:37Z,mtusi-messenger-lab3-lb-1,9.70%,11.51MiB / 64MiB +2026-10-16T17:59:37Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-r2.csv b/evidence/track1/superseded/run2-host-client/stats-r2.csv new file mode 100644 index 00000000..1ff5b5fa --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-r2.csv @@ -0,0 +1,141 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:14:53Z,mtusi-messenger-lab3-lb-1,15.34%,11.02MiB / 64MiB +2026-10-16T18:14:53Z,mtusi-messenger-lab3-postgres-1,50.15%,187MiB / 384MiB +2026-10-16T18:14:53Z,mtusi-messenger-lab3-api-1,20.18%,167.2MiB / 384MiB +2026-10-16T18:14:53Z,mtusi-messenger-lab3-api-2,19.97%,166.8MiB / 384MiB +2026-10-16T18:14:53Z,mtusi-messenger-lab2-postgres-1,0.71%,178.3MiB / 1.913GiB +2026-10-16T18:14:53Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:14:53Z,mtusi-messenger-lab3-redis-1,0.73%,3.863MiB / 192MiB +2026-10-16T18:14:56Z,mtusi-messenger-lab3-lb-1,14.34%,11.05MiB / 64MiB +2026-10-16T18:14:56Z,mtusi-messenger-lab3-postgres-1,49.69%,187.1MiB / 384MiB +2026-10-16T18:14:56Z,mtusi-messenger-lab3-api-1,19.64%,11.77MiB / 384MiB +2026-10-16T18:14:56Z,mtusi-messenger-lab3-api-2,19.52%,13.13MiB / 384MiB +2026-10-16T18:14:56Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:14:56Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:14:56Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:14:59Z,mtusi-messenger-lab3-lb-1,14.74%,11.04MiB / 64MiB +2026-10-16T18:14:59Z,mtusi-messenger-lab3-postgres-1,49.98%,187.1MiB / 384MiB +2026-10-16T18:14:59Z,mtusi-messenger-lab3-api-1,19.44%,11.2MiB / 384MiB +2026-10-16T18:14:59Z,mtusi-messenger-lab3-api-2,19.74%,13.06MiB / 384MiB +2026-10-16T18:14:59Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:14:59Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:14:59Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:15:02Z,mtusi-messenger-lab3-lb-1,10.70%,11.04MiB / 64MiB +2026-10-16T18:15:02Z,mtusi-messenger-lab3-postgres-1,49.47%,199.8MiB / 384MiB +2026-10-16T18:15:02Z,mtusi-messenger-lab3-api-1,15.59%,11.29MiB / 384MiB +2026-10-16T18:15:02Z,mtusi-messenger-lab3-api-2,14.42%,13.13MiB / 384MiB +2026-10-16T18:15:02Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:02Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:15:02Z,mtusi-messenger-lab3-redis-1,0.62%,3.863MiB / 192MiB +2026-10-16T18:15:05Z,mtusi-messenger-lab3-lb-1,14.45%,11.06MiB / 64MiB +2026-10-16T18:15:05Z,mtusi-messenger-lab3-postgres-1,50.28%,194.1MiB / 384MiB +2026-10-16T18:15:05Z,mtusi-messenger-lab3-api-1,19.73%,11.27MiB / 384MiB +2026-10-16T18:15:05Z,mtusi-messenger-lab3-api-2,19.31%,13.33MiB / 384MiB +2026-10-16T18:15:05Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:05Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:15:05Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:15:08Z,mtusi-messenger-lab3-lb-1,1.87%,11.04MiB / 64MiB +2026-10-16T18:15:08Z,mtusi-messenger-lab3-postgres-1,49.37%,191.4MiB / 384MiB +2026-10-16T18:15:08Z,mtusi-messenger-lab3-api-1,19.85%,11.29MiB / 384MiB +2026-10-16T18:15:08Z,mtusi-messenger-lab3-api-2,19.50%,13.06MiB / 384MiB +2026-10-16T18:15:08Z,mtusi-messenger-lab2-postgres-1,0.77%,178.3MiB / 1.913GiB +2026-10-16T18:15:08Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:15:08Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:15:11Z,mtusi-messenger-lab3-lb-1,14.88%,11.05MiB / 64MiB +2026-10-16T18:15:11Z,mtusi-messenger-lab3-postgres-1,50.51%,191.6MiB / 384MiB +2026-10-16T18:15:11Z,mtusi-messenger-lab3-api-1,19.27%,11.11MiB / 384MiB +2026-10-16T18:15:11Z,mtusi-messenger-lab3-api-2,19.41%,12.97MiB / 384MiB +2026-10-16T18:15:11Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:11Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:15:11Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:15:14Z,mtusi-messenger-lab3-lb-1,15.13%,11.05MiB / 64MiB +2026-10-16T18:15:14Z,mtusi-messenger-lab3-postgres-1,50.48%,192.2MiB / 384MiB +2026-10-16T18:15:14Z,mtusi-messenger-lab3-api-1,19.74%,11.11MiB / 384MiB +2026-10-16T18:15:14Z,mtusi-messenger-lab3-api-2,20.09%,12.87MiB / 384MiB +2026-10-16T18:15:14Z,mtusi-messenger-lab2-postgres-1,0.23%,178.3MiB / 1.913GiB +2026-10-16T18:15:14Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:15:14Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:15:18Z,mtusi-messenger-lab3-lb-1,14.84%,11.06MiB / 64MiB +2026-10-16T18:15:18Z,mtusi-messenger-lab3-postgres-1,50.26%,192.2MiB / 384MiB +2026-10-16T18:15:18Z,mtusi-messenger-lab3-api-1,19.38%,11.13MiB / 384MiB +2026-10-16T18:15:18Z,mtusi-messenger-lab3-api-2,19.95%,13.72MiB / 384MiB +2026-10-16T18:15:18Z,mtusi-messenger-lab2-postgres-1,0.68%,178.3MiB / 1.913GiB +2026-10-16T18:15:18Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:15:18Z,mtusi-messenger-lab3-redis-1,0.68%,3.863MiB / 192MiB +2026-10-16T18:15:21Z,mtusi-messenger-lab3-lb-1,14.40%,11.05MiB / 64MiB +2026-10-16T18:15:21Z,mtusi-messenger-lab3-postgres-1,49.06%,193.1MiB / 384MiB +2026-10-16T18:15:21Z,mtusi-messenger-lab3-api-1,18.81%,11.14MiB / 384MiB +2026-10-16T18:15:21Z,mtusi-messenger-lab3-api-2,19.02%,13.4MiB / 384MiB +2026-10-16T18:15:21Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:21Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:15:21Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:15:24Z,mtusi-messenger-lab3-lb-1,2.75%,11.04MiB / 64MiB +2026-10-16T18:15:24Z,mtusi-messenger-lab3-postgres-1,9.40%,193.6MiB / 384MiB +2026-10-16T18:15:24Z,mtusi-messenger-lab3-api-1,3.79%,11.26MiB / 384MiB +2026-10-16T18:15:24Z,mtusi-messenger-lab3-api-2,3.82%,13.12MiB / 384MiB +2026-10-16T18:15:24Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:24Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:15:24Z,mtusi-messenger-lab3-redis-1,0.73%,3.863MiB / 192MiB +2026-10-16T18:15:27Z,mtusi-messenger-lab3-lb-1,14.63%,11.05MiB / 64MiB +2026-10-16T18:15:27Z,mtusi-messenger-lab3-postgres-1,49.93%,193.5MiB / 384MiB +2026-10-16T18:15:27Z,mtusi-messenger-lab3-api-1,19.81%,11.27MiB / 384MiB +2026-10-16T18:15:27Z,mtusi-messenger-lab3-api-2,19.40%,13.69MiB / 384MiB +2026-10-16T18:15:27Z,mtusi-messenger-lab2-postgres-1,0.20%,178.3MiB / 1.913GiB +2026-10-16T18:15:27Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:15:27Z,mtusi-messenger-lab3-redis-1,0.20%,3.863MiB / 192MiB +2026-10-16T18:15:30Z,mtusi-messenger-lab3-lb-1,15.02%,11.04MiB / 64MiB +2026-10-16T18:15:30Z,mtusi-messenger-lab3-postgres-1,49.49%,193.9MiB / 384MiB +2026-10-16T18:15:30Z,mtusi-messenger-lab3-api-1,20.42%,11.34MiB / 384MiB +2026-10-16T18:15:30Z,mtusi-messenger-lab3-api-2,19.72%,13MiB / 384MiB +2026-10-16T18:15:30Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:30Z,mtusi-messenger-lab2-redis-1,0.62%,9.004MiB / 1.913GiB +2026-10-16T18:15:30Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:15:33Z,mtusi-messenger-lab3-lb-1,14.59%,11.04MiB / 64MiB +2026-10-16T18:15:33Z,mtusi-messenger-lab3-postgres-1,48.99%,194.5MiB / 384MiB +2026-10-16T18:15:33Z,mtusi-messenger-lab3-api-1,19.65%,11.25MiB / 384MiB +2026-10-16T18:15:33Z,mtusi-messenger-lab3-api-2,20.03%,13.14MiB / 384MiB +2026-10-16T18:15:33Z,mtusi-messenger-lab2-postgres-1,0.78%,178.3MiB / 1.913GiB +2026-10-16T18:15:33Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:15:33Z,mtusi-messenger-lab3-redis-1,0.23%,3.863MiB / 192MiB +2026-10-16T18:15:36Z,mtusi-messenger-lab3-lb-1,14.51%,11.05MiB / 64MiB +2026-10-16T18:15:36Z,mtusi-messenger-lab3-postgres-1,49.82%,194.5MiB / 384MiB +2026-10-16T18:15:36Z,mtusi-messenger-lab3-api-1,19.17%,11.26MiB / 384MiB +2026-10-16T18:15:36Z,mtusi-messenger-lab3-api-2,19.28%,12.89MiB / 384MiB +2026-10-16T18:15:36Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:36Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:15:36Z,mtusi-messenger-lab3-redis-1,0.24%,3.863MiB / 192MiB +2026-10-16T18:15:39Z,mtusi-messenger-lab3-lb-1,6.21%,11.05MiB / 64MiB +2026-10-16T18:15:39Z,mtusi-messenger-lab3-postgres-1,21.29%,194.8MiB / 384MiB +2026-10-16T18:15:39Z,mtusi-messenger-lab3-api-1,8.16%,11.25MiB / 384MiB +2026-10-16T18:15:39Z,mtusi-messenger-lab3-api-2,8.24%,13.44MiB / 384MiB +2026-10-16T18:15:39Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:39Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:15:39Z,mtusi-messenger-lab3-redis-1,0.22%,4.113MiB / 192MiB +2026-10-16T18:15:42Z,mtusi-messenger-lab3-lb-1,14.47%,11.04MiB / 64MiB +2026-10-16T18:15:42Z,mtusi-messenger-lab3-postgres-1,49.21%,195.4MiB / 384MiB +2026-10-16T18:15:42Z,mtusi-messenger-lab3-api-1,19.71%,11.07MiB / 384MiB +2026-10-16T18:15:42Z,mtusi-messenger-lab3-api-2,19.16%,13.6MiB / 384MiB +2026-10-16T18:15:42Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:42Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:15:42Z,mtusi-messenger-lab3-redis-1,0.82%,3.863MiB / 192MiB +2026-10-16T18:15:45Z,mtusi-messenger-lab3-lb-1,14.63%,11.04MiB / 64MiB +2026-10-16T18:15:45Z,mtusi-messenger-lab3-postgres-1,49.09%,195.6MiB / 384MiB +2026-10-16T18:15:45Z,mtusi-messenger-lab3-api-1,19.35%,11.11MiB / 384MiB +2026-10-16T18:15:45Z,mtusi-messenger-lab3-api-2,19.18%,13.43MiB / 384MiB +2026-10-16T18:15:45Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:45Z,mtusi-messenger-lab2-redis-1,0.72%,9.004MiB / 1.913GiB +2026-10-16T18:15:45Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB +2026-10-16T18:15:48Z,mtusi-messenger-lab3-lb-1,15.08%,11.05MiB / 64MiB +2026-10-16T18:15:48Z,mtusi-messenger-lab3-postgres-1,50.44%,196.2MiB / 384MiB +2026-10-16T18:15:48Z,mtusi-messenger-lab3-api-1,19.72%,11.1MiB / 384MiB +2026-10-16T18:15:48Z,mtusi-messenger-lab3-api-2,20.21%,13.05MiB / 384MiB +2026-10-16T18:15:48Z,mtusi-messenger-lab2-postgres-1,0.75%,178.3MiB / 1.913GiB +2026-10-16T18:15:48Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:15:48Z,mtusi-messenger-lab3-redis-1,0.21%,3.863MiB / 192MiB +2026-10-16T18:15:51Z,mtusi-messenger-lab3-lb-1,10.25%,10.99MiB / 64MiB +2026-10-16T18:15:51Z,mtusi-messenger-lab3-postgres-1,49.45%,206.2MiB / 384MiB +2026-10-16T18:15:51Z,mtusi-messenger-lab3-api-1,13.33%,11.08MiB / 384MiB +2026-10-16T18:15:51Z,mtusi-messenger-lab3-api-2,13.26%,13.6MiB / 384MiB +2026-10-16T18:15:51Z,mtusi-messenger-lab2-postgres-1,0.00%,178.3MiB / 1.913GiB +2026-10-16T18:15:51Z,mtusi-messenger-lab2-redis-1,0.70%,9.004MiB / 1.913GiB +2026-10-16T18:15:51Z,mtusi-messenger-lab3-redis-1,0.22%,3.863MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/stats-r4.csv b/evidence/track1/superseded/run2-host-client/stats-r4.csv new file mode 100644 index 00000000..e951b0a7 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/stats-r4.csv @@ -0,0 +1,181 @@ +timestamp,container,cpu_percent,mem_usage +2026-10-16T18:01:15Z,mtusi-messenger-lab3-api-1,8.59%,142.6MiB / 192MiB +2026-10-16T18:01:15Z,mtusi-messenger-lab3-api-2,9.49%,78.38MiB / 192MiB +2026-10-16T18:01:15Z,mtusi-messenger-lab3-api-4,14.30%,142.2MiB / 192MiB +2026-10-16T18:01:15Z,mtusi-messenger-lab3-api-3,8.42%,10.41MiB / 192MiB +2026-10-16T18:01:15Z,mtusi-messenger-lab3-postgres-1,39.44%,186.3MiB / 384MiB +2026-10-16T18:01:15Z,mtusi-messenger-lab2-postgres-1,0.23%,233.4MiB / 1.913GiB +2026-10-16T18:01:15Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:01:15Z,mtusi-messenger-lab3-lb-1,0.33%,11.52MiB / 64MiB +2026-10-16T18:01:15Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-api-1,10.92%,168.6MiB / 192MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-api-2,11.44%,104.8MiB / 192MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-api-4,11.17%,169.7MiB / 192MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-api-3,11.77%,10.46MiB / 192MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-postgres-1,50.77%,186.8MiB / 384MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab2-postgres-1,0.75%,233.4MiB / 1.913GiB +2026-10-16T18:01:18Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-lb-1,14.42%,11.57MiB / 64MiB +2026-10-16T18:01:18Z,mtusi-messenger-lab3-redis-1,0.73%,3.867MiB / 192MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-api-2,11.18%,133.9MiB / 192MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-api-3,11.25%,10.43MiB / 192MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-postgres-1,38.92%,173.8MiB / 384MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:21Z,mtusi-messenger-lab2-redis-1,0.61%,9.004MiB / 1.913GiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-lb-1,11.97%,11.58MiB / 64MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-api-4,6.30%,7.473MiB / 192MiB +2026-10-16T18:01:21Z,mtusi-messenger-lab3-api-1,4.41%,7.18MiB / 192MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-api-1,11.11%,7.996MiB / 192MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-api-2,10.49%,13.34MiB / 192MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-api-4,10.87%,7.949MiB / 192MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-api-3,11.10%,10.44MiB / 192MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-postgres-1,49.61%,187.1MiB / 384MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:26Z,mtusi-messenger-lab2-redis-1,0.72%,9.004MiB / 1.913GiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-lb-1,14.64%,11.59MiB / 64MiB +2026-10-16T18:01:26Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-api-1,11.71%,7.973MiB / 192MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-api-2,10.67%,12.75MiB / 192MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-api-4,10.03%,7.973MiB / 192MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-api-3,10.04%,10.43MiB / 192MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-postgres-1,46.61%,187.5MiB / 384MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:29Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-lb-1,13.82%,11.54MiB / 64MiB +2026-10-16T18:01:29Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-api-1,10.60%,8.043MiB / 192MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-api-2,11.20%,12.65MiB / 192MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-api-4,9.94%,8.008MiB / 192MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-api-3,11.32%,10.49MiB / 192MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-postgres-1,47.90%,187.9MiB / 384MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:32Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-lb-1,13.77%,11.86MiB / 64MiB +2026-10-16T18:01:32Z,mtusi-messenger-lab3-redis-1,0.24%,3.867MiB / 192MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-api-1,11.04%,7.977MiB / 192MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-api-2,10.70%,12.65MiB / 192MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-api-4,10.97%,8.133MiB / 192MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-api-3,10.40%,10.41MiB / 192MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-postgres-1,50.06%,188.4MiB / 384MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:35Z,mtusi-messenger-lab2-redis-1,0.23%,9.004MiB / 1.913GiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-lb-1,14.22%,11.59MiB / 64MiB +2026-10-16T18:01:35Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-api-1,11.45%,8.223MiB / 192MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-api-2,11.55%,12.65MiB / 192MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-api-4,10.71%,8.141MiB / 192MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-api-3,10.56%,10.43MiB / 192MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-postgres-1,50.07%,188.8MiB / 384MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab2-postgres-1,1.01%,240.5MiB / 1.913GiB +2026-10-16T18:01:38Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-lb-1,14.72%,11.61MiB / 64MiB +2026-10-16T18:01:38Z,mtusi-messenger-lab3-redis-1,0.69%,3.867MiB / 192MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-api-1,10.85%,8.055MiB / 192MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-api-2,11.10%,13.17MiB / 192MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-api-4,10.41%,8.133MiB / 192MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-api-3,11.10%,10.42MiB / 192MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-postgres-1,49.62%,189.4MiB / 384MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:41Z,mtusi-messenger-lab2-redis-1,0.65%,9.004MiB / 1.913GiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-lb-1,14.56%,11.59MiB / 64MiB +2026-10-16T18:01:41Z,mtusi-messenger-lab3-redis-1,0.24%,3.867MiB / 192MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-api-1,10.98%,8.109MiB / 192MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-api-2,11.32%,12.77MiB / 192MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-api-4,10.48%,8.141MiB / 192MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-api-3,10.98%,10.36MiB / 192MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-postgres-1,50.41%,189.9MiB / 384MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:44Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-lb-1,14.84%,11.61MiB / 64MiB +2026-10-16T18:01:44Z,mtusi-messenger-lab3-redis-1,0.77%,3.867MiB / 192MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-api-1,8.62%,8.059MiB / 192MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-api-2,8.69%,12.91MiB / 192MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-api-4,9.10%,8.148MiB / 192MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-api-3,8.16%,10.37MiB / 192MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-postgres-1,37.94%,190.1MiB / 384MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:47Z,mtusi-messenger-lab2-redis-1,0.22%,9.004MiB / 1.913GiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-lb-1,0.06%,11.54MiB / 64MiB +2026-10-16T18:01:47Z,mtusi-messenger-lab3-redis-1,0.22%,3.867MiB / 192MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-api-1,8.06%,7.984MiB / 192MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-api-2,7.97%,12.93MiB / 192MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-api-4,8.10%,8.09MiB / 192MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-api-3,8.09%,10.37MiB / 192MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-postgres-1,49.15%,187.2MiB / 384MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab2-postgres-1,0.20%,240.5MiB / 1.913GiB +2026-10-16T18:01:50Z,mtusi-messenger-lab2-redis-1,0.21%,9.004MiB / 1.913GiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-lb-1,10.58%,11.58MiB / 64MiB +2026-10-16T18:01:50Z,mtusi-messenger-lab3-redis-1,0.23%,3.867MiB / 192MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-api-1,10.57%,7.996MiB / 192MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-api-2,11.56%,13.09MiB / 192MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-api-4,10.78%,8.094MiB / 192MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-api-3,10.48%,10.48MiB / 192MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-postgres-1,49.61%,187.7MiB / 384MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab2-postgres-1,0.80%,240.5MiB / 1.913GiB +2026-10-16T18:01:53Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-lb-1,14.58%,11.59MiB / 64MiB +2026-10-16T18:01:53Z,mtusi-messenger-lab3-redis-1,0.72%,3.867MiB / 192MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-api-1,10.65%,8.094MiB / 192MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-api-2,11.02%,12.71MiB / 192MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-api-4,11.74%,8.098MiB / 192MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-api-3,11.15%,10.45MiB / 192MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-postgres-1,50.24%,188.3MiB / 384MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:01:57Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-lb-1,14.89%,11.6MiB / 64MiB +2026-10-16T18:01:57Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-api-1,10.51%,8.383MiB / 192MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-api-2,10.71%,12.96MiB / 192MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-api-4,10.41%,8.156MiB / 192MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-api-3,11.11%,10.45MiB / 192MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-postgres-1,48.78%,188.8MiB / 384MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab2-postgres-1,0.87%,240.5MiB / 1.913GiB +2026-10-16T18:02:00Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-lb-1,14.51%,11.59MiB / 64MiB +2026-10-16T18:02:00Z,mtusi-messenger-lab3-redis-1,0.20%,3.867MiB / 192MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-api-1,0.04%,8.051MiB / 192MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-api-2,0.04%,12.73MiB / 192MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-api-4,0.03%,8.086MiB / 192MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-api-3,0.03%,10.44MiB / 192MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-postgres-1,0.18%,189.1MiB / 384MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab2-postgres-1,0.23%,240.5MiB / 1.913GiB +2026-10-16T18:02:03Z,mtusi-messenger-lab2-redis-1,0.24%,9.004MiB / 1.913GiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-lb-1,0.12%,11.54MiB / 64MiB +2026-10-16T18:02:03Z,mtusi-messenger-lab3-redis-1,0.23%,3.867MiB / 192MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-api-1,10.71%,8.109MiB / 192MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-api-2,10.63%,12.71MiB / 192MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-api-4,11.29%,8.098MiB / 192MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-api-3,10.92%,10.38MiB / 192MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-postgres-1,49.82%,189.7MiB / 384MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:02:06Z,mtusi-messenger-lab2-redis-1,0.76%,9.004MiB / 1.913GiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-lb-1,14.79%,11.59MiB / 64MiB +2026-10-16T18:02:06Z,mtusi-messenger-lab3-redis-1,0.19%,3.867MiB / 192MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-api-1,11.20%,8.121MiB / 192MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-api-2,11.05%,12.85MiB / 192MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-api-4,10.98%,8.102MiB / 192MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-api-3,10.48%,10.38MiB / 192MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-postgres-1,50.74%,190.2MiB / 384MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:02:09Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-lb-1,14.65%,11.59MiB / 64MiB +2026-10-16T18:02:09Z,mtusi-messenger-lab3-redis-1,0.23%,3.867MiB / 192MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-api-1,10.56%,8.129MiB / 192MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-api-2,11.70%,12.79MiB / 192MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-api-4,10.40%,8.102MiB / 192MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-api-3,11.18%,10.39MiB / 192MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-postgres-1,48.26%,188.2MiB / 384MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab2-postgres-1,0.00%,240.5MiB / 1.913GiB +2026-10-16T18:02:12Z,mtusi-messenger-lab2-redis-1,0.20%,9.004MiB / 1.913GiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-lb-1,14.18%,11.58MiB / 64MiB +2026-10-16T18:02:12Z,mtusi-messenger-lab3-redis-1,0.21%,3.867MiB / 192MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-api-1,1.25%,8.117MiB / 192MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-api-2,1.35%,12.95MiB / 192MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-api-4,1.28%,8.113MiB / 192MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-api-3,1.22%,10.38MiB / 192MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-postgres-1,47.75%,190.8MiB / 384MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab2-postgres-1,0.23%,240.5MiB / 1.913GiB +2026-10-16T18:02:15Z,mtusi-messenger-lab2-redis-1,0.28%,9.004MiB / 1.913GiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-lb-1,1.74%,11.54MiB / 64MiB +2026-10-16T18:02:15Z,mtusi-messenger-lab3-redis-1,0.29%,3.867MiB / 192MiB diff --git a/evidence/track1/superseded/run2-host-client/summary.md b/evidence/track1/superseded/run2-host-client/summary.md new file mode 100644 index 00000000..5bb33ea0 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/summary.md @@ -0,0 +1,14 @@ +# Трек 1: цена масштабирования + +| профиль | реплик | бюджет CPU API | CPU/реплика | бюджет PG CPU/RAM | пул | LB CPU (лимит) | успешный RPS | p50 мс | p95 мс | p99 мс | ошибки | API CPU (сумма) | API RAM max (сумма, MiB) | PG CPU | LB CPU | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| db1cpu | 2 | 1.0 | 0.5 | 1.00/384M | 10 | 0.25 | 1579.722 | 4.033 | 6.236 | 8.668 | 26520 | 34.37 | 340.0 | 46.08 | 13.74 | +| g05 | 2 | 0.5 | 0.25 | 0.50/384M | 10 | 0.25 | 1584.428 | 4.042 | 9.331 | 27.665 | 2845 | 35.23 | 264.6 | 48.11 | 13.01 | +| g10 | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1597.028 | 3.927 | 7.67 | 21.91 | 13795 | 34.67 | 336.7 | 47.34 | 12.38 | +| g15 | 2 | 1.5 | 0.75 | 0.50/384M | 10 | 0.25 | 1639.884 | 3.963 | 7.721 | 23.6 | 6960 | 36.73 | 271.5 | 48.9 | 13.83 | +| lb1cpu | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 1.00 | 1631.408 | 3.894 | 6.989 | 20.148 | 15652 | 35.82 | 336.2 | 44.66 | 13.13 | +| pool10 | 4 | 1.0 | 0.25 | 0.50/384M | 10 | 0.25 | 1582.872 | 4.156 | 7.798 | 19.723 | 11008 | 41.21 | 535.9 | 44.04 | 13.36 | +| pool5 | 4 | 1.0 | 0.25 | 0.50/384M | 5 | 0.25 | 1551.419 | 4.125 | 7.868 | 21.268 | 13051 | 38.75 | 451.3 | 45.23 | 12.9 | +| r1 | 1 | 1.0 | 1.0 | 0.50/384M | 10 | 0.25 | 1717.626 | 3.85 | 7.538 | 25.045 | 0 | 30.38 | 197.9 | 50.15 | 13.29 | +| r2 | 2 | 1.0 | 0.5 | 0.50/384M | 10 | 0.25 | 1632.545 | 3.959 | 7.508 | 22.12 | 9791 | 35.4 | 334.0 | 46.32 | 12.64 | +| r4 | 4 | 1.0 | 0.25 | 0.50/384M | 10 | 0.25 | 1535.673 | 4.184 | 8.208 | 22.167 | 11454 | 37.84 | 453.6 | 45.29 | 11.37 | diff --git a/evidence/track1/superseded/run2-host-client/summary.txt b/evidence/track1/superseded/run2-host-client/summary.txt new file mode 100644 index 00000000..54f13497 --- /dev/null +++ b/evidence/track1/superseded/run2-host-client/summary.txt @@ -0,0 +1,300 @@ +# Track 1: the price of scaling +# generated: 2026-10-16T17:58:18Z +# host: Darwin arm64 +# cpu: Apple M5 Pro +# ram bytes: 51539607552 +# load: tests/load.py closed loop; postgres/lb budgets are recreated and verified per profile +# each profile line below records the budget it was run with +docker engine 29.5.2 +Docker Compose version 5.5.1 + +=== invocation 2026-10-16T17:58:18Z: REPLICAS="1" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r1 replicas=1 cpu=1.00 mem=768M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=r1 replicas=1 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 103077, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 1717.626, + "successful_latency_ms": { + "p50": 3.85, + "p95": 7.538, + "p99": 25.045 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=18 +postgres_max_connections=100 +messages_rows=1919638 +idempotency_rows=1919638 + +=== invocation 2026-10-16T17:59:40Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r2 replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=r2 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.014, + "concurrency": 8, + "successful_requests": 100215, + "failed_requests": 4450, + "error_ratio": 0.042517, + "successful_rps": 1669.874, + "successful_latency_ms": { + "p50": 4.01, + "p95": 7.699, + "p99": 22.735 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=2044175 +idempotency_rows=2044175 + +=== invocation 2026-10-16T18:00:57Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r4 replicas=4 cpu=0.25 mem=192M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=r4 replicas=4 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 92161, + "failed_requests": 11454, + "error_ratio": 0.110544, + "successful_rps": 1535.673, + "successful_latency_ms": { + "p50": 4.184, + "p95": 8.208, + "p99": 22.167 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=21 +postgres_max_connections=100 +messages_rows=2161959 +idempotency_rows=2161959 + +=== invocation 2026-10-16T18:02:17Z: REPLICAS="2" TOTAL_CPU=0.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g05 replicas=2 cpu=0.25 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=g05 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.013, + "concurrency": 8, + "successful_requests": 95087, + "failed_requests": 2845, + "error_ratio": 0.029051, + "successful_rps": 1584.428, + "successful_latency_ms": { + "p50": 4.042, + "p95": 9.331, + "p99": 27.665 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=2282714 +idempotency_rows=2282714 + +=== invocation 2026-10-16T18:03:42Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g10 replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=g10 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 95841, + "failed_requests": 13795, + "error_ratio": 0.125825, + "successful_rps": 1597.028, + "successful_latency_ms": { + "p50": 3.927, + "p95": 7.67, + "p99": 21.91 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=2404027 +idempotency_rows=2404027 + +=== invocation 2026-10-16T18:05:00Z: REPLICAS="2" TOTAL_CPU=1.5 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=g15 replicas=2 cpu=0.75 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=g15 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.011, + "concurrency": 8, + "successful_requests": 98411, + "failed_requests": 6960, + "error_ratio": 0.066052, + "successful_rps": 1639.884, + "successful_latency_ms": { + "p50": 3.963, + "p95": 7.721, + "p99": 23.6 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=2528963 +idempotency_rows=2528963 + +=== invocation 2026-10-16T18:06:17Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool10 replicas=4 cpu=0.25 mem=192M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=pool10 replicas=4 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.014, + "concurrency": 8, + "successful_requests": 94995, + "failed_requests": 11008, + "error_ratio": 0.103846, + "successful_rps": 1582.872, + "successful_latency_ms": { + "p50": 4.156, + "p95": 7.798, + "p99": 19.723 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=2649923 +idempotency_rows=2649923 + +=== invocation 2026-10-16T18:07:37Z: REPLICAS="4" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=pool5 replicas=4 cpu=0.25 mem=192M postgres=0.50/384M lb_cpu=0.25 max_conns=5 === +=== applied label=pool5 replicas=4 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.016, + "concurrency": 8, + "successful_requests": 93110, + "failed_requests": 13051, + "error_ratio": 0.122936, + "successful_rps": 1551.419, + "successful_latency_ms": { + "p50": 4.125, + "p95": 7.868, + "p99": 21.268 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=23 +postgres_max_connections=100 +messages_rows=2767792 +idempotency_rows=2767792 + +=== invocation 2026-10-16T18:08:57Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=db1cpu replicas=2 cpu=0.50 mem=384M postgres=1.00/384M lb_cpu=0.25 max_conns=10 === +=== PostgreSQL: бюджет 0.50/384M -> 1.00/384M, пересоздаю контейнер === +=== applied label=db1cpu replicas=2 postgres=1.00/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.83, + "concurrency": 8, + "successful_requests": 96094, + "failed_requests": 26520, + "error_ratio": 0.216289, + "successful_rps": 1579.722, + "successful_latency_ms": { + "p50": 4.033, + "p95": 6.236, + "p99": 8.668 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=2894016 +idempotency_rows=2894016 + +=== возвращаю PostgreSQL к бюджету 0.50/384M === +=== invocation 2026-10-16T18:10:21Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=lb1cpu replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=1.00 max_conns=10 === +=== LB: бюджет CPU 0.25 -> 1.00, пересоздаю контейнер === +=== applied label=lb1cpu replicas=2 postgres=0.50/384M lb_cpu=1.00 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.01, + "concurrency": 8, + "successful_requests": 97901, + "failed_requests": 15652, + "error_ratio": 0.137839, + "successful_rps": 1631.408, + "successful_latency_ms": { + "p50": 3.894, + "p95": 6.989, + "p99": 20.148 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=3019112 +idempotency_rows=3019112 + +=== возвращаю LB к бюджету CPU 0.25 === +=== invocation 2026-10-16T18:14:37Z: REPLICAS="2" TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 === + +=== profile label=r2 replicas=2 cpu=0.50 mem=384M postgres=0.50/384M lb_cpu=0.25 max_conns=10 === +=== applied label=r2 replicas=2 postgres=0.50/384M lb_cpu=0.25 (снято с контейнеров) +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 60.0, + "elapsed_seconds": 60.012, + "concurrency": 8, + "successful_requests": 97973, + "failed_requests": 9791, + "error_ratio": 0.090856, + "successful_rps": 1632.545, + "successful_latency_ms": { + "p50": 3.959, + "p95": 7.508, + "p99": 22.12 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} +postgres_connections=19 +postgres_max_connections=100 +messages_rows=3252832 +idempotency_rows=3252832 + diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..b627ea23 --- /dev/null +++ b/go.mod @@ -0,0 +1,120 @@ +module mtusi-messenger + +go 1.27.0 + +require ( + github.com/go-faster/errors v0.8.0 + github.com/go-faster/jx v1.2.0 + github.com/go-playground/validator/v10 v10.30.5 + github.com/google/uuid v1.6.0 + github.com/jackc/pgx/v5 v5.11.0 + github.com/ogen-go/ogen v1.24.0 + github.com/pressly/goose/v3 v3.28.0 + github.com/redis/go-redis/v9 v9.22.0 + github.com/spf13/viper v1.21.0 + github.com/stretchr/testify v1.12.1 + go.uber.org/zap v1.28.0 + go.uber.org/zap/exp v0.3.0 + golang.org/x/crypto v0.57.0 + golang.org/x/sync v0.23.0 +) + +require ( + cel.dev/expr v0.25.2 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect + github.com/brunoga/deep v1.3.1 // 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 + github.com/cubicdaiya/gonp v1.0.4 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/dlclark/regexp2 v1.12.0 // indirect + github.com/fatih/color v1.19.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/fatih/structtag v1.2.0 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + 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-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/huandu/xstrings v1.5.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/jedib0t/go-pretty/v6 v6.7.8 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/knadh/koanf/maps v0.1.2 // indirect + github.com/knadh/koanf/parsers/yaml v1.1.0 // indirect + github.com/knadh/koanf/providers/env v1.1.0 // indirect + github.com/knadh/koanf/providers/file v1.2.1 // indirect + github.com/knadh/koanf/providers/posflag v1.0.1 // indirect + github.com/knadh/koanf/providers/structs v1.0.0 // indirect + github.com/knadh/koanf/v2 v2.3.2 // indirect + github.com/leodido/go-urn v1.5.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.24 // indirect + github.com/mattn/go-runewidth v0.0.19 // indirect + github.com/mfridman/interpolate v0.0.2 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/ncruces/go-sqlite3 v0.32.0 // indirect + github.com/ncruces/julianday v1.0.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/pganalyze/pg_query_go/v6 v6.2.2 // indirect + github.com/pingcap/errors v0.11.5-0.20250523034308-74f78ae071ee // indirect + github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 // indirect + github.com/pingcap/log v1.1.0 // indirect + github.com/pingcap/tidb/pkg/parser v0.0.0-20260418072757-ce92298d1124 // indirect + github.com/riza-io/grpc-go v0.2.0 // indirect + github.com/rs/zerolog v1.34.0 // indirect + github.com/sagikazarmark/locafero v0.11.0 // indirect + github.com/segmentio/asm v1.2.1 // indirect + github.com/sethvargo/go-retry v0.4.0 // indirect + github.com/shopspring/decimal v1.4.0 // indirect + github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect + github.com/spf13/afero v1.15.0 // indirect + github.com/spf13/cast v1.10.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.0.10 // indirect + github.com/sqlc-dev/doubleclick v1.0.0 // indirect + github.com/sqlc-dev/sqlc v1.31.1 // indirect + github.com/stretchr/objx v0.5.3 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/tetratelabs/wazero v1.11.0 // indirect + github.com/vektra/mockery/v3 v3.8.0 // indirect + github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 // indirect + github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + 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.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect + golang.org/x/exp v0.0.0-20260824195058-e88cd73687aa // indirect + golang.org/x/mod v0.41.0 // indirect + golang.org/x/net v0.58.0 // indirect + golang.org/x/sys v0.48.0 // indirect + golang.org/x/term v0.46.0 // indirect + golang.org/x/text v0.42.0 // indirect + golang.org/x/tools v0.49.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/grpc v1.83.2 // indirect + google.golang.org/protobuf v1.36.12 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +tool ( + github.com/ogen-go/ogen/cmd/ogen + github.com/sqlc-dev/sqlc/cmd/sqlc + github.com/vektra/mockery/v3 +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..850f17ae --- /dev/null +++ b/go.sum @@ -0,0 +1,322 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/brunoga/deep v1.3.1 h1:bSrL6FhAZa6JlVv4vsi7Hg8SLwroDb1kgDERRVipBCo= +github.com/brunoga/deep v1.3.1/go.mod h1:GDV6dnXqn80ezsLSZ5Wlv1PdKAWAO4L5PnKYtv2dgaI= +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/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= +github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= +github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/cubicdaiya/gonp v1.0.4 h1:ky2uIAJh81WiLcGKBVD5R7KsM/36W6IqqTy6Bo6rGws= +github.com/cubicdaiya/gonp v1.0.4/go.mod h1:iWGuP/7+JVTn02OWhRemVbMmG1DOUnmrGTYYACpOI0I= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8= +github.com/dlclark/regexp2 v1.12.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +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= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI= +github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-faster/errors v0.8.0 h1:9T9eJrM+72dFk7n4DfhuaDDe6cyuFCSW2oNUkN77Yqc= +github.com/go-faster/errors v0.8.0/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo= +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.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= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.30.5 h1:YyCXvVShZbs2Sm3Mb53eNOlhRXctSOzW5QJAouCTZL4= +github.com/go-playground/validator/v10 v10.30.5/go.mod h1:wEqiaov48pXX1kjhc3Da8y0M0Dtg/BK7gurFBLgwFrQ= +github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw= +github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/cel-go v0.28.0 h1:KjSWstCpz/MN5t4a8gnGJNIYUsJRpdi/r97xWDphIQc= +github.com/google/cel-go v0.28.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= +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/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= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg= +github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jedib0t/go-pretty/v6 v6.7.8 h1:BVYrDy5DPBA3Qn9ICT+PokP9cvCv1KaHv2i+Hc8sr5o= +github.com/jedib0t/go-pretty/v6 v6.7.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo= +github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/parsers/yaml v1.1.0 h1:3ltfm9ljprAHt4jxgeYLlFPmUaunuCgu1yILuTXRdM4= +github.com/knadh/koanf/parsers/yaml v1.1.0/go.mod h1:HHmcHXUrp9cOPcuC+2wrr44GTUB0EC+PyfN3HZD9tFg= +github.com/knadh/koanf/providers/env v1.1.0 h1:U2VXPY0f+CsNDkvdsG8GcsnK4ah85WwWyJgef9oQMSc= +github.com/knadh/koanf/providers/env v1.1.0/go.mod h1:QhHHHZ87h9JxJAn2czdEl6pdkNnDh/JS1Vtsyt65hTY= +github.com/knadh/koanf/providers/file v1.2.1 h1:bEWbtQwYrA+W2DtdBrQWyXqJaJSG3KrP3AESOJYp9wM= +github.com/knadh/koanf/providers/file v1.2.1/go.mod h1:bp1PM5f83Q+TOUu10J/0ApLBd9uIzg+n9UgthfY+nRA= +github.com/knadh/koanf/providers/posflag v1.0.1 h1:EnMxHSrPkYCFnKgBUl5KBgrjed8gVFrcXDzaW4l/C6Y= +github.com/knadh/koanf/providers/posflag v1.0.1/go.mod h1:3Wn3+YG3f4ljzRyCUgIwH7G0sZ1pMjCOsNBovrbKmAk= +github.com/knadh/koanf/providers/structs v1.0.0 h1:DznjB7NQykhqCar2LvNug3MuxEQsZ5KvfgMbio+23u4= +github.com/knadh/koanf/providers/structs v1.0.0/go.mod h1:kjo5TFtgpaZORlpoJqcbeLowM2cINodv8kX+oFAeQ1w= +github.com/knadh/koanf/v2 v2.3.2 h1:Ee6tuzQYFwcZXQpc2MiVeC6qHMandf5SMUJJNoFp/c4= +github.com/knadh/koanf/v2 v2.3.2/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0= +github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= +github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= +github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= +github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= +github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/ncruces/go-sqlite3 v0.32.0 h1:hNBUXp88LrfQCsuyXLqWTbTUG35sUuktDsqhhgHvU20= +github.com/ncruces/go-sqlite3 v0.32.0/go.mod h1:MIWTK60ONDl0oVY073zYvJP21C3Dly6P9bxVpgkLwdQ= +github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= +github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= +github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= +github.com/ogen-go/ogen v1.24.0 h1:NehBG/8s0JeM6jYHPJeFJntBG3cE/xQgZd1q8BchPNM= +github.com/ogen-go/ogen v1.24.0/go.mod h1:hcg4aTzLcu/MS1SGGahUriPBEOZB3c82RGIC6dYcdFU= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pganalyze/pg_query_go/v6 v6.2.2 h1:O0L6zMC226R82RF3X5n0Ki6HjytDsoAzuzp4ATVAHNo= +github.com/pganalyze/pg_query_go/v6 v6.2.2/go.mod h1:Cn6+j4870kJz3iYNsb0VsNG04vpSWgEvBwc590J4qD0= +github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/errors v0.11.5-0.20250523034308-74f78ae071ee h1:/IDPbpzkzA97t1/Z1+C3KlxbevjMeaI6BQYxvivu4u8= +github.com/pingcap/errors v0.11.5-0.20250523034308-74f78ae071ee/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= +github.com/pingcap/log v1.1.0 h1:ELiPxACz7vdo1qAvvaWJg1NrYFoY6gqAh/+Uo6aXdD8= +github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= +github.com/pingcap/tidb/pkg/parser v0.0.0-20260418072757-ce92298d1124 h1:zYmP5fBH+i2yhhU6f5uOol6zxHtR2/sD47BsJLfy0oU= +github.com/pingcap/tidb/pkg/parser v0.0.0-20260418072757-ce92298d1124/go.mod h1:zDLDsfNBU5+L6T4J9/OgWAHc/WZvMUjbpgHqQ/t3yKo= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pressly/goose/v3 v3.28.0 h1:D2M+iL31GmpZxSHOhX8mqyqAT3CXnokUmm0eKoSP+Vc= +github.com/pressly/goose/v3 v3.28.0/go.mod h1:v26MOuB8bL3kzzrt3Vqhb3R0PRVsl8hFQKdrht/L6Rk= +github.com/redis/go-redis/v9 v9.22.0 h1:laDvpYXTJtZLloinw1fA5Kqd6HAEH2XKxOkG/PDq2F0= +github.com/redis/go-redis/v9 v9.22.0/go.mod h1:y2g0Wj8rQvuK0ELM+oxSudcLtC09JScs98I/X9gRWY4= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/riza-io/grpc-go v0.2.0 h1:2HxQKFVE7VuYstcJ8zqpN84VnAoJ4dCL6YFhJewNcHQ= +github.com/riza-io/grpc-go v0.2.0/go.mod h1:2bDvR9KkKC3KhtlSHfR3dAXjUMT86kg4UfWFyVGWqi8= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= +github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= +github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= +github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= +github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/sethvargo/go-retry v0.4.0 h1:9qy1OoIAxBL+gBYnkTnTnWle5wlfsXQlwRzIbbpdqPw= +github.com/sethvargo/go-retry v0.4.0/go.mod h1:tvsjdKG6xfiCx4LSiUZ06kcv38xvdVQwv8R6/VnnVWg= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= +github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= +github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= +github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= +github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= +github.com/sqlc-dev/doubleclick v1.0.0 h1:2/OApfQ2eLgcfa/Fqs8WSMA6atH0G8j9hHbQIgMfAXI= +github.com/sqlc-dev/doubleclick v1.0.0/go.mod h1:ODHRroSrk/rr5neRHlWMSRijqOak8YmNaO3VAZCNl5Y= +github.com/sqlc-dev/sqlc v1.31.1 h1:+V+BjBJfFNPX/RFfL8eiZD9jk9lVJUEGGllWvnYNqbc= +github.com/sqlc-dev/sqlc v1.31.1/go.mod h1:6ZPww/Jd3G6MzJeW6NrqizjL+52vYNaaXP9yMeJ/Nao= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= +github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA= +github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU= +github.com/vektra/mockery/v3 v3.8.0 h1:Tklqcx844iV8GtYziqJXam1a8RdcKip4UErMa66Nxps= +github.com/vektra/mockery/v3 v3.8.0/go.mod h1:K+L72OoFVizA9eWtO4L+kU65oylgreiJEJ57Gu8g9Ew= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 h1:mJdDDPblDfPe7z7go8Dvv1AJQDI3eQ/5xith3q2mFlo= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07/go.mod h1:Ak17IJ037caFp4jpCw/iQQ7/W74Sqpb1YuKJU6HTKfM= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/yuin/goldmark v1.8.2 h1:kEGpgqJXdgbkhcOgBxkC0X0PmoPG1ZyoZ117rDVp4zE= +github.com/yuin/goldmark v1.8.2/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +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.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= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= +go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= +go.uber.org/zap/exp v0.3.0 h1:6JYzdifzYkGmTdRR59oYH+Ng7k49H9qVpWwNSsGJj3U= +go.uber.org/zap/exp v0.3.0/go.mod h1:5I384qq7XGxYyByIhHm6jg5CHkGY0nsTfbDLgDDlgJQ= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= +golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/exp v0.0.0-20260824195058-e88cd73687aa h1:QSyA8ishJCyT21kER9KwNt0b7BM3iRK4x9QXhjN5Fdk= +golang.org/x/exp v0.0.0-20260824195058-e88cd73687aa/go.mod h1:zeBbvyFKDaLwa7CH/zI8KXt7gTl14SF7sO08Pl5jBCM= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= +golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= +golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +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/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= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +modernc.org/libc v1.75.6 h1:yKk8qo+Di4gkmvRboK8ocCqH22FiUCR6jRy2OwtCRus= +modernc.org/libc v1.75.6/go.mod h1:bO5o2ztHxBb2rjz0PgdHN0sSMw57CgxGFLZ3Qd/QpVQ= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= +modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g= +modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= +modernc.org/sqlite v1.57.0 h1:qNQP6xnx5M0ISNtlnxoOX0+cD5bJ0/gr9aMmndFczzg= +modernc.org/sqlite v1.57.0/go.mod h1:yCJ2cmAaIkHQ25oXWrF8H4O1lIfPYPR26yCEDj2P3pQ= diff --git a/infra/lb/haproxy.cfg b/infra/lb/haproxy.cfg new file mode 100644 index 00000000..4521326e --- /dev/null +++ b/infra/lb/haproxy.cfg @@ -0,0 +1,71 @@ +# Load balancer for the lab3 stand (HAProxy, container `lb`). +# +# Почему активные проверки, а не пассивные: nginx OSS умел только пассивные, и +# реплика, которая осталась доступной по сети, но потеряла БД, продолжала получать +# трафик и отвечала 503 (измерено: 20 из 40 запросов /health/live). HAProxy сам +# опрашивает /health/ready и полностью убирает неготовую реплику из ротации. +# +# Почему повторы безопасны: `retry-on conn-failure` — повтор только когда +# соединение не установилось и запрос НЕ ушёл. Если запрос уже передан серверу, +# повтора нет, поэтому прозрачного дублирования POST (создание чата, сообщения) +# балансировщик не делает. Неопределённый результат повторяет клиент, а сообщение +# защищено обязательным Idempotency-Key (контракт 1.3.0). + +global + log stdout format raw local0 + maxconn 2048 + +defaults + mode http + log global + option httplog + option dontlognull + timeout connect 1s + timeout client 30s + timeout server 5s + # Проверка готовности: одна проба не может висеть дольше 1 с, поэтому при + # inter 2s fall 2 реплика уходит из ротации максимум за ~4 с, даже если она + # держит соединение открытым и не отвечает. + timeout check 1s + retry-on conn-failure + retries 2 + option redispatch + +resolvers docker + nameserver dns 127.0.0.11:53 + resolve_retries 3 + timeout resolve 1s + timeout retry 1s + hold valid 5s + hold nx 2s + hold timeout 1s + hold refused 1s + hold obsolete 5s + +backend api_backend + balance leastconn + # Период проверки 2 с; реплика исключается после 2 неудач (<=4 с) и + # возвращается в ротацию после 2 успехов (<=4 с). + option httpchk + http-check send meth GET uri /health/ready + http-check expect status 200 + # Одно имя -> все адреса реплик (общий network alias в compose.yaml), + # адреса переразрешаются каждые 5 с: масштабирование и замена контейнеров + # не зависят от их номеров и IP. + default-server check inter 2s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none + # Слотов больше, чем типовых реплик (1/2/4 в треке 1): свободный слот нужен + # ещё и сценарию scripts/lb_readiness_check.sh, который поднимает рядом + # «неготовую» реплику. + server-template api 8 api-replica:8080 + +frontend http_front + bind *:80 + default_backend api_backend + +frontend stats_front + # Только для оператора и доказательств: видно, какие реплики UP/DOWN и почему. + bind *:8404 + stats enable + stats uri /stats + stats refresh 2s + monitor-uri /healthz diff --git a/internal/config/config.go b/internal/config/config.go new file mode 100644 index 00000000..e3729707 --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,251 @@ +package config + +import ( + "errors" + "fmt" + "log/slog" + "net" + "net/url" + "os" + "path/filepath" + "reflect" + "strconv" + "strings" + "time" + + "github.com/go-playground/validator/v10" + "github.com/spf13/viper" + + "mtusi-messenger/internal/logger" +) + +const ( + configEnvKey = "APP_CONFIG" + envKey = "APP_ENV" + configName = "config" + defaultEnv = "dev" + configDir = "./config/" +) + +type Config struct { + Env string `mapstructure:"env" validate:"omitempty,eq=dev"` + Server Server `mapstructure:"server"` + Log Log `mapstructure:"log"` + Postgres Postgres `mapstructure:"postgres"` + Redis Redis `mapstructure:"redis"` + Cache Cache `mapstructure:"cache"` + Session Session `mapstructure:"session"` + Idempotency Idempotency `mapstructure:"idempotency"` +} + +type Session struct { + TTLSeconds int `mapstructure:"ttl_seconds" validate:"required,gt=0"` +} + +// Idempotency holds the retention window of a message Idempotency-Key (contract +// 1.3.0 requires at least 24 hours). +type Idempotency struct { + TTLSeconds int `mapstructure:"ttl_seconds" validate:"required,gt=0"` +} + +type Redis struct { + Enabled bool `mapstructure:"enabled"` + Host string `mapstructure:"host" validate:"omitempty,hostname|ip"` + Port int `mapstructure:"port" validate:"omitempty,min=1,max=65535"` + Password string `mapstructure:"password"` + DB int `mapstructure:"db" validate:"omitempty,gte=0,lte=15"` + MaxRetries int `mapstructure:"max_retries" validate:"omitempty,gte=-1"` + DialTimeout time.Duration `mapstructure:"dial_timeout" validate:"omitempty,gt=0"` + ReadTimeout time.Duration `mapstructure:"read_timeout" validate:"omitempty,gt=0"` + WriteTimeout time.Duration `mapstructure:"write_timeout" validate:"omitempty,gt=0"` + PoolSize int `mapstructure:"pool_size" validate:"omitempty,gt=0"` +} + +type Cache struct { + Enabled bool `mapstructure:"enabled"` + ChatListTTL time.Duration `mapstructure:"chat_list_ttl" validate:"required,gt=0"` + LockTTL time.Duration `mapstructure:"lock_ttl" validate:"required,gt=1s"` + LockWaitTimeout time.Duration `mapstructure:"lock_wait_timeout" validate:"required,gt=0"` +} + +type Server struct { + Host string `mapstructure:"host" validate:"required,hostname|ip"` + Port int `mapstructure:"port" validate:"required,min=1,max=65535"` + ReadHeaderTimeout time.Duration `mapstructure:"read_header_timeout" validate:"required,gt=0"` + ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout" validate:"required,gt=0"` + // MaxBodyBytes bounds a request body before the transport decodes it; uploads + // of a later lab raise it explicitly (contract 4: 10 MiB attachments). + MaxBodyBytes int64 `mapstructure:"max_body_bytes" validate:"required,gt=0"` +} + +type Log struct { + Level string `mapstructure:"level" validate:"required,oneof=debug info warn error"` + Format string `mapstructure:"format" validate:"required,oneof=json console"` +} + +type Postgres struct { + Host string `mapstructure:"host" validate:"omitempty,hostname|ip"` + Port int `mapstructure:"port" validate:"omitempty,min=1,max=65535"` + Database string `mapstructure:"database" validate:"omitempty,min=1"` + User string `mapstructure:"user" validate:"omitempty,min=1"` + Password string `mapstructure:"password"` + SSLMode string `mapstructure:"ssl_mode" validate:"omitempty,oneof=disable require verify-ca verify-full"` + MaxConns int32 `mapstructure:"max_conns" validate:"omitempty,gt=0"` + MinConns int32 `mapstructure:"min_conns" validate:"omitempty,gte=0"` + MaxConnLifetime time.Duration `mapstructure:"max_conn_lifetime" validate:"omitempty,gt=0"` + MaxConnIdleTime time.Duration `mapstructure:"max_conn_idle_time" validate:"omitempty,gt=0"` + ConnectTimeout time.Duration `mapstructure:"connect_timeout" validate:"omitempty,gt=0"` + QueryTimeout time.Duration `mapstructure:"query_timeout" validate:"omitempty,gt=0"` +} + +func (p Postgres) DSN() string { + u := &url.URL{ + Scheme: "postgres", + Host: net.JoinHostPort(p.Host, strconv.Itoa(p.Port)), + Path: "/" + p.Database, + } + + if p.Password == "" { + u.User = url.User(p.User) + } else { + u.User = url.UserPassword(p.User, p.Password) + } + + query := url.Values{} + query.Set("sslmode", p.SSLMode) + u.RawQuery = query.Encode() + + return u.String() +} + +var defaults = map[string]any{ + "env": "dev", + "server.host": "0.0.0.0", + "server.port": 8080, + "server.read_header_timeout": "10s", + "server.shutdown_timeout": "10s", + "server.max_body_bytes": 262144, + "log.level": "info", + "log.format": "json", + "session.ttl_seconds": 3600, + "idempotency.ttl_seconds": 86400, + "redis.enabled": false, + "redis.host": "localhost", + "redis.port": 6379, + "redis.db": 0, + "redis.max_retries": -1, + "redis.dial_timeout": "300ms", + "redis.read_timeout": "200ms", + "redis.write_timeout": "200ms", + "redis.pool_size": 10, + "cache.enabled": false, + "cache.chat_list_ttl": "5m", + "cache.lock_ttl": "10s", + "cache.lock_wait_timeout": "2s", +} + +func Load() (Config, error) { + v := viper.New() + + if err := configureSource(v); err != nil { + return Config{}, err + } + + v.AllowEmptyEnv(true) + v.AutomaticEnv() + v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) + + for key := range defaults { + if err := v.BindEnv(key); err != nil { + return Config{}, fmt.Errorf("bind env %q: %w", key, err) + } + } + + var cfg Config + if err := v.Unmarshal(&cfg); err != nil { + return Config{}, fmt.Errorf("unmarshal config: %w", err) + } + + if err := validate.Struct(cfg); err != nil { + return Config{}, fmt.Errorf("validate config: %w", err) + } + + if err := cfg.validateDependencies(); err != nil { + return Config{}, err + } + + return cfg, nil +} + +func (c Config) validateDependencies() error { + if c.Cache.Enabled && !c.Redis.Enabled { + return errors.New("validate config: cache.enabled requires redis.enabled") + } + + return nil +} + +func configureSource(v *viper.Viper) error { + for key, value := range defaults { + v.SetDefault(key, value) + } + + v.SetConfigType("yaml") + + if path := os.Getenv(configEnvKey); path != "" { + v.SetConfigFile(path) + } else { + env := os.Getenv(envKey) + if env == "" { + env = defaultEnv + } + + v.SetConfigName(configName) + v.AddConfigPath(filepath.Join(configDir, env)) + } + + if err := v.ReadInConfig(); err != nil { + var notFound viper.ConfigFileNotFoundError + if errors.As(err, ¬Found) { + return nil + } + + return fmt.Errorf("read config: %w", err) + } + + return nil +} + +func (c Config) Addr() string { + return net.JoinHostPort(c.Server.Host, strconv.Itoa(c.Server.Port)) +} + +func (c Config) SlogLevel() slog.Level { + level, _ := logger.ParseLevel(c.Log.Level) + + return level +} + +func (c Config) LoggerFormat() logger.Format { + format, _ := logger.ParseFormat(c.Log.Format) + + return format +} + +var validate = newValidator() + +func newValidator() *validator.Validate { + v := validator.New(validator.WithRequiredStructEnabled()) + v.RegisterTagNameFunc(envName) + + return v +} + +func envName(field reflect.StructField) string { + key := field.Tag.Get("mapstructure") + if key == "" { + return field.Name + } + + return strings.ToUpper(key) +} diff --git a/internal/config/config_test.go b/internal/config/config_test.go new file mode 100644 index 00000000..ccd3abc7 --- /dev/null +++ b/internal/config/config_test.go @@ -0,0 +1,343 @@ +package config_test + +import ( + "os" + "path/filepath" + "testing" + "time" + + "github.com/go-playground/validator/v10" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/config" + "mtusi-messenger/internal/logger" +) + +func TestDefaults(t *testing.T) { + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, "0.0.0.0", cfg.Server.Host) + assert.Equal(t, 8080, cfg.Server.Port) + assert.Equal(t, 10*time.Second, cfg.Server.ReadHeaderTimeout) + assert.Equal(t, 10*time.Second, cfg.Server.ShutdownTimeout) + assert.Equal(t, "info", cfg.Log.Level) + assert.Equal(t, "json", cfg.Log.Format) + assert.Equal(t, config.Postgres{}, cfg.Postgres, "postgres defaults live in the adapter") +} + +func TestEnvOverridesDefaults(t *testing.T) { + t.Setenv("SERVER_HOST", "127.0.0.1") + t.Setenv("SERVER_PORT", "9090") + t.Setenv("SERVER_READ_HEADER_TIMEOUT", "3s") + t.Setenv("SERVER_SHUTDOWN_TIMEOUT", "30s") + t.Setenv("LOG_LEVEL", "debug") + t.Setenv("LOG_FORMAT", "console") + + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, "127.0.0.1", cfg.Server.Host) + assert.Equal(t, 9090, cfg.Server.Port) + assert.Equal(t, 3*time.Second, cfg.Server.ReadHeaderTimeout) + assert.Equal(t, 30*time.Second, cfg.Server.ShutdownTimeout) + assert.Equal(t, "debug", cfg.Log.Level) + assert.Equal(t, "console", cfg.Log.Format) +} + +func TestDsnEncodesCredentials(t *testing.T) { + cfg := config.Postgres{ + Host: "db", + Port: 5432, + Database: "app", + User: "user", + Password: "p@ss:w/rd", + SSLMode: "disable", + } + + assert.Equal(t, "postgres://user:p%40ss%3Aw%2Frd@db:5432/app?sslmode=disable", cfg.DSN()) +} + +func writeConfig(t *testing.T, body string) string { + t.Helper() + + path := filepath.Join(t.TempDir(), "config.yaml") + require.NoError(t, os.WriteFile(path, []byte(body), 0o600)) + + return path +} + +func TestLoadsYAMLFile(t *testing.T) { + path := writeConfig(t, ` +env: dev +server: + host: 10.0.0.1 + port: 9999 + read_header_timeout: 3s + shutdown_timeout: 7s +log: + level: debug + format: console +postgres: + host: db + port: 5433 + database: app + user: app + password: secret + ssl_mode: disable + max_conns: 7 + min_conns: 2 + max_conn_lifetime: 2h + max_conn_idle_time: 10m + connect_timeout: 2s + query_timeout: 3s +`) + + t.Setenv("APP_CONFIG", path) + + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, "10.0.0.1", cfg.Server.Host) + assert.Equal(t, 9999, cfg.Server.Port) + assert.Equal(t, 3*time.Second, cfg.Server.ReadHeaderTimeout) + assert.Equal(t, "debug", cfg.Log.Level) + assert.Equal(t, "console", cfg.Log.Format) + assert.Equal(t, "db", cfg.Postgres.Host) + assert.Equal(t, 5433, cfg.Postgres.Port) + assert.Equal(t, "app", cfg.Postgres.Database) + assert.Equal(t, int32(7), cfg.Postgres.MaxConns) + assert.Equal(t, 2*time.Second, cfg.Postgres.ConnectTimeout) +} + +func TestEnvOverridesYAML(t *testing.T) { + path := writeConfig(t, ` +env: dev +server: + host: 10.0.0.1 + port: 9999 + read_header_timeout: 3s + shutdown_timeout: 7s +log: + level: debug + format: console +postgres: + host: db + port: 5433 + database: app + user: app + password: file + ssl_mode: disable +`) + + t.Setenv("APP_CONFIG", path) + t.Setenv("SERVER_HOST", "127.0.0.1") + t.Setenv("POSTGRES_PASSWORD", "env") + + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, "127.0.0.1", cfg.Server.Host, "env переопределяет YAML") + assert.Equal(t, 9999, cfg.Server.Port) + assert.Equal(t, "env", cfg.Postgres.Password) +} + +func TestSessionTTLFromContractEnv(t *testing.T) { + t.Setenv("SESSION_TTL_SECONDS", "2") + + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, 2, cfg.Session.TTLSeconds) +} + +func TestInvalidValues(t *testing.T) { + tests := map[string]map[string]string{ + "пустой server.host": {"SERVER_HOST": ""}, + "host не адрес и не имя": {"SERVER_HOST": "не адрес"}, + "порт ниже диапазона": {"SERVER_PORT": "0"}, + "порт выше диапазона": {"SERVER_PORT": "65536"}, + "нулевой read header timeout": {"SERVER_READ_HEADER_TIMEOUT": "0s"}, + "отрицательный shutdown": {"SERVER_SHUTDOWN_TIMEOUT": "-1s"}, + "неизвестный log level": {"LOG_LEVEL": "trace"}, + "неизвестный log format": {"LOG_FORMAT": "xml"}, + } + + for name, env := range tests { + t.Run(name, func(t *testing.T) { + for key, value := range env { + t.Setenv(key, value) + } + + _, err := config.Load() + require.Error(t, err) + + var validationErrs validator.ValidationErrors + require.ErrorAs(t, err, &validationErrs) + require.NotEmpty(t, validationErrs) + }) + } +} + +func TestInvalidPostgresValues(t *testing.T) { + path := writeConfig(t, ` +env: dev +postgres: + host: db + port: 5432 + database: messenger + user: messenger + ssl_mode: disable + max_conns: 10 +`) + + tests := map[string]map[string]string{ + "неизвестный ssl mode": {"POSTGRES_SSL_MODE": "bogus"}, + "отрицательный max_conns": {"POSTGRES_MAX_CONNS": "-1"}, + } + + for name, env := range tests { + t.Run(name, func(t *testing.T) { + t.Setenv("APP_CONFIG", path) + for key, value := range env { + t.Setenv(key, value) + } + + _, err := config.Load() + require.Error(t, err) + + var validationErrs validator.ValidationErrors + require.ErrorAs(t, err, &validationErrs) + require.NotEmpty(t, validationErrs) + }) + } +} + +func TestUnparsableValues(t *testing.T) { + tests := map[string]map[string]string{ + "порт не число": {"SERVER_PORT": "не-число"}, + "timeout не duration": {"SERVER_READ_HEADER_TIMEOUT": "быстро"}, + } + + for name, env := range tests { + t.Run(name, func(t *testing.T) { + for key, value := range env { + t.Setenv(key, value) + } + + _, err := config.Load() + require.Error(t, err) + }) + } +} + +func TestLoggerSettings(t *testing.T) { + t.Setenv("LOG_LEVEL", "warn") + t.Setenv("LOG_FORMAT", "console") + + cfg, err := config.Load() + require.NoError(t, err) + + level, err := logger.ParseLevel(cfg.Log.Level) + require.NoError(t, err) + assert.Equal(t, level, cfg.SlogLevel()) + + format, err := logger.ParseFormat(cfg.Log.Format) + require.NoError(t, err) + assert.Equal(t, format, cfg.LoggerFormat()) +} + +func TestAddr(t *testing.T) { + t.Setenv("SERVER_HOST", "0.0.0.0") + t.Setenv("SERVER_PORT", "8080") + + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, "0.0.0.0:8080", cfg.Addr()) +} + +func TestAddrWithIPv6Host(t *testing.T) { + t.Setenv("SERVER_HOST", "::1") + + cfg, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, "[::1]:8080", cfg.Addr()) +} + +func TestLoadIsIndependentOfProcessState(t *testing.T) { + t.Setenv("SERVER_PORT", "7070") + + first, err := config.Load() + require.NoError(t, err) + + second, err := config.Load() + require.NoError(t, err) + + assert.Equal(t, first, second) +} + +func TestRedisDefaultsDisabled(t *testing.T) { + cfg, err := config.Load() + require.NoError(t, err) + + assert.False(t, cfg.Redis.Enabled) + assert.Equal(t, "localhost", cfg.Redis.Host) + assert.Equal(t, 6379, cfg.Redis.Port) + assert.Equal(t, -1, cfg.Redis.MaxRetries) + assert.Equal(t, 300*time.Millisecond, cfg.Redis.DialTimeout) + assert.Equal(t, 200*time.Millisecond, cfg.Redis.ReadTimeout) + assert.Equal(t, 200*time.Millisecond, cfg.Redis.WriteTimeout) + assert.False(t, cfg.Cache.Enabled) + assert.Equal(t, 5*time.Minute, cfg.Cache.ChatListTTL) + assert.Equal(t, 10*time.Second, cfg.Cache.LockTTL) + assert.Equal(t, 2*time.Second, cfg.Cache.LockWaitTimeout) +} + +func TestRedisEnvOverrides(t *testing.T) { + t.Setenv("REDIS_ENABLED", "true") + t.Setenv("REDIS_HOST", "cache") + t.Setenv("REDIS_PORT", "6380") + t.Setenv("CACHE_ENABLED", "true") + t.Setenv("CACHE_CHAT_LIST_TTL", "1m") + t.Setenv("CACHE_LOCK_TTL", "7s") + t.Setenv("CACHE_LOCK_WAIT_TIMEOUT", "1500ms") + + cfg, err := config.Load() + require.NoError(t, err) + + assert.True(t, cfg.Redis.Enabled) + assert.Equal(t, "cache", cfg.Redis.Host) + assert.Equal(t, 6380, cfg.Redis.Port) + assert.True(t, cfg.Cache.Enabled) + assert.Equal(t, time.Minute, cfg.Cache.ChatListTTL) + assert.Equal(t, 7*time.Second, cfg.Cache.LockTTL) + assert.Equal(t, 1500*time.Millisecond, cfg.Cache.LockWaitTimeout) +} + +func TestInvalidCacheTTL(t *testing.T) { + for _, key := range []string{ + "CACHE_CHAT_LIST_TTL", + "CACHE_LOCK_TTL", + "CACHE_LOCK_WAIT_TIMEOUT", + } { + for _, value := range []string{"0s", "-1s"} { + t.Run(key+"/"+value, func(t *testing.T) { + t.Setenv(key, value) + _, err := config.Load() + require.Error(t, err) + var validationErrs validator.ValidationErrors + require.ErrorAs(t, err, &validationErrs) + }) + } + } +} + +func TestCacheRequiresRedis(t *testing.T) { + t.Setenv("CACHE_ENABLED", "true") + + _, err := config.Load() + require.ErrorContains(t, err, "cache.enabled requires redis.enabled") +} diff --git a/internal/domain/chat.go b/internal/domain/chat.go new file mode 100644 index 00000000..94385283 --- /dev/null +++ b/internal/domain/chat.go @@ -0,0 +1,51 @@ +package domain + +import ( + "fmt" + "slices" + "time" + + "github.com/google/uuid" +) + +type Chat struct { + ID uuid.UUID + Title string + MemberIDs []uuid.UUID + CreatedAt time.Time +} + +func (c Chat) HasMember(userID uuid.UUID) bool { + return slices.Contains(c.MemberIDs, userID) +} + +type ChatDraft struct { + Title string + MemberIDs []uuid.UUID + CallerID uuid.UUID +} + +func (d ChatDraft) Validate() error { + if err := validateNotBlank("title", d.Title); err != nil { + return err + } + + if len(d.MemberIDs) == 0 { + return fmt.Errorf("member_ids must not be empty: %w", ErrValidation) + } + + seen := make(map[uuid.UUID]struct{}, len(d.MemberIDs)) + for _, id := range d.MemberIDs { + if _, ok := seen[id]; ok { + return fmt.Errorf("member_ids contains duplicates: %w", ErrValidation) + } + + seen[id] = struct{}{} + } + + if _, ok := seen[d.CallerID]; !ok { + return fmt.Errorf("member_ids must contain the caller: %w", ErrValidation) + } + + return nil +} diff --git a/internal/domain/cursor.go b/internal/domain/cursor.go new file mode 100644 index 00000000..e18118c5 --- /dev/null +++ b/internal/domain/cursor.go @@ -0,0 +1,17 @@ +package domain + +import ( + "time" + + "github.com/google/uuid" +) + +type Cursor struct { + Scope uuid.UUID + CreatedAt time.Time + ID uuid.UUID +} + +func (c Cursor) BelongsTo(scope uuid.UUID) bool { + return c.Scope == scope +} diff --git a/internal/domain/errors.go b/internal/domain/errors.go new file mode 100644 index 00000000..a8314c69 --- /dev/null +++ b/internal/domain/errors.go @@ -0,0 +1,15 @@ +package domain + +import "errors" + +var ( + ErrNotFound = errors.New("not found") + ErrUsernameTaken = errors.New("username already taken") + ErrUnknownMember = errors.New("member does not exist") + ErrValidation = errors.New("validation failed") + ErrInvalidCursor = errors.New("invalid cursor") + ErrConflict = errors.New("conflict") + ErrIdempotency = errors.New("idempotency key already used with another payload") + ErrUnauthenticated = errors.New("unauthenticated") + ErrUnavailable = errors.New("temporarily unavailable") +) diff --git a/internal/domain/message.go b/internal/domain/message.go new file mode 100644 index 00000000..1ac8fba6 --- /dev/null +++ b/internal/domain/message.go @@ -0,0 +1,44 @@ +package domain + +import ( + "crypto/sha256" + "fmt" + "time" + + "github.com/google/uuid" +) + +type Message struct { + ID uuid.UUID + ChatID uuid.UUID + SenderID uuid.UUID + Text string + CreatedAt time.Time +} + +// MessageIdempotency is the client Idempotency-Key together with the fingerprint +// of the payload it was first used with. The same key and fingerprint replay the +// stored message; the same key with another payload is a conflict. +type MessageIdempotency struct { + Key string + RequestHash [sha256.Size]byte +} + +type MessageDraft struct { + ChatID uuid.UUID + SenderID uuid.UUID + Text string + Idempotency MessageIdempotency +} + +func (d MessageDraft) Validate() error { + if err := validateNotBlank("text", d.Text); err != nil { + return err + } + + if d.Idempotency.Key == "" { + return fmt.Errorf("idempotency key is missing: %w", ErrValidation) + } + + return nil +} diff --git a/internal/domain/page.go b/internal/domain/page.go new file mode 100644 index 00000000..bd0bd31b --- /dev/null +++ b/internal/domain/page.go @@ -0,0 +1,8 @@ +package domain + +const DefaultPageLimit = 50 + +type Page[T any] struct { + Items []T + Next *Cursor +} diff --git a/internal/domain/session.go b/internal/domain/session.go new file mode 100644 index 00000000..0aea153e --- /dev/null +++ b/internal/domain/session.go @@ -0,0 +1,19 @@ +package domain + +import ( + "time" + + "github.com/google/uuid" +) + +type Session struct { + Token string + ExpiresAt time.Time + User User +} + +type NewSession struct { + TokenHash []byte + UserID uuid.UUID + ExpiresAt time.Time +} diff --git a/internal/domain/text.go b/internal/domain/text.go new file mode 100644 index 00000000..e944b85a --- /dev/null +++ b/internal/domain/text.go @@ -0,0 +1,14 @@ +package domain + +import ( + "fmt" + "strings" +) + +func validateNotBlank(field, value string) error { + if strings.TrimSpace(value) == "" { + return fmt.Errorf("%s consists of whitespace only: %w", field, ErrValidation) + } + + return nil +} diff --git a/internal/domain/user.go b/internal/domain/user.go new file mode 100644 index 00000000..5bb4ffe0 --- /dev/null +++ b/internal/domain/user.go @@ -0,0 +1,44 @@ +package domain + +import ( + "fmt" + "time" + + "github.com/google/uuid" +) + +type User struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time +} + +type UserDraft struct { + Username string + DisplayName string + Password string +} + +func (d UserDraft) Validate() error { + if err := validateNotBlank("display_name", d.DisplayName); err != nil { + return err + } + + if length := len([]rune(d.Password)); length < 12 || length > 128 { + return fmt.Errorf("password length must be between 12 and 128 code points: %w", ErrValidation) + } + + return nil +} + +type NewUser struct { + Username string + DisplayName string + PasswordHash string +} + +type UserCredentials struct { + User User + PasswordHash string +} diff --git a/internal/domain/validation_test.go b/internal/domain/validation_test.go new file mode 100644 index 00000000..adff519f --- /dev/null +++ b/internal/domain/validation_test.go @@ -0,0 +1,121 @@ +package domain_test + +import ( + "strings" + "testing" + + "github.com/google/uuid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/domain" +) + +// Длины, regex и uniqueItems проверяет сгенерированный слой по contracts/openapi.json. +// Домен закрывает только то, что схема выразить не может. + +func TestUserDraftRejectsBlankDisplayName(t *testing.T) { + t.Parallel() + + for _, blank := range []string{" ", " ", "\t", "\n", "\u00a0"} { + draft := domain.UserDraft{Username: "alice", DisplayName: blank} + require.ErrorIs(t, draft.Validate(), domain.ErrValidation) + } +} + +func TestUserDraftAcceptsVisibleName(t *testing.T) { + t.Parallel() + + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: "very-secret-password"} + assert.NoError(t, draft.Validate()) +} + +func TestUserDraftRejectsShortPassword(t *testing.T) { + t.Parallel() + + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: "too-short"} + require.ErrorIs(t, draft.Validate(), domain.ErrValidation) +} + +func TestUserDraftRejectsTooLongPassword(t *testing.T) { + t.Parallel() + + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: strings.Repeat("a", 129)} + require.ErrorIs(t, draft.Validate(), domain.ErrValidation) +} + +func TestUserDraftAcceptsMinimalPassword(t *testing.T) { + t.Parallel() + + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: strings.Repeat("a", 12)} + assert.NoError(t, draft.Validate()) +} + +func TestChatDraftRequiresCallerAmongMembers(t *testing.T) { + t.Parallel() + + caller := uuid.New() + + outside := domain.ChatDraft{ + Title: "Проект", + MemberIDs: []uuid.UUID{uuid.New(), uuid.New()}, + CallerID: caller, + } + require.ErrorIs(t, outside.Validate(), domain.ErrValidation) + + inside := domain.ChatDraft{ + Title: "Проект", + MemberIDs: []uuid.UUID{uuid.New(), caller}, + CallerID: caller, + } + assert.NoError(t, inside.Validate()) +} + +func TestChatDraftRejectsBlankTitle(t *testing.T) { + t.Parallel() + + caller := uuid.New() + + draft := domain.ChatDraft{ + Title: " ", + MemberIDs: []uuid.UUID{caller}, + CallerID: caller, + } + require.ErrorIs(t, draft.Validate(), domain.ErrValidation) +} + +func TestMessageDraftRejectsBlankText(t *testing.T) { + t.Parallel() + + draft := domain.MessageDraft{ + ChatID: uuid.New(), + SenderID: uuid.New(), + Text: strings.Repeat(" ", 10), + Idempotency: domain.MessageIdempotency{Key: "key-1"}, + } + require.ErrorIs(t, draft.Validate(), domain.ErrValidation) +} + +func TestMessageDraftRejectsMissingIdempotencyKey(t *testing.T) { + t.Parallel() + + draft := domain.MessageDraft{ + ChatID: uuid.New(), + SenderID: uuid.New(), + Text: "привет", + } + require.ErrorIs(t, draft.Validate(), domain.ErrValidation, + "с lab3 отправка сообщения невозможна без Idempotency-Key") +} + +func TestMessageDraftAcceptsTextWithSurroundingSpaces(t *testing.T) { + t.Parallel() + + draft := domain.MessageDraft{ + ChatID: uuid.New(), + SenderID: uuid.New(), + Text: " привет ", + Idempotency: domain.MessageIdempotency{Key: "key-1"}, + } + assert.NoError(t, draft.Validate(), "контракт запрещает только полностью пробельный текст") +} diff --git a/internal/health/checker.go b/internal/health/checker.go new file mode 100644 index 00000000..86fc3228 --- /dev/null +++ b/internal/health/checker.go @@ -0,0 +1,28 @@ +package health + +import ( + "context" + "fmt" +) + +type Pinger interface { + Ping(ctx context.Context) error +} + +type Checker struct { + pingers []Pinger +} + +func New(pingers ...Pinger) *Checker { + return &Checker{pingers: pingers} +} + +func (c *Checker) Ping(ctx context.Context) error { + for _, pinger := range c.pingers { + if err := pinger.Ping(ctx); err != nil { + return fmt.Errorf("ping %T: %w", pinger, err) + } + } + + return nil +} diff --git a/internal/health/checker_test.go b/internal/health/checker_test.go new file mode 100644 index 00000000..e379655b --- /dev/null +++ b/internal/health/checker_test.go @@ -0,0 +1,33 @@ +package health_test + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/health" +) + +type stubPinger struct { + err error +} + +func (s stubPinger) Ping(context.Context) error { return s.err } + +func TestCheckerPassesWhenAllHealthy(t *testing.T) { + t.Parallel() + + checker := health.New(stubPinger{}, stubPinger{}) + require.NoError(t, checker.Ping(context.Background())) +} + +func TestCheckerReturnsFirstFailure(t *testing.T) { + t.Parallel() + + sentinel := errors.New("dependency down") + checker := health.New(stubPinger{}, stubPinger{err: sentinel}, stubPinger{err: errors.New("later")}) + + require.ErrorIs(t, checker.Ping(context.Background()), sentinel) +} diff --git a/internal/logger/errors.go b/internal/logger/errors.go new file mode 100644 index 00000000..799c84d8 --- /dev/null +++ b/internal/logger/errors.go @@ -0,0 +1,8 @@ +package logger + +import "errors" + +var ( + ErrUnknownLevel = errors.New("unknown log level") + ErrUnknownFormat = errors.New("unknown log format") +) diff --git a/internal/logger/logger.go b/internal/logger/logger.go new file mode 100644 index 00000000..96aa8ce9 --- /dev/null +++ b/internal/logger/logger.go @@ -0,0 +1,138 @@ +package logger + +import ( + "fmt" + "io" + "log/slog" + "os" + "strings" + + "go.uber.org/zap/exp/zapslog" + "go.uber.org/zap/zapcore" +) + +type Format string + +const ( + FormatJSON Format = "json" + FormatConsole Format = "console" +) + +const ( + DefaultLevel = slog.LevelInfo + DefaultFormat = FormatJSON +) + +type options struct { + writer io.Writer + level slog.Level + format Format + name string +} + +type Option func(*options) + +func WithWriter(writer io.Writer) Option { + return func(opts *options) { + if writer != nil { + opts.writer = writer + } + } +} + +func WithLevel(level slog.Level) Option { + return func(opts *options) { + opts.level = level + } +} + +func WithFormat(format Format) Option { + return func(opts *options) { + if format != "" { + opts.format = format + } + } +} + +func WithName(name string) Option { + return func(opts *options) { + opts.name = name + } +} + +func New(options ...Option) *slog.Logger { + opts := optionsConfig() + for _, option := range options { + option(&opts) + } + + encoderCfg := zapcore.EncoderConfig{ + TimeKey: "time", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.RFC3339NanoTimeEncoder, + EncodeDuration: zapcore.StringDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + } + + var encoder zapcore.Encoder + if opts.format == FormatConsole { + encoder = zapcore.NewConsoleEncoder(encoderCfg) + } else { + encoder = zapcore.NewJSONEncoder(encoderCfg) + } + + core := zapcore.NewCore(encoder, zapcore.AddSync(opts.writer), zapLevel(opts.level)) + handlerOptions := make([]zapslog.HandlerOption, 0, 1) + if opts.name != "" { + handlerOptions = append(handlerOptions, zapslog.WithName(opts.name)) + } + + return slog.New(zapslog.NewHandler(core, handlerOptions...)) +} + +func optionsConfig() options { + return options{ + writer: os.Stdout, + level: DefaultLevel, + format: DefaultFormat, + } +} + +func ParseLevel(raw string) (slog.Level, error) { + var level slog.Level + if err := level.UnmarshalText([]byte(strings.TrimSpace(raw))); err != nil { + return 0, fmt.Errorf("%q: %w", raw, ErrUnknownLevel) + } + + return level, nil +} + +func ParseFormat(raw string) (Format, error) { + switch Format(strings.ToLower(strings.TrimSpace(raw))) { + case FormatJSON: + return FormatJSON, nil + case FormatConsole: + return FormatConsole, nil + default: + return "", fmt.Errorf("%q: %w", raw, ErrUnknownFormat) + } +} + +func zapLevel(level slog.Level) zapcore.Level { + switch { + case level < slog.LevelInfo: + return zapcore.DebugLevel + case level < slog.LevelWarn: + return zapcore.InfoLevel + case level < slog.LevelError: + return zapcore.WarnLevel + default: + return zapcore.ErrorLevel + } +} diff --git a/internal/logger/logger_test.go b/internal/logger/logger_test.go new file mode 100644 index 00000000..0b308272 --- /dev/null +++ b/internal/logger/logger_test.go @@ -0,0 +1,193 @@ +package logger_test + +import ( + "bytes" + "encoding/json" + "log/slog" + "strings" + "testing" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/logger" +) + +type LoggerSuite struct { + suite.Suite + + bb *bytes.Buffer +} + +func TestLoggerSuite(t *testing.T) { + t.Parallel() + suite.Run(t, new(LoggerSuite)) +} + +func (s *LoggerSuite) SetupTest() { + s.bb = &bytes.Buffer{} +} + +func (s *LoggerSuite) records() []map[string]any { + var out []map[string]any + + for line := range strings.SplitSeq(strings.TrimSpace(s.bb.String()), "\n") { + if line == "" { + continue + } + + var record map[string]any + s.Require().NoError(json.Unmarshal([]byte(line), &record)) + + out = append(out, record) + } + + return out +} + +func (s *LoggerSuite) TestJSONOutputCarriesAttributes() { + log := logger.New(logger.WithWriter(s.bb)) + + log.Info("сервер запущен", slog.String("addr", "0.0.0.0:8080")) + + records := s.records() + s.Require().Len(records, 1) + + s.Equal("info", records[0]["level"]) + s.Equal("сервер запущен", records[0]["msg"]) + s.Equal("0.0.0.0:8080", records[0]["addr"]) + s.Contains(records[0], "time") +} + +func (s *LoggerSuite) TestDefaultLevelDropsDebug() { + log := logger.New(logger.WithWriter(s.bb)) + + log.Debug("не должно попасть в вывод") + log.Info("должно попасть") + + records := s.records() + s.Require().Len(records, 1) + s.Equal("должно попасть", records[0]["msg"]) +} + +func (s *LoggerSuite) TestWithLevelEnablesDebug() { + log := logger.New(logger.WithWriter(s.bb), logger.WithLevel(slog.LevelDebug)) + + log.Debug("подробность") + + records := s.records() + s.Require().Len(records, 1) + s.Equal("debug", records[0]["level"]) +} + +func (s *LoggerSuite) TestGroupsAreNested() { + log := logger.New(logger.WithWriter(s.bb)) + + log.Info("запрос", slog.Group("payload", slog.Int("size", 12))) + + records := s.records() + s.Require().Len(records, 1) + + payload, ok := records[0]["payload"].(map[string]any) + s.Require().True(ok, "группа должна кодироваться вложенным объектом") + s.InDelta(12, payload["size"], 0) +} + +func (s *LoggerSuite) TestWithNameSetsLoggerField() { + log := logger.New(logger.WithWriter(s.bb), logger.WithName("messenger")) + + log.Info("старт") + + records := s.records() + s.Require().Len(records, 1) + s.Equal("messenger", records[0]["logger"]) +} + +func (s *LoggerSuite) TestConsoleFormatIsNotJSON() { + log := logger.New(s.consoleOptions()...) + + log.Info("человекочитаемо") + + line := strings.TrimSpace(s.bb.String()) + s.Require().NotEmpty(line) + + var record map[string]any + s.Require().Error(json.Unmarshal([]byte(line), &record), "console-формат не должен быть JSON") + s.Contains(line, "человекочитаемо") +} + +func (s *LoggerSuite) consoleOptions() []logger.Option { + return []logger.Option{ + logger.WithWriter(s.bb), + logger.WithFormat(logger.FormatConsole), + } +} + +func (s *LoggerSuite) TestNilWriterKeepsDefault() { + s.Require().NotPanics(func() { + logger.New(logger.WithWriter(nil)).Info("пишем в stdout по умолчанию") + }) +} + +func TestParseLevel(t *testing.T) { + t.Parallel() + + tests := map[string]struct { + want slog.Level + wantErr bool + }{ + "debug": {want: slog.LevelDebug}, + "info": {want: slog.LevelInfo}, + "WARN": {want: slog.LevelWarn}, + "error": {want: slog.LevelError}, + "trace": {wantErr: true}, + "": {wantErr: true}, + } + + for raw, tt := range tests { + t.Run(raw, func(t *testing.T) { + t.Parallel() + + got, err := logger.ParseLevel(raw) + if tt.wantErr { + require.ErrorIs(t, err, logger.ErrUnknownLevel) + + return + } + + require.NoError(t, err) + require.Equal(t, tt.want, got) + }) + } +} + +func TestParseFormat(t *testing.T) { + t.Parallel() + + tests := map[string]struct { + want logger.Format + wantErr bool + }{ + "json": {want: logger.FormatJSON}, + "JSON": {want: logger.FormatJSON}, + "console": {want: logger.FormatConsole}, + "xml": {wantErr: true}, + "": {wantErr: true}, + } + + for raw, tt := range tests { + t.Run(raw, func(t *testing.T) { + t.Parallel() + + got, err := logger.ParseFormat(raw) + if tt.wantErr { + require.ErrorIs(t, err, logger.ErrUnknownFormat) + + return + } + + require.NoError(t, err) + require.Equal(t, tt.want, got) + }) + } +} diff --git a/internal/platform/cache/cache.go b/internal/platform/cache/cache.go new file mode 100644 index 00000000..57f070d6 --- /dev/null +++ b/internal/platform/cache/cache.go @@ -0,0 +1,31 @@ +package cache + +import ( + "context" + "errors" + "time" +) + +var ErrCacheMiss = errors.New("cache miss") + +type Cache interface { + Get(ctx context.Context, key string) ([]byte, error) + Set(ctx context.Context, key string, value []byte, ttl time.Duration) error + Delete(ctx context.Context, keys ...string) error + Ping(ctx context.Context) error + Close() error +} + +type NoOpCache struct{} + +func (NoOpCache) Get(context.Context, string) ([]byte, error) { return nil, ErrCacheMiss } +func (NoOpCache) Set(context.Context, string, []byte, time.Duration) error { return nil } +func (NoOpCache) Delete(context.Context, ...string) error { return nil } +func (NoOpCache) AcquireLock(context.Context, string, string, time.Duration) (bool, error) { + return true, nil +} + +func (NoOpCache) ReleaseLock(context.Context, string, string) (bool, error) { return true, nil } +func (NoOpCache) LockHeld(context.Context, string) (bool, error) { return false, nil } +func (NoOpCache) Ping(context.Context) error { return nil } +func (NoOpCache) Close() error { return nil } diff --git a/internal/platform/cache/cache_test.go b/internal/platform/cache/cache_test.go new file mode 100644 index 00000000..757c03df --- /dev/null +++ b/internal/platform/cache/cache_test.go @@ -0,0 +1,31 @@ +package cache_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/platform/cache" +) + +func TestNoOpCache(t *testing.T) { + t.Parallel() + ctx := t.Context() + store := cache.NoOpCache{} + require.NoError(t, store.Set(ctx, "key", []byte("value"), time.Minute)) + _, err := store.Get(ctx, "key") + require.ErrorIs(t, err, cache.ErrCacheMiss) + require.NoError(t, store.Delete(ctx, "key")) + acquired, err := store.AcquireLock(ctx, "lock", "token", time.Second) + require.NoError(t, err) + require.True(t, acquired) + held, err := store.LockHeld(ctx, "lock") + require.NoError(t, err) + require.False(t, held) + released, err := store.ReleaseLock(ctx, "lock", "token") + require.NoError(t, err) + require.True(t, released) + require.NoError(t, store.Ping(ctx)) + require.NoError(t, store.Close()) +} diff --git a/internal/platform/cache/distributed.go b/internal/platform/cache/distributed.go new file mode 100644 index 00000000..43a5ead4 --- /dev/null +++ b/internal/platform/cache/distributed.go @@ -0,0 +1,307 @@ +package cache + +import ( + "bytes" + "context" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "log/slog" + mathrand "math/rand/v2" + "strconv" + "sync/atomic" + "time" + + "golang.org/x/sync/singleflight" +) + +const ( + DefaultLockTTL = 10 * time.Second + DefaultWaitTimeout = 2 * time.Second + minLockTTL = time.Second + redisOpTimeout = 200 * time.Millisecond + releaseTimeout = 300 * time.Millisecond +) + +type DistributedConfig struct { + LockTTL time.Duration + WaitTimeout time.Duration +} + +type LockStore interface { + Cache + AcquireLock(ctx context.Context, key, token string, ttl time.Duration) (bool, error) + ReleaseLock(ctx context.Context, key, token string) (bool, error) + LockHeld(ctx context.Context, key string) (bool, error) +} + +type DistributedCache struct { + store LockStore + lockTTL time.Duration + waitTimeout time.Duration + log *slog.Logger + group singleflight.Group +} + +var fallbackTokenCounter atomic.Uint64 + +func NewDistributed(store LockStore, cfg DistributedConfig, log *slog.Logger) (*DistributedCache, error) { + if cfg.LockTTL <= 0 { + cfg.LockTTL = DefaultLockTTL + } + + if cfg.WaitTimeout <= 0 { + cfg.WaitTimeout = DefaultWaitTimeout + } + + if cfg.LockTTL <= minLockTTL { + return nil, fmt.Errorf("cache: lock ttl %s must be greater than %s", cfg.LockTTL, minLockTTL) + } + + if cfg.WaitTimeout > cfg.LockTTL { + return nil, fmt.Errorf("cache: wait timeout %s must not exceed lock ttl %s", cfg.WaitTimeout, cfg.LockTTL) + } + + return &DistributedCache{ + store: store, + lockTTL: cfg.LockTTL, + waitTimeout: cfg.WaitTimeout, + log: log, + }, nil +} + +func (d *DistributedCache) GetOrLoad( + ctx context.Context, + key string, + ttl time.Duration, + loader func(ctx context.Context) ([]byte, error), +) ([]byte, error) { + ch := d.group.DoChan(key, func() (any, error) { + lctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), d.lockTTL+d.waitTimeout) + defer cancel() + + return d.getOrLoad(lctx, key, ttl, loader) + }) + + select { + case <-ctx.Done(): + return nil, ctx.Err() + case result := <-ch: + if result.Err != nil { + return nil, result.Err + } + + value, ok := result.Val.([]byte) + if !ok { + return nil, errors.New("cache: unexpected singleflight result") + } + + return bytes.Clone(value), nil + } +} + +func (d *DistributedCache) getOrLoad( + ctx context.Context, + key string, + ttl time.Duration, + loader func(ctx context.Context) ([]byte, error), +) ([]byte, error) { + lockKey := "lock:" + key + + for { + if err := ctx.Err(); err != nil { + return nil, err + } + + if value, err := d.store.Get(ctx, key); err == nil { + return value, nil + } else if !errors.Is(err, ErrCacheMiss) { + return loader(ctx) + } + + token := randomToken() + + acquired, err := d.store.AcquireLock(ctx, lockKey, token, d.lockTTL) + if err != nil { + return loader(ctx) + } + + if acquired { + return d.fill(ctx, key, lockKey, token, ttl, loader) + } + + value, outcome, err := d.await(ctx, key, lockKey) + if err != nil { + return nil, err + } + + switch outcome { + case waitHit: + return value, nil + case waitDegraded: + return loader(ctx) + case waitTimeout: + return loader(ctx) + case waitRetry: + if ctx.Err() != nil { + return nil, ctx.Err() + } + case waitNone: + return nil, errors.New("cache: unexpected wait outcome") + } + } +} + +func (d *DistributedCache) fill( + ctx context.Context, + key, lockKey, token string, + ttl time.Duration, + loader func(ctx context.Context) ([]byte, error), +) ([]byte, error) { + base := context.WithoutCancel(ctx) + + defer func() { + rctx, cancel := context.WithTimeout(base, releaseTimeout) + defer cancel() + + held, err := d.store.ReleaseLock(rctx, lockKey, token) + switch { + case err != nil: + d.warn(base, "lock release failed", key, err) + case !held: + d.warn(base, "lock expired before release: loader slower than lock ttl", key, nil) + } + }() + + getCtx, cancelGet := context.WithTimeout(base, redisOpTimeout) + value, err := d.store.Get(getCtx, key) + cancelGet() + + if err == nil { + return value, nil + } + + loadCtx, cancel := context.WithTimeout(base, d.lockTTL-minLockTTL) + defer cancel() + + value, err = loader(loadCtx) + if err != nil { + return nil, err + } + + setCtx, cancelSet := context.WithTimeout(base, redisOpTimeout) + setErr := d.store.Set(setCtx, key, value, ttl) + cancelSet() + + if setErr != nil { + d.warn(base, "distributed cache write failed", key, setErr) + } + + return value, nil +} + +type waitOutcome int + +const ( + waitNone waitOutcome = iota + waitHit + waitRetry + waitTimeout + waitDegraded +) + +func (d *DistributedCache) await(ctx context.Context, key, lockKey string) ([]byte, waitOutcome, error) { + wctx, cancel := context.WithTimeout(ctx, d.waitTimeout) + defer cancel() + + for attempt := 1; ; attempt++ { + value, err := d.store.Get(wctx, key) + switch { + case err == nil: + return value, waitHit, nil + case ctx.Err() != nil: + return nil, waitNone, ctx.Err() + case wctx.Err() != nil: + return nil, waitTimeout, nil + case !errors.Is(err, ErrCacheMiss): + return nil, waitDegraded, nil + } + + if held, err := d.store.LockHeld(wctx, lockKey); err == nil && !held { + return nil, waitRetry, nil + } + + select { + case <-wctx.Done(): + if err := ctx.Err(); err != nil { + return nil, waitNone, err + } + + return nil, waitTimeout, nil + case <-time.After(jittered(waitBackoff(attempt))): + } + } +} + +func (d *DistributedCache) Get(ctx context.Context, key string) ([]byte, error) { + return d.store.Get(ctx, key) +} + +func (d *DistributedCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error { + return d.store.Set(ctx, key, value, ttl) +} + +func (d *DistributedCache) Delete(ctx context.Context, keys ...string) error { + return d.store.Delete(ctx, keys...) +} + +func (d *DistributedCache) Ping(ctx context.Context) error { + return d.store.Ping(ctx) +} + +func (d *DistributedCache) Close() error { + return d.store.Close() +} + +func (d *DistributedCache) warn(ctx context.Context, msg, key string, err error) { + if d.log == nil { + return + } + + attrs := []slog.Attr{slog.String("key", key)} + if err != nil { + attrs = append(attrs, slog.Any("error", err)) + } + + d.log.LogAttrs(ctx, slog.LevelWarn, msg, attrs...) +} + +func waitBackoff(attempt int) time.Duration { + const base, maxWait = 50 * time.Millisecond, 500 * time.Millisecond + if attempt > 4 { + return maxWait + } + + return base << (attempt - 1) +} + +func jittered(d time.Duration) time.Duration { + half := d / 2 + if half <= 0 { + return d + } + + return half + mathrand.N(half) +} + +func randomToken() string { + raw := make([]byte, 16) + if _, err := rand.Read(raw); err != nil { + counter := fallbackTokenCounter.Add(1) + + return strconv.FormatInt(time.Now().UnixNano(), 10) + ":" + strconv.FormatUint(counter, 10) + } + + return hex.EncodeToString(raw) +} diff --git a/internal/platform/cache/distributed_internal_test.go b/internal/platform/cache/distributed_internal_test.go new file mode 100644 index 00000000..94c369df --- /dev/null +++ b/internal/platform/cache/distributed_internal_test.go @@ -0,0 +1,43 @@ +package cache + +import ( + "testing" + "time" + + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/platform/cache/mocks" +) + +func TestAwaitChecksCacheBeforePolling(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + store.EXPECT().Get(mock.Anything, "key").Return([]byte("ready"), nil).Once() + + d, err := NewDistributed(store, DistributedConfig{WaitTimeout: time.Second}, nil) + require.NoError(t, err) + + started := time.Now() + value, outcome, err := d.await(t.Context(), "key", "lock:key") + require.NoError(t, err) + require.Equal(t, waitHit, outcome) + require.Equal(t, "ready", string(value)) + require.Less(t, time.Since(started), 25*time.Millisecond, "cache must be checked before the first sleep") +} + +func TestAwaitReturnsTimeoutWhileLockHeld(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + store.EXPECT().Get(mock.Anything, "key").Return(nil, ErrCacheMiss).Maybe() + store.EXPECT().LockHeld(mock.Anything, "lock:key").Return(true, nil).Maybe() + + d, err := NewDistributed(store, DistributedConfig{WaitTimeout: 60 * time.Millisecond}, nil) + require.NoError(t, err) + + _, outcome, err := d.await(t.Context(), "key", "lock:key") + require.NoError(t, err) + require.Equal(t, waitTimeout, outcome) +} diff --git a/internal/platform/cache/distributed_test.go b/internal/platform/cache/distributed_test.go new file mode 100644 index 00000000..63aa2459 --- /dev/null +++ b/internal/platform/cache/distributed_test.go @@ -0,0 +1,374 @@ +package cache_test + +import ( + "context" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/platform/cache" + "mtusi-messenger/internal/platform/cache/mocks" +) + +func newDistributed(t *testing.T, store cache.LockStore, cfg cache.DistributedConfig) *cache.DistributedCache { + t.Helper() + + dc, err := cache.NewDistributed(store, cfg, nil) + require.NoError(t, err) + + return dc +} + +func expectFill(store *mocks.MockLockStore, key string) { + store.EXPECT().Get(mock.Anything, key).Return(nil, cache.ErrCacheMiss).Once() + store.EXPECT().AcquireLock(mock.Anything, "lock:"+key, mock.AnythingOfType("string"), mock.Anything).Return(true, nil).Once() + store.EXPECT().Get(mock.Anything, key).Return(nil, cache.ErrCacheMiss).Once() + store.EXPECT().Set(mock.Anything, key, mock.Anything, mock.Anything).Return(nil).Once() + store.EXPECT().ReleaseLock(mock.Anything, "lock:"+key, mock.AnythingOfType("string")).Return(true, nil).Once() +} + +// sharedWaitTimeout bounds every wait in these tests: a stuck helper must fail +// the test instead of hanging the whole package until -timeout fires. +const sharedWaitTimeout = 5 * time.Second + +func awaitSignal(t *testing.T, ch <-chan struct{}, message string) { + t.Helper() + + select { + case <-ch: + case <-time.After(sharedWaitTimeout): + t.Fatal("timed out: " + message) + } +} + +func awaitValue[T any](t *testing.T, ch <-chan T) T { + t.Helper() + + select { + case value := <-ch: + return value + case <-time.After(sharedWaitTimeout): + var zero T + + t.Fatal("timed out waiting for the shared load to report its result") + + return zero + } +} + +func awaitWaitGroup(t *testing.T, wg *sync.WaitGroup) { + t.Helper() + + done := make(chan struct{}) + + go func() { + wg.Wait() + close(done) + }() + + awaitSignal(t, done, "goroutines did not finish") +} + +func TestDistributedCachesResult(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + dc := newDistributed(t, store, cache.DistributedConfig{}) + ctx := context.Background() + + var calls atomic.Int32 + + loader := func(context.Context) ([]byte, error) { + calls.Add(1) + + return []byte("payload"), nil + } + + expectFill(store, "key") + store.EXPECT().Get(mock.Anything, "key").Return([]byte("payload"), nil).Once() + + first, err := dc.GetOrLoad(ctx, "key", time.Minute, loader) + require.NoError(t, err) + require.Equal(t, []byte("payload"), first) + + second, err := dc.GetOrLoad(ctx, "key", time.Minute, loader) + require.NoError(t, err) + require.Equal(t, []byte("payload"), second) + require.Equal(t, int32(1), calls.Load()) +} + +func TestDistributedDeduplicatesConcurrentMisses(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + dc := newDistributed(t, store, cache.DistributedConfig{}) + ctx := context.Background() + + var calls atomic.Int32 + + loader := func(context.Context) ([]byte, error) { + calls.Add(1) + time.Sleep(30 * time.Millisecond) + + return []byte("payload"), nil + } + + store.EXPECT().Get(mock.Anything, "shared").Return(nil, cache.ErrCacheMiss).Twice() + store.EXPECT().AcquireLock(mock.Anything, "lock:shared", mock.AnythingOfType("string"), mock.Anything).Return(true, nil).Once() + store.EXPECT().Set(mock.Anything, "shared", mock.Anything, mock.Anything).Return(nil).Once() + store.EXPECT().ReleaseLock(mock.Anything, "lock:shared", mock.AnythingOfType("string")).Return(true, nil).Once() + + const workers = 50 + + var ( + wg sync.WaitGroup + failures atomic.Int32 + ) + + wg.Add(workers) + + for range workers { + go func() { + defer wg.Done() + + value, err := dc.GetOrLoad(ctx, "shared", time.Minute, loader) + if err != nil || string(value) != "payload" { + failures.Add(1) + } + }() + } + + awaitWaitGroup(t, &wg) + + require.Zero(t, failures.Load()) + require.Equal(t, int32(1), calls.Load(), "one instance must load once for concurrent misses") +} + +func TestDistributedFallsBackOnWaitTimeout(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + dc := newDistributed(t, store, cache.DistributedConfig{WaitTimeout: 100 * time.Millisecond}) + ctx := context.Background() + + store.EXPECT().Get(mock.Anything, "key").Return(nil, cache.ErrCacheMiss).Maybe() + store.EXPECT().AcquireLock(mock.Anything, "lock:key", mock.AnythingOfType("string"), mock.Anything).Return(false, nil).Once() + store.EXPECT().LockHeld(mock.Anything, "lock:key").Return(true, nil).Maybe() + + var calls atomic.Int32 + + value, err := dc.GetOrLoad(ctx, "key", time.Minute, func(context.Context) ([]byte, error) { + calls.Add(1) + + return []byte("fallback"), nil + }) + require.NoError(t, err) + require.Equal(t, []byte("fallback"), value) + require.Equal(t, int32(1), calls.Load(), "a wait timeout must fall back to a direct load") +} + +func TestDistributedSharedLoadSurvivesCallerCancellation(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + dc := newDistributed(t, store, cache.DistributedConfig{}) + leaderCtx, cancelLeader := context.WithCancel(context.Background()) + defer cancelLeader() + + var calls atomic.Int32 + + started := make(chan struct{}) + release := make(chan struct{}) + + loader := func(loadCtx context.Context) ([]byte, error) { + calls.Add(1) + close(started) + <-release + + if err := loadCtx.Err(); err != nil { + return nil, err + } + + return []byte("value"), nil + } + + store.EXPECT().Get(mock.Anything, "key").Return(nil, cache.ErrCacheMiss).Twice() + store.EXPECT().AcquireLock(mock.Anything, "lock:key", mock.AnythingOfType("string"), mock.Anything).Return(true, nil).Once() + store.EXPECT().Set(mock.Anything, "key", mock.Anything, mock.Anything).Return(nil).Once() + store.EXPECT().ReleaseLock(mock.Anything, "lock:key", mock.AnythingOfType("string")).Return(true, nil).Once() + + leaderErr := make(chan error, 1) + + go func() { + _, err := dc.GetOrLoad(leaderCtx, "key", time.Minute, loader) + leaderErr <- err + }() + + awaitSignal(t, started, "leader must reach the loader") + + // The follower starts while the leader's loader is still blocked, so the + // singleflight call cannot complete: the signal below means DoChan was + // already called, i.e. the follower joined the leader's in-flight call + // instead of starting its own load. + followerJoined := make(chan struct{}) + + var ( + wg sync.WaitGroup + followerV []byte + followerE error + ) + + wg.Add(1) + + go func() { + defer wg.Done() + + ctx := newJoiningContext(followerJoined) + followerV, followerE = dc.GetOrLoad(ctx, "key", time.Minute, loader) + }() + + awaitSignal(t, followerJoined, "follower must join the in-flight load") + + cancelLeader() + close(release) + + require.ErrorIs(t, awaitValue(t, leaderErr), context.Canceled) + awaitWaitGroup(t, &wg) + + require.NoError(t, followerE) + require.Equal(t, []byte("value"), followerV) + require.Equal(t, int32(1), calls.Load()) +} + +// joiningContext reports when GetOrLoad reaches the shared-result wait path. The +// delegate is kept as function fields so no struct holds a context.Context. +type joiningContext struct { + deadline func() (time.Time, bool) + done func() <-chan struct{} + err func() error + value func(any) any + + once *sync.Once + joined chan struct{} +} + +func newJoiningContext(joined chan struct{}) joiningContext { + base := context.Background() + + return joiningContext{ + deadline: base.Deadline, + done: base.Done, + err: base.Err, + value: base.Value, + once: new(sync.Once), + joined: joined, + } +} + +func (c joiningContext) Deadline() (time.Time, bool) { return c.deadline() } + +func (c joiningContext) Done() <-chan struct{} { + c.once.Do(func() { close(c.joined) }) + + return c.done() +} + +func (c joiningContext) Err() error { return c.err() } + +func (c joiningContext) Value(key any) any { return c.value(key) } + +func TestDistributedRetriesWhenLockVanishes(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + dc := newDistributed(t, store, cache.DistributedConfig{}) + ctx := context.Background() + + var released atomic.Bool + + time.AfterFunc(120*time.Millisecond, func() { released.Store(true) }) + + store.EXPECT().Get(mock.Anything, "key").Return(nil, cache.ErrCacheMiss).Maybe() + store.EXPECT().AcquireLock(mock.Anything, "lock:key", mock.AnythingOfType("string"), mock.Anything).Return(false, nil).Once() + store.EXPECT().AcquireLock(mock.Anything, "lock:key", mock.AnythingOfType("string"), mock.Anything).Return(true, nil).Once() + store.EXPECT().LockHeld(mock.Anything, "lock:key").RunAndReturn(func(context.Context, string) (bool, error) { + return !released.Load(), nil + }).Maybe() + store.EXPECT().Set(mock.Anything, "key", mock.Anything, mock.Anything).Return(nil).Once() + store.EXPECT().ReleaseLock(mock.Anything, "lock:key", mock.AnythingOfType("string")).Return(true, nil).Once() + + var calls atomic.Int32 + + value, err := dc.GetOrLoad(ctx, "key", time.Minute, func(context.Context) ([]byte, error) { + calls.Add(1) + + return []byte("recovered"), nil + }) + require.NoError(t, err) + require.Equal(t, []byte("recovered"), value) + require.Equal(t, int32(1), calls.Load()) +} + +func TestFillStoreCallsAreBoundedByDeadline(t *testing.T) { + t.Parallel() + + store := mocks.NewMockLockStore(t) + dc := newDistributed(t, store, cache.DistributedConfig{}) + + var ( + mu sync.Mutex + getBudgets []time.Duration + setBudget time.Duration + setHasDead bool + ) + + store.EXPECT().Get(mock.Anything, "key").RunAndReturn(func(ctx context.Context, _ string) ([]byte, error) { + mu.Lock() + defer mu.Unlock() + + if deadline, ok := ctx.Deadline(); ok { + getBudgets = append(getBudgets, time.Until(deadline)) + } + + return nil, cache.ErrCacheMiss + }).Twice() + store.EXPECT().AcquireLock(mock.Anything, "lock:key", mock.AnythingOfType("string"), mock.Anything).Return(true, nil).Once() + store.EXPECT().Set(mock.Anything, "key", mock.Anything, mock.Anything). + RunAndReturn(func(ctx context.Context, _ string, _ []byte, _ time.Duration) error { + mu.Lock() + defer mu.Unlock() + + deadline, ok := ctx.Deadline() + setHasDead = ok + if ok { + setBudget = time.Until(deadline) + } + + return nil + }).Once() + store.EXPECT().ReleaseLock(mock.Anything, "lock:key", mock.AnythingOfType("string")).Return(true, nil).Once() + + _, err := dc.GetOrLoad(context.Background(), "key", time.Minute, func(context.Context) ([]byte, error) { + return []byte("value"), nil + }) + require.NoError(t, err) + + mu.Lock() + defer mu.Unlock() + + require.True(t, setHasDead, "Set must receive a bounded context") + require.LessOrEqual(t, setBudget, 300*time.Millisecond) + + minGetBudget := time.Hour + for _, budget := range getBudgets { + if budget < minGetBudget { + minGetBudget = budget + } + } + + require.LessOrEqual(t, minGetBudget, 300*time.Millisecond, "fill's Get must receive a bounded context") +} diff --git a/internal/platform/cache/mocks/Cache.go b/internal/platform/cache/mocks/Cache.go new file mode 100644 index 00000000..d511bc7a --- /dev/null +++ b/internal/platform/cache/mocks/Cache.go @@ -0,0 +1,346 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "time" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockCache creates a new instance of MockCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockCache(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCache { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockCache{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockCache is an autogenerated mock type for the Cache type +type MockCache struct { + mock.Mock +} + +type MockCache_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCache) EXPECT() *MockCache_Expecter { + return &MockCache_Expecter{mock: &_m.Mock} +} + +// Close provides a mock function for the type MockCache +func (_mock *MockCache) Close() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockCache_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockCache_Expecter) Close() *MockCache_Close_Call { + return &MockCache_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockCache_Close_Call) Run(run func()) *MockCache_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCache_Close_Call) Return(err error) *MockCache_Close_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_Close_Call) RunAndReturn(run func() error) *MockCache_Close_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function for the type MockCache +func (_mock *MockCache) Delete(ctx context.Context, keys ...string) error { + var tmpRet mock.Arguments + if len(keys) > 0 { + tmpRet = _mock.Called(ctx, keys) + } else { + tmpRet = _mock.Called(ctx) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, ...string) error); ok { + r0 = returnFunc(ctx, keys...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockCache_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - keys ...string +func (_e *MockCache_Expecter) Delete(ctx any, keys ...any) *MockCache_Delete_Call { + return &MockCache_Delete_Call{Call: _e.mock.On("Delete", + append([]any{ctx}, keys...)...)} +} + +func (_c *MockCache_Delete_Call) Run(run func(ctx context.Context, keys ...string)) *MockCache_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 []string + var variadicArgs []string + if len(args) > 1 { + variadicArgs = args[1].([]string) + } + arg1 = variadicArgs + run( + arg0, + arg1..., + ) + }) + return _c +} + +func (_c *MockCache_Delete_Call) Return(err error) *MockCache_Delete_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_Delete_Call) RunAndReturn(run func(ctx context.Context, keys ...string) error) *MockCache_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function for the type MockCache +func (_mock *MockCache) Get(ctx context.Context, key string) ([]byte, error) { + ret := _mock.Called(ctx, key) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok { + return returnFunc(ctx, key) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) []byte); ok { + r0 = returnFunc(ctx, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCache_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockCache_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - key string +func (_e *MockCache_Expecter) Get(ctx any, key any) *MockCache_Get_Call { + return &MockCache_Get_Call{Call: _e.mock.On("Get", ctx, key)} +} + +func (_c *MockCache_Get_Call) Run(run func(ctx context.Context, key string)) *MockCache_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockCache_Get_Call) Return(bytes []byte, err error) *MockCache_Get_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockCache_Get_Call) RunAndReturn(run func(ctx context.Context, key string) ([]byte, error)) *MockCache_Get_Call { + _c.Call.Return(run) + return _c +} + +// Ping provides a mock function for the type MockCache +func (_mock *MockCache) Ping(ctx context.Context) error { + ret := _mock.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Ping") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = returnFunc(ctx) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_Ping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ping' +type MockCache_Ping_Call struct { + *mock.Call +} + +// Ping is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockCache_Expecter) Ping(ctx any) *MockCache_Ping_Call { + return &MockCache_Ping_Call{Call: _e.mock.On("Ping", ctx)} +} + +func (_c *MockCache_Ping_Call) Run(run func(ctx context.Context)) *MockCache_Ping_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockCache_Ping_Call) Return(err error) *MockCache_Ping_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_Ping_Call) RunAndReturn(run func(ctx context.Context) error) *MockCache_Ping_Call { + _c.Call.Return(run) + return _c +} + +// Set provides a mock function for the type MockCache +func (_mock *MockCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error { + ret := _mock.Called(ctx, key, value, ttl) + + if len(ret) == 0 { + panic("no return value specified for Set") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, []byte, time.Duration) error); ok { + r0 = returnFunc(ctx, key, value, ttl) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type MockCache_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - ctx context.Context +// - key string +// - value []byte +// - ttl time.Duration +func (_e *MockCache_Expecter) Set(ctx any, key any, value any, ttl any) *MockCache_Set_Call { + return &MockCache_Set_Call{Call: _e.mock.On("Set", ctx, key, value, ttl)} +} + +func (_c *MockCache_Set_Call) Run(run func(ctx context.Context, key string, value []byte, ttl time.Duration)) *MockCache_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 []byte + if args[2] != nil { + arg2 = args[2].([]byte) + } + var arg3 time.Duration + if args[3] != nil { + arg3 = args[3].(time.Duration) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockCache_Set_Call) Return(err error) *MockCache_Set_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_Set_Call) RunAndReturn(run func(ctx context.Context, key string, value []byte, ttl time.Duration) error) *MockCache_Set_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/platform/cache/mocks/LockStore.go b/internal/platform/cache/mocks/LockStore.go new file mode 100644 index 00000000..bb9903f6 --- /dev/null +++ b/internal/platform/cache/mocks/LockStore.go @@ -0,0 +1,562 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "time" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockLockStore creates a new instance of MockLockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockLockStore(t interface { + mock.TestingT + Cleanup(func()) +}) *MockLockStore { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockLockStore{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockLockStore is an autogenerated mock type for the LockStore type +type MockLockStore struct { + mock.Mock +} + +type MockLockStore_Expecter struct { + mock *mock.Mock +} + +func (_m *MockLockStore) EXPECT() *MockLockStore_Expecter { + return &MockLockStore_Expecter{mock: &_m.Mock} +} + +// AcquireLock provides a mock function for the type MockLockStore +func (_mock *MockLockStore) AcquireLock(ctx context.Context, key string, token string, ttl time.Duration) (bool, error) { + ret := _mock.Called(ctx, key, token, ttl) + + if len(ret) == 0 { + panic("no return value specified for AcquireLock") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, time.Duration) (bool, error)); ok { + return returnFunc(ctx, key, token, ttl) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, time.Duration) bool); ok { + r0 = returnFunc(ctx, key, token, ttl) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, time.Duration) error); ok { + r1 = returnFunc(ctx, key, token, ttl) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockLockStore_AcquireLock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcquireLock' +type MockLockStore_AcquireLock_Call struct { + *mock.Call +} + +// AcquireLock is a helper method to define mock.On call +// - ctx context.Context +// - key string +// - token string +// - ttl time.Duration +func (_e *MockLockStore_Expecter) AcquireLock(ctx any, key any, token any, ttl any) *MockLockStore_AcquireLock_Call { + return &MockLockStore_AcquireLock_Call{Call: _e.mock.On("AcquireLock", ctx, key, token, ttl)} +} + +func (_c *MockLockStore_AcquireLock_Call) Run(run func(ctx context.Context, key string, token string, ttl time.Duration)) *MockLockStore_AcquireLock_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + var arg3 time.Duration + if args[3] != nil { + arg3 = args[3].(time.Duration) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockLockStore_AcquireLock_Call) Return(b bool, err error) *MockLockStore_AcquireLock_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockLockStore_AcquireLock_Call) RunAndReturn(run func(ctx context.Context, key string, token string, ttl time.Duration) (bool, error)) *MockLockStore_AcquireLock_Call { + _c.Call.Return(run) + return _c +} + +// Close provides a mock function for the type MockLockStore +func (_mock *MockLockStore) Close() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockLockStore_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockLockStore_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockLockStore_Expecter) Close() *MockLockStore_Close_Call { + return &MockLockStore_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockLockStore_Close_Call) Run(run func()) *MockLockStore_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockLockStore_Close_Call) Return(err error) *MockLockStore_Close_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockLockStore_Close_Call) RunAndReturn(run func() error) *MockLockStore_Close_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function for the type MockLockStore +func (_mock *MockLockStore) Delete(ctx context.Context, keys ...string) error { + var tmpRet mock.Arguments + if len(keys) > 0 { + tmpRet = _mock.Called(ctx, keys) + } else { + tmpRet = _mock.Called(ctx) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, ...string) error); ok { + r0 = returnFunc(ctx, keys...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockLockStore_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockLockStore_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - keys ...string +func (_e *MockLockStore_Expecter) Delete(ctx any, keys ...any) *MockLockStore_Delete_Call { + return &MockLockStore_Delete_Call{Call: _e.mock.On("Delete", + append([]any{ctx}, keys...)...)} +} + +func (_c *MockLockStore_Delete_Call) Run(run func(ctx context.Context, keys ...string)) *MockLockStore_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 []string + var variadicArgs []string + if len(args) > 1 { + variadicArgs = args[1].([]string) + } + arg1 = variadicArgs + run( + arg0, + arg1..., + ) + }) + return _c +} + +func (_c *MockLockStore_Delete_Call) Return(err error) *MockLockStore_Delete_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockLockStore_Delete_Call) RunAndReturn(run func(ctx context.Context, keys ...string) error) *MockLockStore_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function for the type MockLockStore +func (_mock *MockLockStore) Get(ctx context.Context, key string) ([]byte, error) { + ret := _mock.Called(ctx, key) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok { + return returnFunc(ctx, key) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) []byte); ok { + r0 = returnFunc(ctx, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockLockStore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockLockStore_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - key string +func (_e *MockLockStore_Expecter) Get(ctx any, key any) *MockLockStore_Get_Call { + return &MockLockStore_Get_Call{Call: _e.mock.On("Get", ctx, key)} +} + +func (_c *MockLockStore_Get_Call) Run(run func(ctx context.Context, key string)) *MockLockStore_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockLockStore_Get_Call) Return(bytes []byte, err error) *MockLockStore_Get_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockLockStore_Get_Call) RunAndReturn(run func(ctx context.Context, key string) ([]byte, error)) *MockLockStore_Get_Call { + _c.Call.Return(run) + return _c +} + +// LockHeld provides a mock function for the type MockLockStore +func (_mock *MockLockStore) LockHeld(ctx context.Context, key string) (bool, error) { + ret := _mock.Called(ctx, key) + + if len(ret) == 0 { + panic("no return value specified for LockHeld") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok { + return returnFunc(ctx, key) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) bool); ok { + r0 = returnFunc(ctx, key) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockLockStore_LockHeld_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LockHeld' +type MockLockStore_LockHeld_Call struct { + *mock.Call +} + +// LockHeld is a helper method to define mock.On call +// - ctx context.Context +// - key string +func (_e *MockLockStore_Expecter) LockHeld(ctx any, key any) *MockLockStore_LockHeld_Call { + return &MockLockStore_LockHeld_Call{Call: _e.mock.On("LockHeld", ctx, key)} +} + +func (_c *MockLockStore_LockHeld_Call) Run(run func(ctx context.Context, key string)) *MockLockStore_LockHeld_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockLockStore_LockHeld_Call) Return(b bool, err error) *MockLockStore_LockHeld_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockLockStore_LockHeld_Call) RunAndReturn(run func(ctx context.Context, key string) (bool, error)) *MockLockStore_LockHeld_Call { + _c.Call.Return(run) + return _c +} + +// Ping provides a mock function for the type MockLockStore +func (_mock *MockLockStore) Ping(ctx context.Context) error { + ret := _mock.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Ping") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = returnFunc(ctx) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockLockStore_Ping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ping' +type MockLockStore_Ping_Call struct { + *mock.Call +} + +// Ping is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockLockStore_Expecter) Ping(ctx any) *MockLockStore_Ping_Call { + return &MockLockStore_Ping_Call{Call: _e.mock.On("Ping", ctx)} +} + +func (_c *MockLockStore_Ping_Call) Run(run func(ctx context.Context)) *MockLockStore_Ping_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockLockStore_Ping_Call) Return(err error) *MockLockStore_Ping_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockLockStore_Ping_Call) RunAndReturn(run func(ctx context.Context) error) *MockLockStore_Ping_Call { + _c.Call.Return(run) + return _c +} + +// ReleaseLock provides a mock function for the type MockLockStore +func (_mock *MockLockStore) ReleaseLock(ctx context.Context, key string, token string) (bool, error) { + ret := _mock.Called(ctx, key, token) + + if len(ret) == 0 { + panic("no return value specified for ReleaseLock") + } + + var r0 bool + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (bool, error)); ok { + return returnFunc(ctx, key, token) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) bool); ok { + r0 = returnFunc(ctx, key, token) + } else { + r0 = ret.Get(0).(bool) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = returnFunc(ctx, key, token) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockLockStore_ReleaseLock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReleaseLock' +type MockLockStore_ReleaseLock_Call struct { + *mock.Call +} + +// ReleaseLock is a helper method to define mock.On call +// - ctx context.Context +// - key string +// - token string +func (_e *MockLockStore_Expecter) ReleaseLock(ctx any, key any, token any) *MockLockStore_ReleaseLock_Call { + return &MockLockStore_ReleaseLock_Call{Call: _e.mock.On("ReleaseLock", ctx, key, token)} +} + +func (_c *MockLockStore_ReleaseLock_Call) Run(run func(ctx context.Context, key string, token string)) *MockLockStore_ReleaseLock_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockLockStore_ReleaseLock_Call) Return(b bool, err error) *MockLockStore_ReleaseLock_Call { + _c.Call.Return(b, err) + return _c +} + +func (_c *MockLockStore_ReleaseLock_Call) RunAndReturn(run func(ctx context.Context, key string, token string) (bool, error)) *MockLockStore_ReleaseLock_Call { + _c.Call.Return(run) + return _c +} + +// Set provides a mock function for the type MockLockStore +func (_mock *MockLockStore) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error { + ret := _mock.Called(ctx, key, value, ttl) + + if len(ret) == 0 { + panic("no return value specified for Set") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, []byte, time.Duration) error); ok { + r0 = returnFunc(ctx, key, value, ttl) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockLockStore_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type MockLockStore_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - ctx context.Context +// - key string +// - value []byte +// - ttl time.Duration +func (_e *MockLockStore_Expecter) Set(ctx any, key any, value any, ttl any) *MockLockStore_Set_Call { + return &MockLockStore_Set_Call{Call: _e.mock.On("Set", ctx, key, value, ttl)} +} + +func (_c *MockLockStore_Set_Call) Run(run func(ctx context.Context, key string, value []byte, ttl time.Duration)) *MockLockStore_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 []byte + if args[2] != nil { + arg2 = args[2].([]byte) + } + var arg3 time.Duration + if args[3] != nil { + arg3 = args[3].(time.Duration) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockLockStore_Set_Call) Return(err error) *MockLockStore_Set_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockLockStore_Set_Call) RunAndReturn(run func(ctx context.Context, key string, value []byte, ttl time.Duration) error) *MockLockStore_Set_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/platform/cache/redis.go b/internal/platform/cache/redis.go new file mode 100644 index 00000000..5759dafc --- /dev/null +++ b/internal/platform/cache/redis.go @@ -0,0 +1,139 @@ +package cache + +import ( + "context" + "errors" + "fmt" + "net" + "strconv" + "time" + + "github.com/redis/go-redis/v9" +) + +type RedisConfig struct { + Host string + Port int + Password string + DB int + MaxRetries int + DialTimeout time.Duration + ReadTimeout time.Duration + WriteTimeout time.Duration + PoolSize int +} + +type RedisCache struct { + client *redis.Client +} + +func NewRedis(cfg RedisConfig) (*RedisCache, error) { + client := redis.NewClient(newClientOptions(cfg)) + + ctx, cancel := context.WithTimeout(context.Background(), cfg.DialTimeout) + defer cancel() + + if err := client.Ping(ctx).Err(); err != nil { + _ = client.Close() + + return nil, fmt.Errorf("ping redis: %w", err) + } + + return &RedisCache{client: client}, nil +} + +func newClientOptions(cfg RedisConfig) *redis.Options { + return &redis.Options{ + Addr: net.JoinHostPort(cfg.Host, strconv.Itoa(cfg.Port)), + Password: cfg.Password, + DB: cfg.DB, + MaxRetries: cfg.MaxRetries, + DialTimeout: cfg.DialTimeout, + ReadTimeout: cfg.ReadTimeout, + WriteTimeout: cfg.WriteTimeout, + PoolSize: cfg.PoolSize, + } +} + +func (r *RedisCache) Get(ctx context.Context, key string) ([]byte, error) { + value, err := r.client.Get(ctx, key).Bytes() + if errors.Is(err, redis.Nil) { + return nil, ErrCacheMiss + } + + if err != nil { + return nil, fmt.Errorf("redis get %q: %w", key, err) + } + + return value, nil +} + +func (r *RedisCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error { + if err := r.client.Set(ctx, key, value, ttl).Err(); err != nil { + return fmt.Errorf("redis set %q: %w", key, err) + } + + return nil +} + +func (r *RedisCache) Delete(ctx context.Context, keys ...string) error { + if len(keys) == 0 { + return nil + } + + if err := r.client.Del(ctx, keys...).Err(); err != nil { + return fmt.Errorf("redis delete: %w", err) + } + + return nil +} + +var releaseLockScript = redis.NewScript(` +if redis.call("GET", KEYS[1]) == ARGV[1] then + return redis.call("DEL", KEYS[1]) +end +return 0 +`) + +func (r *RedisCache) AcquireLock(ctx context.Context, key, token string, ttl time.Duration) (bool, error) { + acquired, err := r.client.SetNX(ctx, key, token, ttl).Result() + if err != nil { + return false, fmt.Errorf("redis acquire lock %q: %w", key, err) + } + + return acquired, nil +} + +func (r *RedisCache) ReleaseLock(ctx context.Context, key, token string) (bool, error) { + deleted, err := releaseLockScript.Run(ctx, r.client, []string{key}, token).Int64() + if err != nil { + return false, fmt.Errorf("redis release lock %q: %w", key, err) + } + + return deleted > 0, nil +} + +func (r *RedisCache) LockHeld(ctx context.Context, key string) (bool, error) { + exists, err := r.client.Exists(ctx, key).Result() + if err != nil { + return false, fmt.Errorf("redis check lock %q: %w", key, err) + } + + return exists > 0, nil +} + +func (r *RedisCache) Ping(ctx context.Context) error { + if err := r.client.Ping(ctx).Err(); err != nil { + return fmt.Errorf("redis ping: %w", err) + } + + return nil +} + +func (r *RedisCache) Close() error { + if err := r.client.Close(); err != nil { + return fmt.Errorf("redis close: %w", err) + } + + return nil +} diff --git a/internal/platform/cache/redis_client_test.go b/internal/platform/cache/redis_client_test.go new file mode 100644 index 00000000..f33d4ba3 --- /dev/null +++ b/internal/platform/cache/redis_client_test.go @@ -0,0 +1,32 @@ +package cache + +import ( + "testing" + "time" + + "github.com/redis/go-redis/v9" + "github.com/stretchr/testify/require" +) + +func TestNewClientOptionsAppliesTimeoutsAndRetries(t *testing.T) { + t.Parallel() + + client := redis.NewClient(newClientOptions(RedisConfig{ + Host: "localhost", + Port: 6379, + MaxRetries: -1, + DialTimeout: 300 * time.Millisecond, + ReadTimeout: 200 * time.Millisecond, + WriteTimeout: 200 * time.Millisecond, + PoolSize: 5, + })) + + defer func() { _ = client.Close() }() + + opts := client.Options() + require.Equal(t, 0, opts.MaxRetries, "go-redis: -1 disables retries, 0 would restore the default of 3") + require.Equal(t, 300*time.Millisecond, opts.DialTimeout) + require.Equal(t, 200*time.Millisecond, opts.ReadTimeout) + require.Equal(t, 200*time.Millisecond, opts.WriteTimeout) + require.Equal(t, 5, opts.PoolSize) +} diff --git a/internal/platform/password/password.go b/internal/platform/password/password.go new file mode 100644 index 00000000..acc62377 --- /dev/null +++ b/internal/platform/password/password.go @@ -0,0 +1,52 @@ +package password + +import ( + "crypto/rand" + "crypto/subtle" + "encoding/base64" + "strings" + + "golang.org/x/crypto/argon2" +) + +const ( + argonTime = 1 + argonMemory = 64 * 1024 + argonThreads = 4 + argonKeyLen = 32 + argonSaltLen = 16 +) + +func Hash(plain string) (string, error) { + salt := make([]byte, argonSaltLen) + if _, err := rand.Read(salt); err != nil { + return "", err + } + + hash := argon2.IDKey([]byte(plain), salt, argonTime, argonMemory, argonThreads, argonKeyLen) + + return "argon2id$" + + base64.RawStdEncoding.EncodeToString(salt) + "$" + + base64.RawStdEncoding.EncodeToString(hash), nil +} + +func Verify(plain, encoded string) bool { + parts := strings.Split(encoded, "$") + if len(parts) != 3 || parts[0] != "argon2id" { + return false + } + + salt, err := base64.RawStdEncoding.DecodeString(parts[1]) + if err != nil { + return false + } + + expected, err := base64.RawStdEncoding.DecodeString(parts[2]) + if err != nil || len(salt) != argonSaltLen || len(expected) != argonKeyLen { + return false + } + + actual := argon2.IDKey([]byte(plain), salt, argonTime, argonMemory, argonThreads, argonKeyLen) + + return subtle.ConstantTimeCompare(actual, expected) == 1 +} diff --git a/internal/platform/password/password_test.go b/internal/platform/password/password_test.go new file mode 100644 index 00000000..1fe449b1 --- /dev/null +++ b/internal/platform/password/password_test.go @@ -0,0 +1,33 @@ +package password_test + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/platform/password" +) + +func TestHashVerifyRoundTrip(t *testing.T) { + encoded, err := password.Hash("very-secret-password") + require.NoError(t, err) + require.True(t, password.Verify("very-secret-password", encoded)) + require.False(t, password.Verify("wrong-password-value", encoded)) +} + +func TestHashIsSalted(t *testing.T) { + first, err := password.Hash("very-secret-password") + require.NoError(t, err) + + second, err := password.Hash("very-secret-password") + require.NoError(t, err) + + require.NotEqual(t, first, second) +} + +func TestVerifyRejectsMalformedHash(t *testing.T) { + require.False(t, password.Verify("very-secret-password", "")) + require.False(t, password.Verify("very-secret-password", "plain-text")) + require.False(t, password.Verify("very-secret-password", strings.Repeat("x", 64))) +} diff --git a/internal/platform/token/token.go b/internal/platform/token/token.go new file mode 100644 index 00000000..b5d2351c --- /dev/null +++ b/internal/platform/token/token.go @@ -0,0 +1,40 @@ +package token + +import ( + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "errors" +) + +const size = 32 + +var ErrInvalid = errors.New("invalid token") + +type Token struct{} + +func New() Token { + return Token{} +} + +func (Token) Generate() (string, []byte, error) { + raw := make([]byte, size) + if _, err := rand.Read(raw); err != nil { + return "", nil, err + } + + sum := sha256.Sum256(raw) + + return base64.RawURLEncoding.EncodeToString(raw), sum[:], nil +} + +func (Token) Hash(raw string) ([]byte, error) { + decoded, err := base64.RawURLEncoding.DecodeString(raw) + if err != nil || len(decoded) != size { + return nil, ErrInvalid + } + + sum := sha256.Sum256(decoded) + + return sum[:], nil +} diff --git a/internal/platform/token/token_test.go b/internal/platform/token/token_test.go new file mode 100644 index 00000000..54dfc2e4 --- /dev/null +++ b/internal/platform/token/token_test.go @@ -0,0 +1,44 @@ +package token_test + +import ( + "crypto/sha256" + "testing" + + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/platform/token" +) + +func TestGenerateProducesUniqueOpaqueTokens(t *testing.T) { + tokens := token.New() + + first, firstHash, err := tokens.Generate() + require.NoError(t, err) + require.NotEmpty(t, first) + require.Len(t, firstHash, sha256.Size) + + second, secondHash, err := tokens.Generate() + require.NoError(t, err) + require.NotEqual(t, first, second) + require.NotEqual(t, firstHash, secondHash) +} + +func TestHashMatchesGeneratedHash(t *testing.T) { + tokens := token.New() + + raw, hash, err := tokens.Generate() + require.NoError(t, err) + + actual, err := tokens.Hash(raw) + require.NoError(t, err) + require.Equal(t, hash, actual) +} + +func TestHashRejectsMalformed(t *testing.T) { + tokens := token.New() + + for _, raw := range []string{"", "not-base64!", "c2hvcnQ"} { + _, err := tokens.Hash(raw) + require.ErrorIs(t, err, token.ErrInvalid, raw) + } +} diff --git a/internal/service/chat/mocks/Repository.go b/internal/service/chat/mocks/Repository.go new file mode 100644 index 00000000..aa6f58f0 --- /dev/null +++ b/internal/service/chat/mocks/Repository.go @@ -0,0 +1,265 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRepository { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockRepository is an autogenerated mock type for the Repository type +type MockRepository struct { + mock.Mock +} + +type MockRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRepository) EXPECT() *MockRepository_Expecter { + return &MockRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockRepository +func (_mock *MockRepository) Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Chat + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.ChatDraft) (domain.Chat, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.ChatDraft) domain.Chat); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.Chat) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.ChatDraft) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.ChatDraft +func (_e *MockRepository_Expecter) Create(ctx any, draft any) *MockRepository_Create_Call { + return &MockRepository_Create_Call{Call: _e.mock.On("Create", ctx, draft)} +} + +func (_c *MockRepository_Create_Call) Run(run func(ctx context.Context, draft domain.ChatDraft)) *MockRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.ChatDraft + if args[1] != nil { + arg1 = args[1].(domain.ChatDraft) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_Create_Call) Return(chat domain.Chat, err error) *MockRepository_Create_Call { + _c.Call.Return(chat, err) + return _c +} + +func (_c *MockRepository_Create_Call) RunAndReturn(run func(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error)) *MockRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// GetVisible provides a mock function for the type MockRepository +func (_mock *MockRepository) GetVisible(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID) (domain.Chat, error) { + ret := _mock.Called(ctx, chatID, callerID) + + if len(ret) == 0 { + panic("no return value specified for GetVisible") + } + + var r0 domain.Chat + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) (domain.Chat, error)); ok { + return returnFunc(ctx, chatID, callerID) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) domain.Chat); ok { + r0 = returnFunc(ctx, chatID, callerID) + } else { + r0 = ret.Get(0).(domain.Chat) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID) error); ok { + r1 = returnFunc(ctx, chatID, callerID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_GetVisible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVisible' +type MockRepository_GetVisible_Call struct { + *mock.Call +} + +// GetVisible is a helper method to define mock.On call +// - ctx context.Context +// - chatID uuid.UUID +// - callerID uuid.UUID +func (_e *MockRepository_Expecter) GetVisible(ctx any, chatID any, callerID any) *MockRepository_GetVisible_Call { + return &MockRepository_GetVisible_Call{Call: _e.mock.On("GetVisible", ctx, chatID, callerID)} +} + +func (_c *MockRepository_GetVisible_Call) Run(run func(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID)) *MockRepository_GetVisible_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 uuid.UUID + if args[2] != nil { + arg2 = args[2].(uuid.UUID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockRepository_GetVisible_Call) Return(chat domain.Chat, err error) *MockRepository_GetVisible_Call { + _c.Call.Return(chat, err) + return _c +} + +func (_c *MockRepository_GetVisible_Call) RunAndReturn(run func(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID) (domain.Chat, error)) *MockRepository_GetVisible_Call { + _c.Call.Return(run) + return _c +} + +// ListVisible provides a mock function for the type MockRepository +func (_mock *MockRepository) ListVisible(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error) { + ret := _mock.Called(ctx, callerID, after, limit) + + if len(ret) == 0 { + panic("no return value specified for ListVisible") + } + + var r0 domain.Page[domain.Chat] + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error)); ok { + return returnFunc(ctx, callerID, after, limit) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, *domain.Cursor, int) domain.Page[domain.Chat]); ok { + r0 = returnFunc(ctx, callerID, after, limit) + } else { + r0 = ret.Get(0).(domain.Page[domain.Chat]) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, *domain.Cursor, int) error); ok { + r1 = returnFunc(ctx, callerID, after, limit) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_ListVisible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListVisible' +type MockRepository_ListVisible_Call struct { + *mock.Call +} + +// ListVisible is a helper method to define mock.On call +// - ctx context.Context +// - callerID uuid.UUID +// - after *domain.Cursor +// - limit int +func (_e *MockRepository_Expecter) ListVisible(ctx any, callerID any, after any, limit any) *MockRepository_ListVisible_Call { + return &MockRepository_ListVisible_Call{Call: _e.mock.On("ListVisible", ctx, callerID, after, limit)} +} + +func (_c *MockRepository_ListVisible_Call) Run(run func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int)) *MockRepository_ListVisible_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 *domain.Cursor + if args[2] != nil { + arg2 = args[2].(*domain.Cursor) + } + var arg3 int + if args[3] != nil { + arg3 = args[3].(int) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockRepository_ListVisible_Call) Return(page domain.Page[domain.Chat], err error) *MockRepository_ListVisible_Call { + _c.Call.Return(page, err) + return _c +} + +func (_c *MockRepository_ListVisible_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error)) *MockRepository_ListVisible_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/service/chat/service.go b/internal/service/chat/service.go new file mode 100644 index 00000000..f3a0d3fc --- /dev/null +++ b/internal/service/chat/service.go @@ -0,0 +1,69 @@ +package chat + +import ( + "context" + "fmt" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" +) + +type Repository interface { + Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) + GetVisible(ctx context.Context, chatID, callerID uuid.UUID) (domain.Chat, error) + ListVisible( + ctx context.Context, + callerID uuid.UUID, + after *domain.Cursor, + limit int, + ) (domain.Page[domain.Chat], error) +} + +type Service struct { + chats Repository +} + +func NewService(chats Repository) *Service { + return &Service{chats: chats} +} + +func (s *Service) Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) { + if err := draft.Validate(); err != nil { + return domain.Chat{}, err + } + + created, err := s.chats.Create(ctx, draft) + if err != nil { + return domain.Chat{}, fmt.Errorf("create chat: %w", err) + } + + return created, nil +} + +func (s *Service) Get(ctx context.Context, callerID, chatID uuid.UUID) (domain.Chat, error) { + found, err := s.chats.GetVisible(ctx, chatID, callerID) + if err != nil { + return domain.Chat{}, fmt.Errorf("get chat: %w", err) + } + + return found, nil +} + +func (s *Service) List( + ctx context.Context, + callerID uuid.UUID, + after *domain.Cursor, + limit int, +) (domain.Page[domain.Chat], error) { + if after != nil && !after.BelongsTo(callerID) { + return domain.Page[domain.Chat]{}, fmt.Errorf("cursor is bound to another list: %w", domain.ErrInvalidCursor) + } + + page, err := s.chats.ListVisible(ctx, callerID, after, limit) + if err != nil { + return domain.Page[domain.Chat]{}, fmt.Errorf("list chats: %w", err) + } + + return page, nil +} diff --git a/internal/service/chat/service_test.go b/internal/service/chat/service_test.go new file mode 100644 index 00000000..47450f9c --- /dev/null +++ b/internal/service/chat/service_test.go @@ -0,0 +1,140 @@ +package chat_test + +import ( + "errors" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/service/chat" + "mtusi-messenger/internal/service/chat/mocks" +) + +var errRepository = errors.New("repository is unavailable") + +type ServiceSuite struct { + suite.Suite + + chats *mocks.MockRepository + service *chat.Service + caller uuid.UUID + now time.Time +} + +func TestServiceSuite(t *testing.T) { + t.Parallel() + suite.Run(t, new(ServiceSuite)) +} + +func (s *ServiceSuite) SetupTest() { + s.chats = mocks.NewMockRepository(s.T()) + s.service = chat.NewService(s.chats) + s.caller = uuid.New() + s.now = time.Date(2026, 9, 1, 12, 0, 0, 0, time.UTC) +} + +func (s *ServiceSuite) draft() domain.ChatDraft { + return domain.ChatDraft{ + Title: "Проект по ВНП", + MemberIDs: []uuid.UUID{s.caller}, + CallerID: s.caller, + } +} + +func (s *ServiceSuite) TestCreateReturnsStoredChat() { + draft := s.draft() + stored := domain.Chat{ + ID: uuid.New(), + Title: draft.Title, + MemberIDs: draft.MemberIDs, + CreatedAt: s.now, + } + + s.chats.EXPECT().Create(s.T().Context(), draft).Return(stored, nil).Once() + + got, err := s.service.Create(s.T().Context(), draft) + s.Require().NoError(err) + s.Equal(stored, got) +} + +func (s *ServiceSuite) TestCreateRejectsDraftWithoutCallerWithoutRepositoryCall() { + draft := s.draft() + draft.MemberIDs = []uuid.UUID{uuid.New()} + + _, err := s.service.Create(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrValidation) +} + +func (s *ServiceSuite) TestCreateRejectsBlankTitleWithoutRepositoryCall() { + draft := s.draft() + draft.Title = " " + + _, err := s.service.Create(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrValidation) +} + +func (s *ServiceSuite) TestCreatePropagatesUnknownMember() { + draft := s.draft() + + s.chats.EXPECT().Create(s.T().Context(), draft).Return(domain.Chat{}, domain.ErrUnknownMember).Once() + + _, err := s.service.Create(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrUnknownMember, + "целостность участников проверяет хранилище, сервис только пробрасывает исход") +} + +func (s *ServiceSuite) TestGetPropagatesNotFoundForForeignChat() { + chatID := uuid.New() + + s.chats.EXPECT().GetVisible(s.T().Context(), chatID, s.caller).Return(domain.Chat{}, domain.ErrNotFound).Once() + + _, err := s.service.Get(s.T().Context(), s.caller, chatID) + s.Require().ErrorIs(err, domain.ErrNotFound) +} + +func (s *ServiceSuite) TestListPassesNilCursorOnFirstPage() { + stored := domain.Chat{ID: uuid.New(), Title: "Проект", MemberIDs: []uuid.UUID{s.caller}, CreatedAt: s.now} + + s.chats.EXPECT(). + ListVisible(s.T().Context(), s.caller, (*domain.Cursor)(nil), domain.DefaultPageLimit). + Return(domain.Page[domain.Chat]{Items: []domain.Chat{stored}}, nil). + Once() + + page, err := s.service.List(s.T().Context(), s.caller, nil, domain.DefaultPageLimit) + s.Require().NoError(err) + s.Equal([]domain.Chat{stored}, page.Items) + s.Nil(page.Next, "на последней странице курсора нет") +} + +func (s *ServiceSuite) TestListRejectsCursorFromAnotherCaller() { + foreign := &domain.Cursor{Scope: uuid.New(), CreatedAt: s.now, ID: uuid.New()} + + _, err := s.service.List(s.T().Context(), s.caller, foreign, domain.DefaultPageLimit) + s.Require().ErrorIs(err, domain.ErrInvalidCursor, + "курсор чужого списка не должен открывать чужие чаты") +} + +func (s *ServiceSuite) TestListAcceptsOwnCursor() { + own := &domain.Cursor{Scope: s.caller, CreatedAt: s.now, ID: uuid.New()} + + s.chats.EXPECT(). + ListVisible(s.T().Context(), s.caller, own, 10). + Return(domain.Page[domain.Chat]{}, nil). + Once() + + _, err := s.service.List(s.T().Context(), s.caller, own, 10) + s.Require().NoError(err) +} + +func (s *ServiceSuite) TestListWrapsRepositoryFailure() { + s.chats.EXPECT(). + ListVisible(s.T().Context(), s.caller, (*domain.Cursor)(nil), domain.DefaultPageLimit). + Return(domain.Page[domain.Chat]{}, errRepository). + Once() + + _, err := s.service.List(s.T().Context(), s.caller, nil, domain.DefaultPageLimit) + s.Require().ErrorIs(err, errRepository) +} diff --git a/internal/service/message/mocks/Repository.go b/internal/service/message/mocks/Repository.go new file mode 100644 index 00000000..b09b4656 --- /dev/null +++ b/internal/service/message/mocks/Repository.go @@ -0,0 +1,199 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRepository { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockRepository is an autogenerated mock type for the Repository type +type MockRepository struct { + mock.Mock +} + +type MockRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRepository) EXPECT() *MockRepository_Expecter { + return &MockRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockRepository +func (_mock *MockRepository) Create(ctx context.Context, draft domain.MessageDraft) (domain.Message, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Message + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.MessageDraft) (domain.Message, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.MessageDraft) domain.Message); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.Message) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.MessageDraft) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.MessageDraft +func (_e *MockRepository_Expecter) Create(ctx any, draft any) *MockRepository_Create_Call { + return &MockRepository_Create_Call{Call: _e.mock.On("Create", ctx, draft)} +} + +func (_c *MockRepository_Create_Call) Run(run func(ctx context.Context, draft domain.MessageDraft)) *MockRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.MessageDraft + if args[1] != nil { + arg1 = args[1].(domain.MessageDraft) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_Create_Call) Return(message domain.Message, err error) *MockRepository_Create_Call { + _c.Call.Return(message, err) + return _c +} + +func (_c *MockRepository_Create_Call) RunAndReturn(run func(ctx context.Context, draft domain.MessageDraft) (domain.Message, error)) *MockRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// ListVisible provides a mock function for the type MockRepository +func (_mock *MockRepository) ListVisible(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Message], error) { + ret := _mock.Called(ctx, chatID, callerID, after, limit) + + if len(ret) == 0 { + panic("no return value specified for ListVisible") + } + + var r0 domain.Page[domain.Message] + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Message], error)); ok { + return returnFunc(ctx, chatID, callerID, after, limit) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, *domain.Cursor, int) domain.Page[domain.Message]); ok { + r0 = returnFunc(ctx, chatID, callerID, after, limit) + } else { + r0 = ret.Get(0).(domain.Page[domain.Message]) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, *domain.Cursor, int) error); ok { + r1 = returnFunc(ctx, chatID, callerID, after, limit) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_ListVisible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListVisible' +type MockRepository_ListVisible_Call struct { + *mock.Call +} + +// ListVisible is a helper method to define mock.On call +// - ctx context.Context +// - chatID uuid.UUID +// - callerID uuid.UUID +// - after *domain.Cursor +// - limit int +func (_e *MockRepository_Expecter) ListVisible(ctx any, chatID any, callerID any, after any, limit any) *MockRepository_ListVisible_Call { + return &MockRepository_ListVisible_Call{Call: _e.mock.On("ListVisible", ctx, chatID, callerID, after, limit)} +} + +func (_c *MockRepository_ListVisible_Call) Run(run func(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID, after *domain.Cursor, limit int)) *MockRepository_ListVisible_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 uuid.UUID + if args[2] != nil { + arg2 = args[2].(uuid.UUID) + } + var arg3 *domain.Cursor + if args[3] != nil { + arg3 = args[3].(*domain.Cursor) + } + var arg4 int + if args[4] != nil { + arg4 = args[4].(int) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) + }) + return _c +} + +func (_c *MockRepository_ListVisible_Call) Return(page domain.Page[domain.Message], err error) *MockRepository_ListVisible_Call { + _c.Call.Return(page, err) + return _c +} + +func (_c *MockRepository_ListVisible_Call) RunAndReturn(run func(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Message], error)) *MockRepository_ListVisible_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/service/message/service.go b/internal/service/message/service.go new file mode 100644 index 00000000..cbeb4c23 --- /dev/null +++ b/internal/service/message/service.go @@ -0,0 +1,59 @@ +package message + +import ( + "context" + "fmt" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" +) + +type Repository interface { + Create(ctx context.Context, draft domain.MessageDraft) (domain.Message, error) + ListVisible( + ctx context.Context, + chatID, callerID uuid.UUID, + after *domain.Cursor, + limit int, + ) (domain.Page[domain.Message], error) +} + +type Service struct { + messages Repository +} + +func NewService(messages Repository) *Service { + return &Service{messages: messages} +} + +func (s *Service) Send(ctx context.Context, draft domain.MessageDraft) (domain.Message, error) { + if err := draft.Validate(); err != nil { + return domain.Message{}, err + } + + sent, err := s.messages.Create(ctx, draft) + if err != nil { + return domain.Message{}, fmt.Errorf("create message: %w", err) + } + + return sent, nil +} + +func (s *Service) History( + ctx context.Context, + callerID, chatID uuid.UUID, + after *domain.Cursor, + limit int, +) (domain.Page[domain.Message], error) { + if after != nil && !after.BelongsTo(chatID) { + return domain.Page[domain.Message]{}, fmt.Errorf("cursor is bound to another chat: %w", domain.ErrInvalidCursor) + } + + page, err := s.messages.ListVisible(ctx, chatID, callerID, after, limit) + if err != nil { + return domain.Page[domain.Message]{}, fmt.Errorf("list messages: %w", err) + } + + return page, nil +} diff --git a/internal/service/message/service_test.go b/internal/service/message/service_test.go new file mode 100644 index 00000000..8051799d --- /dev/null +++ b/internal/service/message/service_test.go @@ -0,0 +1,144 @@ +package message_test + +import ( + "errors" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/service/message" + "mtusi-messenger/internal/service/message/mocks" +) + +var errRepository = errors.New("repository is unavailable") + +type ServiceSuite struct { + suite.Suite + + messages *mocks.MockRepository + service *message.Service + caller uuid.UUID + chatID uuid.UUID + now time.Time +} + +func TestServiceSuite(t *testing.T) { + t.Parallel() + suite.Run(t, new(ServiceSuite)) +} + +func (s *ServiceSuite) SetupTest() { + s.messages = mocks.NewMockRepository(s.T()) + s.service = message.NewService(s.messages) + s.caller = uuid.New() + s.chatID = uuid.New() + s.now = time.Date(2026, 9, 1, 12, 0, 0, 0, time.UTC) +} + +func (s *ServiceSuite) draft() domain.MessageDraft { + return domain.MessageDraft{ + ChatID: s.chatID, + SenderID: s.caller, + Text: "Привет, Боб!", + Idempotency: domain.MessageIdempotency{Key: "service-suite-key"}, + } +} + +func (s *ServiceSuite) TestSendReturnsStoredMessage() { + draft := s.draft() + stored := domain.Message{ + ID: uuid.New(), + ChatID: draft.ChatID, + SenderID: draft.SenderID, + Text: draft.Text, + CreatedAt: s.now, + } + + s.messages.EXPECT().Create(s.T().Context(), draft).Return(stored, nil).Once() + + got, err := s.service.Send(s.T().Context(), draft) + s.Require().NoError(err) + s.Equal(stored, got) +} + +func (s *ServiceSuite) TestSendRejectsWhitespaceTextWithoutRepositoryCall() { + draft := s.draft() + draft.Text = " \t\n " + + _, err := s.service.Send(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrValidation, + "пробельный текст не проходит схему контракта, но проходит minLength") +} + +func (s *ServiceSuite) TestSendPropagatesNotFoundForOutsider() { + draft := s.draft() + + s.messages.EXPECT().Create(s.T().Context(), draft).Return(domain.Message{}, domain.ErrNotFound).Once() + + _, err := s.service.Send(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrNotFound, + "доступ проверяет хранилище атомарно со вставкой") +} + +func (s *ServiceSuite) TestHistoryPassesNilCursorOnFirstPage() { + stored := domain.Message{ + ID: uuid.New(), + ChatID: s.chatID, + SenderID: s.caller, + Text: "первое", + CreatedAt: s.now, + } + + s.messages.EXPECT(). + ListVisible(s.T().Context(), s.chatID, s.caller, (*domain.Cursor)(nil), domain.DefaultPageLimit). + Return(domain.Page[domain.Message]{Items: []domain.Message{stored}}, nil). + Once() + + page, err := s.service.History(s.T().Context(), s.caller, s.chatID, nil, domain.DefaultPageLimit) + s.Require().NoError(err) + s.Equal([]domain.Message{stored}, page.Items) + s.Nil(page.Next) +} + +func (s *ServiceSuite) TestHistoryRejectsCursorFromAnotherChat() { + foreign := &domain.Cursor{Scope: uuid.New(), CreatedAt: s.now, ID: uuid.New()} + + _, err := s.service.History(s.T().Context(), s.caller, s.chatID, foreign, domain.DefaultPageLimit) + s.Require().ErrorIs(err, domain.ErrInvalidCursor, + "контракт требует 400 на курсор от другого чата") +} + +func (s *ServiceSuite) TestHistoryAcceptsCursorOfSameChat() { + own := &domain.Cursor{Scope: s.chatID, CreatedAt: s.now, ID: uuid.New()} + + s.messages.EXPECT(). + ListVisible(s.T().Context(), s.chatID, s.caller, own, 7). + Return(domain.Page[domain.Message]{}, nil). + Once() + + _, err := s.service.History(s.T().Context(), s.caller, s.chatID, own, 7) + s.Require().NoError(err) +} + +func (s *ServiceSuite) TestHistoryPropagatesNotFoundForOutsider() { + s.messages.EXPECT(). + ListVisible(s.T().Context(), s.chatID, s.caller, (*domain.Cursor)(nil), domain.DefaultPageLimit). + Return(domain.Page[domain.Message]{}, domain.ErrNotFound). + Once() + + _, err := s.service.History(s.T().Context(), s.caller, s.chatID, nil, domain.DefaultPageLimit) + s.Require().ErrorIs(err, domain.ErrNotFound) +} + +func (s *ServiceSuite) TestHistoryWrapsRepositoryFailure() { + s.messages.EXPECT(). + ListVisible(s.T().Context(), s.chatID, s.caller, (*domain.Cursor)(nil), domain.DefaultPageLimit). + Return(domain.Page[domain.Message]{}, errRepository). + Once() + + _, err := s.service.History(s.T().Context(), s.caller, s.chatID, nil, domain.DefaultPageLimit) + s.Require().ErrorIs(err, errRepository) +} diff --git a/internal/service/session/mocks/Repository.go b/internal/service/session/mocks/Repository.go new file mode 100644 index 00000000..76925a5c --- /dev/null +++ b/internal/service/session/mocks/Repository.go @@ -0,0 +1,310 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRepository { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockRepository is an autogenerated mock type for the Repository type +type MockRepository struct { + mock.Mock +} + +type MockRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRepository) EXPECT() *MockRepository_Expecter { + return &MockRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockRepository +func (_mock *MockRepository) Create(ctx context.Context, session domain.NewSession) (domain.Session, error) { + ret := _mock.Called(ctx, session) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Session + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.NewSession) (domain.Session, error)); ok { + return returnFunc(ctx, session) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.NewSession) domain.Session); ok { + r0 = returnFunc(ctx, session) + } else { + r0 = ret.Get(0).(domain.Session) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.NewSession) error); ok { + r1 = returnFunc(ctx, session) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - session domain.NewSession +func (_e *MockRepository_Expecter) Create(ctx any, session any) *MockRepository_Create_Call { + return &MockRepository_Create_Call{Call: _e.mock.On("Create", ctx, session)} +} + +func (_c *MockRepository_Create_Call) Run(run func(ctx context.Context, session domain.NewSession)) *MockRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.NewSession + if args[1] != nil { + arg1 = args[1].(domain.NewSession) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_Create_Call) Return(session1 domain.Session, err error) *MockRepository_Create_Call { + _c.Call.Return(session1, err) + return _c +} + +func (_c *MockRepository_Create_Call) RunAndReturn(run func(ctx context.Context, session domain.NewSession) (domain.Session, error)) *MockRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// Credentials provides a mock function for the type MockRepository +func (_mock *MockRepository) Credentials(ctx context.Context, username string) (domain.UserCredentials, error) { + ret := _mock.Called(ctx, username) + + if len(ret) == 0 { + panic("no return value specified for Credentials") + } + + var r0 domain.UserCredentials + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) (domain.UserCredentials, error)); ok { + return returnFunc(ctx, username) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) domain.UserCredentials); ok { + r0 = returnFunc(ctx, username) + } else { + r0 = ret.Get(0).(domain.UserCredentials) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, username) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_Credentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Credentials' +type MockRepository_Credentials_Call struct { + *mock.Call +} + +// Credentials is a helper method to define mock.On call +// - ctx context.Context +// - username string +func (_e *MockRepository_Expecter) Credentials(ctx any, username any) *MockRepository_Credentials_Call { + return &MockRepository_Credentials_Call{Call: _e.mock.On("Credentials", ctx, username)} +} + +func (_c *MockRepository_Credentials_Call) Run(run func(ctx context.Context, username string)) *MockRepository_Credentials_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_Credentials_Call) Return(userCredentials domain.UserCredentials, err error) *MockRepository_Credentials_Call { + _c.Call.Return(userCredentials, err) + return _c +} + +func (_c *MockRepository_Credentials_Call) RunAndReturn(run func(ctx context.Context, username string) (domain.UserCredentials, error)) *MockRepository_Credentials_Call { + _c.Call.Return(run) + return _c +} + +// Resolve provides a mock function for the type MockRepository +func (_mock *MockRepository) Resolve(ctx context.Context, tokenHash []byte) (domain.Session, error) { + ret := _mock.Called(ctx, tokenHash) + + if len(ret) == 0 { + panic("no return value specified for Resolve") + } + + var r0 domain.Session + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, []byte) (domain.Session, error)); ok { + return returnFunc(ctx, tokenHash) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, []byte) domain.Session); ok { + r0 = returnFunc(ctx, tokenHash) + } else { + r0 = ret.Get(0).(domain.Session) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, []byte) error); ok { + r1 = returnFunc(ctx, tokenHash) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_Resolve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resolve' +type MockRepository_Resolve_Call struct { + *mock.Call +} + +// Resolve is a helper method to define mock.On call +// - ctx context.Context +// - tokenHash []byte +func (_e *MockRepository_Expecter) Resolve(ctx any, tokenHash any) *MockRepository_Resolve_Call { + return &MockRepository_Resolve_Call{Call: _e.mock.On("Resolve", ctx, tokenHash)} +} + +func (_c *MockRepository_Resolve_Call) Run(run func(ctx context.Context, tokenHash []byte)) *MockRepository_Resolve_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 []byte + if args[1] != nil { + arg1 = args[1].([]byte) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_Resolve_Call) Return(session domain.Session, err error) *MockRepository_Resolve_Call { + _c.Call.Return(session, err) + return _c +} + +func (_c *MockRepository_Resolve_Call) RunAndReturn(run func(ctx context.Context, tokenHash []byte) (domain.Session, error)) *MockRepository_Resolve_Call { + _c.Call.Return(run) + return _c +} + +// Revoke provides a mock function for the type MockRepository +func (_mock *MockRepository) Revoke(ctx context.Context, userID uuid.UUID, tokenHash []byte) error { + ret := _mock.Called(ctx, userID, tokenHash) + + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, []byte) error); ok { + r0 = returnFunc(ctx, userID, tokenHash) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockRepository_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke' +type MockRepository_Revoke_Call struct { + *mock.Call +} + +// Revoke is a helper method to define mock.On call +// - ctx context.Context +// - userID uuid.UUID +// - tokenHash []byte +func (_e *MockRepository_Expecter) Revoke(ctx any, userID any, tokenHash any) *MockRepository_Revoke_Call { + return &MockRepository_Revoke_Call{Call: _e.mock.On("Revoke", ctx, userID, tokenHash)} +} + +func (_c *MockRepository_Revoke_Call) Run(run func(ctx context.Context, userID uuid.UUID, tokenHash []byte)) *MockRepository_Revoke_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 []byte + if args[2] != nil { + arg2 = args[2].([]byte) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockRepository_Revoke_Call) Return(err error) *MockRepository_Revoke_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockRepository_Revoke_Call) RunAndReturn(run func(ctx context.Context, userID uuid.UUID, tokenHash []byte) error) *MockRepository_Revoke_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/service/session/mocks/Tokens.go b/internal/service/session/mocks/Tokens.go new file mode 100644 index 00000000..f5724a50 --- /dev/null +++ b/internal/service/session/mocks/Tokens.go @@ -0,0 +1,168 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockTokens creates a new instance of MockTokens. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockTokens(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTokens { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockTokens{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockTokens is an autogenerated mock type for the Tokens type +type MockTokens struct { + mock.Mock +} + +type MockTokens_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTokens) EXPECT() *MockTokens_Expecter { + return &MockTokens_Expecter{mock: &_m.Mock} +} + +// Generate provides a mock function for the type MockTokens +func (_mock *MockTokens) Generate() (string, []byte, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Generate") + } + + var r0 string + var r1 []byte + var r2 error + if returnFunc, ok := ret.Get(0).(func() (string, []byte, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + if returnFunc, ok := ret.Get(1).(func() []byte); ok { + r1 = returnFunc() + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).([]byte) + } + } + if returnFunc, ok := ret.Get(2).(func() error); ok { + r2 = returnFunc() + } else { + r2 = ret.Error(2) + } + return r0, r1, r2 +} + +// MockTokens_Generate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Generate' +type MockTokens_Generate_Call struct { + *mock.Call +} + +// Generate is a helper method to define mock.On call +func (_e *MockTokens_Expecter) Generate() *MockTokens_Generate_Call { + return &MockTokens_Generate_Call{Call: _e.mock.On("Generate")} +} + +func (_c *MockTokens_Generate_Call) Run(run func()) *MockTokens_Generate_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockTokens_Generate_Call) Return(s string, bytes []byte, err error) *MockTokens_Generate_Call { + _c.Call.Return(s, bytes, err) + return _c +} + +func (_c *MockTokens_Generate_Call) RunAndReturn(run func() (string, []byte, error)) *MockTokens_Generate_Call { + _c.Call.Return(run) + return _c +} + +// Hash provides a mock function for the type MockTokens +func (_mock *MockTokens) Hash(raw string) ([]byte, error) { + ret := _mock.Called(raw) + + if len(ret) == 0 { + panic("no return value specified for Hash") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) ([]byte, error)); ok { + return returnFunc(raw) + } + if returnFunc, ok := ret.Get(0).(func(string) []byte); ok { + r0 = returnFunc(raw) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(raw) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockTokens_Hash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Hash' +type MockTokens_Hash_Call struct { + *mock.Call +} + +// Hash is a helper method to define mock.On call +// - raw string +func (_e *MockTokens_Expecter) Hash(raw any) *MockTokens_Hash_Call { + return &MockTokens_Hash_Call{Call: _e.mock.On("Hash", raw)} +} + +func (_c *MockTokens_Hash_Call) Run(run func(raw string)) *MockTokens_Hash_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockTokens_Hash_Call) Return(bytes []byte, err error) *MockTokens_Hash_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockTokens_Hash_Call) RunAndReturn(run func(raw string) ([]byte, error)) *MockTokens_Hash_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/service/session/service.go b/internal/service/session/service.go new file mode 100644 index 00000000..6b57aba7 --- /dev/null +++ b/internal/service/session/service.go @@ -0,0 +1,95 @@ +package session + +import ( + "context" + "fmt" + "time" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/password" +) + +type Repository interface { + Credentials(ctx context.Context, username string) (domain.UserCredentials, error) + Create(ctx context.Context, session domain.NewSession) (domain.Session, error) + Resolve(ctx context.Context, tokenHash []byte) (domain.Session, error) + Revoke(ctx context.Context, userID uuid.UUID, tokenHash []byte) error +} + +type Tokens interface { + Generate() (string, []byte, error) + Hash(raw string) ([]byte, error) +} + +type Service struct { + sessions Repository + tokens Tokens + ttl time.Duration +} + +func NewService(sessions Repository, tokens Tokens, ttl time.Duration) *Service { + return &Service{sessions: sessions, tokens: tokens, ttl: ttl} +} + +func (s *Service) Authenticate(ctx context.Context, username, plain string) (domain.User, error) { + credentials, err := s.sessions.Credentials(ctx, username) + if err != nil { + return domain.User{}, fmt.Errorf("authenticate: %w", err) + } + + if !password.Verify(plain, credentials.PasswordHash) { + return domain.User{}, fmt.Errorf("authenticate: %w", domain.ErrUnauthenticated) + } + + return credentials.User, nil +} + +func (s *Service) Resolve(ctx context.Context, raw string) (domain.User, error) { + hash, err := s.tokens.Hash(raw) + if err != nil { + return domain.User{}, fmt.Errorf("resolve session: %w", domain.ErrUnauthenticated) + } + + session, err := s.sessions.Resolve(ctx, hash) + if err != nil { + return domain.User{}, fmt.Errorf("resolve session: %w", err) + } + + return session.User, nil +} + +func (s *Service) Create(ctx context.Context, user domain.User) (domain.Session, error) { + raw, hash, err := s.tokens.Generate() + if err != nil { + return domain.Session{}, fmt.Errorf("generate token: %w", err) + } + + session, err := s.sessions.Create(ctx, domain.NewSession{ + TokenHash: hash, + UserID: user.ID, + ExpiresAt: time.Now().UTC().Add(s.ttl), + }) + if err != nil { + return domain.Session{}, fmt.Errorf("create session: %w", err) + } + + session.Token = raw + session.User = user + + return session, nil +} + +func (s *Service) Revoke(ctx context.Context, userID uuid.UUID, raw string) error { + hash, err := s.tokens.Hash(raw) + if err != nil { + return fmt.Errorf("revoke session: %w", domain.ErrUnauthenticated) + } + + if err := s.sessions.Revoke(ctx, userID, hash); err != nil { + return fmt.Errorf("revoke session: %w", err) + } + + return nil +} diff --git a/internal/service/session/service_test.go b/internal/service/session/service_test.go new file mode 100644 index 00000000..8d062ccf --- /dev/null +++ b/internal/service/session/service_test.go @@ -0,0 +1,146 @@ +package session_test + +import ( + "bytes" + "errors" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/password" + "mtusi-messenger/internal/service/session" + "mtusi-messenger/internal/service/session/mocks" +) + +type ServiceSuite struct { + suite.Suite + + sessions *mocks.MockRepository + tokens *mocks.MockTokens + service *session.Service + ttl time.Duration + user domain.User +} + +func TestServiceSuite(t *testing.T) { + t.Parallel() + suite.Run(t, new(ServiceSuite)) +} + +func (s *ServiceSuite) SetupTest() { + s.sessions = mocks.NewMockRepository(s.T()) + s.tokens = mocks.NewMockTokens(s.T()) + s.ttl = time.Hour + s.service = session.NewService(s.sessions, s.tokens, s.ttl) + s.user = domain.User{ + ID: uuid.New(), + Username: "alice", + DisplayName: "Алиса", + CreatedAt: time.Now().UTC(), + } +} + +func (s *ServiceSuite) TestResolveHashesTokenBeforeStorage() { + hash := []byte("hashed-token") + stored := domain.Session{ExpiresAt: time.Now().Add(time.Hour), User: s.user} + + s.tokens.EXPECT().Hash("raw-token").Return(hash, nil).Once() + s.sessions.EXPECT().Resolve(mock.Anything, hash).Return(stored, nil).Once() + + got, err := s.service.Resolve(s.T().Context(), "raw-token") + s.Require().NoError(err) + s.Equal(s.user, got) +} + +func (s *ServiceSuite) TestResolveRejectsMalformedTokenWithoutStorage() { + s.tokens.EXPECT().Hash("garbage").Return(nil, errors.New("invalid token")).Once() + + _, err := s.service.Resolve(s.T().Context(), "garbage") + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} + +func (s *ServiceSuite) TestCreateGeneratesTokenAndReturnsIt() { + hash := []byte("hashed-token") + expiresAt := time.Now().Add(s.ttl) + + s.tokens.EXPECT().Generate().Return("raw-token", hash, nil).Once() + s.sessions.EXPECT(). + Create(mock.Anything, mock.MatchedBy(func(candidate domain.NewSession) bool { + return bytes.Equal(candidate.TokenHash, hash) && + candidate.UserID == s.user.ID && + candidate.ExpiresAt.After(time.Now()) + })). + Return(domain.Session{ExpiresAt: expiresAt}, nil). + Once() + + got, err := s.service.Create(s.T().Context(), s.user) + s.Require().NoError(err) + s.Equal("raw-token", got.Token) + s.Equal(s.user, got.User) + s.Equal(expiresAt, got.ExpiresAt) +} + +func (s *ServiceSuite) TestCreatePropagatesTokenGenerationError() { + s.tokens.EXPECT().Generate().Return("", nil, errors.New("no entropy")).Once() + + _, err := s.service.Create(s.T().Context(), s.user) + s.Require().Error(err) +} + +func (s *ServiceSuite) TestRevokeHashesTokenBeforeStorage() { + hash := []byte("hashed-token") + userID := uuid.New() + + s.tokens.EXPECT().Hash("raw-token").Return(hash, nil).Once() + s.sessions.EXPECT().Revoke(mock.Anything, userID, hash).Return(nil).Once() + + s.Require().NoError(s.service.Revoke(s.T().Context(), userID, "raw-token")) +} + +func (s *ServiceSuite) TestRevokeRejectsMalformedToken() { + s.tokens.EXPECT().Hash("garbage").Return(nil, errors.New("invalid token")).Once() + + err := s.service.Revoke(s.T().Context(), uuid.New(), "garbage") + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} + +func (s *ServiceSuite) TestAuthenticateVerifiesPassword() { + hash, err := password.Hash("secret-password-123") + s.Require().NoError(err) + + s.sessions.EXPECT(). + Credentials(mock.Anything, "alice"). + Return(domain.UserCredentials{User: s.user, PasswordHash: hash}, nil). + Once() + + got, err := s.service.Authenticate(s.T().Context(), "alice", "secret-password-123") + s.Require().NoError(err) + s.Equal(s.user, got) +} + +func (s *ServiceSuite) TestAuthenticateRejectsWrongPassword() { + hash, err := password.Hash("secret-password-123") + s.Require().NoError(err) + + s.sessions.EXPECT(). + Credentials(mock.Anything, "alice"). + Return(domain.UserCredentials{User: s.user, PasswordHash: hash}, nil). + Once() + + _, err = s.service.Authenticate(s.T().Context(), "alice", "wrong-password-value") + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} + +func (s *ServiceSuite) TestAuthenticatePropagatesUnknownUser() { + s.sessions.EXPECT(). + Credentials(mock.Anything, "nobody"). + Return(domain.UserCredentials{}, domain.ErrUnauthenticated). + Once() + + _, err := s.service.Authenticate(s.T().Context(), "nobody", "secret-password-123") + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} diff --git a/internal/service/user/mocks/Repository.go b/internal/service/user/mocks/Repository.go new file mode 100644 index 00000000..96978d34 --- /dev/null +++ b/internal/service/user/mocks/Repository.go @@ -0,0 +1,181 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRepository { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockRepository is an autogenerated mock type for the Repository type +type MockRepository struct { + mock.Mock +} + +type MockRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRepository) EXPECT() *MockRepository_Expecter { + return &MockRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockRepository +func (_mock *MockRepository) Create(ctx context.Context, draft domain.NewUser) (domain.User, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.NewUser) (domain.User, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.NewUser) domain.User); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.NewUser) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.NewUser +func (_e *MockRepository_Expecter) Create(ctx any, draft any) *MockRepository_Create_Call { + return &MockRepository_Create_Call{Call: _e.mock.On("Create", ctx, draft)} +} + +func (_c *MockRepository_Create_Call) Run(run func(ctx context.Context, draft domain.NewUser)) *MockRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.NewUser + if args[1] != nil { + arg1 = args[1].(domain.NewUser) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_Create_Call) Return(user domain.User, err error) *MockRepository_Create_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockRepository_Create_Call) RunAndReturn(run func(ctx context.Context, draft domain.NewUser) (domain.User, error)) *MockRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// GetByID provides a mock function for the type MockRepository +func (_mock *MockRepository) GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) { + ret := _mock.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for GetByID") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) (domain.User, error)); ok { + return returnFunc(ctx, id) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) domain.User); ok { + r0 = returnFunc(ctx, id) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok { + r1 = returnFunc(ctx, id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockRepository_GetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByID' +type MockRepository_GetByID_Call struct { + *mock.Call +} + +// GetByID is a helper method to define mock.On call +// - ctx context.Context +// - id uuid.UUID +func (_e *MockRepository_Expecter) GetByID(ctx any, id any) *MockRepository_GetByID_Call { + return &MockRepository_GetByID_Call{Call: _e.mock.On("GetByID", ctx, id)} +} + +func (_c *MockRepository_GetByID_Call) Run(run func(ctx context.Context, id uuid.UUID)) *MockRepository_GetByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockRepository_GetByID_Call) Return(user domain.User, err error) *MockRepository_GetByID_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockRepository_GetByID_Call) RunAndReturn(run func(ctx context.Context, id uuid.UUID) (domain.User, error)) *MockRepository_GetByID_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/service/user/service.go b/internal/service/user/service.go new file mode 100644 index 00000000..57a0eb1b --- /dev/null +++ b/internal/service/user/service.go @@ -0,0 +1,55 @@ +package user + +import ( + "context" + "fmt" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/password" +) + +type Repository interface { + Create(ctx context.Context, draft domain.NewUser) (domain.User, error) + GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) +} + +type Service struct { + users Repository +} + +func NewService(users Repository) *Service { + return &Service{users: users} +} + +func (s *Service) Register(ctx context.Context, draft domain.UserDraft) (domain.User, error) { + if err := draft.Validate(); err != nil { + return domain.User{}, err + } + + hash, err := password.Hash(draft.Password) + if err != nil { + return domain.User{}, fmt.Errorf("hash password: %w", err) + } + + user, err := s.users.Create(ctx, domain.NewUser{ + Username: draft.Username, + DisplayName: draft.DisplayName, + PasswordHash: hash, + }) + if err != nil { + return domain.User{}, fmt.Errorf("create user: %w", err) + } + + return user, nil +} + +func (s *Service) GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) { + user, err := s.users.GetByID(ctx, id) + if err != nil { + return domain.User{}, fmt.Errorf("get user: %w", err) + } + + return user, nil +} diff --git a/internal/service/user/service_test.go b/internal/service/user/service_test.go new file mode 100644 index 00000000..f816e5b3 --- /dev/null +++ b/internal/service/user/service_test.go @@ -0,0 +1,104 @@ +package user_test + +import ( + "errors" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/service/user" + "mtusi-messenger/internal/service/user/mocks" +) + +var errRepository = errors.New("repository is unavailable") + +type ServiceSuite struct { + suite.Suite + + users *mocks.MockRepository + service *user.Service + now time.Time +} + +func TestServiceSuite(t *testing.T) { + t.Parallel() + suite.Run(t, new(ServiceSuite)) +} + +func (s *ServiceSuite) SetupTest() { + s.users = mocks.NewMockRepository(s.T()) + s.service = user.NewService(s.users) + s.now = time.Date(2026, 9, 1, 12, 0, 0, 0, time.UTC) +} + +func (s *ServiceSuite) TestRegisterHashesPasswordAndReturnsStoredUser() { + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: "very-secret-password"} + stored := domain.User{ + ID: uuid.New(), + Username: draft.Username, + DisplayName: draft.DisplayName, + CreatedAt: s.now, + } + + s.users.EXPECT(). + Create(s.T().Context(), mock.MatchedBy(func(candidate domain.NewUser) bool { + return candidate.Username == draft.Username && + candidate.DisplayName == draft.DisplayName && + candidate.PasswordHash != "" && + candidate.PasswordHash != draft.Password + })). + Return(stored, nil). + Once() + + got, err := s.service.Register(s.T().Context(), draft) + s.Require().NoError(err) + s.Equal(stored, got, "сервис отдаёт то, что присвоило хранилище") +} + +func (s *ServiceSuite) TestRegisterRejectsBlankDisplayNameWithoutRepositoryCall() { + draft := domain.UserDraft{Username: "alice", DisplayName: " ", Password: "very-secret-password"} + + _, err := s.service.Register(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrValidation) +} + +func (s *ServiceSuite) TestRegisterRejectsShortPasswordWithoutRepositoryCall() { + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: "too-short"} + + _, err := s.service.Register(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrValidation) +} + +func (s *ServiceSuite) TestRegisterPropagatesUsernameConflict() { + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: "very-secret-password"} + + s.users.EXPECT(). + Create(s.T().Context(), mock.Anything). + Return(domain.User{}, domain.ErrUsernameTaken). + Once() + + _, err := s.service.Register(s.T().Context(), draft) + s.Require().ErrorIs(err, domain.ErrUsernameTaken) +} + +func (s *ServiceSuite) TestGetByIDPropagatesNotFound() { + id := uuid.New() + + s.users.EXPECT().GetByID(s.T().Context(), id).Return(domain.User{}, domain.ErrNotFound).Once() + + _, err := s.service.GetByID(s.T().Context(), id) + s.Require().ErrorIs(err, domain.ErrNotFound) +} + +func (s *ServiceSuite) TestGetByIDWrapsRepositoryFailure() { + id := uuid.New() + + s.users.EXPECT().GetByID(s.T().Context(), id).Return(domain.User{}, errRepository).Once() + + _, err := s.service.GetByID(s.T().Context(), id) + s.Require().ErrorIs(err, errRepository) +} diff --git a/internal/storage/postgres/cache_latency_experiment_test.go b/internal/storage/postgres/cache_latency_experiment_test.go new file mode 100644 index 00000000..39858fd1 --- /dev/null +++ b/internal/storage/postgres/cache_latency_experiment_test.go @@ -0,0 +1,159 @@ +//go:build integration + +package postgres_test + +import ( + "context" + "fmt" + "sort" + "sync/atomic" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/cache" + storageredis "mtusi-messenger/internal/storage/redis" + "mtusi-messenger/internal/storage/redis/mocks" +) + +func TestCacheLatencyExperiment(t *testing.T) { + suite := new(BaseSuite) + suite.SetT(t) + suite.SetupTest() + defer suite.TearDownTest() + + ctx := context.Background() + redisConfig := cache.RedisConfig{ + Host: envOr("TEST_REDIS_HOST", "localhost"), + Port: envInt("TEST_REDIS_PORT", 6379), + Password: envOr("TEST_REDIS_PASSWORD", ""), + DB: envInt("TEST_REDIS_DB", 2), + DialTimeout: 5 * time.Second, + ReadTimeout: 3 * time.Second, + WriteTimeout: 3 * time.Second, + PoolSize: 5, + } + redisCache, err := cache.NewRedis(redisConfig) + require.NoError(t, err) + defer func() { _ = redisCache.Close() }() + + alice := suite.createUser("latency_alice") + for range 20 { + suite.createChat(alice) + } + + realChats := suite.store.Chats() + + var loads atomic.Int32 + + source := mocks.NewMockChatSource(t) + source.EXPECT().ListVersion(mock.Anything, mock.Anything).RunAndReturn( + func(ctx context.Context, userID uuid.UUID) (int64, error) { + return realChats.ListVersion(ctx, userID) + }).Maybe() + source.EXPECT().ListVisible(mock.Anything, mock.Anything, mock.Anything, mock.Anything). + RunAndReturn(func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error) { + loads.Add(1) + + return realChats.ListVisible(ctx, callerID, after, limit) + }).Maybe() + + for range 50 { + _, err := source.ListVisible(ctx, alice.ID, nil, 50) + require.NoError(t, err) + } + loads.Store(0) + baseline := measureLatency(ctx, t, source.ListVisible, &loads, alice.ID, 1000) + + distributed, err := cache.NewDistributed(redisCache, cache.DistributedConfig{}, nil) + require.NoError(t, err) + + cached := storageredis.NewChatRepository( + source, + distributed, + time.Minute, + nil, + ) + loads.Store(0) + cachedStats := measureCachedLatency(ctx, t, cached, alice.ID, 1000) + cachedStats.Loads = int(loads.Load()) + require.Equal(t, 1000, baseline.Loads) + require.Equal(t, 1, cachedStats.Loads) + + t.Logf("baseline: %s", formatLatency(baseline)) + t.Logf("redis cache: %s", formatLatency(cachedStats)) +} + +func measureLatency( + ctx context.Context, + t *testing.T, + list func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error), + loads *atomic.Int32, + callerID uuid.UUID, + requests int, +) latencyStats { + t.Helper() + values := make([]time.Duration, 0, requests) + for range requests { + started := time.Now() + _, err := list(ctx, callerID, nil, 50) + require.NoError(t, err) + values = append(values, time.Since(started)) + } + + return makeLatencyStats(values, int(loads.Load())) +} + +func measureCachedLatency( + ctx context.Context, + t *testing.T, + repository *storageredis.ChatRepository, + callerID uuid.UUID, + requests int, +) latencyStats { + t.Helper() + values := make([]time.Duration, 0, requests) + for range requests { + started := time.Now() + _, err := repository.ListVisible(ctx, callerID, nil, 50) + require.NoError(t, err) + values = append(values, time.Since(started)) + } + + return makeLatencyStats(values, 0) +} + +type latencyStats struct { + Requests int + Loads int + P50 time.Duration + P95 time.Duration + P99 time.Duration +} + +func makeLatencyStats(values []time.Duration, loads int) latencyStats { + sort.Slice(values, func(i, j int) bool { return values[i] < values[j] }) + percentile := func(percent int) time.Duration { + index := (len(values)*percent + 99) / 100 + if index > 0 { + index-- + } + return values[index] + } + + return latencyStats{ + Requests: len(values), Loads: loads, + P50: percentile(50), P95: percentile(95), P99: percentile(99), + } +} + +func formatLatency(value latencyStats) string { + return fmt.Sprintf( + "requests=%d source_loads=%d p50=%s p95=%s p99=%s", + value.Requests, value.Loads, value.P50, value.P95, value.P99, + ) +} diff --git a/internal/storage/postgres/cache_performance_experiment_test.go b/internal/storage/postgres/cache_performance_experiment_test.go new file mode 100644 index 00000000..c803fdd3 --- /dev/null +++ b/internal/storage/postgres/cache_performance_experiment_test.go @@ -0,0 +1,192 @@ +//go:build integration + +package postgres_test + +import ( + "context" + "fmt" + "sort" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/cache" + storageredis "mtusi-messenger/internal/storage/redis" + "mtusi-messenger/internal/storage/redis/mocks" +) + +func TestCachePerformanceExperiment(t *testing.T) { + suite := new(BaseSuite) + suite.SetT(t) + suite.SetupTest() + defer suite.TearDownTest() + + ctx := context.Background() + redisConfig := cache.RedisConfig{ + Host: envOr("TEST_REDIS_HOST", "localhost"), + Port: envInt("TEST_REDIS_PORT", 6379), + Password: envOr("TEST_REDIS_PASSWORD", ""), + DB: envInt("TEST_REDIS_DB", 2), + DialTimeout: 5 * time.Second, + ReadTimeout: 3 * time.Second, + WriteTimeout: 3 * time.Second, + PoolSize: 10, + } + redisCache, err := cache.NewRedis(redisConfig) + require.NoError(t, err) + defer func() { _ = redisCache.Close() }() + + alice := suite.createUser("perf_alice") + bob := suite.createUser("perf_bob") + carol := suite.createUser("perf_carol") + + for i := range 150 { + title := fmt.Sprintf("Chat %d with Alice", i+1) + members := []uuid.UUID{alice.ID} + if i%3 == 0 { + members = append(members, bob.ID) + } + if i%5 == 0 { + members = append(members, carol.ID) + } + _, err := suite.store.Chats().Create(ctx, domain.ChatDraft{ + Title: title, + MemberIDs: members, + }) + require.NoError(t, err) + } + + realChats := suite.store.Chats() + + var loads atomic.Int32 + + source := mocks.NewMockChatSource(t) + source.EXPECT().ListVersion(mock.Anything, mock.Anything).RunAndReturn( + func(ctx context.Context, userID uuid.UUID) (int64, error) { + return realChats.ListVersion(ctx, userID) + }).Maybe() + source.EXPECT().ListVisible(mock.Anything, mock.Anything, mock.Anything, mock.Anything). + RunAndReturn(func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error) { + loads.Add(1) + + return realChats.ListVisible(ctx, callerID, after, limit) + }).Maybe() + + distributed, err := cache.NewDistributed(redisCache, cache.DistributedConfig{}, nil) + require.NoError(t, err) + + cached := storageredis.NewChatRepository( + source, + distributed, + time.Minute, + nil, + ) + + baselineStats := benchmarkConcurrent(ctx, t, func(ctx context.Context) error { + _, err := source.ListVisible(ctx, alice.ID, nil, 50) + return err + }, 50, 200) + + baselineStats.SQLQueries = int(loads.Load()) + loads.Store(0) + cachedStats := benchmarkConcurrent(ctx, t, func(ctx context.Context) error { + _, err := cached.ListVisible(ctx, alice.ID, nil, 50) + return err + }, 50, 200) + + cachedStats.SQLQueries = int(loads.Load()) + loads.Store(0) + + _, err = cached.ListVisible(ctx, alice.ID, nil, 50) + require.NoError(t, err) + + cachedHotStats := benchmarkConcurrent(ctx, t, func(ctx context.Context) error { + _, err := cached.ListVisible(ctx, alice.ID, nil, 50) + return err + }, 50, 200) + cachedHotStats.SQLQueries = int(loads.Load()) + + t.Logf("baseline (no cache): %s", formatPerfStats(baselineStats)) + t.Logf("redis cache (cold): %s", formatPerfStats(cachedStats)) + t.Logf("redis cache (hot): %s", formatPerfStats(cachedHotStats)) +} + +type perfStats struct { + TotalRequests int + Concurrency int + SQLQueries int + Duration time.Duration + RPS float64 + P50 time.Duration + P95 time.Duration + P99 time.Duration +} + +func benchmarkConcurrent( + ctx context.Context, + t *testing.T, + operation func(context.Context) error, + concurrency int, + requestsPerWorker int, +) perfStats { + t.Helper() + + totalRequests := concurrency * requestsPerWorker + latencies := make([]time.Duration, totalRequests) + var wg sync.WaitGroup + var failures atomic.Int32 + started := time.Now() + + for worker := range concurrency { + wg.Add(1) + go func(workerID int) { + defer wg.Done() + offset := workerID * requestsPerWorker + for i := range requestsPerWorker { + reqStart := time.Now() + err := operation(ctx) + if err != nil { + failures.Add(1) + } + latencies[offset+i] = time.Since(reqStart) + } + }(worker) + } + + wg.Wait() + require.Zero(t, failures.Load(), "some requests failed") + duration := time.Since(started) + + sort.Slice(latencies, func(i, j int) bool { return latencies[i] < latencies[j] }) + percentile := func(p int) time.Duration { + index := (len(latencies)*p + 99) / 100 + if index > 0 { + index-- + } + return latencies[index] + } + + return perfStats{ + TotalRequests: totalRequests, + Concurrency: concurrency, + Duration: duration, + RPS: float64(totalRequests) / duration.Seconds(), + P50: percentile(50), + P95: percentile(95), + P99: percentile(99), + } +} + +func formatPerfStats(s perfStats) string { + return fmt.Sprintf( + "requests=%d concurrency=%d sql=%d duration=%s rps=%.0f p50=%s p95=%s p99=%s", + s.TotalRequests, s.Concurrency, s.SQLQueries, s.Duration.Round(time.Millisecond), + s.RPS, s.P50, s.P95, s.P99, + ) +} diff --git a/internal/storage/postgres/chat_repository.go b/internal/storage/postgres/chat_repository.go new file mode 100644 index 00000000..0cda071f --- /dev/null +++ b/internal/storage/postgres/chat_repository.go @@ -0,0 +1,162 @@ +package postgres + +import ( + "bytes" + "context" + "errors" + "fmt" + "slices" + "time" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/storage/postgres/internal/sqlcgen" +) + +type ChatRepository struct { + store *Store +} + +func (r *ChatRepository) Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + var created domain.Chat + + if err := r.store.RunInTx(ctx, func(queries *sqlcgen.Queries) error { + missing, err := queries.ListMissingUserIDs(ctx, draft.MemberIDs) + if err != nil { + return fmt.Errorf("check chat members: %w", mapError(err)) + } + + if len(missing) > 0 { + return domain.ErrUnknownMember + } + + row, err := queries.CreateChat(ctx, draft.Title) + if err != nil { + return fmt.Errorf("create chat: %w", mapError(err)) + } + + if err := queries.AddChatMembers(ctx, sqlcgen.AddChatMembersParams{ + ChatID: row.ID, + UserIds: draft.MemberIDs, + }); err != nil { + return fmt.Errorf("add chat members: %w", mapError(err)) + } + + if err := queries.BumpChatListVersions(ctx, sortedUnique(draft.MemberIDs)); err != nil { + return fmt.Errorf("bump chat list versions: %w", mapError(err)) + } + + created = mapChat(row.ID, row.Title, row.CreatedAt, draft.MemberIDs) + + return nil + }); err != nil { + return domain.Chat{}, err + } + + return created, nil +} + +func (r *ChatRepository) ListVersion(ctx context.Context, userID uuid.UUID) (int64, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + version, err := r.store.queries.GetChatListVersion(ctx, userID) + if err != nil { + return 0, fmt.Errorf("get chat list version: %w", mapError(err)) + } + + return version, nil +} + +func sortedUnique(ids []uuid.UUID) []uuid.UUID { + sorted := slices.Clone(ids) + slices.SortFunc(sorted, func(a, b uuid.UUID) int { + return bytes.Compare(a[:], b[:]) + }) + + return slices.Compact(sorted) +} + +func (r *ChatRepository) GetVisible(ctx context.Context, chatID, callerID uuid.UUID) (domain.Chat, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + row, err := r.store.queries.GetChatForMember(ctx, sqlcgen.GetChatForMemberParams{ + UserID: callerID, + ID: chatID, + }) + if err != nil { + mapped := mapError(err) + if errors.Is(mapped, domain.ErrNotFound) { + return domain.Chat{}, fmt.Errorf("%w: chat %s for user %s", domain.ErrNotFound, chatID, callerID) + } + + return domain.Chat{}, fmt.Errorf("get chat: %w", mapped) + } + + return mapChat(row.ID, row.Title, row.CreatedAt, row.MemberIds), nil +} + +func (r *ChatRepository) ListVisible( + ctx context.Context, + callerID uuid.UUID, + after *domain.Cursor, + limit int, +) (domain.Page[domain.Chat], error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + limit = clampLimit(limit) + fetch := int32(limit + 1) //nolint:gosec // limit is clamped to maxPageSize + + var rows []domain.Chat + + if after == nil { + pageRows, err := r.store.queries.ListChatsForMember(ctx, sqlcgen.ListChatsForMemberParams{ + UserID: callerID, + RowLimit: fetch, + }) + if err != nil { + return domain.Page[domain.Chat]{}, fmt.Errorf("list chats: %w", mapError(err)) + } + + rows = mapAll(pageRows, mapChatRow) + } else { + pageRows, err := r.store.queries.ListChatsForMemberAfter(ctx, sqlcgen.ListChatsForMemberAfterParams{ + UserID: callerID, + AfterCreatedAt: after.CreatedAt, + AfterID: after.ID, + RowLimit: fetch, + }) + if err != nil { + return domain.Page[domain.Chat]{}, fmt.Errorf("list chats: %w", mapError(err)) + } + + rows = mapAll(pageRows, mapChatRowAfter) + } + + return buildPage(rows, limit, func(chat domain.Chat) domain.Cursor { + return domain.Cursor{Scope: callerID, CreatedAt: chat.CreatedAt, ID: chat.ID} + }), nil +} + +func mapChatRow(row sqlcgen.ListChatsForMemberRow) domain.Chat { + return mapChat(row.ID, row.Title, row.CreatedAt, row.MemberIds) +} + +func mapChatRowAfter(row sqlcgen.ListChatsForMemberAfterRow) domain.Chat { + return mapChat(row.ID, row.Title, row.CreatedAt, row.MemberIds) +} + +func mapChat(id uuid.UUID, title string, createdAt time.Time, memberIDs []uuid.UUID) domain.Chat { + return domain.Chat{ + ID: id, + Title: title, + MemberIDs: memberIDs, + CreatedAt: toUTCTime(createdAt), + } +} diff --git a/internal/storage/postgres/chat_repository_test.go b/internal/storage/postgres/chat_repository_test.go new file mode 100644 index 00000000..3f813459 --- /dev/null +++ b/internal/storage/postgres/chat_repository_test.go @@ -0,0 +1,239 @@ +//go:build integration + +package postgres_test + +import ( + "fmt" + "slices" + "sync" + "testing" + + "github.com/google/uuid" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" +) + +type ChatRepositorySuite struct { + BaseSuite +} + +func TestChatRepositorySuite(t *testing.T) { + suite.Run(t, new(ChatRepositorySuite)) +} + +func (s *ChatRepositorySuite) TestCreateRejectsUnknownMemberAtomically() { + alice := s.createUser("alice") + + _, err := s.store.Chats().Create(s.T().Context(), domain.ChatDraft{ + Title: "С неизвестным участником", + MemberIDs: []uuid.UUID{alice.ID, uuid.New()}, + CallerID: alice.ID, + }) + s.Require().ErrorIs(err, domain.ErrUnknownMember) + + var chats int + s.Require().NoError(s.pool.QueryRow(s.T().Context(), "SELECT count(*) FROM chats").Scan(&chats)) + s.Zero(chats, "неуспешное создание чата не оставляет строк") + + var members int + s.Require().NoError(s.pool.QueryRow(s.T().Context(), "SELECT count(*) FROM chat_members").Scan(&members)) + s.Zero(members) +} + +func (s *ChatRepositorySuite) TestCreateRejectsDuplicateMembers() { + alice := s.createUser("alice") + + _, err := s.store.Chats().Create(s.T().Context(), domain.ChatDraft{ + Title: "Дубликаты", + MemberIDs: []uuid.UUID{alice.ID, alice.ID}, + CallerID: alice.ID, + }) + s.Require().ErrorIs(err, domain.ErrConflict) +} + +func (s *ChatRepositorySuite) TestCreateBumpsMemberListVersions() { + ctx := s.T().Context() + alice := s.createUser("alice") + bob := s.createUser("bob") + carol := s.createUser("carol") + + s.createChat(alice, bob) + + aliceVersion, err := s.store.Chats().ListVersion(ctx, alice.ID) + s.Require().NoError(err) + s.Equal(int64(1), aliceVersion, "creator version must be bumped") + + bobVersion, err := s.store.Chats().ListVersion(ctx, bob.ID) + s.Require().NoError(err) + s.Equal(int64(1), bobVersion, "member version must be bumped") + + carolVersion, err := s.store.Chats().ListVersion(ctx, carol.ID) + s.Require().NoError(err) + s.Zero(carolVersion, "non-member version must stay unchanged") + + s.createChat(alice, carol) + + aliceVersion, err = s.store.Chats().ListVersion(ctx, alice.ID) + s.Require().NoError(err) + s.Equal(int64(2), aliceVersion, "version must grow monotonically") + + carolVersion, err = s.store.Chats().ListVersion(ctx, carol.ID) + s.Require().NoError(err) + s.Equal(int64(1), carolVersion) +} + +func (s *ChatRepositorySuite) TestConcurrentCreateNoDeadlock() { + ctx := s.T().Context() + + users := make([]domain.User, 0, 8) + for i := range 8 { + users = append(users, s.createUser(fmt.Sprintf("member%d", i))) + } + + const workers = 16 + + var wg sync.WaitGroup + + errs := make(chan error, workers) + + wg.Add(workers) + + for w := range workers { + go func(w int) { + defer wg.Done() + + ids := []uuid.UUID{ + users[w%len(users)].ID, + users[(w+1)%len(users)].ID, + users[(w+2)%len(users)].ID, + } + if w%2 == 1 { + slices.Reverse(ids) + } + + _, err := s.store.Chats().Create(ctx, domain.ChatDraft{ + Title: fmt.Sprintf("chat-%d", w), + MemberIDs: ids, + CallerID: ids[0], + }) + if err != nil { + errs <- err + } + }(w) + } + + wg.Wait() + close(errs) + + for err := range errs { + s.Require().NoError(err) + } +} + +func (s *ChatRepositorySuite) TestCreateStoresAllMembers() { + alice := s.createUser("alice") + bob := s.createUser("bob") + eve := s.createUser("eve") + + chat := s.createChat(alice, bob, eve) + s.Equal(uuid.Version(7), chat.ID.Version()) + s.False(chat.CreatedAt.IsZero()) + + visible, err := s.store.Chats().GetVisible(s.T().Context(), chat.ID, bob.ID) + s.Require().NoError(err) + s.ElementsMatch([]uuid.UUID{alice.ID, bob.ID, eve.ID}, visible.MemberIDs) +} + +func (s *ChatRepositorySuite) TestVisibility() { + alice := s.createUser("alice") + bob := s.createUser("bob") + eve := s.createUser("eve") + + chat := s.createChat(alice, bob) + + visible, err := s.store.Chats().GetVisible(s.T().Context(), chat.ID, bob.ID) + s.Require().NoError(err) + s.Equal(chat.ID, visible.ID) + s.ElementsMatch([]uuid.UUID{alice.ID, bob.ID}, visible.MemberIDs) + + _, err = s.store.Chats().GetVisible(s.T().Context(), chat.ID, eve.ID) + s.Require().ErrorIs(err, domain.ErrNotFound) + + page, err := s.store.Chats().ListVisible(s.T().Context(), eve.ID, nil, 50) + s.Require().NoError(err) + s.Empty(page.Items) + + page, err = s.store.Chats().ListVisible(s.T().Context(), alice.ID, nil, 50) + s.Require().NoError(err) + s.Require().Len(page.Items, 1) + s.ElementsMatch([]uuid.UUID{alice.ID, bob.ID}, page.Items[0].MemberIDs) + s.Nil(page.Next) +} + +func (s *ChatRepositorySuite) TestListPagination() { + alice := s.createUser("alice") + + const total = 5 + for range total { + s.createChat(alice) + } + + seen := make(map[uuid.UUID]struct{}, total) + + var cursor *domain.Cursor + + for { + page, err := s.store.Chats().ListVisible(s.T().Context(), alice.ID, cursor, 2) + s.Require().NoError(err) + s.Require().NotEmpty(page.Items) + + for _, chat := range page.Items { + _, duplicate := seen[chat.ID] + s.Require().False(duplicate) + seen[chat.ID] = struct{}{} + } + + if page.Next == nil { + break + } + + cursor = page.Next + } + + s.Len(seen, total) +} + +func (s *ChatRepositorySuite) TestListPaginationWithSharedTimestamp() { + alice := s.createUser("alice") + + for range 5 { + s.createChat(alice) + } + + _, err := s.pool.Exec(s.T().Context(), "UPDATE chats SET created_at = '2026-01-01 00:00:00+00'") + s.Require().NoError(err) + + seen := make(map[uuid.UUID]struct{}, 5) + + var cursor *domain.Cursor + + for { + page, err := s.store.Chats().ListVisible(s.T().Context(), alice.ID, cursor, 2) + s.Require().NoError(err) + + for _, chat := range page.Items { + _, duplicate := seen[chat.ID] + s.Require().False(duplicate) + seen[chat.ID] = struct{}{} + } + + if page.Next == nil { + break + } + + cursor = page.Next + } + + s.Len(seen, 5) +} diff --git a/internal/storage/postgres/config.go b/internal/storage/postgres/config.go new file mode 100644 index 00000000..305b212e --- /dev/null +++ b/internal/storage/postgres/config.go @@ -0,0 +1,74 @@ +package postgres + +import ( + "errors" + "time" + + "mtusi-messenger/internal/config" +) + +const ( + defaultHost = "localhost" + defaultPort = 5432 + defaultDatabase = "messenger" + defaultUser = "messenger" + defaultSSLMode = "disable" + defaultMaxConns = int32(10) + defaultMinConns = int32(1) + defaultMaxConnLifetime = time.Hour + defaultMaxConnIdleTime = 30 * time.Minute + defaultConnectTimeout = 5 * time.Second + defaultQueryTimeout = 5 * time.Second +) + +func normalize(cfg config.Postgres) (config.Postgres, error) { + if cfg.Host == "" { + cfg.Host = defaultHost + } + + if cfg.Port == 0 { + cfg.Port = defaultPort + } + + if cfg.Database == "" { + cfg.Database = defaultDatabase + } + + if cfg.User == "" { + cfg.User = defaultUser + } + + if cfg.SSLMode == "" { + cfg.SSLMode = defaultSSLMode + } + + if cfg.MaxConns == 0 { + cfg.MaxConns = defaultMaxConns + } + + if cfg.MinConns == 0 { + cfg.MinConns = defaultMinConns + } + + if cfg.MaxConnLifetime == 0 { + cfg.MaxConnLifetime = defaultMaxConnLifetime + } + + if cfg.MaxConnIdleTime == 0 { + cfg.MaxConnIdleTime = defaultMaxConnIdleTime + } + + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = defaultConnectTimeout + } + + if cfg.QueryTimeout == 0 { + cfg.QueryTimeout = defaultQueryTimeout + } + + if cfg.MinConns > cfg.MaxConns { + return cfg, errors.New("postgres: min_conns must not exceed max_conns") + } + + return cfg, nil +} diff --git a/internal/storage/postgres/config_test.go b/internal/storage/postgres/config_test.go new file mode 100644 index 00000000..4461dd87 --- /dev/null +++ b/internal/storage/postgres/config_test.go @@ -0,0 +1,49 @@ +package postgres + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/config" +) + +func TestNormalizeAppliesDefaults(t *testing.T) { + cfg, err := normalize(config.Postgres{}) + require.NoError(t, err) + + require.Equal(t, "localhost", cfg.Host) + require.Equal(t, 5432, cfg.Port) + require.Equal(t, "messenger", cfg.Database) + require.Equal(t, "messenger", cfg.User) + require.Equal(t, "disable", cfg.SSLMode) + require.Equal(t, int32(10), cfg.MaxConns) + require.Equal(t, int32(1), cfg.MinConns) + require.Equal(t, time.Hour, cfg.MaxConnLifetime) + require.Equal(t, 5*time.Second, cfg.ConnectTimeout) +} + +func TestNormalizeKeepsProvidedValues(t *testing.T) { + cfg, err := normalize(config.Postgres{ + Host: "db", + Port: 6543, + Database: "app", + User: "app", + SSLMode: "require", + MaxConns: 7, + MinConns: 2, + }) + require.NoError(t, err) + + require.Equal(t, "db", cfg.Host) + require.Equal(t, 6543, cfg.Port) + require.Equal(t, "app", cfg.Database) + require.Equal(t, "require", cfg.SSLMode) + require.Equal(t, int32(7), cfg.MaxConns) +} + +func TestNormalizeRejectsMinGreaterThanMax(t *testing.T) { + _, err := normalize(config.Postgres{MinConns: 5, MaxConns: 2}) + require.Error(t, err) +} diff --git a/internal/storage/postgres/errors.go b/internal/storage/postgres/errors.go new file mode 100644 index 00000000..788e9293 --- /dev/null +++ b/internal/storage/postgres/errors.go @@ -0,0 +1,82 @@ +package postgres + +import ( + "context" + "errors" + "fmt" + "io" + "net" + "syscall" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" + + "mtusi-messenger/internal/domain" +) + +const ( + pgUniqueViolation = "23505" + pgForeignKeyViolation = "23503" + pgCheckViolation = "23514" +) + +func isUniqueViolation(err error) bool { + var pgErr *pgconn.PgError + + return errors.As(err, &pgErr) && pgErr.Code == pgUniqueViolation +} + +// isUnavailable reports whether err is a transport-level failure — the server is +// down, the connection dropped, or the pool/query deadline expired — rather than +// a statement-level error. Such failures are dependency outages, not caller errors. +func isUnavailable(err error) bool { + if err == nil { + return false + } + + var ( + connectErr *pgconn.ConnectError + netErr net.Error + ) + + return errors.As(err, &connectErr) || + errors.As(err, &netErr) || + errors.Is(err, context.DeadlineExceeded) || + errors.Is(err, syscall.ECONNREFUSED) || + errors.Is(err, syscall.ECONNRESET) || + errors.Is(err, syscall.EPIPE) || + errors.Is(err, io.EOF) || + errors.Is(err, io.ErrUnexpectedEOF) || + errors.Is(err, pgx.ErrTxClosed) || + errors.Is(err, pgx.ErrTxCommitRollback) +} + +func mapError(err error) error { + if err == nil { + return nil + } + + if errors.Is(err, pgx.ErrNoRows) { + return domain.ErrNotFound + } + + if pgErr, ok := errors.AsType[*pgconn.PgError](err); ok { + switch pgErr.Code { + case pgUniqueViolation: + return domain.ErrConflict + case pgForeignKeyViolation: + // Нарушение внешнего ключа означает ссылку на отсутствующую сущность: + // например, отправка сообщения в несуществующий чат или в чат, где + // отправителя нет. Для клиента это 404, а не 500. + return domain.ErrNotFound + case pgCheckViolation: + return domain.ErrValidation + } + } + + if isUnavailable(err) { + return fmt.Errorf("%w: %w", domain.ErrUnavailable, err) + } + + return err +} diff --git a/internal/storage/postgres/idempotency_test.go b/internal/storage/postgres/idempotency_test.go new file mode 100644 index 00000000..29ae9ada --- /dev/null +++ b/internal/storage/postgres/idempotency_test.go @@ -0,0 +1,183 @@ +//go:build integration + +package postgres_test + +import ( + "crypto/sha256" + "sync" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" +) + +type IdempotencySuite struct { + BaseSuite +} + +func TestIdempotencySuite(t *testing.T) { + suite.Run(t, new(IdempotencySuite)) +} + +func messageDraft(chat domain.Chat, sender domain.User, key, text string) domain.MessageDraft { + return domain.MessageDraft{ + ChatID: chat.ID, + SenderID: sender.ID, + Text: text, + Idempotency: domain.MessageIdempotency{ + Key: key, + RequestHash: sha256.Sum256([]byte(text)), + }, + } +} + +func (s *IdempotencySuite) history(chat domain.Chat, actor domain.User) []domain.Message { + s.T().Helper() + + page, err := s.store.Messages().ListVisible(s.T().Context(), chat.ID, actor.ID, nil, 100) + s.Require().NoError(err) + + return page.Items +} + +func (s *IdempotencySuite) TestReplayReturnsStoredMessage() { + alice := s.createUser("alice") + bob := s.createUser("bob") + chat := s.createChat(alice, bob) + draft := messageDraft(chat, alice, "key-1", "привет") + + created, err := s.store.Messages().Create(s.T().Context(), draft) + s.Require().NoError(err) + + replayed, err := s.store.Messages().Create(s.T().Context(), draft) + s.Require().NoError(err) + + s.Equal(created, replayed, "повтор с тем же ключом и payload возвращает исходное сообщение") + s.Len(s.history(chat, bob), 1, "повтор не создаёт дубль") +} + +func (s *IdempotencySuite) TestSameKeyWithAnotherPayloadConflicts() { + alice := s.createUser("alice") + bob := s.createUser("bob") + chat := s.createChat(alice, bob) + + created, err := s.store.Messages().Create(s.T().Context(), messageDraft(chat, alice, "key-1", "привет")) + s.Require().NoError(err) + + _, err = s.store.Messages().Create(s.T().Context(), messageDraft(chat, alice, "key-1", "другое")) + s.Require().ErrorIs(err, domain.ErrIdempotency) + + history := s.history(chat, bob) + s.Require().Len(history, 1, "конфликт не создаёт сообщение") + s.Equal(created.ID, history[0].ID, "исходное сообщение не изменено") +} + +func (s *IdempotencySuite) TestConcurrentReplaysCreateOneMessage() { + const callers = 8 + + alice := s.createUser("alice") + bob := s.createUser("bob") + chat := s.createChat(alice, bob) + draft := messageDraft(chat, alice, "key-concurrent", "конкурентный повтор") + + ctx := s.T().Context() + results := make([]domain.Message, callers) + errs := make([]error, callers) + + start := make(chan struct{}) + + var wg sync.WaitGroup + + for i := range callers { + wg.Add(1) + + go func() { + defer wg.Done() + + <-start + + results[i], errs[i] = s.store.Messages().Create(ctx, draft) + }() + } + + close(start) + wg.Wait() + + for i := range callers { + s.Require().NoError(errs[i], "caller %d", i) + s.Equal(results[0].ID, results[i].ID, "все одновременные повторы получают одно сообщение") + } + + s.Len(s.history(chat, bob), 1, "конкурентный повтор создаёт ровно одно сообщение") +} + +func (s *IdempotencySuite) TestKeyIsScopedToActorAndChat() { + alice := s.createUser("alice") + bob := s.createUser("bob") + carol := s.createUser("carol") + + first := s.createChat(alice, bob) + second := s.createChat(alice, carol) + + mine, err := s.store.Messages().Create(s.T().Context(), messageDraft(first, alice, "shared-key", "от Алисы")) + s.Require().NoError(err) + + byBob, err := s.store.Messages().Create(s.T().Context(), messageDraft(first, bob, "shared-key", "от Боба")) + s.Require().NoError(err) + + s.NotEqual(mine.ID, byBob.ID, "одинаковый ключ разных пользователей независим") + + another, err := s.store.Messages().Create(s.T().Context(), messageDraft(second, alice, "shared-key", "в другом чате")) + s.Require().NoError(err) + + s.NotEqual(mine.ID, another.ID, "одинаковый ключ в другом чате независим") +} + +func (s *IdempotencySuite) TestExpiredKeyIsReplaced() { + alice := s.createUser("alice") + bob := s.createUser("bob") + chat := s.createChat(alice, bob) + draft := messageDraft(chat, alice, "key-expiring", "первое") + + // Отрицательный TTL: записи идемпотентности истекают сразу. + expiring := openStoreWithTTL(s.T(), s.db, -time.Second, nil) + s.T().Cleanup(expiring.Close) + + created, err := expiring.Messages().Create(s.T().Context(), draft) + s.Require().NoError(err) + + replaced, err := expiring.Messages().Create(s.T().Context(), messageDraft(chat, alice, "key-expiring", "второе")) + s.Require().NoError(err, "истёкший ключ можно использовать с другим payload") + s.NotEqual(created.ID, replaced.ID) +} + +func (s *IdempotencySuite) TestClaimForMissingChatIsNotFound() { + alice := s.createUser("alice") + + // Чат не существует: claim ключа ссылается на chats(id), поэтому наружу + // должен уйти 404, а не 500 из-за нарушения внешнего ключа. + _, err := s.store.Messages().Create( + s.T().Context(), + messageDraft(domain.Chat{ID: uuid.New()}, alice, "key-1", "привет"), + ) + s.Require().ErrorIs(err, domain.ErrNotFound) +} + +func (s *IdempotencySuite) TestFailedAttemptLeavesNoClaim() { + alice := s.createUser("alice") + outsider := s.createUser("outsider") + chat := s.createChat(alice) + + _, err := s.store.Messages().Create(s.T().Context(), messageDraft(chat, outsider, "key-1", "привет")) + s.Require().ErrorIs(err, domain.ErrNotFound) + + var claims int + + s.Require().NoError( + s.pool.QueryRow(s.T().Context(), "SELECT count(*) FROM message_idempotency").Scan(&claims), + ) + s.Zero(claims, "отклонённая попытка не оставляет claim: транзакция откатывается целиком") +} diff --git a/internal/storage/postgres/internal/sqlcgen/chats.sql.go b/internal/storage/postgres/internal/sqlcgen/chats.sql.go new file mode 100644 index 00000000..cd2b5d33 --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/chats.sql.go @@ -0,0 +1,251 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: chats.sql + +package sqlcgen + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const addChatMembers = `-- name: AddChatMembers :exec +INSERT INTO chat_members (chat_id, user_id) +SELECT $1, members.member_id +FROM unnest($2::uuid[]) AS members(member_id) +` + +type AddChatMembersParams struct { + ChatID uuid.UUID + UserIds []uuid.UUID +} + +func (q *Queries) AddChatMembers(ctx context.Context, arg AddChatMembersParams) error { + _, err := q.db.Exec(ctx, addChatMembers, arg.ChatID, arg.UserIds) + return err +} + +const bumpChatListVersions = `-- name: BumpChatListVersions :exec +INSERT INTO user_chat_versions (user_id, version) +SELECT DISTINCT m, 1 +FROM unnest($1::uuid[]) AS m +ORDER BY m +ON CONFLICT (user_id) DO UPDATE SET version = user_chat_versions.version + 1 +` + +func (q *Queries) BumpChatListVersions(ctx context.Context, userIds []uuid.UUID) error { + _, err := q.db.Exec(ctx, bumpChatListVersions, userIds) + return err +} + +const createChat = `-- name: CreateChat :one +INSERT INTO chats (title) +VALUES ($1) +RETURNING id, title, created_at +` + +func (q *Queries) CreateChat(ctx context.Context, title string) (Chat, error) { + row := q.db.QueryRow(ctx, createChat, title) + var i Chat + err := row.Scan(&i.ID, &i.Title, &i.CreatedAt) + return i, err +} + +const getChatForMember = `-- name: GetChatForMember :one +SELECT + c.id, + c.title, + c.created_at, + ( + SELECT COALESCE(array_agg(m.user_id ORDER BY m.user_id), '{}') + FROM chat_members m + WHERE m.chat_id = c.id + )::uuid[] AS member_ids +FROM chats c +JOIN chat_members visible + ON visible.chat_id = c.id AND visible.user_id = $1 +WHERE c.id = $2 +` + +type GetChatForMemberParams struct { + UserID uuid.UUID + ID uuid.UUID +} + +type GetChatForMemberRow struct { + ID uuid.UUID + Title string + CreatedAt time.Time + MemberIds []uuid.UUID +} + +func (q *Queries) GetChatForMember(ctx context.Context, arg GetChatForMemberParams) (GetChatForMemberRow, error) { + row := q.db.QueryRow(ctx, getChatForMember, arg.UserID, arg.ID) + var i GetChatForMemberRow + err := row.Scan( + &i.ID, + &i.Title, + &i.CreatedAt, + &i.MemberIds, + ) + return i, err +} + +const getChatListVersion = `-- name: GetChatListVersion :one +SELECT COALESCE(MAX(version), 0)::bigint AS version +FROM user_chat_versions +WHERE user_id = $1 +` + +func (q *Queries) GetChatListVersion(ctx context.Context, userID uuid.UUID) (int64, error) { + row := q.db.QueryRow(ctx, getChatListVersion, userID) + var version int64 + err := row.Scan(&version) + return version, err +} + +const listChatsForMember = `-- name: ListChatsForMember :many +SELECT + c.id, + c.title, + c.created_at, + ( + SELECT COALESCE(array_agg(m.user_id ORDER BY m.user_id), '{}') + FROM chat_members m + WHERE m.chat_id = c.id + )::uuid[] AS member_ids +FROM chats c +JOIN chat_members visible ON visible.chat_id = c.id +WHERE visible.user_id = $1 +ORDER BY c.created_at, c.id +LIMIT $2 +` + +type ListChatsForMemberParams struct { + UserID uuid.UUID + RowLimit int32 +} + +type ListChatsForMemberRow struct { + ID uuid.UUID + Title string + CreatedAt time.Time + MemberIds []uuid.UUID +} + +func (q *Queries) ListChatsForMember(ctx context.Context, arg ListChatsForMemberParams) ([]ListChatsForMemberRow, error) { + rows, err := q.db.Query(ctx, listChatsForMember, arg.UserID, arg.RowLimit) + if err != nil { + return nil, err + } + defer rows.Close() + items := []ListChatsForMemberRow{} + for rows.Next() { + var i ListChatsForMemberRow + if err := rows.Scan( + &i.ID, + &i.Title, + &i.CreatedAt, + &i.MemberIds, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listChatsForMemberAfter = `-- name: ListChatsForMemberAfter :many +SELECT + c.id, + c.title, + c.created_at, + ( + SELECT COALESCE(array_agg(m.user_id ORDER BY m.user_id), '{}') + FROM chat_members m + WHERE m.chat_id = c.id + )::uuid[] AS member_ids +FROM chats c +JOIN chat_members visible ON visible.chat_id = c.id +WHERE visible.user_id = $1 + AND (c.created_at, c.id) > ($2::timestamptz, $3::uuid) +ORDER BY c.created_at, c.id +LIMIT $4 +` + +type ListChatsForMemberAfterParams struct { + UserID uuid.UUID + AfterCreatedAt time.Time + AfterID uuid.UUID + RowLimit int32 +} + +type ListChatsForMemberAfterRow struct { + ID uuid.UUID + Title string + CreatedAt time.Time + MemberIds []uuid.UUID +} + +func (q *Queries) ListChatsForMemberAfter(ctx context.Context, arg ListChatsForMemberAfterParams) ([]ListChatsForMemberAfterRow, error) { + rows, err := q.db.Query(ctx, listChatsForMemberAfter, + arg.UserID, + arg.AfterCreatedAt, + arg.AfterID, + arg.RowLimit, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []ListChatsForMemberAfterRow{} + for rows.Next() { + var i ListChatsForMemberAfterRow + if err := rows.Scan( + &i.ID, + &i.Title, + &i.CreatedAt, + &i.MemberIds, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listMissingUserIDs = `-- name: ListMissingUserIDs :many +SELECT input.id::uuid AS missing_id +FROM unnest($1::uuid[]) AS input(id) +LEFT JOIN users u ON u.id = input.id +WHERE u.id IS NULL +` + +func (q *Queries) ListMissingUserIDs(ctx context.Context, userIds []uuid.UUID) ([]uuid.UUID, error) { + rows, err := q.db.Query(ctx, listMissingUserIDs, userIds) + if err != nil { + return nil, err + } + defer rows.Close() + items := []uuid.UUID{} + for rows.Next() { + var missing_id uuid.UUID + if err := rows.Scan(&missing_id); err != nil { + return nil, err + } + items = append(items, missing_id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/storage/postgres/internal/sqlcgen/db.go b/internal/storage/postgres/internal/sqlcgen/db.go new file mode 100644 index 00000000..38811fcc --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package sqlcgen + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/storage/postgres/internal/sqlcgen/idempotency.sql.go b/internal/storage/postgres/internal/sqlcgen/idempotency.sql.go new file mode 100644 index 00000000..3aecb901 --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/idempotency.sql.go @@ -0,0 +1,128 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: idempotency.sql + +package sqlcgen + +import ( + "context" + "time" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" +) + +const claimMessageIdempotency = `-- name: ClaimMessageIdempotency :one +INSERT INTO message_idempotency (actor_id, chat_id, key, request_hash, expires_at) +VALUES ( + $1, + $2, + $3, + $4, + $5 +) +ON CONFLICT (actor_id, chat_id, key) DO UPDATE + SET request_hash = EXCLUDED.request_hash, + expires_at = EXCLUDED.expires_at, + message_id = NULL + WHERE message_idempotency.expires_at <= now() +RETURNING key +` + +type ClaimMessageIdempotencyParams struct { + ActorID uuid.UUID + ChatID uuid.UUID + Key string + RequestHash []byte + ExpiresAt time.Time +} + +// Claims the key for this actor/chat and returns whether this request owns it. +// A live record wins: the statement returns nothing and the caller replays the +// stored message. An expired record is replaced in place. +func (q *Queries) ClaimMessageIdempotency(ctx context.Context, arg ClaimMessageIdempotencyParams) (string, error) { + row := q.db.QueryRow(ctx, claimMessageIdempotency, + arg.ActorID, + arg.ChatID, + arg.Key, + arg.RequestHash, + arg.ExpiresAt, + ) + var key string + err := row.Scan(&key) + return key, err +} + +const completeMessageIdempotency = `-- name: CompleteMessageIdempotency :exec +UPDATE message_idempotency +SET message_id = $1 +WHERE actor_id = $2 + AND chat_id = $3 + AND key = $4 +` + +type CompleteMessageIdempotencyParams struct { + MessageID pgtype.UUID + ActorID uuid.UUID + ChatID uuid.UUID + Key string +} + +func (q *Queries) CompleteMessageIdempotency(ctx context.Context, arg CompleteMessageIdempotencyParams) error { + _, err := q.db.Exec(ctx, completeMessageIdempotency, + arg.MessageID, + arg.ActorID, + arg.ChatID, + arg.Key, + ) + return err +} + +const getMessageByID = `-- name: GetMessageByID :one +SELECT id, chat_id, sender_id, text, created_at +FROM messages +WHERE id = $1 +` + +func (q *Queries) GetMessageByID(ctx context.Context, id uuid.UUID) (Message, error) { + row := q.db.QueryRow(ctx, getMessageByID, id) + var i Message + err := row.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + ) + return i, err +} + +const getMessageIdempotency = `-- name: GetMessageIdempotency :one +SELECT message_id, request_hash +FROM message_idempotency +WHERE actor_id = $1 + AND chat_id = $2 + AND key = $3 +FOR UPDATE +` + +type GetMessageIdempotencyParams struct { + ActorID uuid.UUID + ChatID uuid.UUID + Key string +} + +type GetMessageIdempotencyRow struct { + MessageID pgtype.UUID + RequestHash []byte +} + +// Concurrent duplicates block here until the owner commits, then read the +// result it stored in the same transaction. +func (q *Queries) GetMessageIdempotency(ctx context.Context, arg GetMessageIdempotencyParams) (GetMessageIdempotencyRow, error) { + row := q.db.QueryRow(ctx, getMessageIdempotency, arg.ActorID, arg.ChatID, arg.Key) + var i GetMessageIdempotencyRow + err := row.Scan(&i.MessageID, &i.RequestHash) + return i, err +} diff --git a/internal/storage/postgres/internal/sqlcgen/messages.sql.go b/internal/storage/postgres/internal/sqlcgen/messages.sql.go new file mode 100644 index 00000000..43a25100 --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/messages.sql.go @@ -0,0 +1,160 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: messages.sql + +package sqlcgen + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const createMessage = `-- name: CreateMessage :one +INSERT INTO messages (chat_id, sender_id, text) +SELECT $1, $2, $3 +WHERE EXISTS ( + SELECT 1 + FROM chat_members + WHERE chat_id = $1 + AND user_id = $2 +) +RETURNING id, chat_id, sender_id, text, created_at +` + +type CreateMessageParams struct { + ChatID uuid.UUID + SenderID uuid.UUID + Text string +} + +func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (Message, error) { + row := q.db.QueryRow(ctx, createMessage, arg.ChatID, arg.SenderID, arg.Text) + var i Message + err := row.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + ) + return i, err +} + +const isChatMember = `-- name: IsChatMember :one +SELECT EXISTS ( + SELECT 1 + FROM chat_members + WHERE chat_id = $1 + AND user_id = $2 +) AS is_member +` + +type IsChatMemberParams struct { + ChatID uuid.UUID + UserID uuid.UUID +} + +func (q *Queries) IsChatMember(ctx context.Context, arg IsChatMemberParams) (bool, error) { + row := q.db.QueryRow(ctx, isChatMember, arg.ChatID, arg.UserID) + var is_member bool + err := row.Scan(&is_member) + return is_member, err +} + +const listMessagesForChat = `-- name: ListMessagesForChat :many +SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at +FROM messages m +JOIN chat_members cm + ON cm.chat_id = m.chat_id + AND cm.user_id = $1 +WHERE m.chat_id = $2 +ORDER BY m.created_at, m.id +LIMIT $3 +` + +type ListMessagesForChatParams struct { + CallerID uuid.UUID + ChatID uuid.UUID + RowLimit int32 +} + +func (q *Queries) ListMessagesForChat(ctx context.Context, arg ListMessagesForChatParams) ([]Message, error) { + rows, err := q.db.Query(ctx, listMessagesForChat, arg.CallerID, arg.ChatID, arg.RowLimit) + if err != nil { + return nil, err + } + defer rows.Close() + items := []Message{} + for rows.Next() { + var i Message + if err := rows.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listMessagesForChatAfter = `-- name: ListMessagesForChatAfter :many +SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at +FROM messages m +JOIN chat_members cm + ON cm.chat_id = m.chat_id + AND cm.user_id = $1 +WHERE m.chat_id = $2 + AND (m.created_at, m.id) > ($3::timestamptz, $4::uuid) +ORDER BY m.created_at, m.id +LIMIT $5 +` + +type ListMessagesForChatAfterParams struct { + CallerID uuid.UUID + ChatID uuid.UUID + AfterCreatedAt time.Time + AfterID uuid.UUID + RowLimit int32 +} + +func (q *Queries) ListMessagesForChatAfter(ctx context.Context, arg ListMessagesForChatAfterParams) ([]Message, error) { + rows, err := q.db.Query(ctx, listMessagesForChatAfter, + arg.CallerID, + arg.ChatID, + arg.AfterCreatedAt, + arg.AfterID, + arg.RowLimit, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []Message{} + for rows.Next() { + var i Message + if err := rows.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/storage/postgres/internal/sqlcgen/models.go b/internal/storage/postgres/internal/sqlcgen/models.go new file mode 100644 index 00000000..d9f11089 --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/models.go @@ -0,0 +1,62 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package sqlcgen + +import ( + "time" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" +) + +type Chat struct { + ID uuid.UUID + Title string + CreatedAt time.Time +} + +type ChatMember struct { + ChatID uuid.UUID + UserID uuid.UUID + CreatedAt time.Time +} + +type Message struct { + ID uuid.UUID + ChatID uuid.UUID + SenderID uuid.UUID + Text string + CreatedAt time.Time +} + +type MessageIdempotency struct { + ActorID uuid.UUID + ChatID uuid.UUID + Key string + RequestHash []byte + MessageID pgtype.UUID + CreatedAt time.Time + ExpiresAt time.Time +} + +type Session struct { + TokenHash []byte + UserID uuid.UUID + ExpiresAt time.Time + CreatedAt time.Time +} + +type User struct { + ID uuid.UUID + Username string + PasswordHash string + DisplayName string + CreatedAt time.Time +} + +type UserChatVersion struct { + UserID uuid.UUID + Version int64 +} diff --git a/internal/storage/postgres/internal/sqlcgen/sessions.sql.go b/internal/storage/postgres/internal/sqlcgen/sessions.sql.go new file mode 100644 index 00000000..fc20b002 --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/sessions.sql.go @@ -0,0 +1,83 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: sessions.sql + +package sqlcgen + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const createSession = `-- name: CreateSession :one +INSERT INTO sessions (token_hash, user_id, expires_at) +VALUES ($1, $2, $3) +RETURNING token_hash, user_id, expires_at +` + +type CreateSessionParams struct { + TokenHash []byte + UserID uuid.UUID + ExpiresAt time.Time +} + +type CreateSessionRow struct { + TokenHash []byte + UserID uuid.UUID + ExpiresAt time.Time +} + +func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (CreateSessionRow, error) { + row := q.db.QueryRow(ctx, createSession, arg.TokenHash, arg.UserID, arg.ExpiresAt) + var i CreateSessionRow + err := row.Scan(&i.TokenHash, &i.UserID, &i.ExpiresAt) + return i, err +} + +const deleteSession = `-- name: DeleteSession :exec +DELETE FROM sessions +WHERE token_hash = $1 + AND user_id = $2 +` + +type DeleteSessionParams struct { + TokenHash []byte + UserID uuid.UUID +} + +func (q *Queries) DeleteSession(ctx context.Context, arg DeleteSessionParams) error { + _, err := q.db.Exec(ctx, deleteSession, arg.TokenHash, arg.UserID) + return err +} + +const getSessionUser = `-- name: GetSessionUser :one +SELECT u.id, u.username, u.display_name, u.created_at, s.expires_at +FROM sessions s +JOIN users u ON u.id = s.user_id +WHERE s.token_hash = $1 + AND s.expires_at > now() +` + +type GetSessionUserRow struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time + ExpiresAt time.Time +} + +func (q *Queries) GetSessionUser(ctx context.Context, tokenHash []byte) (GetSessionUserRow, error) { + row := q.db.QueryRow(ctx, getSessionUser, tokenHash) + var i GetSessionUserRow + err := row.Scan( + &i.ID, + &i.Username, + &i.DisplayName, + &i.CreatedAt, + &i.ExpiresAt, + ) + return i, err +} diff --git a/internal/storage/postgres/internal/sqlcgen/users.sql.go b/internal/storage/postgres/internal/sqlcgen/users.sql.go new file mode 100644 index 00000000..fdbc1b61 --- /dev/null +++ b/internal/storage/postgres/internal/sqlcgen/users.sql.go @@ -0,0 +1,100 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: users.sql + +package sqlcgen + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const createUser = `-- name: CreateUser :one +INSERT INTO users (username, display_name, password_hash) +VALUES ($1, $2, $3) +RETURNING id, username, display_name, created_at, password_hash +` + +type CreateUserParams struct { + Username string + DisplayName string + PasswordHash string +} + +type CreateUserRow struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time + PasswordHash string +} + +func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error) { + row := q.db.QueryRow(ctx, createUser, arg.Username, arg.DisplayName, arg.PasswordHash) + var i CreateUserRow + err := row.Scan( + &i.ID, + &i.Username, + &i.DisplayName, + &i.CreatedAt, + &i.PasswordHash, + ) + return i, err +} + +const getUserByID = `-- name: GetUserByID :one +SELECT id, username, display_name, created_at, password_hash +FROM users +WHERE id = $1 +` + +type GetUserByIDRow struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time + PasswordHash string +} + +func (q *Queries) GetUserByID(ctx context.Context, id uuid.UUID) (GetUserByIDRow, error) { + row := q.db.QueryRow(ctx, getUserByID, id) + var i GetUserByIDRow + err := row.Scan( + &i.ID, + &i.Username, + &i.DisplayName, + &i.CreatedAt, + &i.PasswordHash, + ) + return i, err +} + +const getUserByUsername = `-- name: GetUserByUsername :one +SELECT id, username, display_name, created_at, password_hash +FROM users +WHERE username = $1 +` + +type GetUserByUsernameRow struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time + PasswordHash string +} + +func (q *Queries) GetUserByUsername(ctx context.Context, username string) (GetUserByUsernameRow, error) { + row := q.db.QueryRow(ctx, getUserByUsername, username) + var i GetUserByUsernameRow + err := row.Scan( + &i.ID, + &i.Username, + &i.DisplayName, + &i.CreatedAt, + &i.PasswordHash, + ) + return i, err +} diff --git a/internal/storage/postgres/main_test.go b/internal/storage/postgres/main_test.go new file mode 100644 index 00000000..324975cf --- /dev/null +++ b/internal/storage/postgres/main_test.go @@ -0,0 +1,291 @@ +//go:build integration + +package postgres_test + +import ( + "context" + "database/sql" + "fmt" + "os" + "strconv" + "strings" + "testing" + "time" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/pressly/goose/v3" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/config" + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/password" + "mtusi-messenger/internal/storage/postgres" + "mtusi-messenger/internal/storage/postgres/migrations" + + _ "github.com/jackc/pgx/v5/stdlib" +) + +const templateDB = "messenger_template" + +var adminPool *pgxpool.Pool + +func envOr(key, fallback string) string { + if value := os.Getenv(key); value != "" { + return value + } + + return fallback +} + +func envInt(key string, fallback int) int { + value := os.Getenv(key) + if value == "" { + return fallback + } + + parsed, err := strconv.Atoi(value) + if err != nil { + return fallback + } + + return parsed +} + +func testConfig() config.Postgres { + return config.Postgres{ + Host: envOr("TEST_POSTGRES_HOST", "localhost"), + Port: envInt("TEST_POSTGRES_PORT", 5432), + Database: envOr("TEST_POSTGRES_DATABASE", "messenger"), + User: envOr("TEST_POSTGRES_USER", "messenger"), + Password: envOr("TEST_POSTGRES_PASSWORD", "messenger"), + SSLMode: envOr("TEST_POSTGRES_SSL_MODE", "disable"), + MaxConns: 5, + MinConns: 1, + MaxConnLifetime: time.Hour, + MaxConnIdleTime: 30 * time.Minute, + ConnectTimeout: 5 * time.Second, + QueryTimeout: 5 * time.Second, + } +} + +func dsnFor(database string) string { + cfg := testConfig() + cfg.Database = database + + return cfg.DSN() +} + +func TestMain(m *testing.M) { + ctx := context.Background() + + var err error + + adminPool, err = pgxpool.New(ctx, dsnFor(testConfig().Database)) + if err != nil { + fmt.Fprintln(os.Stderr, "admin pool:", err) + os.Exit(1) + } + + if err := waitForDatabase(ctx, adminPool); err != nil { + fmt.Fprintln(os.Stderr, "database is not ready:", err) + os.Exit(1) + } + + if err := recreateTemplate(ctx); err != nil { + fmt.Fprintln(os.Stderr, "create template:", err) + os.Exit(1) + } + + code := m.Run() + + adminPool.Close() + os.Exit(code) +} + +func waitForDatabase(ctx context.Context, pool *pgxpool.Pool) error { + var lastErr error + + for range 60 { + err := pool.Ping(ctx) + if err == nil { + return nil + } + + lastErr = err + + time.Sleep(500 * time.Millisecond) + } + + return lastErr +} + +func adminExec(ctx context.Context, query string) error { + conn, err := adminPool.Acquire(ctx) + if err != nil { + return err + } + + defer conn.Release() + + _, err = conn.Conn().PgConn().Exec(ctx, query).ReadAll() + + return err +} + +const templateLockKey int64 = 0x6d657373656e6765 + +func withAdvisoryLock(ctx context.Context, shared bool, fn func() error) error { + conn, err := adminPool.Acquire(ctx) + if err != nil { + return err + } + + defer conn.Release() + + lock, unlock := "pg_advisory_lock", "pg_advisory_unlock" + if shared { + lock, unlock = "pg_advisory_lock_shared", "pg_advisory_unlock_shared" + } + + if _, err := conn.Exec(ctx, "SELECT "+lock+"($1)", templateLockKey); err != nil { + return err + } + + defer func() { _, _ = conn.Exec(context.WithoutCancel(ctx), "SELECT "+unlock+"($1)", templateLockKey) }() + + return fn() +} + +func recreateTemplate(ctx context.Context) error { + return withAdvisoryLock(ctx, false, func() error { + if err := adminExec(ctx, "DROP DATABASE IF EXISTS "+templateDB+" WITH (FORCE)"); err != nil { + return err + } + + if err := adminExec(ctx, "CREATE DATABASE "+templateDB); err != nil { + return err + } + + db, err := sql.Open("pgx", dsnFor(templateDB)) + if err != nil { + return err + } + + defer func() { _ = db.Close() }() + + if err := db.PingContext(ctx); err != nil { + return err + } + + goose.SetBaseFS(migrations.FS) + + if err := goose.SetDialect("postgres"); err != nil { + return err + } + + return goose.Up(db, ".") + }) +} + +type BaseSuite struct { + suite.Suite + + store *postgres.Store + pool *pgxpool.Pool + db string +} + +func (s *BaseSuite) SetupTest() { + ctx := s.T().Context() + s.db = "test_" + strings.ReplaceAll(uuid.NewString(), "-", "") + + s.Require().NoError(withAdvisoryLock(ctx, true, func() error { + return adminExec(ctx, "CREATE DATABASE "+s.db+" TEMPLATE "+templateDB) + })) + + var err error + + s.pool, err = pgxpool.New(ctx, dsnFor(s.db)) + s.Require().NoError(err) + + s.store = openStore(s.T(), s.db, nil) +} + +func (s *BaseSuite) TearDownTest() { + if s.store != nil { + s.store.Close() + } + + if s.pool != nil { + s.pool.Close() + } + + if s.db != "" { + s.Require().NoError(adminExec(s.T().Context(), "DROP DATABASE "+s.db+" WITH (FORCE)")) + } +} + +const testIdempotencyTTL = 24 * time.Hour + +func openStore(t *testing.T, database string, override func(*config.Postgres)) *postgres.Store { + t.Helper() + + return openStoreWithTTL(t, database, testIdempotencyTTL, override) +} + +func openStoreWithTTL( + t *testing.T, + database string, + idempotencyTTL time.Duration, + override func(*config.Postgres), +) *postgres.Store { + t.Helper() + + cfg := testConfig() + cfg.Database = database + + if override != nil { + override(&cfg) + } + + store, err := postgres.New(t.Context(), cfg, idempotencyTTL) + require.NoError(t, err) + + return store +} + +func (s *BaseSuite) createUser(username string) domain.User { + s.T().Helper() + + hash, err := password.Hash("strong-test-password") + s.Require().NoError(err) + + user, err := s.store.Users().Create(s.T().Context(), domain.NewUser{ + Username: username, + DisplayName: "Пользователь " + username, + PasswordHash: hash, + }) + s.Require().NoError(err) + + return user +} + +func (s *BaseSuite) createChat(owner domain.User, members ...domain.User) domain.Chat { + s.T().Helper() + + ids := []uuid.UUID{owner.ID} + for _, member := range members { + ids = append(ids, member.ID) + } + + chat, err := s.store.Chats().Create(s.T().Context(), domain.ChatDraft{ + Title: "Чат", + MemberIDs: ids, + CallerID: owner.ID, + }) + s.Require().NoError(err) + + return chat +} diff --git a/internal/storage/postgres/mapping.go b/internal/storage/postgres/mapping.go new file mode 100644 index 00000000..62bb7b37 --- /dev/null +++ b/internal/storage/postgres/mapping.go @@ -0,0 +1,21 @@ +package postgres + +import "time" + +func toUTCTime(t time.Time) time.Time { + if t.Location() == time.UTC { + return t + } + + return t.UTC() +} + +func mapAll[S, D any](rows []S, mapRow func(S) D) []D { + mapped := make([]D, 0, len(rows)) + + for _, row := range rows { + mapped = append(mapped, mapRow(row)) + } + + return mapped +} diff --git a/internal/storage/postgres/message_repository.go b/internal/storage/postgres/message_repository.go new file mode 100644 index 00000000..c2744823 --- /dev/null +++ b/internal/storage/postgres/message_repository.go @@ -0,0 +1,206 @@ +package postgres + +import ( + "bytes" + "context" + "errors" + "fmt" + "time" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/storage/postgres/internal/sqlcgen" +) + +type MessageRepository struct { + store *Store +} + +func (r *MessageRepository) Create(ctx context.Context, draft domain.MessageDraft) (domain.Message, error) { + var created domain.Message + + err := r.store.RunInTx(ctx, func(queries *sqlcgen.Queries) error { + message, err := createIdempotent(ctx, queries, draft, r.store.idempotencyTTL) + if err != nil { + return err + } + + created = message + + return nil + }) + if err != nil { + // mapError нужен и здесь: отказ BEGIN/COMMIT (недоступная БД, исчерпанный + // пул, истёкший контекст) обязан давать 503, а не 500. + return domain.Message{}, fmt.Errorf("create message: %w", mapError(err)) + } + + return created, nil +} + +// createIdempotent stores the message and its Idempotency-Key in one +// transaction: either both are committed or neither, so a replay never observes +// a claimed key whose message is missing. Claiming is a single statement, so +// concurrent duplicates with the same key wait for the winner and then replay +// the message it stored. +func createIdempotent( + ctx context.Context, + queries *sqlcgen.Queries, + draft domain.MessageDraft, + ttl time.Duration, +) (domain.Message, error) { + _, err := queries.ClaimMessageIdempotency(ctx, sqlcgen.ClaimMessageIdempotencyParams{ + ActorID: draft.SenderID, + ChatID: draft.ChatID, + Key: draft.Idempotency.Key, + RequestHash: draft.Idempotency.RequestHash[:], + ExpiresAt: time.Now().Add(ttl), + }) + + switch { + case errors.Is(err, pgx.ErrNoRows): // the key is still live: replay it + return replayIdempotent(ctx, queries, draft) + case err != nil: + return domain.Message{}, mapError(err) + default: + return createClaimed(ctx, queries, draft) + } +} + +func createClaimed(ctx context.Context, queries *sqlcgen.Queries, draft domain.MessageDraft) (domain.Message, error) { + row, err := queries.CreateMessage(ctx, sqlcgen.CreateMessageParams{ + ChatID: draft.ChatID, + SenderID: draft.SenderID, + Text: draft.Text, + }) + if err != nil { + return domain.Message{}, mapError(err) + } + + err = queries.CompleteMessageIdempotency(ctx, sqlcgen.CompleteMessageIdempotencyParams{ + MessageID: pgtype.UUID{Bytes: row.ID, Valid: true}, + ActorID: draft.SenderID, + ChatID: draft.ChatID, + Key: draft.Idempotency.Key, + }) + if err != nil { + return domain.Message{}, mapError(err) + } + + return mapMessage(row.ID, row.ChatID, row.SenderID, row.Text, row.CreatedAt), nil +} + +func replayIdempotent(ctx context.Context, queries *sqlcgen.Queries, draft domain.MessageDraft) (domain.Message, error) { + stored, err := queries.GetMessageIdempotency(ctx, sqlcgen.GetMessageIdempotencyParams{ + ActorID: draft.SenderID, + ChatID: draft.ChatID, + Key: draft.Idempotency.Key, + }) + if err != nil { + return domain.Message{}, mapError(err) + } + + if !bytes.Equal(stored.RequestHash, draft.Idempotency.RequestHash[:]) { + return domain.Message{}, domain.ErrIdempotency + } + + if !stored.MessageID.Valid { + return domain.Message{}, errors.New("idempotency record without a message") + } + + row, err := queries.GetMessageByID(ctx, uuid.UUID(stored.MessageID.Bytes)) + if err != nil { + return domain.Message{}, mapError(err) + } + + return mapMessage(row.ID, row.ChatID, row.SenderID, row.Text, row.CreatedAt), nil +} + +func (r *MessageRepository) ListVisible( + ctx context.Context, + chatID, callerID uuid.UUID, + after *domain.Cursor, + limit int, +) (domain.Page[domain.Message], error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + limit = clampLimit(limit) + fetch := int32(limit + 1) //nolint:gosec // limit is clamped to maxPageSize + + messages, err := r.fetch(ctx, chatID, callerID, after, fetch) + if err != nil { + return domain.Page[domain.Message]{}, err + } + + if len(messages) == 0 { + member, err := r.store.queries.IsChatMember(ctx, sqlcgen.IsChatMemberParams{ + ChatID: chatID, + UserID: callerID, + }) + if err != nil { + return domain.Page[domain.Message]{}, fmt.Errorf("check chat membership: %w", mapError(err)) + } + + if !member { + return domain.Page[domain.Message]{}, fmt.Errorf( + "%w: chat %s for user %s", + domain.ErrNotFound, chatID, callerID, + ) + } + } + + return buildPage(messages, limit, func(message domain.Message) domain.Cursor { + return domain.Cursor{Scope: chatID, CreatedAt: message.CreatedAt, ID: message.ID} + }), nil +} + +func (r *MessageRepository) fetch( + ctx context.Context, + chatID, callerID uuid.UUID, + after *domain.Cursor, + fetch int32, +) ([]domain.Message, error) { + if after == nil { + rows, err := r.store.queries.ListMessagesForChat(ctx, sqlcgen.ListMessagesForChatParams{ + ChatID: chatID, + CallerID: callerID, + RowLimit: fetch, + }) + if err != nil { + return nil, fmt.Errorf("list messages: %w", mapError(err)) + } + + return mapAll(rows, mapMessageRow), nil + } + + rows, err := r.store.queries.ListMessagesForChatAfter(ctx, sqlcgen.ListMessagesForChatAfterParams{ + ChatID: chatID, + CallerID: callerID, + AfterCreatedAt: after.CreatedAt, + AfterID: after.ID, + RowLimit: fetch, + }) + if err != nil { + return nil, fmt.Errorf("list messages: %w", mapError(err)) + } + + return mapAll(rows, mapMessageRow), nil +} + +func mapMessageRow(row sqlcgen.Message) domain.Message { + return mapMessage(row.ID, row.ChatID, row.SenderID, row.Text, row.CreatedAt) +} + +func mapMessage(id, chatID, senderID uuid.UUID, text string, createdAt time.Time) domain.Message { + return domain.Message{ + ID: id, + ChatID: chatID, + SenderID: senderID, + Text: text, + CreatedAt: toUTCTime(createdAt), + } +} diff --git a/internal/storage/postgres/message_repository_test.go b/internal/storage/postgres/message_repository_test.go new file mode 100644 index 00000000..73f4c288 --- /dev/null +++ b/internal/storage/postgres/message_repository_test.go @@ -0,0 +1,161 @@ +//go:build integration + +package postgres_test + +import ( + "crypto/sha256" + "fmt" + "sync" + "testing" + + "github.com/google/uuid" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" +) + +type MessageRepositorySuite struct { + BaseSuite +} + +func TestMessageRepositorySuite(t *testing.T) { + suite.Run(t, new(MessageRepositorySuite)) +} + +// draft builds a message draft with a fresh Idempotency-Key (lab3 contract). +func (s *MessageRepositorySuite) draft(chatID, senderID uuid.UUID, text string) domain.MessageDraft { + s.T().Helper() + + key := uuid.NewString() + + return domain.MessageDraft{ + ChatID: chatID, + SenderID: senderID, + Text: text, + Idempotency: domain.MessageIdempotency{ + Key: key, + RequestHash: sha256.Sum256([]byte(key + text)), + }, + } +} + +func (s *MessageRepositorySuite) TestCreateAndPagination() { + alice := s.createUser("alice") + bob := s.createUser("bob") + + chat := s.createChat(alice, bob) + + const total = 5 + for i := range total { + message, err := s.store.Messages().Create(s.T().Context(), s.draft(chat.ID, alice.ID, fmt.Sprintf("сообщение %d", i))) + s.Require().NoError(err) + s.Equal(uuid.Version(7), message.ID.Version()) + s.False(message.CreatedAt.IsZero()) + } + + seen := make(map[uuid.UUID]struct{}, total) + + var cursor *domain.Cursor + + for { + page, err := s.store.Messages().ListVisible(s.T().Context(), chat.ID, alice.ID, cursor, 2) + s.Require().NoError(err) + s.Require().NotEmpty(page.Items) + + for _, message := range page.Items { + _, duplicate := seen[message.ID] + s.Require().False(duplicate, "keyset-пагинация не повторяет сообщения") + seen[message.ID] = struct{}{} + } + + if page.Next == nil { + break + } + + cursor = page.Next + } + + s.Len(seen, total) +} + +func (s *MessageRepositorySuite) TestPaginationWithSharedTimestamp() { + alice := s.createUser("alice") + chat := s.createChat(alice) + + for range 5 { + _, err := s.store.Messages().Create(s.T().Context(), s.draft(chat.ID, alice.ID, "same timestamp")) + s.Require().NoError(err) + } + + _, err := s.pool.Exec(s.T().Context(), "UPDATE messages SET created_at = '2026-01-01 00:00:00+00'") + s.Require().NoError(err) + + seen := make(map[uuid.UUID]struct{}, 5) + + var cursor *domain.Cursor + + for { + page, err := s.store.Messages().ListVisible(s.T().Context(), chat.ID, alice.ID, cursor, 2) + s.Require().NoError(err) + + for _, message := range page.Items { + _, duplicate := seen[message.ID] + s.Require().False(duplicate) + seen[message.ID] = struct{}{} + } + + if page.Next == nil { + break + } + + cursor = page.Next + } + + s.Len(seen, 5) +} + +func (s *MessageRepositorySuite) TestAccessIsRestricted() { + alice := s.createUser("alice") + bob := s.createUser("bob") + + chat := s.createChat(alice) + + _, err := s.store.Messages().Create(s.T().Context(), s.draft(chat.ID, bob.ID, "чужое")) + s.Require().ErrorIs(err, domain.ErrNotFound, "не участник не может писать в чат") + + _, err = s.store.Messages().ListVisible(s.T().Context(), chat.ID, bob.ID, nil, 50) + s.Require().ErrorIs(err, domain.ErrNotFound, "не участник не может читать историю") +} + +func (s *MessageRepositorySuite) TestListingForMissingChatReturnsNotFound() { + alice := s.createUser("alice") + + _, err := s.store.Messages().ListVisible(s.T().Context(), uuid.New(), alice.ID, nil, 50) + s.Require().ErrorIs(err, domain.ErrNotFound) +} + +func (s *MessageRepositorySuite) TestFinishedMessageSurvivesConcurrentReads() { + alice := s.createUser("alice") + chat := s.createChat(alice) + + const total = 20 + + var wg sync.WaitGroup + + wg.Go(func() { + for i := range total { + _, err := s.store.Messages().Create(s.T().Context(), s.draft(chat.ID, alice.ID, fmt.Sprintf("message %d", i))) + if err != nil { + return + } + } + }) + + for range total { + page, err := s.store.Messages().ListVisible(s.T().Context(), chat.ID, alice.ID, nil, 100) + s.Require().NoError(err) + s.LessOrEqual(len(page.Items), total) + } + + wg.Wait() +} diff --git a/internal/storage/postgres/migrations/00001_init.sql b/internal/storage/postgres/migrations/00001_init.sql new file mode 100644 index 00000000..09282415 --- /dev/null +++ b/internal/storage/postgres/migrations/00001_init.sql @@ -0,0 +1,71 @@ +-- +goose Up + +CREATE TABLE users ( + id uuid PRIMARY KEY DEFAULT uuidv7(), + username text NOT NULL, + password_hash text NOT NULL, + display_name text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now(), + + CONSTRAINT users_username_key UNIQUE (username), + CONSTRAINT users_username_format CHECK (username ~ '^[a-z0-9_]{3,32}$'), + CONSTRAINT users_display_name_not_blank CHECK (btrim(display_name) <> ''), + CONSTRAINT users_display_name_length CHECK (char_length(display_name) BETWEEN 1 AND 100) +); + +CREATE TABLE chats ( + id uuid PRIMARY KEY DEFAULT uuidv7(), + title text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now(), + CONSTRAINT chats_title_not_blank CHECK (btrim(title) <> '') +); + +CREATE TABLE chat_members ( + chat_id uuid NOT NULL REFERENCES chats (id) ON DELETE CASCADE, + user_id uuid NOT NULL REFERENCES users (id) ON DELETE RESTRICT, + created_at timestamptz NOT NULL DEFAULT now(), + PRIMARY KEY (chat_id, user_id) +); + +CREATE TABLE messages ( + id uuid PRIMARY KEY DEFAULT uuidv7(), + chat_id uuid NOT NULL REFERENCES chats (id) ON DELETE CASCADE, + sender_id uuid NOT NULL REFERENCES users (id) ON DELETE RESTRICT, + text text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now(), + CONSTRAINT messages_text_not_blank CHECK (btrim(text) <> ''), + CONSTRAINT messages_text_length CHECK (char_length(text) <= 4000) +); + +CREATE TABLE sessions ( + token_hash bytea PRIMARY KEY, + user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE, + expires_at timestamptz NOT NULL, + created_at timestamptz NOT NULL DEFAULT now() +); + +CREATE TABLE user_chat_versions ( + user_id uuid PRIMARY KEY REFERENCES users (id) ON DELETE CASCADE, + version bigint NOT NULL DEFAULT 0 +); + +CREATE INDEX messages_chat_id_created_at_id_idx + ON messages (chat_id, created_at, id); + +CREATE INDEX chat_members_user_id_chat_id_idx + ON chat_members (user_id, chat_id); + +CREATE INDEX chats_created_at_id_idx + ON chats (created_at, id); + +CREATE INDEX sessions_user_id_idx + ON sessions (user_id); + +-- +goose Down + +DROP TABLE sessions; +DROP TABLE messages; +DROP TABLE chat_members; +DROP TABLE chats; +DROP TABLE users; +DROP TABLE user_chat_versions; diff --git a/internal/storage/postgres/migrations/00003_message_idempotency.sql b/internal/storage/postgres/migrations/00003_message_idempotency.sql new file mode 100644 index 00000000..b1facb51 --- /dev/null +++ b/internal/storage/postgres/migrations/00003_message_idempotency.sql @@ -0,0 +1,25 @@ +-- +goose Up +-- Версия 3, а не 2: в базе, перенесённой из лабораторной 2, goose уже содержит +-- запись версии 2 (другая миграция того же репозитория), и одноимённый номер был +-- бы молча пропущен при обновлении существующего стенда до ЛР3. + +CREATE TABLE message_idempotency ( + actor_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE, + chat_id uuid NOT NULL REFERENCES chats (id) ON DELETE CASCADE, + key text NOT NULL, + request_hash bytea NOT NULL, + message_id uuid REFERENCES messages (id) ON DELETE CASCADE, + created_at timestamptz NOT NULL DEFAULT now(), + expires_at timestamptz NOT NULL, + + PRIMARY KEY (actor_id, chat_id, key), + CONSTRAINT message_idempotency_key_length CHECK (char_length(key) BETWEEN 1 AND 128) +); + +-- Expired records are replaced lazily by a new claim, the index keeps that +-- lookup and a future sweep cheap. +CREATE INDEX message_idempotency_expires_at_idx ON message_idempotency (expires_at); + +-- +goose Down + +DROP TABLE message_idempotency; diff --git a/internal/storage/postgres/migrations/migrations.go b/internal/storage/postgres/migrations/migrations.go new file mode 100644 index 00000000..91cca1c3 --- /dev/null +++ b/internal/storage/postgres/migrations/migrations.go @@ -0,0 +1,6 @@ +package migrations + +import "embed" + +//go:embed *.sql +var FS embed.FS diff --git a/internal/storage/postgres/pagination.go b/internal/storage/postgres/pagination.go new file mode 100644 index 00000000..63d54df2 --- /dev/null +++ b/internal/storage/postgres/pagination.go @@ -0,0 +1,25 @@ +package postgres + +import "mtusi-messenger/internal/domain" + +const ( + minPageSize = 1 + maxPageSize = 100 +) + +func clampLimit(limit int) int { + return min(max(limit, minPageSize), maxPageSize) +} + +func buildPage[T any](items []T, limit int, cursor func(item T) domain.Cursor) domain.Page[T] { + if len(items) > limit { + next := cursor(items[limit-1]) + + return domain.Page[T]{ + Items: append([]T(nil), items[:limit]...), + Next: &next, + } + } + + return domain.Page[T]{Items: append([]T(nil), items...)} +} diff --git a/internal/storage/postgres/queries/chats.sql b/internal/storage/postgres/queries/chats.sql new file mode 100644 index 00000000..d404ef7d --- /dev/null +++ b/internal/storage/postgres/queries/chats.sql @@ -0,0 +1,75 @@ +-- name: CreateChat :one +INSERT INTO chats (title) +VALUES (sqlc.arg(title)) +RETURNING id, title, created_at; + +-- name: AddChatMembers :exec +INSERT INTO chat_members (chat_id, user_id) +SELECT sqlc.arg(chat_id), members.member_id +FROM unnest(sqlc.arg(user_ids)::uuid[]) AS members(member_id); + +-- name: ListMissingUserIDs :many +SELECT input.id::uuid AS missing_id +FROM unnest(sqlc.arg(user_ids)::uuid[]) AS input(id) +LEFT JOIN users u ON u.id = input.id +WHERE u.id IS NULL; + +-- name: BumpChatListVersions :exec +INSERT INTO user_chat_versions (user_id, version) +SELECT DISTINCT m, 1 +FROM unnest(sqlc.arg(user_ids)::uuid[]) AS m +ORDER BY m +ON CONFLICT (user_id) DO UPDATE SET version = user_chat_versions.version + 1; + +-- name: GetChatListVersion :one +SELECT COALESCE(MAX(version), 0)::bigint AS version +FROM user_chat_versions +WHERE user_id = sqlc.arg(user_id); + +-- name: GetChatForMember :one +SELECT + c.id, + c.title, + c.created_at, + ( + SELECT COALESCE(array_agg(m.user_id ORDER BY m.user_id), '{}') + FROM chat_members m + WHERE m.chat_id = c.id + )::uuid[] AS member_ids +FROM chats c +JOIN chat_members visible + ON visible.chat_id = c.id AND visible.user_id = sqlc.arg(user_id) +WHERE c.id = sqlc.arg(id); + +-- name: ListChatsForMember :many +SELECT + c.id, + c.title, + c.created_at, + ( + SELECT COALESCE(array_agg(m.user_id ORDER BY m.user_id), '{}') + FROM chat_members m + WHERE m.chat_id = c.id + )::uuid[] AS member_ids +FROM chats c +JOIN chat_members visible ON visible.chat_id = c.id +WHERE visible.user_id = sqlc.arg(user_id) +ORDER BY c.created_at, c.id +LIMIT sqlc.arg(row_limit); + +-- name: ListChatsForMemberAfter :many +SELECT + c.id, + c.title, + c.created_at, + ( + SELECT COALESCE(array_agg(m.user_id ORDER BY m.user_id), '{}') + FROM chat_members m + WHERE m.chat_id = c.id + )::uuid[] AS member_ids +FROM chats c +JOIN chat_members visible ON visible.chat_id = c.id +WHERE visible.user_id = sqlc.arg(user_id) + AND (c.created_at, c.id) > (sqlc.arg(after_created_at)::timestamptz, sqlc.arg(after_id)::uuid) +ORDER BY c.created_at, c.id +LIMIT sqlc.arg(row_limit); diff --git a/internal/storage/postgres/queries/idempotency.sql b/internal/storage/postgres/queries/idempotency.sql new file mode 100644 index 00000000..14f911e7 --- /dev/null +++ b/internal/storage/postgres/queries/idempotency.sql @@ -0,0 +1,40 @@ +-- Claims the key for this actor/chat and returns whether this request owns it. +-- A live record wins: the statement returns nothing and the caller replays the +-- stored message. An expired record is replaced in place. +-- name: ClaimMessageIdempotency :one +INSERT INTO message_idempotency (actor_id, chat_id, key, request_hash, expires_at) +VALUES ( + sqlc.arg(actor_id), + sqlc.arg(chat_id), + sqlc.arg(key), + sqlc.arg(request_hash), + sqlc.arg(expires_at) +) +ON CONFLICT (actor_id, chat_id, key) DO UPDATE + SET request_hash = EXCLUDED.request_hash, + expires_at = EXCLUDED.expires_at, + message_id = NULL + WHERE message_idempotency.expires_at <= now() +RETURNING key; + +-- Concurrent duplicates block here until the owner commits, then read the +-- result it stored in the same transaction. +-- name: GetMessageIdempotency :one +SELECT message_id, request_hash +FROM message_idempotency +WHERE actor_id = sqlc.arg(actor_id) + AND chat_id = sqlc.arg(chat_id) + AND key = sqlc.arg(key) +FOR UPDATE; + +-- name: CompleteMessageIdempotency :exec +UPDATE message_idempotency +SET message_id = sqlc.arg(message_id) +WHERE actor_id = sqlc.arg(actor_id) + AND chat_id = sqlc.arg(chat_id) + AND key = sqlc.arg(key); + +-- name: GetMessageByID :one +SELECT id, chat_id, sender_id, text, created_at +FROM messages +WHERE id = sqlc.arg(id); diff --git a/internal/storage/postgres/queries/messages.sql b/internal/storage/postgres/queries/messages.sql new file mode 100644 index 00000000..90e804dd --- /dev/null +++ b/internal/storage/postgres/queries/messages.sql @@ -0,0 +1,39 @@ +-- name: CreateMessage :one +INSERT INTO messages (chat_id, sender_id, text) +SELECT sqlc.arg(chat_id), sqlc.arg(sender_id), sqlc.arg(text) +WHERE EXISTS ( + SELECT 1 + FROM chat_members + WHERE chat_id = sqlc.arg(chat_id) + AND user_id = sqlc.arg(sender_id) +) +RETURNING id, chat_id, sender_id, text, created_at; + +-- name: IsChatMember :one +SELECT EXISTS ( + SELECT 1 + FROM chat_members + WHERE chat_id = sqlc.arg(chat_id) + AND user_id = sqlc.arg(user_id) +) AS is_member; + +-- name: ListMessagesForChat :many +SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at +FROM messages m +JOIN chat_members cm + ON cm.chat_id = m.chat_id + AND cm.user_id = sqlc.arg(caller_id) +WHERE m.chat_id = sqlc.arg(chat_id) +ORDER BY m.created_at, m.id +LIMIT sqlc.arg(row_limit); + +-- name: ListMessagesForChatAfter :many +SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at +FROM messages m +JOIN chat_members cm + ON cm.chat_id = m.chat_id + AND cm.user_id = sqlc.arg(caller_id) +WHERE m.chat_id = sqlc.arg(chat_id) + AND (m.created_at, m.id) > (sqlc.arg(after_created_at)::timestamptz, sqlc.arg(after_id)::uuid) +ORDER BY m.created_at, m.id +LIMIT sqlc.arg(row_limit); diff --git a/internal/storage/postgres/queries/sessions.sql b/internal/storage/postgres/queries/sessions.sql new file mode 100644 index 00000000..a5564ee3 --- /dev/null +++ b/internal/storage/postgres/queries/sessions.sql @@ -0,0 +1,16 @@ +-- name: CreateSession :one +INSERT INTO sessions (token_hash, user_id, expires_at) +VALUES (sqlc.arg(token_hash), sqlc.arg(user_id), sqlc.arg(expires_at)) +RETURNING token_hash, user_id, expires_at; + +-- name: GetSessionUser :one +SELECT u.id, u.username, u.display_name, u.created_at, s.expires_at +FROM sessions s +JOIN users u ON u.id = s.user_id +WHERE s.token_hash = sqlc.arg(token_hash) + AND s.expires_at > now(); + +-- name: DeleteSession :exec +DELETE FROM sessions +WHERE token_hash = sqlc.arg(token_hash) + AND user_id = sqlc.arg(user_id); diff --git a/internal/storage/postgres/queries/users.sql b/internal/storage/postgres/queries/users.sql new file mode 100644 index 00000000..24e2b507 --- /dev/null +++ b/internal/storage/postgres/queries/users.sql @@ -0,0 +1,14 @@ +-- name: CreateUser :one +INSERT INTO users (username, display_name, password_hash) +VALUES (sqlc.arg(username), sqlc.arg(display_name), sqlc.arg(password_hash)) +RETURNING id, username, display_name, created_at, password_hash; + +-- name: GetUserByID :one +SELECT id, username, display_name, created_at, password_hash +FROM users +WHERE id = sqlc.arg(id); + +-- name: GetUserByUsername :one +SELECT id, username, display_name, created_at, password_hash +FROM users +WHERE username = sqlc.arg(username); diff --git a/internal/storage/postgres/session_repository.go b/internal/storage/postgres/session_repository.go new file mode 100644 index 00000000..e695b6a0 --- /dev/null +++ b/internal/storage/postgres/session_repository.go @@ -0,0 +1,94 @@ +package postgres + +import ( + "context" + "errors" + "fmt" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/storage/postgres/internal/sqlcgen" +) + +type SessionRepository struct { + store *Store +} + +func (r *SessionRepository) Credentials(ctx context.Context, username string) (domain.UserCredentials, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + row, err := r.store.queries.GetUserByUsername(ctx, username) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return domain.UserCredentials{}, fmt.Errorf("%w: username %q", domain.ErrUnauthenticated, username) + } + + return domain.UserCredentials{}, fmt.Errorf("load credentials: %w", mapError(err)) + } + + return domain.UserCredentials{ + User: domain.User{ + ID: row.ID, + Username: row.Username, + DisplayName: row.DisplayName, + CreatedAt: toUTCTime(row.CreatedAt), + }, + PasswordHash: row.PasswordHash, + }, nil +} + +func (r *SessionRepository) Create(ctx context.Context, session domain.NewSession) (domain.Session, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + row, err := r.store.queries.CreateSession(ctx, sqlcgen.CreateSessionParams{ + TokenHash: session.TokenHash, + UserID: session.UserID, + ExpiresAt: session.ExpiresAt, + }) + if err != nil { + return domain.Session{}, fmt.Errorf("create session: %w", mapError(err)) + } + + return domain.Session{ExpiresAt: toUTCTime(row.ExpiresAt)}, nil +} + +func (r *SessionRepository) Resolve(ctx context.Context, tokenHash []byte) (domain.Session, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + row, err := r.store.queries.GetSessionUser(ctx, tokenHash) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return domain.Session{}, fmt.Errorf("%w: session not found or expired", domain.ErrUnauthenticated) + } + + return domain.Session{}, fmt.Errorf("resolve session: %w", mapError(err)) + } + + return domain.Session{ + ExpiresAt: toUTCTime(row.ExpiresAt), + User: domain.User{ + ID: row.ID, + Username: row.Username, + DisplayName: row.DisplayName, + CreatedAt: toUTCTime(row.CreatedAt), + }, + }, nil +} + +func (r *SessionRepository) Revoke(ctx context.Context, userID uuid.UUID, tokenHash []byte) error { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + if err := r.store.queries.DeleteSession( + ctx, sqlcgen.DeleteSessionParams{TokenHash: tokenHash, UserID: userID}, + ); err != nil { + return fmt.Errorf("revoke session: %w", mapError(err)) + } + + return nil +} diff --git a/internal/storage/postgres/session_repository_test.go b/internal/storage/postgres/session_repository_test.go new file mode 100644 index 00000000..1057c69d --- /dev/null +++ b/internal/storage/postgres/session_repository_test.go @@ -0,0 +1,81 @@ +//go:build integration + +package postgres_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/password" + "mtusi-messenger/internal/platform/token" +) + +type SessionRepositorySuite struct { + BaseSuite +} + +func TestSessionRepositorySuite(t *testing.T) { + suite.Run(t, new(SessionRepositorySuite)) +} + +func (s *SessionRepositorySuite) TestCredentials() { + alice := s.createUser("alice") + + credentials, err := s.store.Sessions().Credentials(s.T().Context(), "alice") + s.Require().NoError(err) + s.Equal(alice.ID, credentials.User.ID) + s.True(password.Verify("strong-test-password", credentials.PasswordHash)) + s.False(password.Verify("wrong-password-value", credentials.PasswordHash)) +} + +func (s *SessionRepositorySuite) TestCredentialsUnknownUser() { + _, err := s.store.Sessions().Credentials(s.T().Context(), "nobody") + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} + +func (s *SessionRepositorySuite) TestCreateResolveRevoke() { + alice := s.createUser("alice") + + _, hash, err := token.New().Generate() + s.Require().NoError(err) + + expiresAt := time.Now().UTC().Add(time.Hour).Truncate(time.Microsecond) + + created, err := s.store.Sessions().Create(s.T().Context(), domain.NewSession{ + TokenHash: hash, + UserID: alice.ID, + ExpiresAt: expiresAt, + }) + s.Require().NoError(err) + s.Equal(expiresAt, created.ExpiresAt) + + resolved, err := s.store.Sessions().Resolve(s.T().Context(), hash) + s.Require().NoError(err) + s.Equal(alice.ID, resolved.User.ID) + s.Equal(created.ExpiresAt, resolved.ExpiresAt) + + s.Require().NoError(s.store.Sessions().Revoke(s.T().Context(), alice.ID, hash)) + + _, err = s.store.Sessions().Resolve(s.T().Context(), hash) + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} + +func (s *SessionRepositorySuite) TestResolveRejectsExpiredToken() { + alice := s.createUser("alice") + + _, hash, err := token.New().Generate() + s.Require().NoError(err) + + _, err = s.store.Sessions().Create(s.T().Context(), domain.NewSession{ + TokenHash: hash, + UserID: alice.ID, + ExpiresAt: time.Now().UTC().Add(-time.Minute), + }) + s.Require().NoError(err) + + _, err = s.store.Sessions().Resolve(s.T().Context(), hash) + s.Require().ErrorIs(err, domain.ErrUnauthenticated) +} diff --git a/internal/storage/postgres/store.go b/internal/storage/postgres/store.go new file mode 100644 index 00000000..35aff1ea --- /dev/null +++ b/internal/storage/postgres/store.go @@ -0,0 +1,96 @@ +package postgres + +import ( + "context" + "fmt" + "time" + + "github.com/jackc/pgx/v5/pgxpool" + + "mtusi-messenger/internal/config" + "mtusi-messenger/internal/storage/postgres/internal/sqlcgen" +) + +type Store struct { + pool *pgxpool.Pool + queries *sqlcgen.Queries + queryTimeout time.Duration + idempotencyTTL time.Duration + + users *UserRepository + chats *ChatRepository + messages *MessageRepository + sessions *SessionRepository +} + +func New(ctx context.Context, cfg config.Postgres, idempotencyTTL time.Duration) (*Store, error) { + cfg, err := normalize(cfg) + if err != nil { + return nil, fmt.Errorf("normalize database config: %w", err) + } + + poolCfg, err := pgxpool.ParseConfig(cfg.DSN()) + if err != nil { + return nil, fmt.Errorf("parse database dsn: %w", err) + } + + poolCfg.MaxConns = cfg.MaxConns + poolCfg.MinConns = cfg.MinConns + poolCfg.MaxConnLifetime = cfg.MaxConnLifetime + poolCfg.MaxConnIdleTime = cfg.MaxConnIdleTime + poolCfg.ConnConfig.ConnectTimeout = cfg.ConnectTimeout + + pool, err := pgxpool.NewWithConfig(ctx, poolCfg) + if err != nil { + return nil, fmt.Errorf("create pool: %w", err) + } + + pingCtx, cancel := context.WithTimeout(ctx, cfg.ConnectTimeout) + defer cancel() + + if err := pool.Ping(pingCtx); err != nil { + pool.Close() + + return nil, fmt.Errorf("ping database: %w", err) + } + + store := &Store{ + pool: pool, + queries: sqlcgen.New(pool), + queryTimeout: cfg.QueryTimeout, + idempotencyTTL: idempotencyTTL, + } + + store.users = &UserRepository{store: store} + store.chats = &ChatRepository{store: store} + store.messages = &MessageRepository{store: store} + store.sessions = &SessionRepository{store: store} + + return store, nil +} + +func (s *Store) Users() *UserRepository { return s.users } + +func (s *Store) Chats() *ChatRepository { return s.chats } + +func (s *Store) Messages() *MessageRepository { return s.messages } + +func (s *Store) Sessions() *SessionRepository { return s.sessions } + +func (s *Store) Ping(ctx context.Context) error { + if err := s.pool.Ping(ctx); err != nil { + return fmt.Errorf("ping database: %w", err) + } + + return nil +} + +func (s *Store) Close() { s.pool.Close() } + +func (s *Store) timeout(ctx context.Context) (context.Context, context.CancelFunc) { + if s.queryTimeout <= 0 { + return context.WithCancel(ctx) + } + + return context.WithTimeout(ctx, s.queryTimeout) +} diff --git a/internal/storage/postgres/transaction.go b/internal/storage/postgres/transaction.go new file mode 100644 index 00000000..ab8fb5dc --- /dev/null +++ b/internal/storage/postgres/transaction.go @@ -0,0 +1,32 @@ +package postgres + +import ( + "context" + "fmt" + + "github.com/jackc/pgx/v5" + + "mtusi-messenger/internal/storage/postgres/internal/sqlcgen" +) + +func (s *Store) RunInTx(ctx context.Context, fn func(queries *sqlcgen.Queries) error) error { + ctx, cancel := s.timeout(ctx) + defer cancel() + + tx, err := s.pool.BeginTx(ctx, pgx.TxOptions{}) + if err != nil { + return fmt.Errorf("begin transaction: %w", err) + } + + defer func() { _ = tx.Rollback(ctx) }() + + if err := fn(s.queries.WithTx(tx)); err != nil { + return err + } + + if err := tx.Commit(ctx); err != nil { + return fmt.Errorf("commit transaction: %w", err) + } + + return nil +} diff --git a/internal/storage/postgres/user_repository.go b/internal/storage/postgres/user_repository.go new file mode 100644 index 00000000..c9e6e98b --- /dev/null +++ b/internal/storage/postgres/user_repository.go @@ -0,0 +1,63 @@ +package postgres + +import ( + "context" + "errors" + "fmt" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/storage/postgres/internal/sqlcgen" +) + +type UserRepository struct { + store *Store +} + +func (r *UserRepository) Create(ctx context.Context, draft domain.NewUser) (domain.User, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + row, err := r.store.queries.CreateUser(ctx, sqlcgen.CreateUserParams{ + Username: draft.Username, + DisplayName: draft.DisplayName, + PasswordHash: draft.PasswordHash, + }) + if err != nil { + if isUniqueViolation(err) { + return domain.User{}, fmt.Errorf("%w: username %q", domain.ErrUsernameTaken, draft.Username) + } + + return domain.User{}, fmt.Errorf("create user: %w", mapError(err)) + } + + return domain.User{ + ID: row.ID, + Username: row.Username, + DisplayName: row.DisplayName, + CreatedAt: toUTCTime(row.CreatedAt), + }, nil +} + +func (r *UserRepository) GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) { + ctx, cancel := r.store.timeout(ctx) + defer cancel() + + row, err := r.store.queries.GetUserByID(ctx, id) + if err != nil { + mapped := mapError(err) + if errors.Is(mapped, domain.ErrNotFound) { + return domain.User{}, fmt.Errorf("%w: user %s", domain.ErrNotFound, id) + } + + return domain.User{}, fmt.Errorf("get user: %w", mapped) + } + + return domain.User{ + ID: row.ID, + Username: row.Username, + DisplayName: row.DisplayName, + CreatedAt: toUTCTime(row.CreatedAt), + }, nil +} diff --git a/internal/storage/postgres/user_repository_test.go b/internal/storage/postgres/user_repository_test.go new file mode 100644 index 00000000..4ceb276f --- /dev/null +++ b/internal/storage/postgres/user_repository_test.go @@ -0,0 +1,114 @@ +//go:build integration + +package postgres_test + +import ( + "errors" + "sync" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/config" + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/password" +) + +type UserRepositorySuite struct { + BaseSuite +} + +func TestUserRepositorySuite(t *testing.T) { + suite.Run(t, new(UserRepositorySuite)) +} + +func (s *UserRepositorySuite) TestCreateAndLookup() { + created := s.createUser("alice") + s.NotEqual(uuid.Nil, created.ID) + s.Equal(uuid.Version(7), created.ID.Version()) + s.Equal("alice", created.Username) + s.False(created.CreatedAt.IsZero()) + + found, err := s.store.Users().GetByID(s.T().Context(), created.ID) + s.Require().NoError(err) + s.Equal(created, found) + + _, err = s.store.Users().GetByID(s.T().Context(), uuid.New()) + s.Require().ErrorIs(err, domain.ErrNotFound) +} + +func (s *UserRepositorySuite) TestDuplicateUsernameConflicts() { + s.createUser("alice") + + hash, err := password.Hash("strong-test-password") + s.Require().NoError(err) + + _, err = s.store.Users().Create(s.T().Context(), domain.NewUser{ + Username: "alice", + DisplayName: "Другая Алиса", + PasswordHash: hash, + }) + s.Require().ErrorIs(err, domain.ErrUsernameTaken) +} + +func (s *UserRepositorySuite) TestConcurrentRegistrationCreatesSingleUser() { + hash, err := password.Hash("strong-test-password") + s.Require().NoError(err) + + const attempts = 8 + + var ( + wg sync.WaitGroup + mu sync.Mutex + successes int + failures []error + ) + + for range attempts { + wg.Go(func() { + _, err := s.store.Users().Create(s.T().Context(), domain.NewUser{ + Username: "racer", + DisplayName: "Racer", + PasswordHash: hash, + }) + + mu.Lock() + defer mu.Unlock() + + if err == nil { + successes++ + + return + } + + failures = append(failures, err) + }) + } + + wg.Wait() + + s.Equal(1, successes, "ровно одна регистрация выигрывает гонку") + s.Len(failures, attempts-1) + + for _, failure := range failures { + ok := errors.Is(failure, domain.ErrUsernameTaken) || errors.Is(failure, domain.ErrConflict) + s.True(ok, "проигравшая регистрация должна давать конфликт, получено: %v", failure) + } + + var count int + s.Require().NoError(s.pool.QueryRow(s.T().Context(), "SELECT count(*) FROM users WHERE username = 'racer'").Scan(&count)) + s.Equal(1, count) +} + +func (s *UserRepositorySuite) TestQueryTimeoutReturnsError() { + store := openStore(s.T(), s.db, func(cfg *config.Postgres) { + cfg.QueryTimeout = time.Nanosecond + }) + defer store.Close() + + _, err := store.Users().GetByID(s.T().Context(), uuid.New()) + s.Require().Error(err) + s.NotErrorIs(err, domain.ErrNotFound) +} diff --git a/internal/storage/redis/chat_repository.go b/internal/storage/redis/chat_repository.go new file mode 100644 index 00000000..9ce0c088 --- /dev/null +++ b/internal/storage/redis/chat_repository.go @@ -0,0 +1,183 @@ +package redis + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "log/slog" + "time" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/cache" +) + +type ChatSource interface { + Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) + GetVisible(ctx context.Context, chatID, callerID uuid.UUID) (domain.Chat, error) + ListVersion(ctx context.Context, userID uuid.UUID) (int64, error) + ListVisible( + ctx context.Context, + callerID uuid.UUID, + after *domain.Cursor, + limit int, + ) (domain.Page[domain.Chat], error) +} + +type ChatRepository struct { + source ChatSource + cache *cache.DistributedCache + ttl time.Duration + log *slog.Logger +} + +func NewChatRepository( + source ChatSource, + cache *cache.DistributedCache, + ttl time.Duration, + log *slog.Logger, +) *ChatRepository { + return &ChatRepository{source: source, cache: cache, ttl: ttl, log: log} +} + +func (r *ChatRepository) Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) { + return r.source.Create(ctx, draft) +} + +func (r *ChatRepository) GetVisible(ctx context.Context, chatID, callerID uuid.UUID) (domain.Chat, error) { + return r.source.GetVisible(ctx, chatID, callerID) +} + +type sourceError struct{ err error } + +func (e sourceError) Error() string { return e.err.Error() } + +func (e sourceError) Unwrap() error { return e.err } + +const cacheOperationTimeout = 500 * time.Millisecond + +func (r *ChatRepository) ListVisible( + ctx context.Context, + callerID uuid.UUID, + after *domain.Cursor, + limit int, +) (domain.Page[domain.Chat], error) { + if after != nil { + return r.source.ListVisible(ctx, callerID, after, limit) + } + + version, err := r.source.ListVersion(ctx, callerID) + if err != nil { + return domain.Page[domain.Chat]{}, fmt.Errorf("chat list version: %w", err) + } + + key := chatListKey(callerID, version, limit) + + loader := func(ctx context.Context) ([]byte, error) { + page, err := r.source.ListVisible(ctx, callerID, nil, limit) + if err != nil { + return nil, sourceError{err} + } + + return json.Marshal(newChatPageDTO(page)) + } + + cctx, cancel := context.WithTimeout(ctx, cacheOperationTimeout) + defer cancel() + + encoded, err := r.cache.GetOrLoad(cctx, key, r.ttl, loader) + if err != nil { + var sourceErr sourceError + switch { + case errors.As(err, &sourceErr): + return domain.Page[domain.Chat]{}, sourceErr.err + case ctx.Err() != nil: + return domain.Page[domain.Chat]{}, ctx.Err() + } + } else { + var dto chatPageDTO + unmarshalErr := json.Unmarshal(encoded, &dto) + if unmarshalErr == nil { + return dto.toDomain(), nil + } + err = unmarshalErr + + _ = r.cache.Delete(ctx, key) + } + + if r.log != nil { + r.log.WarnContext(ctx, "chat list cache unavailable, falling back to source", slog.Any("error", err)) + } + + return r.source.ListVisible(ctx, callerID, nil, limit) +} + +func chatListKey(userID uuid.UUID, version int64, limit int) string { + return fmt.Sprintf("chat_list:%s:%d:%d", userID, version, limit) +} + +type chatPageDTO struct { + Items []chatDTO `json:"items"` + Next *cursorDTO `json:"next,omitempty"` +} + +type chatDTO struct { + ID uuid.UUID `json:"id"` + Title string `json:"title"` + MemberIDs []uuid.UUID `json:"member_ids"` + CreatedAt time.Time `json:"created_at"` +} + +type cursorDTO struct { + Scope uuid.UUID `json:"scope"` + CreatedAt time.Time `json:"created_at"` + ID uuid.UUID `json:"id"` +} + +func newChatPageDTO(page domain.Page[domain.Chat]) chatPageDTO { + items := make([]chatDTO, 0, len(page.Items)) + for _, chat := range page.Items { + items = append(items, chatDTO{ + ID: chat.ID, + Title: chat.Title, + MemberIDs: chat.MemberIDs, + CreatedAt: chat.CreatedAt, + }) + } + + var next *cursorDTO + if page.Next != nil { + next = &cursorDTO{ + Scope: page.Next.Scope, + CreatedAt: page.Next.CreatedAt, + ID: page.Next.ID, + } + } + + return chatPageDTO{Items: items, Next: next} +} + +func (d chatPageDTO) toDomain() domain.Page[domain.Chat] { + items := make([]domain.Chat, 0, len(d.Items)) + for _, chat := range d.Items { + items = append(items, domain.Chat{ + ID: chat.ID, + Title: chat.Title, + MemberIDs: chat.MemberIDs, + CreatedAt: chat.CreatedAt, + }) + } + + var next *domain.Cursor + if d.Next != nil { + next = &domain.Cursor{ + Scope: d.Next.Scope, + CreatedAt: d.Next.CreatedAt, + ID: d.Next.ID, + } + } + + return domain.Page[domain.Chat]{Items: items, Next: next} +} diff --git a/internal/storage/redis/chat_repository_test.go b/internal/storage/redis/chat_repository_test.go new file mode 100644 index 00000000..c06f10e9 --- /dev/null +++ b/internal/storage/redis/chat_repository_test.go @@ -0,0 +1,428 @@ +//go:build integration + +package redis_test + +import ( + "context" + "errors" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/platform/cache" + cachemocks "mtusi-messenger/internal/platform/cache/mocks" + storageredis "mtusi-messenger/internal/storage/redis" + storagemocks "mtusi-messenger/internal/storage/redis/mocks" +) + +type ChatRepositorySuite struct { + suite.Suite + + cache *cache.RedisCache +} + +func TestChatRepositorySuite(t *testing.T) { + suite.Run(t, new(ChatRepositorySuite)) +} + +func (s *ChatRepositorySuite) SetupSuite() { + var err error + + s.cache, err = cache.NewRedis(testRedisConfig()) + s.Require().NoError(err) + + s.Require().NoError(s.cache.Ping(s.T().Context())) + s.Require().NoError(flushRedisDB(s.T().Context())) +} + +func (s *ChatRepositorySuite) TearDownSuite() { + if s.cache != nil { + s.Require().NoError(s.cache.Close()) + } +} + +func (s *ChatRepositorySuite) newDistributed() *cache.DistributedCache { + s.T().Helper() + + dc, err := cache.NewDistributed(s.cache, cache.DistributedConfig{}, nil) + s.Require().NoError(err) + + return dc +} + +func (s *ChatRepositorySuite) newRepo(source storageredis.ChatSource) *storageredis.ChatRepository { + s.T().Helper() + + return storageredis.NewChatRepository(source, s.newDistributed(), time.Minute, nil) +} + +func (s *ChatRepositorySuite) TestFirstPageIsCached() { + ctx := s.T().Context() + alice := uuid.New() + page := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Twice() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(page, nil).Once() + + repo := s.newRepo(source) + + first, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + s.Empty(first.Items) + + second, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + s.Empty(second.Items) +} + +func (s *ChatRepositorySuite) TestCreateInvalidatesMemberCaches() { + ctx := s.T().Context() + alice := uuid.New() + bob := uuid.New() + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + chat := domain.Chat{ + ID: uuid.New(), + Title: "Чат", + MemberIDs: []uuid.UUID{alice, bob}, + CreatedAt: time.Now().UTC(), + } + page := domain.Page[domain.Chat]{Items: []domain.Chat{chat}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Once() + source.EXPECT().ListVersion(mock.Anything, bob).Return(int64(0), nil).Once() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(empty, nil).Once() + source.EXPECT().ListVisible(mock.Anything, bob, (*domain.Cursor)(nil), 50).Return(empty, nil).Once() + source.EXPECT().Create(mock.Anything, mock.AnythingOfType("domain.ChatDraft")).Return(chat, nil).Once() + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(1), nil).Once() + source.EXPECT().ListVersion(mock.Anything, bob).Return(int64(1), nil).Once() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(page, nil).Once() + source.EXPECT().ListVisible(mock.Anything, bob, (*domain.Cursor)(nil), 50).Return(page, nil).Once() + + repo := s.newRepo(source) + + _, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + _, err = repo.ListVisible(ctx, bob, nil, 50) + s.Require().NoError(err) + + _, err = repo.Create(ctx, domain.ChatDraft{ + Title: "Чат", + MemberIDs: []uuid.UUID{alice, bob}, + CallerID: alice, + }) + s.Require().NoError(err) + + alicePage, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + s.Len(alicePage.Items, 1, "creator must observe the new chat immediately") + + bobPage, err := repo.ListVisible(ctx, bob, nil, 50) + s.Require().NoError(err) + s.Len(bobPage.Items, 1, "other member must observe the new chat immediately") +} + +func (s *ChatRepositorySuite) TestEvictedCacheEntryReloadsFromSource() { + ctx := s.T().Context() + alice := uuid.New() + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Twice() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(empty, nil).Twice() + + repo := s.newRepo(source) + + _, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + + // Simulate a Redis flush/restart by dropping all cache entries. + s.Require().NoError(flushRedisDB(ctx)) + + _, err = repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) +} + +func (s *ChatRepositorySuite) TestDeeperPagesBypassCache() { + ctx := s.T().Context() + alice := uuid.New() + cursor := &domain.Cursor{Scope: alice, CreatedAt: time.Now().UTC(), ID: uuid.New()} + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVisible(mock.Anything, alice, cursor, 50).Return(empty, nil).Twice() + + repo := s.newRepo(source) + + _, err := repo.ListVisible(ctx, alice, cursor, 50) + s.Require().NoError(err) + _, err = repo.ListVisible(ctx, alice, cursor, 50) + s.Require().NoError(err) +} + +func (s *ChatRepositorySuite) TestLimitIsPartOfCacheKey() { + ctx := s.T().Context() + alice := uuid.New() + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Twice() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 10).Return(empty, nil).Once() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(empty, nil).Once() + + repo := s.newRepo(source) + + _, err := repo.ListVisible(ctx, alice, nil, 10) + s.Require().NoError(err) + _, err = repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) +} + +func (s *ChatRepositorySuite) TestConcurrentColdReadsAreDeduplicated() { + ctx := s.T().Context() + alice := uuid.New() + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Maybe() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50). + RunAndReturn(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error) { + time.Sleep(25 * time.Millisecond) + + return empty, nil + }).Once() + + repo := s.newRepo(source) + + const workers = 100 + + var ( + wg sync.WaitGroup + failures atomic.Int32 + ) + + wg.Add(workers) + + for range workers { + go func() { + defer wg.Done() + + if _, err := repo.ListVisible(ctx, alice, nil, 50); err != nil { + failures.Add(1) + } + }() + } + + wg.Wait() + + s.Require().Zero(failures.Load()) + s.T().Logf("distributed lock: %d concurrent cold reads -> 1 source load", workers) +} + +func (s *ChatRepositorySuite) TestMultipleInstancesShareDistributedLock() { + ctx := s.T().Context() + alice := uuid.New() + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Maybe() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50). + RunAndReturn(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error) { + time.Sleep(25 * time.Millisecond) + + return empty, nil + }).Once() + + const ( + instances = 3 + workersPerInstance = 30 + ) + + repos := make([]*storageredis.ChatRepository, instances) + for i := range repos { + repos[i] = s.newRepo(source) + } + + var ( + wg sync.WaitGroup + failures atomic.Int32 + ) + + wg.Add(instances * workersPerInstance) + + for i := range repos { + repo := repos[i] + for range workersPerInstance { + go func() { + defer wg.Done() + + if _, err := repo.ListVisible(ctx, alice, nil, 50); err != nil { + failures.Add(1) + } + }() + } + } + + wg.Wait() + + s.Require().Zero(failures.Load()) + s.T().Logf("multi-instance distributed lock: %d instances x %d reads -> 1 source load", + instances, workersPerInstance) +} + +func (s *ChatRepositorySuite) TestCacheUnavailableFallsBackToSource() { + ctx := s.T().Context() + alice := uuid.New() + page := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Once() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(page, nil).Once() + + lockStore := cachemocks.NewMockLockStore(s.T()) + lockStore.EXPECT().Get(mock.Anything, mock.Anything).Return(nil, errors.New("redis down")).Maybe() + + distributed, err := cache.NewDistributed(lockStore, cache.DistributedConfig{}, nil) + s.Require().NoError(err) + + repo := storageredis.NewChatRepository(source, distributed, time.Minute, nil) + + got, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err, "cache failure must not fail the read") + s.Empty(got.Items) +} + +func (s *ChatRepositorySuite) TestBrokenCacheEntryIsDroppedAndRepopulated() { + ctx := s.T().Context() + alice := uuid.New() + page := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Times(3) + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50).Return(page, nil).Twice() + + repo := s.newRepo(source) + + key := "chat_list:" + alice.String() + ":0:50" + s.Require().NoError(s.cache.Set(ctx, key, []byte("{not json"), time.Minute)) + + // 1st: garbage -> dropped -> source. + first, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err, "a corrupted cache entry must not fail the read") + + // 2nd: miss -> source -> repopulate. + second, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + + // 3rd: served from cache, no source call. + third, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err) + + s.Equal(first, second) + s.Equal(second, third) +} + +func (s *ChatRepositorySuite) TestSlowLoaderBeyondCacheBudgetReturnsData() { + ctx := s.T().Context() + alice := uuid.New() + page := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + release := make(chan struct{}) + var calls atomic.Int32 + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Once() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50). + RunAndReturn(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error) { + if calls.Add(1) == 1 { + <-release // the loader outlives the caller's cache budget + } + + return page, nil + }).Maybe() + + repo := s.newRepo(source) + + started := time.Now() + got, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().NoError(err, "budget expiry must fall back to the source, not fail") + s.Empty(got.Items) + s.GreaterOrEqual(time.Since(started), 450*time.Millisecond, "the caller must be bounded by the cache budget") + + // Let the background loader finish before the test (and its mock) is torn down. + close(release) + time.Sleep(200 * time.Millisecond) +} + +func (s *ChatRepositorySuite) TestSourceErrorIsNotRetried() { + ctx := s.T().Context() + alice := uuid.New() + sentinel := errors.New("postgres down") + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVersion(mock.Anything, alice).Return(int64(0), nil).Once() + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50). + Return(domain.Page[domain.Chat]{}, sentinel).Once() + + repo := s.newRepo(source) + + _, err := repo.ListVisible(ctx, alice, nil, 50) + s.Require().ErrorIs(err, sentinel, "source error must propagate") +} + +func (s *ChatRepositorySuite) TestConcurrentColdReadsWithoutProtectionStampede() { + ctx := s.T().Context() + alice := uuid.New() + key := "naive:" + alice.String() + empty := domain.Page[domain.Chat]{Items: []domain.Chat{}} + + var loads atomic.Int32 + + source := storagemocks.NewMockChatSource(s.T()) + source.EXPECT().ListVisible(mock.Anything, alice, (*domain.Cursor)(nil), 50). + RunAndReturn(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error) { + loads.Add(1) + time.Sleep(2 * time.Millisecond) + + return empty, nil + }).Maybe() + + const workers = 100 + + var ( + wg sync.WaitGroup + failures atomic.Int32 + ) + + wg.Add(workers) + + for range workers { + go func() { + defer wg.Done() + + // Naive cache-aside without distributed coordination: every concurrent miss loads. + if _, err := s.cache.Get(ctx, key); err != nil { + if _, loadErr := source.ListVisible(ctx, alice, nil, 50); loadErr != nil { + failures.Add(1) + + return + } + + _ = s.cache.Set(ctx, key, []byte("page"), time.Minute) + } + }() + } + + wg.Wait() + + s.Require().Zero(failures.Load()) + s.Greater(loads.Load(), int32(1), "without distributed coordination concurrent misses stampede the source") + s.T().Logf("stampede demonstration: %d concurrent reads -> %d source loads", workers, loads.Load()) +} diff --git a/internal/storage/redis/main_test.go b/internal/storage/redis/main_test.go new file mode 100644 index 00000000..fabadf25 --- /dev/null +++ b/internal/storage/redis/main_test.go @@ -0,0 +1,66 @@ +//go:build integration + +package redis_test + +import ( + "context" + "os" + "strconv" + "time" + + goredis "github.com/redis/go-redis/v9" + + "mtusi-messenger/internal/platform/cache" +) + +const testRedisDB = 1 + +func redisEnv(key, fallback string) string { + if value := os.Getenv(key); value != "" { + return value + } + + return fallback +} + +func redisEnvInt(key string, fallback int) int { + value := os.Getenv(key) + if value == "" { + return fallback + } + + parsed, err := strconv.Atoi(value) + if err != nil { + return fallback + } + + return parsed +} + +func testRedisConfig() cache.RedisConfig { + return cache.RedisConfig{ + Host: redisEnv("TEST_REDIS_HOST", "localhost"), + Port: redisEnvInt("TEST_REDIS_PORT", 6379), + Password: os.Getenv("TEST_REDIS_PASSWORD"), + DB: redisEnvInt("TEST_REDIS_DB", testRedisDB), + MaxRetries: 3, + DialTimeout: 5 * time.Second, + ReadTimeout: 3 * time.Second, + WriteTimeout: 3 * time.Second, + PoolSize: 5, + } +} + +func flushRedisDB(ctx context.Context) error { + cfg := testRedisConfig() + + client := goredis.NewClient(&goredis.Options{ + Addr: cfg.Host + ":" + strconv.Itoa(cfg.Port), + Password: cfg.Password, + DB: cfg.DB, + }) + + defer func() { _ = client.Close() }() + + return client.FlushDB(ctx).Err() +} diff --git a/internal/storage/redis/mocks/ChatSource.go b/internal/storage/redis/mocks/ChatSource.go new file mode 100644 index 00000000..5d9d3736 --- /dev/null +++ b/internal/storage/redis/mocks/ChatSource.go @@ -0,0 +1,331 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockChatSource creates a new instance of MockChatSource. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockChatSource(t interface { + mock.TestingT + Cleanup(func()) +}) *MockChatSource { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockChatSource{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockChatSource is an autogenerated mock type for the ChatSource type +type MockChatSource struct { + mock.Mock +} + +type MockChatSource_Expecter struct { + mock *mock.Mock +} + +func (_m *MockChatSource) EXPECT() *MockChatSource_Expecter { + return &MockChatSource_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockChatSource +func (_mock *MockChatSource) Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Chat + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.ChatDraft) (domain.Chat, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.ChatDraft) domain.Chat); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.Chat) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.ChatDraft) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatSource_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockChatSource_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.ChatDraft +func (_e *MockChatSource_Expecter) Create(ctx any, draft any) *MockChatSource_Create_Call { + return &MockChatSource_Create_Call{Call: _e.mock.On("Create", ctx, draft)} +} + +func (_c *MockChatSource_Create_Call) Run(run func(ctx context.Context, draft domain.ChatDraft)) *MockChatSource_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.ChatDraft + if args[1] != nil { + arg1 = args[1].(domain.ChatDraft) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockChatSource_Create_Call) Return(chat domain.Chat, err error) *MockChatSource_Create_Call { + _c.Call.Return(chat, err) + return _c +} + +func (_c *MockChatSource_Create_Call) RunAndReturn(run func(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error)) *MockChatSource_Create_Call { + _c.Call.Return(run) + return _c +} + +// GetVisible provides a mock function for the type MockChatSource +func (_mock *MockChatSource) GetVisible(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID) (domain.Chat, error) { + ret := _mock.Called(ctx, chatID, callerID) + + if len(ret) == 0 { + panic("no return value specified for GetVisible") + } + + var r0 domain.Chat + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) (domain.Chat, error)); ok { + return returnFunc(ctx, chatID, callerID) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) domain.Chat); ok { + r0 = returnFunc(ctx, chatID, callerID) + } else { + r0 = ret.Get(0).(domain.Chat) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID) error); ok { + r1 = returnFunc(ctx, chatID, callerID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatSource_GetVisible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVisible' +type MockChatSource_GetVisible_Call struct { + *mock.Call +} + +// GetVisible is a helper method to define mock.On call +// - ctx context.Context +// - chatID uuid.UUID +// - callerID uuid.UUID +func (_e *MockChatSource_Expecter) GetVisible(ctx any, chatID any, callerID any) *MockChatSource_GetVisible_Call { + return &MockChatSource_GetVisible_Call{Call: _e.mock.On("GetVisible", ctx, chatID, callerID)} +} + +func (_c *MockChatSource_GetVisible_Call) Run(run func(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID)) *MockChatSource_GetVisible_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 uuid.UUID + if args[2] != nil { + arg2 = args[2].(uuid.UUID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockChatSource_GetVisible_Call) Return(chat domain.Chat, err error) *MockChatSource_GetVisible_Call { + _c.Call.Return(chat, err) + return _c +} + +func (_c *MockChatSource_GetVisible_Call) RunAndReturn(run func(ctx context.Context, chatID uuid.UUID, callerID uuid.UUID) (domain.Chat, error)) *MockChatSource_GetVisible_Call { + _c.Call.Return(run) + return _c +} + +// ListVersion provides a mock function for the type MockChatSource +func (_mock *MockChatSource) ListVersion(ctx context.Context, userID uuid.UUID) (int64, error) { + ret := _mock.Called(ctx, userID) + + if len(ret) == 0 { + panic("no return value specified for ListVersion") + } + + var r0 int64 + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) (int64, error)); ok { + return returnFunc(ctx, userID) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) int64); ok { + r0 = returnFunc(ctx, userID) + } else { + r0 = ret.Get(0).(int64) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok { + r1 = returnFunc(ctx, userID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatSource_ListVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListVersion' +type MockChatSource_ListVersion_Call struct { + *mock.Call +} + +// ListVersion is a helper method to define mock.On call +// - ctx context.Context +// - userID uuid.UUID +func (_e *MockChatSource_Expecter) ListVersion(ctx any, userID any) *MockChatSource_ListVersion_Call { + return &MockChatSource_ListVersion_Call{Call: _e.mock.On("ListVersion", ctx, userID)} +} + +func (_c *MockChatSource_ListVersion_Call) Run(run func(ctx context.Context, userID uuid.UUID)) *MockChatSource_ListVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockChatSource_ListVersion_Call) Return(n int64, err error) *MockChatSource_ListVersion_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *MockChatSource_ListVersion_Call) RunAndReturn(run func(ctx context.Context, userID uuid.UUID) (int64, error)) *MockChatSource_ListVersion_Call { + _c.Call.Return(run) + return _c +} + +// ListVisible provides a mock function for the type MockChatSource +func (_mock *MockChatSource) ListVisible(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error) { + ret := _mock.Called(ctx, callerID, after, limit) + + if len(ret) == 0 { + panic("no return value specified for ListVisible") + } + + var r0 domain.Page[domain.Chat] + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error)); ok { + return returnFunc(ctx, callerID, after, limit) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, *domain.Cursor, int) domain.Page[domain.Chat]); ok { + r0 = returnFunc(ctx, callerID, after, limit) + } else { + r0 = ret.Get(0).(domain.Page[domain.Chat]) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, *domain.Cursor, int) error); ok { + r1 = returnFunc(ctx, callerID, after, limit) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatSource_ListVisible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListVisible' +type MockChatSource_ListVisible_Call struct { + *mock.Call +} + +// ListVisible is a helper method to define mock.On call +// - ctx context.Context +// - callerID uuid.UUID +// - after *domain.Cursor +// - limit int +func (_e *MockChatSource_Expecter) ListVisible(ctx any, callerID any, after any, limit any) *MockChatSource_ListVisible_Call { + return &MockChatSource_ListVisible_Call{Call: _e.mock.On("ListVisible", ctx, callerID, after, limit)} +} + +func (_c *MockChatSource_ListVisible_Call) Run(run func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int)) *MockChatSource_ListVisible_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 *domain.Cursor + if args[2] != nil { + arg2 = args[2].(*domain.Cursor) + } + var arg3 int + if args[3] != nil { + arg3 = args[3].(int) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockChatSource_ListVisible_Call) Return(page domain.Page[domain.Chat], err error) *MockChatSource_ListVisible_Call { + _c.Call.Return(page, err) + return _c +} + +func (_c *MockChatSource_ListVisible_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error)) *MockChatSource_ListVisible_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/bodylimit.go b/internal/transport/rest/bodylimit.go new file mode 100644 index 00000000..660feefc --- /dev/null +++ b/internal/transport/rest/bodylimit.go @@ -0,0 +1,35 @@ +package rest + +import ( + "log/slog" + "net/http" +) + +// bodyLimitMiddleware bounds the request body before it reaches the generated +// transport. Without it the JSON decoders read the whole body into memory before +// any schema check or authentication happens, so an oversized request to a public +// endpoint (for example POST /api/v1/users) could exhaust the replica's memory. +// +// The declared length is rejected early with 413; a client that lies about +// Content-Length is cut off by http.MaxBytesReader, which also makes the server +// close the connection instead of reading the rest. +func bodyLimitMiddleware(limit int64, log *slog.Logger, next http.Handler) http.Handler { + if limit <= 0 { + return next + } + + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.ContentLength > limit { + logRejected(r.Context(), log, r, http.StatusRequestEntityTooLarge, nil) + writeError(r.Context(), log, w, r, http.StatusRequestEntityTooLarge) + + return + } + + if r.Body != nil { + r.Body = http.MaxBytesReader(w, r.Body, limit) + } + + next.ServeHTTP(w, r) + }) +} diff --git a/internal/transport/rest/errors.go b/internal/transport/rest/errors.go new file mode 100644 index 00000000..0f5c2033 --- /dev/null +++ b/internal/transport/rest/errors.go @@ -0,0 +1,141 @@ +package rest + +import ( + "context" + "encoding/json" + "errors" + "log/slog" + "net/http" + + "github.com/ogen-go/ogen/ogenerrors" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/transport/rest/internal/oas" +) + +var fallbackErrorBody = []byte(`{"error":{"code":"internal_error","message":"Internal error","request_id":""}}`) + +func newErrorHandler(log *slog.Logger) oas.ErrorHandler { + return func(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) { + status := statusForError(err) + + if preMiddlewareError(err) { + logRejected(ctx, log, r, status, err) + } + + writeError(ctx, log, w, r, status) + } +} + +func statusForError(err error) int { + var securityErr *ogenerrors.SecurityError + + if errors.As(err, &securityErr) { + if status := statusForDomainError(securityErr.Err); status != http.StatusInternalServerError { + return status + } + + return http.StatusUnauthorized + } + + if status := ogenerrors.ErrorCode(err); status != http.StatusInternalServerError { + return status + } + + return statusForDomainError(err) +} + +func statusForDomainError(err error) int { + switch { + case errors.Is(err, ErrUnauthenticated), errors.Is(err, domain.ErrUnauthenticated): + return http.StatusUnauthorized + case errors.Is(err, domain.ErrNotFound): + return http.StatusNotFound + case errors.Is(err, domain.ErrUsernameTaken), + errors.Is(err, domain.ErrConflict), + errors.Is(err, domain.ErrIdempotency): + return http.StatusConflict + case errors.Is(err, domain.ErrValidation), + errors.Is(err, domain.ErrUnknownMember), + errors.Is(err, domain.ErrInvalidCursor): + return http.StatusBadRequest + case errors.Is(err, domain.ErrUnavailable): + return http.StatusServiceUnavailable + default: + return http.StatusInternalServerError + } +} + +func newNotFoundHandler(log *slog.Logger) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + logRejected(r.Context(), log, r, http.StatusNotFound, nil) + writeError(r.Context(), log, w, r, http.StatusNotFound) + } +} + +func newMethodNotAllowedHandler(log *slog.Logger) func(http.ResponseWriter, *http.Request, string) { + return func(w http.ResponseWriter, r *http.Request, allowed string) { + w.Header().Set("Allow", allowed) + logRejected(r.Context(), log, r, http.StatusMethodNotAllowed, nil) + writeError(r.Context(), log, w, r, http.StatusMethodNotAllowed) + } +} + +func writeError(ctx context.Context, log *slog.Logger, w http.ResponseWriter, r *http.Request, status int) { + requestID := requestIDFromContext(ctx) + if requestID == "" { + requestID = r.Header.Get(requestIDHeader) + } + + body := oas.Error{ + Error: oas.ErrorError{ + Code: codeForStatus(status), + Message: http.StatusText(status), + RequestID: requestID, + }, + } + + payload, marshalErr := json.Marshal(body) + if marshalErr != nil { + status = http.StatusInternalServerError + payload = fallbackErrorBody + } + + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set(requestIDHeader, requestID) + if status == http.StatusUnauthorized { + challenge := `Bearer realm="messenger"` + if r.URL.Path == "/api/v1/auth/sessions" { + challenge = `Basic realm="messenger", charset="UTF-8"` + } + w.Header().Set("WWW-Authenticate", challenge) + } + w.WriteHeader(status) + + if _, err := w.Write(payload); err != nil && log != nil { + log.WarnContext(ctx, "response write failed", slog.String("error", err.Error())) + } +} + +func codeForStatus(status int) oas.ErrorErrorCode { + switch status { + case http.StatusBadRequest, http.StatusMethodNotAllowed: + return oas.ErrorErrorCodeInvalidRequest + case http.StatusUnauthorized: + return oas.ErrorErrorCodeUnauthorized + case http.StatusNotFound: + return oas.ErrorErrorCodeNotFound + case http.StatusConflict: + return oas.ErrorErrorCodeConflict + case http.StatusRequestEntityTooLarge: + return oas.ErrorErrorCodePayloadTooLarge + case http.StatusUnsupportedMediaType: + return oas.ErrorErrorCodeUnsupportedMediaType + case http.StatusTooManyRequests: + return oas.ErrorErrorCodeRateLimited + case http.StatusServiceUnavailable: + return oas.ErrorErrorCodeUnavailable + default: + return oas.ErrorErrorCodeInternalError + } +} diff --git a/internal/transport/rest/handler.go b/internal/transport/rest/handler.go new file mode 100644 index 00000000..f437f306 --- /dev/null +++ b/internal/transport/rest/handler.go @@ -0,0 +1,406 @@ +package rest + +import ( + "bytes" + "context" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/transport/rest/internal/oas" +) + +type UserService interface { + Register(ctx context.Context, draft domain.UserDraft) (domain.User, error) + GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) +} + +type ChatService interface { + Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) + Get(ctx context.Context, callerID, chatID uuid.UUID) (domain.Chat, error) + List( + ctx context.Context, + callerID uuid.UUID, + after *domain.Cursor, + limit int, + ) (domain.Page[domain.Chat], error) +} + +type MessageService interface { + Send(ctx context.Context, draft domain.MessageDraft) (domain.Message, error) + History( + ctx context.Context, + callerID, chatID uuid.UUID, + after *domain.Cursor, + limit int, + ) (domain.Page[domain.Message], error) +} + +type HealthChecker interface { + Ping(ctx context.Context) error +} + +type SessionService interface { + Create(ctx context.Context, user domain.User) (domain.Session, error) + Revoke(ctx context.Context, userID uuid.UUID, token string) error +} + +type Handler struct { + oas.UnimplementedHandler + + users UserService + chats ChatService + messages MessageService + health HealthChecker + sessions SessionService +} + +var noCursor *domain.Cursor + +func NewHandler( + users UserService, + chats ChatService, + messages MessageService, + health HealthChecker, + sessions SessionService, +) *Handler { + return &Handler{ + users: users, + chats: chats, + messages: messages, + health: health, + sessions: sessions, + } +} + +func (h *Handler) CreateSession(ctx context.Context) (oas.CreateSessionRes, error) { + user, ok := ctx.Value(credentialsKey{}).(domain.User) + if !ok { + return nil, domain.ErrUnauthenticated + } + + created, err := h.sessions.Create(ctx, user) + if err != nil { + return nil, err + } + + return &oas.SessionHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: oas.Session{ + Token: created.Token, TokenType: "Bearer", ExpiresAt: created.ExpiresAt, User: userResponse(created.User), + }, + }, nil +} + +func (h *Handler) RevokeSession(ctx context.Context) (oas.RevokeSessionRes, error) { + token, ok := ctx.Value(tokenKey{}).(string) + if !ok { + return nil, domain.ErrUnauthenticated + } + if err := h.sessions.Revoke(ctx, caller(ctx), token); err != nil { + return nil, err + } + return &oas.RevokeSessionNoContent{XRequestID: oas.NewOptString(requestIDFromContext(ctx))}, nil +} + +func (h *Handler) Liveness(ctx context.Context) (oas.LivenessRes, error) { + return &oas.HealthHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: oas.Health{Status: oas.HealthStatusOk}, + }, nil +} + +func (h *Handler) Readiness(ctx context.Context) (oas.ReadinessRes, error) { + if h.health == nil || h.health.Ping(ctx) == nil { + return &oas.HealthHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: oas.Health{Status: oas.HealthStatusOk}, + }, nil + } + + requestID := requestIDFromContext(ctx) + + return &oas.ReadinessServiceUnavailable{ + XRequestID: oas.NewOptString(requestID), + Response: oas.Error{Error: oas.ErrorError{ + Code: oas.ErrorErrorCodeUnavailable, + Message: http.StatusText(http.StatusServiceUnavailable), + RequestID: requestID, + }}, + }, nil +} + +func (h *Handler) RegisterUser(ctx context.Context, req *oas.CreateUser) (oas.RegisterUserRes, error) { + user, err := h.users.Register(ctx, domain.UserDraft{ + Username: req.Username, + DisplayName: req.DisplayName, + Password: req.Password, + }) + if err != nil { + return nil, err + } + + return &oas.UserHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: userResponse(user), + }, nil +} + +func (h *Handler) CurrentUser(ctx context.Context) (oas.CurrentUserRes, error) { + callerID := caller(ctx) + + user, err := h.users.GetByID(ctx, callerID) + if err != nil { + return nil, err + } + + return &oas.UserHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: userResponse(user), + }, nil +} + +func (h *Handler) CreateChat(ctx context.Context, req *oas.CreateChat) (oas.CreateChatRes, error) { + callerID := caller(ctx) + + chat, err := h.chats.Create(ctx, domain.ChatDraft{ + Title: req.Title, + MemberIDs: req.MemberIds, + CallerID: callerID, + }) + if err != nil { + return nil, err + } + + return &oas.ChatHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: chatResponse(chat), + }, nil +} + +func (h *Handler) GetChat(ctx context.Context, params oas.GetChatParams) (oas.GetChatRes, error) { + callerID := caller(ctx) + + chat, err := h.chats.Get(ctx, callerID, params.ChatID) + if err != nil { + return nil, err + } + + return &oas.ChatHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: chatResponse(chat), + }, nil +} + +func (h *Handler) ListChats(ctx context.Context, params oas.ListChatsParams) (oas.ListChatsRes, error) { + callerID := caller(ctx) + + after, err := parseCursor(params.Cursor) + if err != nil { + return nil, err + } + + page, err := h.chats.List(ctx, callerID, after, limitOrDefault(params.Limit)) + if err != nil { + return nil, err + } + + items := make([]oas.Chat, 0, len(page.Items)) + for _, chat := range page.Items { + items = append(items, chatResponse(chat)) + } + + return &oas.ChatPageHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: oas.ChatPage{ + Items: items, + NextCursor: encodeCursor(page.Next), + }, + }, nil +} + +func (h *Handler) CreateMessage( + ctx context.Context, + req *oas.CreateMessage, + params oas.CreateMessageParams, +) (oas.CreateMessageRes, error) { + callerID := caller(ctx) + + fingerprint, err := messageFingerprint(req) + if err != nil { + return nil, err + } + + message, err := h.messages.Send(ctx, domain.MessageDraft{ + ChatID: params.ChatID, + SenderID: callerID, + Text: req.Text, + Idempotency: domain.MessageIdempotency{ + Key: params.IdempotencyKey, + RequestHash: fingerprint, + }, + }) + if err != nil { + return nil, err + } + + return &oas.MessageHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: messageResponse(message), + }, nil +} + +// messageFingerprint canonicalises the create-message payload so that the key +// order of the client JSON cannot change the fingerprint, while a different +// payload with the same Idempotency-Key can (contract 1.3.0). +func messageFingerprint(req *oas.CreateMessage) ([sha256.Size]byte, error) { + payload, err := json.Marshal(struct { + Text string `json:"text"` + }{Text: req.Text}) + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("encode message payload: %w", err) + } + + return sha256.Sum256(payload), nil +} + +func (h *Handler) ListMessages(ctx context.Context, params oas.ListMessagesParams) (oas.ListMessagesRes, error) { + callerID := caller(ctx) + + after, err := parseCursor(params.Cursor) + if err != nil { + return nil, err + } + + page, err := h.messages.History(ctx, callerID, params.ChatID, after, limitOrDefault(params.Limit)) + if err != nil { + return nil, err + } + + items := make([]oas.Message, 0, len(page.Items)) + for _, message := range page.Items { + items = append(items, messageResponse(message)) + } + + return &oas.MessagePageHeaders{ + XRequestID: oas.NewOptString(requestIDFromContext(ctx)), + Response: oas.MessagePage{ + Items: items, + NextCursor: encodeCursor(page.Next), + }, + }, nil +} + +func parseCursor(raw oas.OptString) (*domain.Cursor, error) { + encoded, ok := raw.Get() + if !ok { + return noCursor, nil + } + + cursor, err := decodeCursor(encoded) + if err != nil { + return nil, err + } + + return &cursor, nil +} + +func encodeCursor(next *domain.Cursor) oas.NilString { + var out oas.NilString + + if next == nil { + out.SetToNull() + + return out + } + + out.SetTo(encodeCursorValue(*next)) + + return out +} + +type cursorWire struct { + Scope uuid.UUID `json:"scope"` + CreatedAt time.Time `json:"created_at"` + ID uuid.UUID `json:"id"` +} + +func encodeCursorValue(cursor domain.Cursor) string { + payload, err := json.Marshal(cursorWire{ + Scope: cursor.Scope, + CreatedAt: cursor.CreatedAt.UTC(), + ID: cursor.ID, + }) + if err != nil { + return "" + } + + return base64.RawURLEncoding.EncodeToString(payload) +} + +func decodeCursor(encoded string) (domain.Cursor, error) { + payload, err := base64.RawURLEncoding.DecodeString(encoded) + if err != nil { + return domain.Cursor{}, fmt.Errorf("decode cursor: %w", domain.ErrInvalidCursor) + } + + decoder := json.NewDecoder(bytes.NewReader(payload)) + decoder.DisallowUnknownFields() + + var wire cursorWire + if err := decoder.Decode(&wire); err != nil { + return domain.Cursor{}, fmt.Errorf("parse cursor: %w", domain.ErrInvalidCursor) + } + + if wire.ID == uuid.Nil { + return domain.Cursor{}, fmt.Errorf("cursor id is empty: %w", domain.ErrInvalidCursor) + } + + return domain.Cursor{ + Scope: wire.Scope, + CreatedAt: wire.CreatedAt.UTC(), + ID: wire.ID, + }, nil +} + +func limitOrDefault(limit oas.OptInt) int { + if value, ok := limit.Get(); ok { + return value + } + + return domain.DefaultPageLimit +} + +func userResponse(user domain.User) oas.User { + return oas.User{ + ID: user.ID, + Username: user.Username, + DisplayName: user.DisplayName, + CreatedAt: user.CreatedAt, + } +} + +func chatResponse(chat domain.Chat) oas.Chat { + return oas.Chat{ + ID: chat.ID, + Title: chat.Title, + MemberIds: chat.MemberIDs, + CreatedAt: chat.CreatedAt, + } +} + +func messageResponse(message domain.Message) oas.Message { + return oas.Message{ + ID: message.ID, + ChatID: message.ChatID, + SenderID: message.SenderID, + Text: message.Text, + CreatedAt: message.CreatedAt, + } +} diff --git a/internal/transport/rest/instance.go b/internal/transport/rest/instance.go new file mode 100644 index 00000000..5c105103 --- /dev/null +++ b/internal/transport/rest/instance.go @@ -0,0 +1,67 @@ +package rest + +import ( + "net/http" + "os" +) + +const ( + instanceIDEnv = "INSTANCE_ID" + instanceIDHeader = "X-Instance-Id" +) + +// InstanceID is the alias of this API process reported in the X-Instance-Id +// response header (contract 1.3.0). INSTANCE_ID wins when set; otherwise the +// hostname is used, which inside a container is the short container id the +// stand maps back to the replica that served the request. +func InstanceID() string { + if id := os.Getenv(instanceIDEnv); id != "" { + return id + } + + if host, err := os.Hostname(); err == nil && host != "" { + return host + } + + return "unknown" +} + +// instanceIDWriter injects the header on the first write of the response, so +// every API-generated response carries it — including errors produced by the +// router, the security handler and the error handler rather than by a handler. +// A value already set by the transport is never overwritten. +type instanceIDWriter struct { + http.ResponseWriter + + id string + sealed bool +} + +func (w *instanceIDWriter) inject() { + if w.sealed { + return + } + + w.sealed = true + + if w.Header().Get(instanceIDHeader) == "" { + w.Header().Set(instanceIDHeader, w.id) + } +} + +func (w *instanceIDWriter) WriteHeader(status int) { + w.inject() + w.ResponseWriter.WriteHeader(status) +} + +func (w *instanceIDWriter) Write(body []byte) (int, error) { + w.inject() + + return w.ResponseWriter.Write(body) +} + +func instanceIDMiddleware(id string, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + next.ServeHTTP(&instanceIDWriter{ResponseWriter: w, id: id}, r) + }) +} diff --git a/internal/transport/rest/instance_test.go b/internal/transport/rest/instance_test.go new file mode 100644 index 00000000..edd5f196 --- /dev/null +++ b/internal/transport/rest/instance_test.go @@ -0,0 +1,77 @@ +package rest + +import ( + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestInstanceIDPrefersEnvironment(t *testing.T) { + t.Setenv(instanceIDEnv, "api-7") + + assert.Equal(t, "api-7", InstanceID()) +} + +func TestInstanceIDFallsBackToHostname(t *testing.T) { + t.Setenv(instanceIDEnv, "") + + host, err := os.Hostname() + require.NoError(t, err) + + assert.Equal(t, host, InstanceID()) +} + +func TestInstanceIDMiddleware(t *testing.T) { + tests := []struct { + name string + handler http.HandlerFunc + wantID string + wantCode int + }{ + { + name: "handler response", + handler: func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusCreated) }, + wantID: "api-1", + wantCode: http.StatusCreated, + }, + { + name: "response without explicit status", + handler: func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write([]byte("ok")) }, + wantID: "api-1", + wantCode: http.StatusOK, + }, + { + name: "error produced outside a handler", + handler: func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusMethodNotAllowed) }, + wantID: "api-1", + wantCode: http.StatusMethodNotAllowed, + }, + { + name: "header set by the transport is not overwritten", + handler: func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set(instanceIDHeader, "explicit") + w.WriteHeader(http.StatusOK) + }, + wantID: "explicit", + wantCode: http.StatusOK, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + recorder := httptest.NewRecorder() + + instanceIDMiddleware("api-1", test.handler).ServeHTTP( + recorder, + httptest.NewRequest(http.MethodGet, "/api/v1/users/me", nil), + ) + + assert.Equal(t, test.wantID, recorder.Header().Get(instanceIDHeader)) + assert.Equal(t, test.wantCode, recorder.Code) + }) + } +} diff --git a/internal/transport/rest/internal/oas/oas_cfg_gen.go b/internal/transport/rest/internal/oas/oas_cfg_gen.go new file mode 100644 index 00000000..2c4ff69f --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_cfg_gen.go @@ -0,0 +1,174 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "net/http" + "strings" + + "github.com/ogen-go/ogen/middleware" + "github.com/ogen-go/ogen/ogenerrors" + "github.com/ogen-go/ogen/ogenregex" +) + +var regexMap = map[string]ogenregex.Regexp{ + "^[A-Za-z0-9._:-]+$": ogenregex.MustCompile("^[A-Za-z0-9._:-]+$"), + "^[a-z0-9_]{3,32}$": ogenregex.MustCompile("^[a-z0-9_]{3,32}$"), +} + +type ( + optionFunc[C any] func(*C) +) + +// ErrorHandler is error handler. +type ErrorHandler = ogenerrors.ErrorHandler + +type serverConfig struct { + NotFound http.HandlerFunc + MethodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string) + ErrorHandler ErrorHandler + Prefix string + Middleware Middleware + MaxMultipartMemory int64 +} + +// ServerOption is server config option. +type ServerOption interface { + applyServer(*serverConfig) +} + +var _ ServerOption = (optionFunc[serverConfig])(nil) + +func (o optionFunc[C]) applyServer(c *C) { + o(c) +} + +func newServerConfig(opts ...ServerOption) serverConfig { + cfg := serverConfig{ + NotFound: http.NotFound, + MethodNotAllowed: nil, + ErrorHandler: ogenerrors.DefaultErrorHandler, + Middleware: nil, + MaxMultipartMemory: 32 << 20, // 32 MB + } + for _, opt := range opts { + opt.applyServer(&cfg) + } + return cfg +} + +type baseServer struct { + cfg serverConfig +} + +func (s baseServer) notFound(w http.ResponseWriter, r *http.Request) { + s.cfg.NotFound(w, r) +} + +type notAllowedParams struct { + allowedMethods string + allowedHeaders map[string]string + acceptPost string + acceptPatch string +} + +func (s baseServer) notAllowed(w http.ResponseWriter, r *http.Request, params notAllowedParams) { + h := w.Header() + isOptions := r.Method == "OPTIONS" + if isOptions { + h.Set("Access-Control-Allow-Methods", params.allowedMethods) + if params.allowedHeaders != nil { + m := r.Header.Get("Access-Control-Request-Method") + if m != "" { + allowedHeaders, ok := params.allowedHeaders[strings.ToUpper(m)] + if ok { + h.Set("Access-Control-Allow-Headers", allowedHeaders) + } + } + } + if params.acceptPost != "" { + h.Set("Accept-Post", params.acceptPost) + } + if params.acceptPatch != "" { + h.Set("Accept-Patch", params.acceptPatch) + } + } + if s.cfg.MethodNotAllowed != nil { + s.cfg.MethodNotAllowed(w, r, params.allowedMethods) + return + } + status := http.StatusNoContent + if !isOptions { + h.Set("Allow", params.allowedMethods) + status = http.StatusMethodNotAllowed + } + w.WriteHeader(status) +} + +func (cfg serverConfig) baseServer() (s baseServer, err error) { + s = baseServer{cfg: cfg} + return s, nil +} + +// Option is config option. +type Option interface { + ServerOption +} + +// WithNotFound specifies Not Found handler to use. +func WithNotFound(notFound http.HandlerFunc) ServerOption { + return optionFunc[serverConfig](func(cfg *serverConfig) { + if notFound != nil { + cfg.NotFound = notFound + } + }) +} + +// WithMethodNotAllowed specifies Method Not Allowed handler to use. +func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption { + return optionFunc[serverConfig](func(cfg *serverConfig) { + if methodNotAllowed != nil { + cfg.MethodNotAllowed = methodNotAllowed + } + }) +} + +// WithErrorHandler specifies error handler to use. +func WithErrorHandler(h ErrorHandler) ServerOption { + return optionFunc[serverConfig](func(cfg *serverConfig) { + if h != nil { + cfg.ErrorHandler = h + } + }) +} + +// WithPathPrefix specifies server path prefix. +func WithPathPrefix(prefix string) ServerOption { + return optionFunc[serverConfig](func(cfg *serverConfig) { + cfg.Prefix = prefix + }) +} + +// WithMiddleware specifies middlewares to use. +func WithMiddleware(m ...Middleware) ServerOption { + return optionFunc[serverConfig](func(cfg *serverConfig) { + switch len(m) { + case 0: + cfg.Middleware = nil + case 1: + cfg.Middleware = m[0] + default: + cfg.Middleware = middleware.ChainMiddlewares(m...) + } + }) +} + +// WithMaxMultipartMemory specifies limit of memory for storing file parts. +// File parts which can't be stored in memory will be stored on disk in temporary files. +func WithMaxMultipartMemory(max int64) ServerOption { + return optionFunc[serverConfig](func(cfg *serverConfig) { + if max > 0 { + cfg.MaxMultipartMemory = max + } + }) +} diff --git a/internal/transport/rest/internal/oas/oas_handlers_gen.go b/internal/transport/rest/internal/oas/oas_handlers_gen.go new file mode 100644 index 00000000..aee7b144 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_handlers_gen.go @@ -0,0 +1,1253 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "context" + "net/http" + + "github.com/go-faster/errors" + ht "github.com/ogen-go/ogen/http" + "github.com/ogen-go/ogen/middleware" + "github.com/ogen-go/ogen/ogenerrors" +) + +type codeRecorder struct { + http.ResponseWriter + status int +} + +func (c *codeRecorder) WriteHeader(status int) { + c.status = status + c.ResponseWriter.WriteHeader(status) +} + +func (c *codeRecorder) Unwrap() http.ResponseWriter { + return c.ResponseWriter +} + +func recordError(string, error) {} + +// handleCreateChatRequest handles createChat operation. +// +// Создать чат; вызывающий должен входить в member_ids. +// +// POST /api/v1/chats +func (s *Server) handleCreateChatRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: CreateChatOperation, + ID: "createChat", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, CreateChatOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + + var rawBody []byte + request, rawBody, close, err := s.decodeCreateChatRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response CreateChatRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: CreateChatOperation, + OperationSummary: "Создать чат; вызывающий должен входить в member_ids", + OperationID: "createChat", + Body: request, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = *CreateChat + Params = struct{} + Response = CreateChatRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.CreateChat(ctx, request) + return response, err + }, + ) + } else { + response, err = s.h.CreateChat(ctx, request) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeCreateChatResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleCreateMessageRequest handles createMessage operation. +// +// Отправить сообщение. +// +// POST /api/v1/chats/{chat_id}/messages +func (s *Server) handleCreateMessageRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: CreateMessageOperation, + ID: "createMessage", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, CreateMessageOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + params, err := decodeCreateMessageParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var rawBody []byte + request, rawBody, close, err := s.decodeCreateMessageRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response CreateMessageRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: CreateMessageOperation, + OperationSummary: "Отправить сообщение", + OperationID: "createMessage", + Body: request, + RawBody: rawBody, + Params: middleware.Parameters{ + { + Name: "chat_id", + In: "path", + }: params.ChatID, + { + Name: "Idempotency-Key", + In: "header", + }: params.IdempotencyKey, + }, + Raw: r, + } + + type ( + Request = *CreateMessage + Params = CreateMessageParams + Response = CreateMessageRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackCreateMessageParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.CreateMessage(ctx, request, params) + return response, err + }, + ) + } else { + response, err = s.h.CreateMessage(ctx, request, params) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeCreateMessageResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleCreateSessionRequest handles createSession operation. +// +// Вход: Basic username:password; выдаёт сессию. +// +// POST /api/v1/auth/sessions +func (s *Server) handleCreateSessionRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: CreateSessionOperation, + ID: "createSession", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBasicAuth(ctx, CreateSessionOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BasicAuth", + Err: err, + } + defer recordError("Security:BasicAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + + var rawBody []byte + + var response CreateSessionRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: CreateSessionOperation, + OperationSummary: "Вход: Basic username:password; выдаёт сессию", + OperationID: "createSession", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = CreateSessionRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.CreateSession(ctx) + return response, err + }, + ) + } else { + response, err = s.h.CreateSession(ctx) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeCreateSessionResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleCurrentUserRequest handles currentUser operation. +// +// Текущий пользователь. +// +// GET /api/v1/users/me +func (s *Server) handleCurrentUserRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: CurrentUserOperation, + ID: "currentUser", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, CurrentUserOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + + var rawBody []byte + + var response CurrentUserRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: CurrentUserOperation, + OperationSummary: "Текущий пользователь", + OperationID: "currentUser", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = CurrentUserRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.CurrentUser(ctx) + return response, err + }, + ) + } else { + response, err = s.h.CurrentUser(ctx) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeCurrentUserResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleGetChatRequest handles getChat operation. +// +// Получить доступный чат. +// +// GET /api/v1/chats/{chat_id} +func (s *Server) handleGetChatRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: GetChatOperation, + ID: "getChat", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, GetChatOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + params, err := decodeGetChatParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var rawBody []byte + + var response GetChatRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: GetChatOperation, + OperationSummary: "Получить доступный чат", + OperationID: "getChat", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{ + { + Name: "chat_id", + In: "path", + }: params.ChatID, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetChatParams + Response = GetChatRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetChatParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.GetChat(ctx, params) + return response, err + }, + ) + } else { + response, err = s.h.GetChat(ctx, params) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeGetChatResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleListChatsRequest handles listChats operation. +// +// Чаты текущего пользователя. +// +// GET /api/v1/chats +func (s *Server) handleListChatsRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: ListChatsOperation, + ID: "listChats", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, ListChatsOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + params, err := decodeListChatsParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var rawBody []byte + + var response ListChatsRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: ListChatsOperation, + OperationSummary: "Чаты текущего пользователя", + OperationID: "listChats", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{ + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "cursor", + In: "query", + }: params.Cursor, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = ListChatsParams + Response = ListChatsRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackListChatsParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.ListChats(ctx, params) + return response, err + }, + ) + } else { + response, err = s.h.ListChats(ctx, params) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeListChatsResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleListMessagesRequest handles listMessages operation. +// +// Сообщения по (created_at, id) по возрастанию. +// +// GET /api/v1/chats/{chat_id}/messages +func (s *Server) handleListMessagesRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: ListMessagesOperation, + ID: "listMessages", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, ListMessagesOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + params, err := decodeListMessagesParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var rawBody []byte + + var response ListMessagesRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: ListMessagesOperation, + OperationSummary: "Сообщения по (created_at, id) по возрастанию", + OperationID: "listMessages", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{ + { + Name: "chat_id", + In: "path", + }: params.ChatID, + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "cursor", + In: "query", + }: params.Cursor, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = ListMessagesParams + Response = ListMessagesRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackListMessagesParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.ListMessages(ctx, params) + return response, err + }, + ) + } else { + response, err = s.h.ListMessages(ctx, params) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeListMessagesResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleLivenessRequest handles liveness operation. +// +// Процесс жив. +// +// GET /health/live +func (s *Server) handleLivenessRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + ) + + var rawBody []byte + + var response LivenessRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: LivenessOperation, + OperationSummary: "Процесс жив", + OperationID: "liveness", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = LivenessRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.Liveness(ctx) + return response, err + }, + ) + } else { + response, err = s.h.Liveness(ctx) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeLivenessResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleReadinessRequest handles readiness operation. +// +// Готов принимать трафик. +// +// GET /health/ready +func (s *Server) handleReadinessRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + ) + + var rawBody []byte + + var response ReadinessRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: ReadinessOperation, + OperationSummary: "Готов принимать трафик", + OperationID: "readiness", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = ReadinessRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.Readiness(ctx) + return response, err + }, + ) + } else { + response, err = s.h.Readiness(ctx) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeReadinessResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleRegisterUserRequest handles registerUser operation. +// +// Создать пользователя. +// +// POST /api/v1/users +func (s *Server) handleRegisterUserRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: RegisterUserOperation, + ID: "registerUser", + } + ) + + var rawBody []byte + request, rawBody, close, err := s.decodeRegisterUserRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response RegisterUserRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: RegisterUserOperation, + OperationSummary: "Создать пользователя", + OperationID: "registerUser", + Body: request, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = *CreateUser + Params = struct{} + Response = RegisterUserRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.RegisterUser(ctx, request) + return response, err + }, + ) + } else { + response, err = s.h.RegisterUser(ctx, request) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeRegisterUserResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + +// handleRevokeSessionRequest handles revokeSession operation. +// +// Отозвать текущую сессию. +// +// DELETE /api/v1/auth/sessions/current +func (s *Server) handleRevokeSessionRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + ctx := r.Context() + + var ( + err error + opErrContext = ogenerrors.OperationContext{ + Name: RevokeSessionOperation, + ID: "revokeSession", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, RevokeSessionOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + + var rawBody []byte + + var response RevokeSessionRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: RevokeSessionOperation, + OperationSummary: "Отозвать текущую сессию", + OperationID: "revokeSession", + Body: nil, + RawBody: rawBody, + Params: middleware.Parameters{}, + Raw: r, + } + + type ( + Request = struct{} + Params = struct{} + Response = RevokeSessionRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + nil, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.RevokeSession(ctx) + return response, err + }, + ) + } else { + response, err = s.h.RevokeSession(ctx) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodeRevokeSessionResponse(response, w); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} diff --git a/internal/transport/rest/internal/oas/oas_interfaces_gen.go b/internal/transport/rest/internal/oas/oas_interfaces_gen.go new file mode 100644 index 00000000..aa93e9de --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_interfaces_gen.go @@ -0,0 +1,46 @@ +// Code generated by ogen, DO NOT EDIT. +package oas + +type CreateChatRes interface { + createChatRes() +} + +type CreateMessageRes interface { + createMessageRes() +} + +type CreateSessionRes interface { + createSessionRes() +} + +type CurrentUserRes interface { + currentUserRes() +} + +type GetChatRes interface { + getChatRes() +} + +type ListChatsRes interface { + listChatsRes() +} + +type ListMessagesRes interface { + listMessagesRes() +} + +type LivenessRes interface { + livenessRes() +} + +type ReadinessRes interface { + readinessRes() +} + +type RegisterUserRes interface { + registerUserRes() +} + +type RevokeSessionRes interface { + revokeSessionRes() +} diff --git a/internal/transport/rest/internal/oas/oas_json_gen.go b/internal/transport/rest/internal/oas/oas_json_gen.go new file mode 100644 index 00000000..7642cbf6 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_json_gen.go @@ -0,0 +1,1676 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "math/bits" + "strconv" + + "github.com/go-faster/errors" + "github.com/go-faster/jx" + "github.com/google/uuid" + "github.com/ogen-go/ogen/json" + "github.com/ogen-go/ogen/validate" +) + +// Encode implements json.Marshaler. +func (s *Chat) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *Chat) encodeFields(e *jx.Encoder) { + { + e.FieldStart("id") + json.EncodeUUID(e, s.ID) + } + { + e.FieldStart("title") + e.Str(s.Title) + } + { + e.FieldStart("member_ids") + e.ArrStart() + for _, elem := range s.MemberIds { + json.EncodeUUID(e, elem) + } + e.ArrEnd() + } + { + e.FieldStart("created_at") + json.EncodeDateTime(e, s.CreatedAt) + } +} + +var jsonFieldsNameOfChat = [4]string{ + 0: "id", + 1: "title", + 2: "member_ids", + 3: "created_at", +} + +// Decode decodes Chat from json. +func (s *Chat) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode Chat to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := json.DecodeUUID(d) + s.ID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "title": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Title = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"title\"") + } + case "member_ids": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + s.MemberIds = make([]uuid.UUID, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem uuid.UUID + v, err := json.DecodeUUID(d) + elem = v + if err != nil { + return err + } + s.MemberIds = append(s.MemberIds, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"member_ids\"") + } + case "created_at": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := json.DecodeDateTime(d) + s.CreatedAt = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"created_at\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode Chat") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfChat) { + name = jsonFieldsNameOfChat[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *Chat) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *Chat) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *ChatPage) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *ChatPage) encodeFields(e *jx.Encoder) { + { + e.FieldStart("items") + e.ArrStart() + for _, elem := range s.Items { + elem.Encode(e) + } + e.ArrEnd() + } + { + e.FieldStart("next_cursor") + s.NextCursor.Encode(e) + } +} + +var jsonFieldsNameOfChatPage = [2]string{ + 0: "items", + 1: "next_cursor", +} + +// Decode decodes ChatPage from json. +func (s *ChatPage) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode ChatPage to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "items": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + s.Items = make([]Chat, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem Chat + if err := elem.Decode(d); err != nil { + return err + } + s.Items = append(s.Items, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"items\"") + } + case "next_cursor": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.NextCursor.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"next_cursor\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode ChatPage") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfChatPage) { + name = jsonFieldsNameOfChatPage[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *ChatPage) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *ChatPage) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *CreateChat) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *CreateChat) encodeFields(e *jx.Encoder) { + { + e.FieldStart("title") + e.Str(s.Title) + } + { + e.FieldStart("member_ids") + e.ArrStart() + for _, elem := range s.MemberIds { + json.EncodeUUID(e, elem) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfCreateChat = [2]string{ + 0: "title", + 1: "member_ids", +} + +// Decode decodes CreateChat from json. +func (s *CreateChat) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode CreateChat to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "title": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.Title = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"title\"") + } + case "member_ids": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + s.MemberIds = make([]uuid.UUID, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem uuid.UUID + v, err := json.DecodeUUID(d) + elem = v + if err != nil { + return err + } + s.MemberIds = append(s.MemberIds, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"member_ids\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode CreateChat") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfCreateChat) { + name = jsonFieldsNameOfCreateChat[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *CreateChat) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *CreateChat) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *CreateMessage) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *CreateMessage) encodeFields(e *jx.Encoder) { + { + e.FieldStart("text") + e.Str(s.Text) + } +} + +var jsonFieldsNameOfCreateMessage = [1]string{ + 0: "text", +} + +// Decode decodes CreateMessage from json. +func (s *CreateMessage) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode CreateMessage to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "text": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.Text = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"text\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode CreateMessage") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfCreateMessage) { + name = jsonFieldsNameOfCreateMessage[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *CreateMessage) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *CreateMessage) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *CreateUser) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *CreateUser) encodeFields(e *jx.Encoder) { + { + e.FieldStart("username") + e.Str(s.Username) + } + { + e.FieldStart("display_name") + e.Str(s.DisplayName) + } + { + e.FieldStart("password") + e.Str(s.Password) + } +} + +var jsonFieldsNameOfCreateUser = [3]string{ + 0: "username", + 1: "display_name", + 2: "password", +} + +// Decode decodes CreateUser from json. +func (s *CreateUser) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode CreateUser to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "username": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.Username = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"username\"") + } + case "display_name": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.DisplayName = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"display_name\"") + } + case "password": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.Password = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"password\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode CreateUser") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfCreateUser) { + name = jsonFieldsNameOfCreateUser[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *CreateUser) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *CreateUser) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *Error) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *Error) encodeFields(e *jx.Encoder) { + { + e.FieldStart("error") + s.Error.Encode(e) + } +} + +var jsonFieldsNameOfError = [1]string{ + 0: "error", +} + +// Decode decodes Error from json. +func (s *Error) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode Error to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "error": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Error.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"error\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode Error") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfError) { + name = jsonFieldsNameOfError[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *Error) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *Error) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *ErrorError) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *ErrorError) encodeFields(e *jx.Encoder) { + { + e.FieldStart("code") + s.Code.Encode(e) + } + { + e.FieldStart("message") + e.Str(s.Message) + } + { + e.FieldStart("request_id") + e.Str(s.RequestID) + } +} + +var jsonFieldsNameOfErrorError = [3]string{ + 0: "code", + 1: "message", + 2: "request_id", +} + +// Decode decodes ErrorError from json. +func (s *ErrorError) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode ErrorError to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "code": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Code.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"code\"") + } + case "message": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Message = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"message\"") + } + case "request_id": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.RequestID = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"request_id\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode ErrorError") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfErrorError) { + name = jsonFieldsNameOfErrorError[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *ErrorError) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *ErrorError) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes ErrorErrorCode as json. +func (s ErrorErrorCode) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes ErrorErrorCode from json. +func (s *ErrorErrorCode) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode ErrorErrorCode to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch ErrorErrorCode(v) { + case ErrorErrorCodeInvalidRequest: + *s = ErrorErrorCodeInvalidRequest + case ErrorErrorCodeUnauthorized: + *s = ErrorErrorCodeUnauthorized + case ErrorErrorCodeNotFound: + *s = ErrorErrorCodeNotFound + case ErrorErrorCodeConflict: + *s = ErrorErrorCodeConflict + case ErrorErrorCodePayloadTooLarge: + *s = ErrorErrorCodePayloadTooLarge + case ErrorErrorCodeUnsupportedMediaType: + *s = ErrorErrorCodeUnsupportedMediaType + case ErrorErrorCodeRateLimited: + *s = ErrorErrorCodeRateLimited + case ErrorErrorCodeUnavailable: + *s = ErrorErrorCodeUnavailable + case ErrorErrorCodeInternalError: + *s = ErrorErrorCodeInternalError + default: + *s = ErrorErrorCode(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s ErrorErrorCode) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *ErrorErrorCode) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *Health) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *Health) encodeFields(e *jx.Encoder) { + { + e.FieldStart("status") + s.Status.Encode(e) + } +} + +var jsonFieldsNameOfHealth = [1]string{ + 0: "status", +} + +// Decode decodes Health from json. +func (s *Health) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode Health to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "status": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Status.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"status\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode Health") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfHealth) { + name = jsonFieldsNameOfHealth[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *Health) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *Health) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes HealthStatus as json. +func (s HealthStatus) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes HealthStatus from json. +func (s *HealthStatus) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode HealthStatus to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch HealthStatus(v) { + case HealthStatusOk: + *s = HealthStatusOk + default: + *s = HealthStatus(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s HealthStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *HealthStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *Message) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *Message) encodeFields(e *jx.Encoder) { + { + e.FieldStart("id") + json.EncodeUUID(e, s.ID) + } + { + e.FieldStart("chat_id") + json.EncodeUUID(e, s.ChatID) + } + { + e.FieldStart("sender_id") + json.EncodeUUID(e, s.SenderID) + } + { + e.FieldStart("text") + e.Str(s.Text) + } + { + e.FieldStart("created_at") + json.EncodeDateTime(e, s.CreatedAt) + } +} + +var jsonFieldsNameOfMessage = [5]string{ + 0: "id", + 1: "chat_id", + 2: "sender_id", + 3: "text", + 4: "created_at", +} + +// Decode decodes Message from json. +func (s *Message) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode Message to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := json.DecodeUUID(d) + s.ID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "chat_id": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := json.DecodeUUID(d) + s.ChatID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"chat_id\"") + } + case "sender_id": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := json.DecodeUUID(d) + s.SenderID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"sender_id\"") + } + case "text": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := d.Str() + s.Text = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"text\"") + } + case "created_at": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + v, err := json.DecodeDateTime(d) + s.CreatedAt = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"created_at\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode Message") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00011111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMessage) { + name = jsonFieldsNameOfMessage[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *Message) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *Message) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MessagePage) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MessagePage) encodeFields(e *jx.Encoder) { + { + e.FieldStart("items") + e.ArrStart() + for _, elem := range s.Items { + elem.Encode(e) + } + e.ArrEnd() + } + { + e.FieldStart("next_cursor") + s.NextCursor.Encode(e) + } +} + +var jsonFieldsNameOfMessagePage = [2]string{ + 0: "items", + 1: "next_cursor", +} + +// Decode decodes MessagePage from json. +func (s *MessagePage) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MessagePage to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "items": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + s.Items = make([]Message, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem Message + if err := elem.Decode(d); err != nil { + return err + } + s.Items = append(s.Items, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"items\"") + } + case "next_cursor": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.NextCursor.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"next_cursor\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MessagePage") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMessagePage) { + name = jsonFieldsNameOfMessagePage[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MessagePage) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MessagePage) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes string as json. +func (o NilString) Encode(e *jx.Encoder) { + if o.Null { + e.Null() + return + } + e.Str(string(o.Value)) +} + +// Decode decodes string from json. +func (o *NilString) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode NilString to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v string + o.Value = v + o.Null = true + return nil + } + o.Null = false + v, err := d.Str() + if err != nil { + return err + } + o.Value = string(v) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s NilString) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *NilString) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *Session) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *Session) encodeFields(e *jx.Encoder) { + { + e.FieldStart("token") + e.Str(s.Token) + } + { + e.FieldStart("token_type") + e.Str("Bearer") + } + { + e.FieldStart("expires_at") + json.EncodeDateTime(e, s.ExpiresAt) + } + { + e.FieldStart("user") + s.User.Encode(e) + } +} + +var jsonFieldsNameOfSession = [4]string{ + 0: "token", + 1: "token_type", + 2: "expires_at", + 3: "user", +} + +// Decode decodes Session from json. +func (s *Session) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode Session to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "token": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Str() + s.Token = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"token\"") + } + case "token_type": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.TokenType = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"token_type\"") + } + case "expires_at": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := json.DecodeDateTime(d) + s.ExpiresAt = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"expires_at\"") + } + case "user": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.User.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"user\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode Session") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfSession) { + name = jsonFieldsNameOfSession[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *Session) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *Session) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *User) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *User) encodeFields(e *jx.Encoder) { + { + e.FieldStart("id") + json.EncodeUUID(e, s.ID) + } + { + e.FieldStart("username") + e.Str(s.Username) + } + { + e.FieldStart("display_name") + e.Str(s.DisplayName) + } + { + e.FieldStart("created_at") + json.EncodeDateTime(e, s.CreatedAt) + } +} + +var jsonFieldsNameOfUser = [4]string{ + 0: "id", + 1: "username", + 2: "display_name", + 3: "created_at", +} + +// Decode decodes User from json. +func (s *User) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode User to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := json.DecodeUUID(d) + s.ID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "username": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.Username = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"username\"") + } + case "display_name": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + v, err := d.Str() + s.DisplayName = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"display_name\"") + } + case "created_at": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + v, err := json.DecodeDateTime(d) + s.CreatedAt = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"created_at\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode User") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfUser) { + name = jsonFieldsNameOfUser[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *User) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *User) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} diff --git a/internal/transport/rest/internal/oas/oas_middleware_gen.go b/internal/transport/rest/internal/oas/oas_middleware_gen.go new file mode 100644 index 00000000..7ba299f2 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_middleware_gen.go @@ -0,0 +1,10 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "github.com/ogen-go/ogen/middleware" +) + +// Middleware is middleware type. +type Middleware = middleware.Middleware diff --git a/internal/transport/rest/internal/oas/oas_operations_gen.go b/internal/transport/rest/internal/oas/oas_operations_gen.go new file mode 100644 index 00000000..b182d0a6 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_operations_gen.go @@ -0,0 +1,20 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +// OperationName is the ogen operation name +type OperationName = string + +const ( + CreateChatOperation OperationName = "CreateChat" + CreateMessageOperation OperationName = "CreateMessage" + CreateSessionOperation OperationName = "CreateSession" + CurrentUserOperation OperationName = "CurrentUser" + GetChatOperation OperationName = "GetChat" + ListChatsOperation OperationName = "ListChats" + ListMessagesOperation OperationName = "ListMessages" + LivenessOperation OperationName = "Liveness" + ReadinessOperation OperationName = "Readiness" + RegisterUserOperation OperationName = "RegisterUser" + RevokeSessionOperation OperationName = "RevokeSession" +) diff --git a/internal/transport/rest/internal/oas/oas_parameters_gen.go b/internal/transport/rest/internal/oas/oas_parameters_gen.go new file mode 100644 index 00000000..814390eb --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_parameters_gen.go @@ -0,0 +1,610 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "net/http" + "net/url" + + "github.com/go-faster/errors" + "github.com/google/uuid" + "github.com/ogen-go/ogen/conv" + "github.com/ogen-go/ogen/middleware" + "github.com/ogen-go/ogen/ogenerrors" + "github.com/ogen-go/ogen/uri" + "github.com/ogen-go/ogen/validate" +) + +// CreateMessageParams is parameters of createMessage operation. +type CreateMessageParams struct { + ChatID uuid.UUID + // Обязателен с lab3. Область: пользователь + метод + путь + + // ключ; хранить результат не менее 24 ч. Повтор того же JSON + // возвращает исходный 201 и то же сообщение, другой JSON — + // 409. + IdempotencyKey string +} + +func unpackCreateMessageParams(packed middleware.Parameters) (params CreateMessageParams) { + { + key := middleware.ParameterKey{ + Name: "chat_id", + In: "path", + } + params.ChatID = packed[key].(uuid.UUID) + } + { + key := middleware.ParameterKey{ + Name: "Idempotency-Key", + In: "header", + } + params.IdempotencyKey = packed[key].(string) + } + return params +} + +func decodeCreateMessageParams(args [1]string, argsEscaped bool, r *http.Request) (params CreateMessageParams, _ error) { + h := uri.NewHeaderDecoder(r.Header) + // Decode path: chat_id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "chat_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUUID(val) + if err != nil { + return err + } + + params.ChatID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "chat_id", + In: "path", + Err: err, + } + } + // Decode header: Idempotency-Key. + if err := func() error { + cfg := uri.HeaderParameterDecodingConfig{ + Name: "Idempotency-Key", + Explode: false, + } + if err := h.HasParam(cfg); err == nil { + if err := h.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.IdempotencyKey = c + return nil + }); err != nil { + return err + } + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 128, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: regexMap["^[A-Za-z0-9._:-]+$"], + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(params.IdempotencyKey)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } else { + return err + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "Idempotency-Key", + In: "header", + Err: err, + } + } + return params, nil +} + +// GetChatParams is parameters of getChat operation. +type GetChatParams struct { + ChatID uuid.UUID +} + +func unpackGetChatParams(packed middleware.Parameters) (params GetChatParams) { + { + key := middleware.ParameterKey{ + Name: "chat_id", + In: "path", + } + params.ChatID = packed[key].(uuid.UUID) + } + return params +} + +func decodeGetChatParams(args [1]string, argsEscaped bool, r *http.Request) (params GetChatParams, _ error) { + // Decode path: chat_id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "chat_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUUID(val) + if err != nil { + return err + } + + params.ChatID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "chat_id", + In: "path", + Err: err, + } + } + return params, nil +} + +// ListChatsParams is parameters of listChats operation. +type ListChatsParams struct { + Limit OptInt `json:",omitempty,omitzero"` + Cursor OptString `json:",omitempty,omitzero"` +} + +func unpackListChatsParams(packed middleware.Parameters) (params ListChatsParams) { + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + if v, ok := packed[key]; ok { + params.Limit = v.(OptInt) + } + } + { + key := middleware.ParameterKey{ + Name: "cursor", + In: "query", + } + if v, ok := packed[key]; ok { + params.Cursor = v.(OptString) + } + } + return params +} + +func decodeListChatsParams(args [0]string, argsEscaped bool, r *http.Request) (params ListChatsParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Set default value for query: limit. + { + val := int(50) + params.Limit.SetTo(val) + } + // Decode query: limit. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotLimitVal int + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt(val) + if err != nil { + return err + } + + paramsDotLimitVal = c + return nil + }(); err != nil { + return err + } + params.Limit.SetTo(paramsDotLimitVal) + return nil + }); err != nil { + return err + } + if err := func() error { + if value, ok := params.Limit.Get(); ok { + if err := func() error { + if err := (validate.Int{ + MinSet: true, + Min: 1, + MaxSet: true, + Max: 100, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + Pattern: nil, + }).Validate(int64(value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "limit", + In: "query", + Err: err, + } + } + // Decode query: cursor. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "cursor", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotCursorVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + paramsDotCursorVal = c + return nil + }(); err != nil { + return err + } + params.Cursor.SetTo(paramsDotCursorVal) + return nil + }); err != nil { + return err + } + if err := func() error { + if value, ok := params.Cursor.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "cursor", + In: "query", + Err: err, + } + } + return params, nil +} + +// ListMessagesParams is parameters of listMessages operation. +type ListMessagesParams struct { + ChatID uuid.UUID + Limit OptInt `json:",omitempty,omitzero"` + Cursor OptString `json:",omitempty,omitzero"` +} + +func unpackListMessagesParams(packed middleware.Parameters) (params ListMessagesParams) { + { + key := middleware.ParameterKey{ + Name: "chat_id", + In: "path", + } + params.ChatID = packed[key].(uuid.UUID) + } + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + if v, ok := packed[key]; ok { + params.Limit = v.(OptInt) + } + } + { + key := middleware.ParameterKey{ + Name: "cursor", + In: "query", + } + if v, ok := packed[key]; ok { + params.Cursor = v.(OptString) + } + } + return params +} + +func decodeListMessagesParams(args [1]string, argsEscaped bool, r *http.Request) (params ListMessagesParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + // Decode path: chat_id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "chat_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUUID(val) + if err != nil { + return err + } + + params.ChatID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "chat_id", + In: "path", + Err: err, + } + } + // Set default value for query: limit. + { + val := int(50) + params.Limit.SetTo(val) + } + // Decode query: limit. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotLimitVal int + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt(val) + if err != nil { + return err + } + + paramsDotLimitVal = c + return nil + }(); err != nil { + return err + } + params.Limit.SetTo(paramsDotLimitVal) + return nil + }); err != nil { + return err + } + if err := func() error { + if value, ok := params.Limit.Get(); ok { + if err := func() error { + if err := (validate.Int{ + MinSet: true, + Min: 1, + MaxSet: true, + Max: 100, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + Pattern: nil, + }).Validate(int64(value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "limit", + In: "query", + Err: err, + } + } + // Decode query: cursor. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "cursor", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotCursorVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + paramsDotCursorVal = c + return nil + }(); err != nil { + return err + } + params.Cursor.SetTo(paramsDotCursorVal) + return nil + }); err != nil { + return err + } + if err := func() error { + if value, ok := params.Cursor.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "cursor", + In: "query", + Err: err, + } + } + return params, nil +} diff --git a/internal/transport/rest/internal/oas/oas_request_decoders_gen.go b/internal/transport/rest/internal/oas/oas_request_decoders_gen.go new file mode 100644 index 00000000..72c6b1bd --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_request_decoders_gen.go @@ -0,0 +1,252 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "bytes" + "io" + "mime" + "net/http" + + "github.com/go-faster/errors" + "github.com/go-faster/jx" + "github.com/ogen-go/ogen/ogenerrors" + "github.com/ogen-go/ogen/validate" +) + +func (s *Server) decodeCreateChatRequest(r *http.Request) ( + req *CreateChat, + rawBody []byte, + close func() error, + rerr error, +) { + var closers []func() error + close = func() error { + var merr error + // Close in reverse order, to match defer behavior. + for i := len(closers) - 1; i >= 0; i-- { + c := closers[i] + merr = errors.Join(merr, c()) + } + return merr + } + defer func() { + if rerr != nil { + rerr = errors.Join(rerr, close()) + } + }() + ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return req, rawBody, close, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + if r.ContentLength == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + buf, err := io.ReadAll(r.Body) + defer func() { + _ = r.Body.Close() + }() + if err != nil { + return req, rawBody, close, err + } + + // Reset the body to allow for downstream reading. + r.Body = io.NopCloser(bytes.NewBuffer(buf)) + + if len(buf) == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + + rawBody = append(rawBody, buf...) + d := jx.DecodeBytes(buf) + + var request CreateChat + if err := func() error { + if err := request.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return req, rawBody, close, err + } + if err := func() error { + if err := request.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return req, rawBody, close, errors.Wrap(err, "validate") + } + return &request, rawBody, close, nil + default: + return req, rawBody, close, validate.InvalidContentType(ct) + } +} + +func (s *Server) decodeCreateMessageRequest(r *http.Request) ( + req *CreateMessage, + rawBody []byte, + close func() error, + rerr error, +) { + var closers []func() error + close = func() error { + var merr error + // Close in reverse order, to match defer behavior. + for i := len(closers) - 1; i >= 0; i-- { + c := closers[i] + merr = errors.Join(merr, c()) + } + return merr + } + defer func() { + if rerr != nil { + rerr = errors.Join(rerr, close()) + } + }() + ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return req, rawBody, close, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + if r.ContentLength == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + buf, err := io.ReadAll(r.Body) + defer func() { + _ = r.Body.Close() + }() + if err != nil { + return req, rawBody, close, err + } + + // Reset the body to allow for downstream reading. + r.Body = io.NopCloser(bytes.NewBuffer(buf)) + + if len(buf) == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + + rawBody = append(rawBody, buf...) + d := jx.DecodeBytes(buf) + + var request CreateMessage + if err := func() error { + if err := request.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return req, rawBody, close, err + } + if err := func() error { + if err := request.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return req, rawBody, close, errors.Wrap(err, "validate") + } + return &request, rawBody, close, nil + default: + return req, rawBody, close, validate.InvalidContentType(ct) + } +} + +func (s *Server) decodeRegisterUserRequest(r *http.Request) ( + req *CreateUser, + rawBody []byte, + close func() error, + rerr error, +) { + var closers []func() error + close = func() error { + var merr error + // Close in reverse order, to match defer behavior. + for i := len(closers) - 1; i >= 0; i-- { + c := closers[i] + merr = errors.Join(merr, c()) + } + return merr + } + defer func() { + if rerr != nil { + rerr = errors.Join(rerr, close()) + } + }() + ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return req, rawBody, close, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + if r.ContentLength == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + buf, err := io.ReadAll(r.Body) + defer func() { + _ = r.Body.Close() + }() + if err != nil { + return req, rawBody, close, err + } + + // Reset the body to allow for downstream reading. + r.Body = io.NopCloser(bytes.NewBuffer(buf)) + + if len(buf) == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + + rawBody = append(rawBody, buf...) + d := jx.DecodeBytes(buf) + + var request CreateUser + if err := func() error { + if err := request.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return req, rawBody, close, err + } + if err := func() error { + if err := request.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return req, rawBody, close, errors.Wrap(err, "validate") + } + return &request, rawBody, close, nil + default: + return req, rawBody, close, validate.InvalidContentType(ct) + } +} diff --git a/internal/transport/rest/internal/oas/oas_response_encoders_gen.go b/internal/transport/rest/internal/oas/oas_response_encoders_gen.go new file mode 100644 index 00000000..3ffd6b6d --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_response_encoders_gen.go @@ -0,0 +1,3627 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "net/http" + + "github.com/go-faster/errors" + "github.com/go-faster/jx" + "github.com/ogen-go/ogen/conv" + "github.com/ogen-go/ogen/uri" +) + +func encodeCreateChatResponse(response CreateChatRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *ChatHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(201) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateChatBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateChatNotFound: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateChatConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateChatInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateChatServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeCreateMessageResponse(response CreateMessageRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *MessageHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(201) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateMessageBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateMessageNotFound: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateMessageConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateMessageInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateMessageServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeCreateSessionResponse(response CreateSessionRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *SessionHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(201) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeCurrentUserResponse(response CurrentUserRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *UserHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CurrentUserBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CurrentUserNotFound: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CurrentUserConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CurrentUserInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CurrentUserServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeGetChatResponse(response GetChatRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *ChatHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *GetChatBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *GetChatNotFound: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *GetChatConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *GetChatInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *GetChatServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeListChatsResponse(response ListChatsRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *ChatPageHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListChatsBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListChatsNotFound: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListChatsConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListChatsInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListChatsServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeListMessagesResponse(response ListMessagesRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *MessagePageHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListMessagesBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListMessagesNotFound: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListMessagesConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListMessagesInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ListMessagesServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeLivenessResponse(response LivenessRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *HealthHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ErrorHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeReadinessResponse(response ReadinessRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *HealthHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ReadinessInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ReadinessServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeRegisterUserResponse(response RegisterUserRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *UserHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(201) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *RegisterUserBadRequest: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *RegisterUserConflict: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(409) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *RegisterUserInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *RegisterUserServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + +func encodeRevokeSessionResponse(response RevokeSessionRes, w http.ResponseWriter) error { + switch response := response.(type) { + case *RevokeSessionNoContent: + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(204) + + return nil + + case *CreateSessionUnauthorizedHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Www-Authenticate,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "WWW-Authenticate" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "WWW-Authenticate", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.WWWAuthenticate.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode WWW-Authenticate header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *CreateSessionTooManyRequestsHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "Retry-After,X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Retry-After" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Retry-After", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.RetryAfter.Get(); ok { + return e.EncodeValue(conv.IntToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode Retry-After header") + } + } + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(429) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *RevokeSessionInternalServerError: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(500) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *RevokeSessionServiceUnavailable: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Access-Control-Expose-Headers", "X-Instance-Id,X-Request-Id") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "X-Instance-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Instance-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XInstanceID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Instance-Id header") + } + } + // Encode "X-Request-Id" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "X-Request-Id", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + if val, ok := response.XRequestID.Get(); ok { + return e.EncodeValue(conv.StringToString(val)) + } + return nil + }); err != nil { + return errors.Wrap(err, "encode X-Request-Id header") + } + } + } + w.WriteHeader(503) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} diff --git a/internal/transport/rest/internal/oas/oas_router_gen.go b/internal/transport/rest/internal/oas/oas_router_gen.go new file mode 100644 index 00000000..a14efa17 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_router_gen.go @@ -0,0 +1,755 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "net/http" + "net/url" + "strings" + + "github.com/ogen-go/ogen/uri" +) + +var ( + rn6AllowedHeaders = map[string]string{ + "POST": "Authorization", + } + rn13AllowedHeaders = map[string]string{ + "DELETE": "Authorization", + } + rn1AllowedHeaders = map[string]string{ + "GET": "Authorization", + "POST": "Authorization,Content-Type", + } + rn3AllowedHeaders = map[string]string{ + "GET": "Authorization", + } + rn4AllowedHeaders = map[string]string{ + "GET": "Authorization", + "POST": "Authorization,Content-Type,Idempotency-Key", + } + rn12AllowedHeaders = map[string]string{ + "POST": "Content-Type", + } + rn7AllowedHeaders = map[string]string{ + "GET": "Authorization", + } +) + +func (s *Server) cutPrefix(path string) (string, bool) { + prefix := s.cfg.Prefix + if prefix == "" { + return path, true + } + if !strings.HasPrefix(path, prefix) { + // Prefix doesn't match. + return "", false + } + // Cut prefix from the path. + return strings.TrimPrefix(path, prefix), true +} + +// ServeHTTP serves http request as defined by OpenAPI v3 specification, +// calling handler that matches the path or returning not found error. +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + elem := r.URL.Path + elemIsEscaped := false + if rawPath := r.URL.RawPath; rawPath != "" { + if normalized, ok := uri.NormalizeEscapedPath(rawPath); ok { + elem = normalized + elemIsEscaped = strings.ContainsRune(elem, '%') + } + } + + elem, ok := s.cutPrefix(elem) + if !ok || len(elem) == 0 { + s.notFound(w, r) + return + } + args := [1]string{} + + // Static code generated router with unwrapped path search. + switch { + default: + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/" + + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "api/v1/" + + if l := len("api/v1/"); len(elem) >= l && elem[0:l] == "api/v1/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "auth/sessions" + + if l := len("auth/sessions"); len(elem) >= l && elem[0:l] == "auth/sessions" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch r.Method { + case "POST": + s.handleCreateSessionRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "POST", + allowedHeaders: rn6AllowedHeaders, + acceptPost: "", + acceptPatch: "", + }) + } + + return + } + switch elem[0] { + case '/': // Prefix: "/current" + + if l := len("/current"); len(elem) >= l && elem[0:l] == "/current" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "DELETE": + s.handleRevokeSessionRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "DELETE", + allowedHeaders: rn13AllowedHeaders, + acceptPost: "", + acceptPatch: "", + }) + } + + return + } + + } + + case 'c': // Prefix: "chats" + + if l := len("chats"); len(elem) >= l && elem[0:l] == "chats" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch r.Method { + case "GET": + s.handleListChatsRequest([0]string{}, elemIsEscaped, w, r) + case "POST": + s.handleCreateChatRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "GET,POST", + allowedHeaders: rn1AllowedHeaders, + acceptPost: "application/json", + acceptPatch: "", + }) + } + + return + } + switch elem[0] { + case '/': // Prefix: "/" + + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + // Param: "chat_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + switch r.Method { + case "GET": + s.handleGetChatRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "GET", + allowedHeaders: rn3AllowedHeaders, + acceptPost: "", + acceptPatch: "", + }) + } + + return + } + switch elem[0] { + case '/': // Prefix: "/messages" + + if l := len("/messages"); len(elem) >= l && elem[0:l] == "/messages" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleListMessagesRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + case "POST": + s.handleCreateMessageRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "GET,POST", + allowedHeaders: rn4AllowedHeaders, + acceptPost: "application/json", + acceptPatch: "", + }) + } + + return + } + + } + + } + + case 'u': // Prefix: "users" + + if l := len("users"); len(elem) >= l && elem[0:l] == "users" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch r.Method { + case "POST": + s.handleRegisterUserRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "POST", + allowedHeaders: rn12AllowedHeaders, + acceptPost: "application/json", + acceptPatch: "", + }) + } + + return + } + switch elem[0] { + case '/': // Prefix: "/me" + + if l := len("/me"); len(elem) >= l && elem[0:l] == "/me" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleCurrentUserRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "GET", + allowedHeaders: rn7AllowedHeaders, + acceptPost: "", + acceptPatch: "", + }) + } + + return + } + + } + + } + + case 'h': // Prefix: "health/" + + if l := len("health/"); len(elem) >= l && elem[0:l] == "health/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'l': // Prefix: "live" + + if l := len("live"); len(elem) >= l && elem[0:l] == "live" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleLivenessRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "GET", + allowedHeaders: nil, + acceptPost: "", + acceptPatch: "", + }) + } + + return + } + + case 'r': // Prefix: "ready" + + if l := len("ready"); len(elem) >= l && elem[0:l] == "ready" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleReadinessRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "GET", + allowedHeaders: nil, + acceptPost: "", + acceptPatch: "", + }) + } + + return + } + + } + + } + + } + } + s.notFound(w, r) +} + +// Route is route object. +type Route struct { + name string + summary string + operationID string + operationGroup string + pathPattern string + count int + args [1]string +} + +// Name returns ogen operation name. +// +// It is guaranteed to be unique and not empty. +func (r Route) Name() string { + return r.name +} + +// Summary returns OpenAPI summary. +func (r Route) Summary() string { + return r.summary +} + +// OperationID returns OpenAPI operationId. +func (r Route) OperationID() string { + return r.operationID +} + +// OperationGroup returns the x-ogen-operation-group value. +func (r Route) OperationGroup() string { + return r.operationGroup +} + +// PathPattern returns OpenAPI path. +func (r Route) PathPattern() string { + return r.pathPattern +} + +// Args returns parsed arguments. +func (r Route) Args() []string { + return r.args[:r.count] +} + +// FindRoute finds Route for given method and path. +// +// Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead. +func (s *Server) FindRoute(method, path string) (Route, bool) { + return s.FindPath(method, &url.URL{Path: path}) +} + +// FindPath finds Route for given method and URL. +func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { + var ( + elem = u.Path + args = r.args + ) + if rawPath := u.RawPath; rawPath != "" { + if normalized, ok := uri.NormalizeEscapedPath(rawPath); ok { + elem = normalized + } + defer func() { + for i, arg := range r.args[:r.count] { + if unescaped, err := url.PathUnescape(arg); err == nil { + r.args[i] = unescaped + } + } + }() + } + + elem, ok := s.cutPrefix(elem) + if !ok { + return r, false + } + + // Static code generated router with unwrapped path search. + switch { + default: + if len(elem) == 0 { + break + } + switch elem[0] { + case '/': // Prefix: "/" + + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "api/v1/" + + if l := len("api/v1/"); len(elem) >= l && elem[0:l] == "api/v1/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'a': // Prefix: "auth/sessions" + + if l := len("auth/sessions"); len(elem) >= l && elem[0:l] == "auth/sessions" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + r.name = CreateSessionOperation + r.summary = "Вход: Basic username:password; выдаёт сессию" + r.operationID = "createSession" + r.operationGroup = "" + r.pathPattern = "/api/v1/auth/sessions" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/current" + + if l := len("/current"); len(elem) >= l && elem[0:l] == "/current" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "DELETE": + r.name = RevokeSessionOperation + r.summary = "Отозвать текущую сессию" + r.operationID = "revokeSession" + r.operationGroup = "" + r.pathPattern = "/api/v1/auth/sessions/current" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + + } + + case 'c': // Prefix: "chats" + + if l := len("chats"); len(elem) >= l && elem[0:l] == "chats" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + r.name = ListChatsOperation + r.summary = "Чаты текущего пользователя" + r.operationID = "listChats" + r.operationGroup = "" + r.pathPattern = "/api/v1/chats" + r.args = args + r.count = 0 + return r, true + case "POST": + r.name = CreateChatOperation + r.summary = "Создать чат; вызывающий должен входить в member_ids" + r.operationID = "createChat" + r.operationGroup = "" + r.pathPattern = "/api/v1/chats" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/" + + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + elem = elem[l:] + } else { + break + } + + // Param: "chat_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + + if len(elem) == 0 { + switch method { + case "GET": + r.name = GetChatOperation + r.summary = "Получить доступный чат" + r.operationID = "getChat" + r.operationGroup = "" + r.pathPattern = "/api/v1/chats/{chat_id}" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/messages" + + if l := len("/messages"); len(elem) >= l && elem[0:l] == "/messages" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "GET": + r.name = ListMessagesOperation + r.summary = "Сообщения по (created_at, id) по возрастанию" + r.operationID = "listMessages" + r.operationGroup = "" + r.pathPattern = "/api/v1/chats/{chat_id}/messages" + r.args = args + r.count = 1 + return r, true + case "POST": + r.name = CreateMessageOperation + r.summary = "Отправить сообщение" + r.operationID = "createMessage" + r.operationGroup = "" + r.pathPattern = "/api/v1/chats/{chat_id}/messages" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + + } + + } + + case 'u': // Prefix: "users" + + if l := len("users"); len(elem) >= l && elem[0:l] == "users" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + r.name = RegisterUserOperation + r.summary = "Создать пользователя" + r.operationID = "registerUser" + r.operationGroup = "" + r.pathPattern = "/api/v1/users" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + switch elem[0] { + case '/': // Prefix: "/me" + + if l := len("/me"); len(elem) >= l && elem[0:l] == "/me" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "GET": + r.name = CurrentUserOperation + r.summary = "Текущий пользователь" + r.operationID = "currentUser" + r.operationGroup = "" + r.pathPattern = "/api/v1/users/me" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + + } + + } + + case 'h': // Prefix: "health/" + + if l := len("health/"); len(elem) >= l && elem[0:l] == "health/" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + break + } + switch elem[0] { + case 'l': // Prefix: "live" + + if l := len("live"); len(elem) >= l && elem[0:l] == "live" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "GET": + r.name = LivenessOperation + r.summary = "Процесс жив" + r.operationID = "liveness" + r.operationGroup = "" + r.pathPattern = "/health/live" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + + case 'r': // Prefix: "ready" + + if l := len("ready"); len(elem) >= l && elem[0:l] == "ready" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "GET": + r.name = ReadinessOperation + r.summary = "Готов принимать трафик" + r.operationID = "readiness" + r.operationGroup = "" + r.pathPattern = "/health/ready" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + + } + + } + + } + } + return r, false +} diff --git a/internal/transport/rest/internal/oas/oas_schemas_gen.go b/internal/transport/rest/internal/oas/oas_schemas_gen.go new file mode 100644 index 00000000..75f4a280 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_schemas_gen.go @@ -0,0 +1,1353 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "time" + + "github.com/go-faster/errors" + "github.com/google/uuid" +) + +type BasicAuth struct { + Username string + Password string + Roles []string +} + +// GetUsername returns the value of Username. +func (s *BasicAuth) GetUsername() string { + return s.Username +} + +// GetPassword returns the value of Password. +func (s *BasicAuth) GetPassword() string { + return s.Password +} + +// GetRoles returns the value of Roles. +func (s *BasicAuth) GetRoles() []string { + return s.Roles +} + +// SetUsername sets the value of Username. +func (s *BasicAuth) SetUsername(val string) { + s.Username = val +} + +// SetPassword sets the value of Password. +func (s *BasicAuth) SetPassword(val string) { + s.Password = val +} + +// SetRoles sets the value of Roles. +func (s *BasicAuth) SetRoles(val []string) { + s.Roles = val +} + +type BearerAuth struct { + Token string + Roles []string +} + +// GetToken returns the value of Token. +func (s *BearerAuth) GetToken() string { + return s.Token +} + +// GetRoles returns the value of Roles. +func (s *BearerAuth) GetRoles() []string { + return s.Roles +} + +// SetToken sets the value of Token. +func (s *BearerAuth) SetToken(val string) { + s.Token = val +} + +// SetRoles sets the value of Roles. +func (s *BearerAuth) SetRoles(val []string) { + s.Roles = val +} + +// Ref: #/components/schemas/Chat +type Chat struct { + ID uuid.UUID `json:"id"` + Title string `json:"title"` + MemberIds []uuid.UUID `json:"member_ids"` + CreatedAt time.Time `json:"created_at"` +} + +// GetID returns the value of ID. +func (s *Chat) GetID() uuid.UUID { + return s.ID +} + +// GetTitle returns the value of Title. +func (s *Chat) GetTitle() string { + return s.Title +} + +// GetMemberIds returns the value of MemberIds. +func (s *Chat) GetMemberIds() []uuid.UUID { + return s.MemberIds +} + +// GetCreatedAt returns the value of CreatedAt. +func (s *Chat) GetCreatedAt() time.Time { + return s.CreatedAt +} + +// SetID sets the value of ID. +func (s *Chat) SetID(val uuid.UUID) { + s.ID = val +} + +// SetTitle sets the value of Title. +func (s *Chat) SetTitle(val string) { + s.Title = val +} + +// SetMemberIds sets the value of MemberIds. +func (s *Chat) SetMemberIds(val []uuid.UUID) { + s.MemberIds = val +} + +// SetCreatedAt sets the value of CreatedAt. +func (s *Chat) SetCreatedAt(val time.Time) { + s.CreatedAt = val +} + +// ChatHeaders wraps Chat with response headers. +type ChatHeaders struct { + XInstanceID OptString + XRequestID OptString + Response Chat +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *ChatHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *ChatHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *ChatHeaders) GetResponse() Chat { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *ChatHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *ChatHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *ChatHeaders) SetResponse(val Chat) { + s.Response = val +} + +func (*ChatHeaders) createChatRes() {} +func (*ChatHeaders) getChatRes() {} + +// Ref: #/components/schemas/ChatPage +type ChatPage struct { + Items []Chat `json:"items"` + NextCursor NilString `json:"next_cursor"` +} + +// GetItems returns the value of Items. +func (s *ChatPage) GetItems() []Chat { + return s.Items +} + +// GetNextCursor returns the value of NextCursor. +func (s *ChatPage) GetNextCursor() NilString { + return s.NextCursor +} + +// SetItems sets the value of Items. +func (s *ChatPage) SetItems(val []Chat) { + s.Items = val +} + +// SetNextCursor sets the value of NextCursor. +func (s *ChatPage) SetNextCursor(val NilString) { + s.NextCursor = val +} + +// ChatPageHeaders wraps ChatPage with response headers. +type ChatPageHeaders struct { + XInstanceID OptString + XRequestID OptString + Response ChatPage +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *ChatPageHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *ChatPageHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *ChatPageHeaders) GetResponse() ChatPage { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *ChatPageHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *ChatPageHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *ChatPageHeaders) SetResponse(val ChatPage) { + s.Response = val +} + +func (*ChatPageHeaders) listChatsRes() {} + +// Ref: #/components/schemas/CreateChat +type CreateChat struct { + Title string `json:"title"` + MemberIds []uuid.UUID `json:"member_ids"` +} + +// GetTitle returns the value of Title. +func (s *CreateChat) GetTitle() string { + return s.Title +} + +// GetMemberIds returns the value of MemberIds. +func (s *CreateChat) GetMemberIds() []uuid.UUID { + return s.MemberIds +} + +// SetTitle sets the value of Title. +func (s *CreateChat) SetTitle(val string) { + s.Title = val +} + +// SetMemberIds sets the value of MemberIds. +func (s *CreateChat) SetMemberIds(val []uuid.UUID) { + s.MemberIds = val +} + +type CreateChatBadRequest ErrorHeaders + +func (*CreateChatBadRequest) createChatRes() {} + +type CreateChatConflict ErrorHeaders + +func (*CreateChatConflict) createChatRes() {} + +type CreateChatInternalServerError ErrorHeaders + +func (*CreateChatInternalServerError) createChatRes() {} + +type CreateChatNotFound ErrorHeaders + +func (*CreateChatNotFound) createChatRes() {} + +type CreateChatServiceUnavailable ErrorHeaders + +func (*CreateChatServiceUnavailable) createChatRes() {} + +// Ref: #/components/schemas/CreateMessage +type CreateMessage struct { + Text string `json:"text"` +} + +// GetText returns the value of Text. +func (s *CreateMessage) GetText() string { + return s.Text +} + +// SetText sets the value of Text. +func (s *CreateMessage) SetText(val string) { + s.Text = val +} + +type CreateMessageBadRequest ErrorHeaders + +func (*CreateMessageBadRequest) createMessageRes() {} + +type CreateMessageConflict ErrorHeaders + +func (*CreateMessageConflict) createMessageRes() {} + +type CreateMessageInternalServerError ErrorHeaders + +func (*CreateMessageInternalServerError) createMessageRes() {} + +type CreateMessageNotFound ErrorHeaders + +func (*CreateMessageNotFound) createMessageRes() {} + +type CreateMessageServiceUnavailable ErrorHeaders + +func (*CreateMessageServiceUnavailable) createMessageRes() {} + +type CreateSessionBadRequest ErrorHeaders + +func (*CreateSessionBadRequest) createSessionRes() {} + +type CreateSessionInternalServerError ErrorHeaders + +func (*CreateSessionInternalServerError) createSessionRes() {} + +type CreateSessionServiceUnavailable ErrorHeaders + +func (*CreateSessionServiceUnavailable) createSessionRes() {} + +// CreateSessionTooManyRequestsHeaders wraps Error with response headers. +type CreateSessionTooManyRequestsHeaders struct { + RetryAfter OptInt + XInstanceID OptString + XRequestID OptString + Response Error +} + +// GetRetryAfter returns the value of RetryAfter. +func (s *CreateSessionTooManyRequestsHeaders) GetRetryAfter() OptInt { + return s.RetryAfter +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *CreateSessionTooManyRequestsHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *CreateSessionTooManyRequestsHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *CreateSessionTooManyRequestsHeaders) GetResponse() Error { + return s.Response +} + +// SetRetryAfter sets the value of RetryAfter. +func (s *CreateSessionTooManyRequestsHeaders) SetRetryAfter(val OptInt) { + s.RetryAfter = val +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *CreateSessionTooManyRequestsHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *CreateSessionTooManyRequestsHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *CreateSessionTooManyRequestsHeaders) SetResponse(val Error) { + s.Response = val +} + +func (*CreateSessionTooManyRequestsHeaders) createChatRes() {} +func (*CreateSessionTooManyRequestsHeaders) createMessageRes() {} +func (*CreateSessionTooManyRequestsHeaders) createSessionRes() {} +func (*CreateSessionTooManyRequestsHeaders) currentUserRes() {} +func (*CreateSessionTooManyRequestsHeaders) getChatRes() {} +func (*CreateSessionTooManyRequestsHeaders) listChatsRes() {} +func (*CreateSessionTooManyRequestsHeaders) listMessagesRes() {} +func (*CreateSessionTooManyRequestsHeaders) registerUserRes() {} +func (*CreateSessionTooManyRequestsHeaders) revokeSessionRes() {} + +// CreateSessionUnauthorizedHeaders wraps Error with response headers. +type CreateSessionUnauthorizedHeaders struct { + WWWAuthenticate OptString + XInstanceID OptString + XRequestID OptString + Response Error +} + +// GetWWWAuthenticate returns the value of WWWAuthenticate. +func (s *CreateSessionUnauthorizedHeaders) GetWWWAuthenticate() OptString { + return s.WWWAuthenticate +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *CreateSessionUnauthorizedHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *CreateSessionUnauthorizedHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *CreateSessionUnauthorizedHeaders) GetResponse() Error { + return s.Response +} + +// SetWWWAuthenticate sets the value of WWWAuthenticate. +func (s *CreateSessionUnauthorizedHeaders) SetWWWAuthenticate(val OptString) { + s.WWWAuthenticate = val +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *CreateSessionUnauthorizedHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *CreateSessionUnauthorizedHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *CreateSessionUnauthorizedHeaders) SetResponse(val Error) { + s.Response = val +} + +func (*CreateSessionUnauthorizedHeaders) createChatRes() {} +func (*CreateSessionUnauthorizedHeaders) createMessageRes() {} +func (*CreateSessionUnauthorizedHeaders) createSessionRes() {} +func (*CreateSessionUnauthorizedHeaders) currentUserRes() {} +func (*CreateSessionUnauthorizedHeaders) getChatRes() {} +func (*CreateSessionUnauthorizedHeaders) listChatsRes() {} +func (*CreateSessionUnauthorizedHeaders) listMessagesRes() {} +func (*CreateSessionUnauthorizedHeaders) revokeSessionRes() {} + +// Ref: #/components/schemas/CreateUser +type CreateUser struct { + Username string `json:"username"` + DisplayName string `json:"display_name"` + Password string `json:"password"` +} + +// GetUsername returns the value of Username. +func (s *CreateUser) GetUsername() string { + return s.Username +} + +// GetDisplayName returns the value of DisplayName. +func (s *CreateUser) GetDisplayName() string { + return s.DisplayName +} + +// GetPassword returns the value of Password. +func (s *CreateUser) GetPassword() string { + return s.Password +} + +// SetUsername sets the value of Username. +func (s *CreateUser) SetUsername(val string) { + s.Username = val +} + +// SetDisplayName sets the value of DisplayName. +func (s *CreateUser) SetDisplayName(val string) { + s.DisplayName = val +} + +// SetPassword sets the value of Password. +func (s *CreateUser) SetPassword(val string) { + s.Password = val +} + +type CurrentUserBadRequest ErrorHeaders + +func (*CurrentUserBadRequest) currentUserRes() {} + +type CurrentUserConflict ErrorHeaders + +func (*CurrentUserConflict) currentUserRes() {} + +type CurrentUserInternalServerError ErrorHeaders + +func (*CurrentUserInternalServerError) currentUserRes() {} + +type CurrentUserNotFound ErrorHeaders + +func (*CurrentUserNotFound) currentUserRes() {} + +type CurrentUserServiceUnavailable ErrorHeaders + +func (*CurrentUserServiceUnavailable) currentUserRes() {} + +// Ref: #/components/schemas/Error +type Error struct { + Error ErrorError `json:"error"` +} + +// GetError returns the value of Error. +func (s *Error) GetError() ErrorError { + return s.Error +} + +// SetError sets the value of Error. +func (s *Error) SetError(val ErrorError) { + s.Error = val +} + +type ErrorError struct { + Code ErrorErrorCode `json:"code"` + Message string `json:"message"` + RequestID string `json:"request_id"` +} + +// GetCode returns the value of Code. +func (s *ErrorError) GetCode() ErrorErrorCode { + return s.Code +} + +// GetMessage returns the value of Message. +func (s *ErrorError) GetMessage() string { + return s.Message +} + +// GetRequestID returns the value of RequestID. +func (s *ErrorError) GetRequestID() string { + return s.RequestID +} + +// SetCode sets the value of Code. +func (s *ErrorError) SetCode(val ErrorErrorCode) { + s.Code = val +} + +// SetMessage sets the value of Message. +func (s *ErrorError) SetMessage(val string) { + s.Message = val +} + +// SetRequestID sets the value of RequestID. +func (s *ErrorError) SetRequestID(val string) { + s.RequestID = val +} + +type ErrorErrorCode string + +const ( + ErrorErrorCodeInvalidRequest ErrorErrorCode = "invalid_request" + ErrorErrorCodeUnauthorized ErrorErrorCode = "unauthorized" + ErrorErrorCodeNotFound ErrorErrorCode = "not_found" + ErrorErrorCodeConflict ErrorErrorCode = "conflict" + ErrorErrorCodePayloadTooLarge ErrorErrorCode = "payload_too_large" + ErrorErrorCodeUnsupportedMediaType ErrorErrorCode = "unsupported_media_type" + ErrorErrorCodeRateLimited ErrorErrorCode = "rate_limited" + ErrorErrorCodeUnavailable ErrorErrorCode = "unavailable" + ErrorErrorCodeInternalError ErrorErrorCode = "internal_error" +) + +// AllValues returns all ErrorErrorCode values. +func (ErrorErrorCode) AllValues() []ErrorErrorCode { + return []ErrorErrorCode{ + ErrorErrorCodeInvalidRequest, + ErrorErrorCodeUnauthorized, + ErrorErrorCodeNotFound, + ErrorErrorCodeConflict, + ErrorErrorCodePayloadTooLarge, + ErrorErrorCodeUnsupportedMediaType, + ErrorErrorCodeRateLimited, + ErrorErrorCodeUnavailable, + ErrorErrorCodeInternalError, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s ErrorErrorCode) MarshalText() ([]byte, error) { + switch s { + case ErrorErrorCodeInvalidRequest: + return []byte(s), nil + case ErrorErrorCodeUnauthorized: + return []byte(s), nil + case ErrorErrorCodeNotFound: + return []byte(s), nil + case ErrorErrorCodeConflict: + return []byte(s), nil + case ErrorErrorCodePayloadTooLarge: + return []byte(s), nil + case ErrorErrorCodeUnsupportedMediaType: + return []byte(s), nil + case ErrorErrorCodeRateLimited: + return []byte(s), nil + case ErrorErrorCodeUnavailable: + return []byte(s), nil + case ErrorErrorCodeInternalError: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *ErrorErrorCode) UnmarshalText(data []byte) error { + switch ErrorErrorCode(data) { + case ErrorErrorCodeInvalidRequest: + *s = ErrorErrorCodeInvalidRequest + return nil + case ErrorErrorCodeUnauthorized: + *s = ErrorErrorCodeUnauthorized + return nil + case ErrorErrorCodeNotFound: + *s = ErrorErrorCodeNotFound + return nil + case ErrorErrorCodeConflict: + *s = ErrorErrorCodeConflict + return nil + case ErrorErrorCodePayloadTooLarge: + *s = ErrorErrorCodePayloadTooLarge + return nil + case ErrorErrorCodeUnsupportedMediaType: + *s = ErrorErrorCodeUnsupportedMediaType + return nil + case ErrorErrorCodeRateLimited: + *s = ErrorErrorCodeRateLimited + return nil + case ErrorErrorCodeUnavailable: + *s = ErrorErrorCodeUnavailable + return nil + case ErrorErrorCodeInternalError: + *s = ErrorErrorCodeInternalError + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// ErrorHeaders wraps Error with response headers. +type ErrorHeaders struct { + XInstanceID OptString + XRequestID OptString + Response Error +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *ErrorHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *ErrorHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *ErrorHeaders) GetResponse() Error { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *ErrorHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *ErrorHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *ErrorHeaders) SetResponse(val Error) { + s.Response = val +} + +func (*ErrorHeaders) livenessRes() {} + +type GetChatBadRequest ErrorHeaders + +func (*GetChatBadRequest) getChatRes() {} + +type GetChatConflict ErrorHeaders + +func (*GetChatConflict) getChatRes() {} + +type GetChatInternalServerError ErrorHeaders + +func (*GetChatInternalServerError) getChatRes() {} + +type GetChatNotFound ErrorHeaders + +func (*GetChatNotFound) getChatRes() {} + +type GetChatServiceUnavailable ErrorHeaders + +func (*GetChatServiceUnavailable) getChatRes() {} + +// Ref: #/components/schemas/Health +type Health struct { + Status HealthStatus `json:"status"` +} + +// GetStatus returns the value of Status. +func (s *Health) GetStatus() HealthStatus { + return s.Status +} + +// SetStatus sets the value of Status. +func (s *Health) SetStatus(val HealthStatus) { + s.Status = val +} + +// HealthHeaders wraps Health with response headers. +type HealthHeaders struct { + XInstanceID OptString + XRequestID OptString + Response Health +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *HealthHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *HealthHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *HealthHeaders) GetResponse() Health { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *HealthHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *HealthHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *HealthHeaders) SetResponse(val Health) { + s.Response = val +} + +func (*HealthHeaders) livenessRes() {} +func (*HealthHeaders) readinessRes() {} + +type HealthStatus string + +const ( + HealthStatusOk HealthStatus = "ok" +) + +// AllValues returns all HealthStatus values. +func (HealthStatus) AllValues() []HealthStatus { + return []HealthStatus{ + HealthStatusOk, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s HealthStatus) MarshalText() ([]byte, error) { + switch s { + case HealthStatusOk: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *HealthStatus) UnmarshalText(data []byte) error { + switch HealthStatus(data) { + case HealthStatusOk: + *s = HealthStatusOk + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +type ListChatsBadRequest ErrorHeaders + +func (*ListChatsBadRequest) listChatsRes() {} + +type ListChatsConflict ErrorHeaders + +func (*ListChatsConflict) listChatsRes() {} + +type ListChatsInternalServerError ErrorHeaders + +func (*ListChatsInternalServerError) listChatsRes() {} + +type ListChatsNotFound ErrorHeaders + +func (*ListChatsNotFound) listChatsRes() {} + +type ListChatsServiceUnavailable ErrorHeaders + +func (*ListChatsServiceUnavailable) listChatsRes() {} + +type ListMessagesBadRequest ErrorHeaders + +func (*ListMessagesBadRequest) listMessagesRes() {} + +type ListMessagesConflict ErrorHeaders + +func (*ListMessagesConflict) listMessagesRes() {} + +type ListMessagesInternalServerError ErrorHeaders + +func (*ListMessagesInternalServerError) listMessagesRes() {} + +type ListMessagesNotFound ErrorHeaders + +func (*ListMessagesNotFound) listMessagesRes() {} + +type ListMessagesServiceUnavailable ErrorHeaders + +func (*ListMessagesServiceUnavailable) listMessagesRes() {} + +// Ref: #/components/schemas/Message +type Message struct { + ID uuid.UUID `json:"id"` + ChatID uuid.UUID `json:"chat_id"` + SenderID uuid.UUID `json:"sender_id"` + Text string `json:"text"` + CreatedAt time.Time `json:"created_at"` +} + +// GetID returns the value of ID. +func (s *Message) GetID() uuid.UUID { + return s.ID +} + +// GetChatID returns the value of ChatID. +func (s *Message) GetChatID() uuid.UUID { + return s.ChatID +} + +// GetSenderID returns the value of SenderID. +func (s *Message) GetSenderID() uuid.UUID { + return s.SenderID +} + +// GetText returns the value of Text. +func (s *Message) GetText() string { + return s.Text +} + +// GetCreatedAt returns the value of CreatedAt. +func (s *Message) GetCreatedAt() time.Time { + return s.CreatedAt +} + +// SetID sets the value of ID. +func (s *Message) SetID(val uuid.UUID) { + s.ID = val +} + +// SetChatID sets the value of ChatID. +func (s *Message) SetChatID(val uuid.UUID) { + s.ChatID = val +} + +// SetSenderID sets the value of SenderID. +func (s *Message) SetSenderID(val uuid.UUID) { + s.SenderID = val +} + +// SetText sets the value of Text. +func (s *Message) SetText(val string) { + s.Text = val +} + +// SetCreatedAt sets the value of CreatedAt. +func (s *Message) SetCreatedAt(val time.Time) { + s.CreatedAt = val +} + +// MessageHeaders wraps Message with response headers. +type MessageHeaders struct { + XInstanceID OptString + XRequestID OptString + Response Message +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *MessageHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *MessageHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *MessageHeaders) GetResponse() Message { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *MessageHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *MessageHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *MessageHeaders) SetResponse(val Message) { + s.Response = val +} + +func (*MessageHeaders) createMessageRes() {} + +// Ref: #/components/schemas/MessagePage +type MessagePage struct { + Items []Message `json:"items"` + NextCursor NilString `json:"next_cursor"` +} + +// GetItems returns the value of Items. +func (s *MessagePage) GetItems() []Message { + return s.Items +} + +// GetNextCursor returns the value of NextCursor. +func (s *MessagePage) GetNextCursor() NilString { + return s.NextCursor +} + +// SetItems sets the value of Items. +func (s *MessagePage) SetItems(val []Message) { + s.Items = val +} + +// SetNextCursor sets the value of NextCursor. +func (s *MessagePage) SetNextCursor(val NilString) { + s.NextCursor = val +} + +// MessagePageHeaders wraps MessagePage with response headers. +type MessagePageHeaders struct { + XInstanceID OptString + XRequestID OptString + Response MessagePage +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *MessagePageHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *MessagePageHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *MessagePageHeaders) GetResponse() MessagePage { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *MessagePageHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *MessagePageHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *MessagePageHeaders) SetResponse(val MessagePage) { + s.Response = val +} + +func (*MessagePageHeaders) listMessagesRes() {} + +// NewNilString returns new NilString with value set to v. +func NewNilString(v string) NilString { + return NilString{ + Value: v, + } +} + +// NilString is nullable string. +type NilString struct { + Value string + Null bool +} + +// SetTo sets value to v. +func (o *NilString) SetTo(v string) { + o.Null = false + o.Value = v +} + +// IsNull returns true if value is Null. +func (o NilString) IsNull() bool { return o.Null } + +// SetToNull sets value to null. +func (o *NilString) SetToNull() { + o.Null = true + var v string + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o NilString) Get() (v string, ok bool) { + if o.Null { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o NilString) Or(d string) string { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptInt returns new OptInt with value set to v. +func NewOptInt(v int) OptInt { + return OptInt{ + Value: v, + Set: true, + } +} + +// OptInt is optional int. +type OptInt struct { + Value int + Set bool +} + +// IsSet returns true if OptInt was set. +func (o OptInt) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptInt) Reset() { + var v int + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptInt) SetTo(v int) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptInt) Get() (v int, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptInt) Or(d int) int { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptString returns new OptString with value set to v. +func NewOptString(v string) OptString { + return OptString{ + Value: v, + Set: true, + } +} + +// OptString is optional string. +type OptString struct { + Value string + Set bool +} + +// IsSet returns true if OptString was set. +func (o OptString) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptString) Reset() { + var v string + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptString) SetTo(v string) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptString) Get() (v string, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptString) Or(d string) string { + if v, ok := o.Get(); ok { + return v + } + return d +} + +type ReadinessInternalServerError ErrorHeaders + +func (*ReadinessInternalServerError) readinessRes() {} + +type ReadinessServiceUnavailable ErrorHeaders + +func (*ReadinessServiceUnavailable) readinessRes() {} + +type RegisterUserBadRequest ErrorHeaders + +func (*RegisterUserBadRequest) registerUserRes() {} + +type RegisterUserConflict ErrorHeaders + +func (*RegisterUserConflict) registerUserRes() {} + +type RegisterUserInternalServerError ErrorHeaders + +func (*RegisterUserInternalServerError) registerUserRes() {} + +type RegisterUserServiceUnavailable ErrorHeaders + +func (*RegisterUserServiceUnavailable) registerUserRes() {} + +type RevokeSessionInternalServerError ErrorHeaders + +func (*RevokeSessionInternalServerError) revokeSessionRes() {} + +// RevokeSessionNoContent is response for RevokeSession operation. +type RevokeSessionNoContent struct { + XInstanceID OptString + XRequestID OptString +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *RevokeSessionNoContent) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *RevokeSessionNoContent) GetXRequestID() OptString { + return s.XRequestID +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *RevokeSessionNoContent) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *RevokeSessionNoContent) SetXRequestID(val OptString) { + s.XRequestID = val +} + +func (*RevokeSessionNoContent) revokeSessionRes() {} + +type RevokeSessionServiceUnavailable ErrorHeaders + +func (*RevokeSessionServiceUnavailable) revokeSessionRes() {} + +// Ref: #/components/schemas/Session +type Session struct { + Token string `json:"token"` + TokenType string `json:"token_type"` + ExpiresAt time.Time `json:"expires_at"` + User User `json:"user"` +} + +// GetToken returns the value of Token. +func (s *Session) GetToken() string { + return s.Token +} + +// GetTokenType returns the value of TokenType. +func (s *Session) GetTokenType() string { + return s.TokenType +} + +// GetExpiresAt returns the value of ExpiresAt. +func (s *Session) GetExpiresAt() time.Time { + return s.ExpiresAt +} + +// GetUser returns the value of User. +func (s *Session) GetUser() User { + return s.User +} + +// SetToken sets the value of Token. +func (s *Session) SetToken(val string) { + s.Token = val +} + +// SetTokenType sets the value of TokenType. +func (s *Session) SetTokenType(val string) { + s.TokenType = val +} + +// SetExpiresAt sets the value of ExpiresAt. +func (s *Session) SetExpiresAt(val time.Time) { + s.ExpiresAt = val +} + +// SetUser sets the value of User. +func (s *Session) SetUser(val User) { + s.User = val +} + +// SessionHeaders wraps Session with response headers. +type SessionHeaders struct { + XInstanceID OptString + XRequestID OptString + Response Session +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *SessionHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *SessionHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *SessionHeaders) GetResponse() Session { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *SessionHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *SessionHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *SessionHeaders) SetResponse(val Session) { + s.Response = val +} + +func (*SessionHeaders) createSessionRes() {} + +// Ref: #/components/schemas/User +type User struct { + ID uuid.UUID `json:"id"` + Username string `json:"username"` + DisplayName string `json:"display_name"` + CreatedAt time.Time `json:"created_at"` +} + +// GetID returns the value of ID. +func (s *User) GetID() uuid.UUID { + return s.ID +} + +// GetUsername returns the value of Username. +func (s *User) GetUsername() string { + return s.Username +} + +// GetDisplayName returns the value of DisplayName. +func (s *User) GetDisplayName() string { + return s.DisplayName +} + +// GetCreatedAt returns the value of CreatedAt. +func (s *User) GetCreatedAt() time.Time { + return s.CreatedAt +} + +// SetID sets the value of ID. +func (s *User) SetID(val uuid.UUID) { + s.ID = val +} + +// SetUsername sets the value of Username. +func (s *User) SetUsername(val string) { + s.Username = val +} + +// SetDisplayName sets the value of DisplayName. +func (s *User) SetDisplayName(val string) { + s.DisplayName = val +} + +// SetCreatedAt sets the value of CreatedAt. +func (s *User) SetCreatedAt(val time.Time) { + s.CreatedAt = val +} + +// UserHeaders wraps User with response headers. +type UserHeaders struct { + XInstanceID OptString + XRequestID OptString + Response User +} + +// GetXInstanceID returns the value of XInstanceID. +func (s *UserHeaders) GetXInstanceID() OptString { + return s.XInstanceID +} + +// GetXRequestID returns the value of XRequestID. +func (s *UserHeaders) GetXRequestID() OptString { + return s.XRequestID +} + +// GetResponse returns the value of Response. +func (s *UserHeaders) GetResponse() User { + return s.Response +} + +// SetXInstanceID sets the value of XInstanceID. +func (s *UserHeaders) SetXInstanceID(val OptString) { + s.XInstanceID = val +} + +// SetXRequestID sets the value of XRequestID. +func (s *UserHeaders) SetXRequestID(val OptString) { + s.XRequestID = val +} + +// SetResponse sets the value of Response. +func (s *UserHeaders) SetResponse(val User) { + s.Response = val +} + +func (*UserHeaders) currentUserRes() {} +func (*UserHeaders) registerUserRes() {} diff --git a/internal/transport/rest/internal/oas/oas_security_gen.go b/internal/transport/rest/internal/oas/oas_security_gen.go new file mode 100644 index 00000000..60303072 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_security_gen.go @@ -0,0 +1,131 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "context" + "net/http" + "strings" + + "github.com/go-faster/errors" + "github.com/ogen-go/ogen/ogenerrors" +) + +// SecurityHandler is handler for security parameters. +type SecurityHandler interface { + // HandleBasicAuth handles basicAuth security. + HandleBasicAuth(ctx context.Context, operationName OperationName, t BasicAuth) (context.Context, error) + // HandleBearerAuth handles bearerAuth security. + HandleBearerAuth(ctx context.Context, operationName OperationName, t BearerAuth) (context.Context, error) +} + +func findAuthorization(h http.Header, prefix string) (string, bool) { + v, ok := h["Authorization"] + if !ok { + return "", false + } + for _, vv := range v { + scheme, value, ok := strings.Cut(vv, " ") + if !ok || !strings.EqualFold(scheme, prefix) { + continue + } + return value, true + } + return "", false +} + +// operationRolesBasicAuth is a private map storing roles per operation. +var operationRolesBasicAuth = map[string][]string{ + CreateSessionOperation: []string{}, +} + +// GetRolesForBasicAuth returns the required roles for the given operation. +// +// This is useful for authorization scenarios where you need to know which roles +// are required for an operation. +// +// Example: +// +// requiredRoles := GetRolesForBasicAuth(AddPetOperation) +// +// Returns nil if the operation has no role requirements or if the operation is unknown. +func GetRolesForBasicAuth(operation string) []string { + roles, ok := operationRolesBasicAuth[operation] + if !ok { + return nil + } + // Return a copy to prevent external modification + result := make([]string, len(roles)) + copy(result, roles) + return result +} + +// operationRolesBearerAuth is a private map storing roles per operation. +var operationRolesBearerAuth = map[string][]string{ + CreateChatOperation: []string{}, + CreateMessageOperation: []string{}, + CurrentUserOperation: []string{}, + GetChatOperation: []string{}, + ListChatsOperation: []string{}, + ListMessagesOperation: []string{}, + RevokeSessionOperation: []string{}, +} + +// GetRolesForBearerAuth returns the required roles for the given operation. +// +// This is useful for authorization scenarios where you need to know which roles +// are required for an operation. +// +// Example: +// +// requiredRoles := GetRolesForBearerAuth(AddPetOperation) +// +// Returns nil if the operation has no role requirements or if the operation is unknown. +func GetRolesForBearerAuth(operation string) []string { + roles, ok := operationRolesBearerAuth[operation] + if !ok { + return nil + } + // Return a copy to prevent external modification + result := make([]string, len(roles)) + copy(result, roles) + return result +} + +func (s *Server) securityBasicAuth(ctx context.Context, operationName OperationName, req *http.Request) (context.Context, bool, error) { + var t BasicAuth + if _, ok := findAuthorization(req.Header, "Basic"); !ok { + return ctx, false, nil + } + username, password, ok := req.BasicAuth() + if !ok { + return nil, false, errors.New("invalid basic auth") + } + t.Username = username + t.Password = password + t.Roles = operationRolesBasicAuth[operationName] + rctx, err := s.sec.HandleBasicAuth(ctx, operationName, t) + if errors.Is(err, ogenerrors.ErrSkipServerSecurity) { + return nil, false, nil + } else if err != nil { + return nil, false, err + } + return rctx, true, err +} + +func (s *Server) securityBearerAuth(ctx context.Context, operationName OperationName, req *http.Request) (context.Context, bool, error) { + var t BearerAuth + token, ok := findAuthorization(req.Header, "Bearer") + if !ok { + return ctx, false, nil + } + t.Token = token + t.Roles = operationRolesBearerAuth[operationName] + rctx, err := s.sec.HandleBearerAuth(ctx, operationName, t) + if errors.Is(err, ogenerrors.ErrSkipServerSecurity) { + return nil, false, nil + } else if err != nil { + return nil, false, err + } + return rctx, true, err +} diff --git a/internal/transport/rest/internal/oas/oas_server_gen.go b/internal/transport/rest/internal/oas/oas_server_gen.go new file mode 100644 index 00000000..93463c13 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_server_gen.go @@ -0,0 +1,98 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "context" +) + +// Handler handles operations described by OpenAPI v3 specification. +type Handler interface { + // CreateChat implements createChat operation. + // + // Создать чат; вызывающий должен входить в member_ids. + // + // POST /api/v1/chats + CreateChat(ctx context.Context, req *CreateChat) (CreateChatRes, error) + // CreateMessage implements createMessage operation. + // + // Отправить сообщение. + // + // POST /api/v1/chats/{chat_id}/messages + CreateMessage(ctx context.Context, req *CreateMessage, params CreateMessageParams) (CreateMessageRes, error) + // CreateSession implements createSession operation. + // + // Вход: Basic username:password; выдаёт сессию. + // + // POST /api/v1/auth/sessions + CreateSession(ctx context.Context) (CreateSessionRes, error) + // CurrentUser implements currentUser operation. + // + // Текущий пользователь. + // + // GET /api/v1/users/me + CurrentUser(ctx context.Context) (CurrentUserRes, error) + // GetChat implements getChat operation. + // + // Получить доступный чат. + // + // GET /api/v1/chats/{chat_id} + GetChat(ctx context.Context, params GetChatParams) (GetChatRes, error) + // ListChats implements listChats operation. + // + // Чаты текущего пользователя. + // + // GET /api/v1/chats + ListChats(ctx context.Context, params ListChatsParams) (ListChatsRes, error) + // ListMessages implements listMessages operation. + // + // Сообщения по (created_at, id) по возрастанию. + // + // GET /api/v1/chats/{chat_id}/messages + ListMessages(ctx context.Context, params ListMessagesParams) (ListMessagesRes, error) + // Liveness implements liveness operation. + // + // Процесс жив. + // + // GET /health/live + Liveness(ctx context.Context) (LivenessRes, error) + // Readiness implements readiness operation. + // + // Готов принимать трафик. + // + // GET /health/ready + Readiness(ctx context.Context) (ReadinessRes, error) + // RegisterUser implements registerUser operation. + // + // Создать пользователя. + // + // POST /api/v1/users + RegisterUser(ctx context.Context, req *CreateUser) (RegisterUserRes, error) + // RevokeSession implements revokeSession operation. + // + // Отозвать текущую сессию. + // + // DELETE /api/v1/auth/sessions/current + RevokeSession(ctx context.Context) (RevokeSessionRes, error) +} + +// Server implements http server based on OpenAPI v3 specification and +// calls Handler to handle requests. +type Server struct { + h Handler + sec SecurityHandler + baseServer +} + +// NewServer creates new Server. +func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error) { + s, err := newServerConfig(opts...).baseServer() + if err != nil { + return nil, err + } + return &Server{ + h: h, + sec: sec, + baseServer: s, + }, nil +} diff --git a/internal/transport/rest/internal/oas/oas_unimplemented_gen.go b/internal/transport/rest/internal/oas/oas_unimplemented_gen.go new file mode 100644 index 00000000..7d2dc7e1 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_unimplemented_gen.go @@ -0,0 +1,113 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "context" + + ht "github.com/ogen-go/ogen/http" +) + +// UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented. +type UnimplementedHandler struct{} + +var _ Handler = UnimplementedHandler{} + +// CreateChat implements createChat operation. +// +// Создать чат; вызывающий должен входить в member_ids. +// +// POST /api/v1/chats +func (UnimplementedHandler) CreateChat(ctx context.Context, req *CreateChat) (r CreateChatRes, _ error) { + return r, ht.ErrNotImplemented +} + +// CreateMessage implements createMessage operation. +// +// Отправить сообщение. +// +// POST /api/v1/chats/{chat_id}/messages +func (UnimplementedHandler) CreateMessage(ctx context.Context, req *CreateMessage, params CreateMessageParams) (r CreateMessageRes, _ error) { + return r, ht.ErrNotImplemented +} + +// CreateSession implements createSession operation. +// +// Вход: Basic username:password; выдаёт сессию. +// +// POST /api/v1/auth/sessions +func (UnimplementedHandler) CreateSession(ctx context.Context) (r CreateSessionRes, _ error) { + return r, ht.ErrNotImplemented +} + +// CurrentUser implements currentUser operation. +// +// Текущий пользователь. +// +// GET /api/v1/users/me +func (UnimplementedHandler) CurrentUser(ctx context.Context) (r CurrentUserRes, _ error) { + return r, ht.ErrNotImplemented +} + +// GetChat implements getChat operation. +// +// Получить доступный чат. +// +// GET /api/v1/chats/{chat_id} +func (UnimplementedHandler) GetChat(ctx context.Context, params GetChatParams) (r GetChatRes, _ error) { + return r, ht.ErrNotImplemented +} + +// ListChats implements listChats operation. +// +// Чаты текущего пользователя. +// +// GET /api/v1/chats +func (UnimplementedHandler) ListChats(ctx context.Context, params ListChatsParams) (r ListChatsRes, _ error) { + return r, ht.ErrNotImplemented +} + +// ListMessages implements listMessages operation. +// +// Сообщения по (created_at, id) по возрастанию. +// +// GET /api/v1/chats/{chat_id}/messages +func (UnimplementedHandler) ListMessages(ctx context.Context, params ListMessagesParams) (r ListMessagesRes, _ error) { + return r, ht.ErrNotImplemented +} + +// Liveness implements liveness operation. +// +// Процесс жив. +// +// GET /health/live +func (UnimplementedHandler) Liveness(ctx context.Context) (r LivenessRes, _ error) { + return r, ht.ErrNotImplemented +} + +// Readiness implements readiness operation. +// +// Готов принимать трафик. +// +// GET /health/ready +func (UnimplementedHandler) Readiness(ctx context.Context) (r ReadinessRes, _ error) { + return r, ht.ErrNotImplemented +} + +// RegisterUser implements registerUser operation. +// +// Создать пользователя. +// +// POST /api/v1/users +func (UnimplementedHandler) RegisterUser(ctx context.Context, req *CreateUser) (r RegisterUserRes, _ error) { + return r, ht.ErrNotImplemented +} + +// RevokeSession implements revokeSession operation. +// +// Отозвать текущую сессию. +// +// DELETE /api/v1/auth/sessions/current +func (UnimplementedHandler) RevokeSession(ctx context.Context) (r RevokeSessionRes, _ error) { + return r, ht.ErrNotImplemented +} diff --git a/internal/transport/rest/internal/oas/oas_validators_gen.go b/internal/transport/rest/internal/oas/oas_validators_gen.go new file mode 100644 index 00000000..bad56ad4 --- /dev/null +++ b/internal/transport/rest/internal/oas/oas_validators_gen.go @@ -0,0 +1,1866 @@ +// Code generated by ogen, DO NOT EDIT. + +package oas + +import ( + "fmt" + + "github.com/go-faster/errors" + "github.com/ogen-go/ogen/validate" +) + +func (s *Chat) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 100, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Title)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "title", + Error: err, + }) + } + if err := func() error { + if s.MemberIds == nil { + return errors.New("nil is invalid value") + } + if err := (validate.Array{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 100, + MaxLengthSet: true, + }).ValidateLength(len(s.MemberIds)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.MemberIds); err != nil { + return errors.Wrap(err, "array") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "member_ids", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *ChatHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *ChatPage) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if s.Items == nil { + return errors.New("nil is invalid value") + } + var failures []validate.FieldError + for i, elem := range s.Items { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "items", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *ChatPageHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *CreateChat) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 100, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Title)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "title", + Error: err, + }) + } + if err := func() error { + if s.MemberIds == nil { + return errors.New("nil is invalid value") + } + if err := (validate.Array{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 100, + MaxLengthSet: true, + }).ValidateLength(len(s.MemberIds)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.MemberIds); err != nil { + return errors.Wrap(err, "array") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "member_ids", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *CreateChatBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateChatConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateChatInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateChatNotFound) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateChatServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateMessage) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 4000, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Text)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "text", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *CreateMessageBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateMessageConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateMessageInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateMessageNotFound) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateMessageServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateSessionBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateSessionInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateSessionServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CreateSessionTooManyRequestsHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.RetryAfter.Get(); ok { + if err := func() error { + if err := (validate.Int{ + MinSet: true, + Min: 1, + MaxSet: false, + Max: 0, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + Pattern: nil, + }).Validate(int64(value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "RetryAfter", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *CreateSessionUnauthorizedHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *CreateUser) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: regexMap["^[a-z0-9_]{3,32}$"], + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Username)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "username", + Error: err, + }) + } + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 100, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.DisplayName)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "display_name", + Error: err, + }) + } + if err := func() error { + if err := (validate.String{ + MinLength: 12, + MinLengthSet: true, + MaxLength: 128, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Password)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "password", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *CurrentUserBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CurrentUserConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CurrentUserInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CurrentUserNotFound) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *CurrentUserServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *Error) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Error.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "error", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *ErrorError) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Code.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "code", + Error: err, + }) + } + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Message)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "message", + Error: err, + }) + } + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.RequestID)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "request_id", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s ErrorErrorCode) Validate() error { + switch s { + case "invalid_request": + return nil + case "unauthorized": + return nil + case "not_found": + return nil + case "conflict": + return nil + case "payload_too_large": + return nil + case "unsupported_media_type": + return nil + case "rate_limited": + return nil + case "unavailable": + return nil + case "internal_error": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *ErrorHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *GetChatBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *GetChatConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *GetChatInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *GetChatNotFound) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *GetChatServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *Health) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Status.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "status", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *HealthHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s HealthStatus) Validate() error { + switch s { + case "ok": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *ListChatsBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListChatsConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListChatsInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListChatsNotFound) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListChatsServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListMessagesBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListMessagesConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListMessagesInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListMessagesNotFound) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ListMessagesServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *Message) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 4000, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Text)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "text", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MessageHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MessagePage) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if s.Items == nil { + return errors.New("nil is invalid value") + } + var failures []validate.FieldError + for i, elem := range s.Items { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "items", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MessagePageHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *ReadinessInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *ReadinessServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *RegisterUserBadRequest) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *RegisterUserConflict) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *RegisterUserInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *RegisterUserServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *RevokeSessionInternalServerError) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *RevokeSessionNoContent) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *RevokeSessionServiceUnavailable) Validate() error { + alias := (*ErrorHeaders)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *Session) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 32, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Token)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "token", + Error: err, + }) + } + if err := func() error { + if err := s.User.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "user", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *SessionHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *User) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: regexMap["^[a-z0-9_]{3,32}$"], + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.Username)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "username", + Error: err, + }) + } + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 100, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(s.DisplayName)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "display_name", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *UserHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.XInstanceID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XInstanceID", + Error: err, + }) + } + if err := func() error { + if value, ok := s.XRequestID.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: nil, + MinNumeric: 0, + MinNumericSet: false, + MaxNumeric: 0, + MaxNumericSet: false, + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "XRequestID", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} diff --git a/internal/transport/rest/logging.go b/internal/transport/rest/logging.go new file mode 100644 index 00000000..cf40069a --- /dev/null +++ b/internal/transport/rest/logging.go @@ -0,0 +1,146 @@ +package rest + +import ( + "context" + "errors" + "fmt" + "log/slog" + "net/http" + "time" + + "github.com/ogen-go/ogen/middleware" + "github.com/ogen-go/ogen/ogenerrors" + "github.com/ogen-go/ogen/openapi" + + "mtusi-messenger/internal/transport/rest/internal/oas" +) + +func loggingMiddleware(log *slog.Logger) oas.Middleware { + return func(req middleware.Request, next middleware.Next) (middleware.Response, error) { + started := time.Now() + + base := []any{ + slog.String("request_id", requestIDFromContext(req.Context)), + slog.String("operation", req.OperationID), + slog.String("method", req.Raw.Method), + slog.String("path", req.Raw.URL.Path), + } + + accepted := make([]any, 0, len(base)+6) + accepted = append(accepted, base...) + accepted = append(accepted, + slog.String("query", req.Raw.URL.RawQuery), + slog.String("remote_addr", req.Raw.RemoteAddr), + slog.String("user_agent", req.Raw.UserAgent()), + slog.Int64("content_length", req.Raw.ContentLength), + slog.Any("params", loggedParams(req.Params)), + payloadAttr(req.RawBody), + ) + + log.InfoContext(req.Context, "request accepted", accepted...) + + resp, err := next(req) + + handled := make([]any, 0, len(base)+4) + handled = append(handled, base...) + handled = append(handled, slog.Duration("duration", time.Since(started))) + + if err != nil { + // Статус в логе должен совпадать с ответом клиенту: ogenerrors.ErrorCode + // возвращает 500 для доменных ошибок, поэтому используем ту же функцию, + // что и обработчик ошибок транспорта. + status := statusForError(err) + + handled = append(handled, + slog.Int("status", status), + slog.String("error", err.Error()), + ) + log.Log(req.Context, levelForStatus(status), "request failed", handled...) + + return resp, err + } + + handled = append(handled, slog.String("result", resultType(resp))) + log.InfoContext(req.Context, "request handled", handled...) + + return resp, nil + } +} + +func logRejected(ctx context.Context, log *slog.Logger, r *http.Request, status int, err error) { + if log == nil { + return + } + + attrs := []any{ + slog.String("request_id", requestIDFromContext(ctx)), + slog.String("method", r.Method), + slog.String("path", r.URL.Path), + slog.Int("status", status), + } + + if err != nil { + attrs = append(attrs, slog.String("error", err.Error())) + } + + log.Log(ctx, levelForStatus(status), "request rejected", attrs...) +} + +func preMiddlewareError(err error) bool { + return errors.As(err, new(*ogenerrors.SecurityError)) || + errors.As(err, new(*ogenerrors.DecodeParamsError)) || + errors.As(err, new(*ogenerrors.DecodeRequestError)) +} + +func levelForStatus(status int) slog.Level { + if status >= http.StatusInternalServerError { + return slog.LevelError + } + + return slog.LevelWarn +} + +func loggedParams(params middleware.Parameters) map[string]any { + if len(params) == 0 { + return nil + } + + out := make(map[string]any, len(params)) + + for key, value := range params { + name := string(key.In) + "." + key.Name + + if key.In == openapi.LocationHeader { + // Значения заголовков не попадают в лог: Idempotency-Key и подобные + // параметры — это долгоживущий след конкретного запроса, а для отладки + // достаточно факта наличия. + out[name] = "redacted" + + continue + } + + out[name] = value + } + + return out +} + +func payloadAttr(body []byte) slog.Attr { + size := len(body) + if size == 0 { + return slog.Attr{} + } + + return slog.Group("payload", + slog.Int("size", size), + slog.Bool("content_logged", false), + ) +} + +func resultType(resp middleware.Response) string { + if resp.Type == nil { + return "" + } + + return fmt.Sprintf("%T", resp.Type) +} diff --git a/internal/transport/rest/logging_test.go b/internal/transport/rest/logging_test.go new file mode 100644 index 00000000..2ff16455 --- /dev/null +++ b/internal/transport/rest/logging_test.go @@ -0,0 +1,228 @@ +package rest + +import ( + "encoding/json" + "errors" + "log/slog" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/ogen-go/ogen/middleware" + "github.com/ogen-go/ogen/openapi" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "mtusi-messenger/internal/logger" + "mtusi-messenger/internal/transport/rest/internal/oas" +) + +type LoggingSuite struct { + suite.Suite + + sink *strings.Builder + log *slog.Logger +} + +func TestLoggingSuite(t *testing.T) { + t.Parallel() + suite.Run(t, new(LoggingSuite)) +} + +func (s *LoggingSuite) SetupTest() { + s.sink = &strings.Builder{} + s.log = logger.New( + logger.WithWriter(s.sink), + logger.WithLevel(slog.LevelDebug), + ) +} + +func (s *LoggingSuite) records() []map[string]any { + var out []map[string]any + + for line := range strings.SplitSeq(strings.TrimSpace(s.sink.String()), "\n") { + if line == "" { + continue + } + + var record map[string]any + s.Require().NoError(json.Unmarshal([]byte(line), &record)) + + out = append(out, record) + } + + return out +} + +func (s *LoggingSuite) request(method, target, body string) middleware.Request { + raw := httptest.NewRequestWithContext( + s.T().Context(), + method, + target, + strings.NewReader(body), + ) + raw.RemoteAddr = "192.0.2.10:54321" + raw.Header.Set("User-Agent", "smoke/1.0") + + ctx := withRequestID(raw.Context(), "req-42") + + return middleware.Request{ + Context: ctx, + OperationName: oas.CreateMessageOperation, + OperationID: "createMessage", + RawBody: []byte(body), + Params: middleware.Parameters{ + {Name: "chat_id", In: openapi.LocationPath}: "33333333-3333-4333-8333-333333333333", + {Name: "limit", In: openapi.LocationQuery}: 50, + }, + Raw: raw, + } +} + +func (s *LoggingSuite) TestHeaderParamsAreRedacted() { + req := s.request(http.MethodPost, "/api/v1/chats/33333333-3333-4333-8333-333333333333/messages", `{"text":"привет"}`) + req.Params = middleware.Parameters{ + {Name: "chat_id", In: openapi.LocationPath}: "33333333-3333-4333-8333-333333333333", + {Name: "Idempotency-Key", In: openapi.LocationHeader}: "secret-key-value", + } + + _, err := loggingMiddleware(s.log)(req, func(middleware.Request) (middleware.Response, error) { + return middleware.Response{}, nil + }) + s.Require().NoError(err) + + records := s.records() + s.Require().NotEmpty(records) + + params, ok := records[0]["params"].(map[string]any) + s.Require().True(ok, "params должны быть объектом") + s.Equal("redacted", params["header.Idempotency-Key"], "значение заголовка не логируется") + s.Equal("33333333-3333-4333-8333-333333333333", params["path.chat_id"]) + s.NotContains(s.sink.String(), "secret-key-value") +} + +func (s *LoggingSuite) TestLogsAcceptedAndHandled() { + req := s.request(http.MethodPost, "/api/v1/chats/33333333-3333-4333-8333-333333333333/messages?limit=50", `{"text":"привет"}`) + + response := middleware.Response{Type: &oas.Message{}} + + got, err := loggingMiddleware(s.log)(req, func(middleware.Request) (middleware.Response, error) { + return response, nil + }) + + s.Require().NoError(err) + s.Equal(response, got) + + records := s.records() + s.Require().Len(records, 2, "ожидаются записи о принятом и обработанном запросе") + + accepted, handled := records[0], records[1] + + s.Equal("request accepted", accepted["msg"]) + s.Equal("info", accepted["level"]) + s.Equal("req-42", accepted["request_id"]) + s.Equal("createMessage", accepted["operation"]) + s.Equal(http.MethodPost, accepted["method"]) + s.Equal("/api/v1/chats/33333333-3333-4333-8333-333333333333/messages", accepted["path"]) + s.Equal("limit=50", accepted["query"]) + s.Equal("192.0.2.10:54321", accepted["remote_addr"]) + s.Equal("smoke/1.0", accepted["user_agent"]) + + params, ok := accepted["params"].(map[string]any) + s.Require().True(ok, "params должны быть объектом") + s.Equal("33333333-3333-4333-8333-333333333333", params["path.chat_id"]) + s.InEpsilon(float64(50), params["query.limit"], 0.0001) + + payload, ok := accepted["payload"].(map[string]any) + s.Require().True(ok, "payload должен быть объектом") + + s.False(payload["content_logged"].(bool)) + s.NotContains(s.sink.String(), "привет") + + s.Equal("request handled", handled["msg"]) + s.Equal("info", handled["level"]) + s.Equal("req-42", handled["request_id"]) + s.Equal("*oas.Message", handled["result"]) + s.NotEmpty(handled["duration"], "длительность обработки обязательна") +} + +func (s *LoggingSuite) TestLogsFailure() { + req := s.request(http.MethodGet, "/api/v1/chats", "") + + wantErr := errors.New("storage unavailable") + + _, err := loggingMiddleware(s.log)(req, func(middleware.Request) (middleware.Response, error) { + return middleware.Response{}, wantErr + }) + + s.Require().ErrorIs(err, wantErr) + + records := s.records() + s.Require().Len(records, 2) + + failed := records[1] + s.Equal("request failed", failed["msg"]) + s.Equal("error", failed["level"]) + s.Equal("storage unavailable", failed["error"]) + s.NotEmpty(failed["duration"]) +} + +func (s *LoggingSuite) TestOmitsPayloadWhenBodyIsEmpty() { + req := s.request(http.MethodGet, "/api/v1/chats", "") + + _, err := loggingMiddleware(s.log)(req, func(middleware.Request) (middleware.Response, error) { + return middleware.Response{Type: &oas.ChatPage{}}, nil + }) + s.Require().NoError(err) + + accepted := s.records()[0] + s.NotContains(accepted, "payload", "у запроса без тела не должно быть payload") +} + +func (s *LoggingSuite) TestPayloadContentIsNeverLogged() { + body := strings.Repeat("s", 4096) + req := s.request(http.MethodPost, "/api/v1/chats/33333333-3333-4333-8333-333333333333/messages", body) + + _, err := loggingMiddleware(s.log)(req, func(middleware.Request) (middleware.Response, error) { + return middleware.Response{Type: &oas.Message{}}, nil + }) + s.Require().NoError(err) + + payload, ok := s.records()[0]["payload"].(map[string]any) + s.Require().True(ok) + + s.InEpsilon(float64(len(body)), payload["size"], 0.0001) + s.False(payload["content_logged"].(bool)) + s.NotContains(s.sink.String(), body) +} + +func TestRequestIDMiddlewareSetsHeaderBeforeSecurity(t *testing.T) { + t.Parallel() + + var seen string + + handler := requestIDMiddleware(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) { + seen = requestIDFromContext(r.Context()) + })) + + rec := httptest.NewRecorder() + handler.ServeHTTP(rec, httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/health/live", nil)) + + require.NotEmpty(t, seen, "идентификатор должен попадать в контекст") + require.Equal(t, seen, rec.Header().Get("X-Request-ID")) +} + +func TestRequestIDMiddlewarePreservesIncomingID(t *testing.T) { + t.Parallel() + + handler := requestIDMiddleware(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {})) + + req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/health/live", nil) + req.Header.Set("X-Request-ID", "from-client") + + rec := httptest.NewRecorder() + handler.ServeHTTP(rec, req) + + require.Equal(t, "from-client", rec.Header().Get("X-Request-ID")) +} diff --git a/internal/transport/rest/mocks/ChatService.go b/internal/transport/rest/mocks/ChatService.go new file mode 100644 index 00000000..09671a5e --- /dev/null +++ b/internal/transport/rest/mocks/ChatService.go @@ -0,0 +1,265 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockChatService creates a new instance of MockChatService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockChatService(t interface { + mock.TestingT + Cleanup(func()) +}) *MockChatService { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockChatService{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockChatService is an autogenerated mock type for the ChatService type +type MockChatService struct { + mock.Mock +} + +type MockChatService_Expecter struct { + mock *mock.Mock +} + +func (_m *MockChatService) EXPECT() *MockChatService_Expecter { + return &MockChatService_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockChatService +func (_mock *MockChatService) Create(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Chat + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.ChatDraft) (domain.Chat, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.ChatDraft) domain.Chat); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.Chat) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.ChatDraft) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatService_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockChatService_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.ChatDraft +func (_e *MockChatService_Expecter) Create(ctx any, draft any) *MockChatService_Create_Call { + return &MockChatService_Create_Call{Call: _e.mock.On("Create", ctx, draft)} +} + +func (_c *MockChatService_Create_Call) Run(run func(ctx context.Context, draft domain.ChatDraft)) *MockChatService_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.ChatDraft + if args[1] != nil { + arg1 = args[1].(domain.ChatDraft) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockChatService_Create_Call) Return(chat domain.Chat, err error) *MockChatService_Create_Call { + _c.Call.Return(chat, err) + return _c +} + +func (_c *MockChatService_Create_Call) RunAndReturn(run func(ctx context.Context, draft domain.ChatDraft) (domain.Chat, error)) *MockChatService_Create_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function for the type MockChatService +func (_mock *MockChatService) Get(ctx context.Context, callerID uuid.UUID, chatID uuid.UUID) (domain.Chat, error) { + ret := _mock.Called(ctx, callerID, chatID) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 domain.Chat + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) (domain.Chat, error)); ok { + return returnFunc(ctx, callerID, chatID) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) domain.Chat); ok { + r0 = returnFunc(ctx, callerID, chatID) + } else { + r0 = ret.Get(0).(domain.Chat) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID) error); ok { + r1 = returnFunc(ctx, callerID, chatID) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatService_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockChatService_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - callerID uuid.UUID +// - chatID uuid.UUID +func (_e *MockChatService_Expecter) Get(ctx any, callerID any, chatID any) *MockChatService_Get_Call { + return &MockChatService_Get_Call{Call: _e.mock.On("Get", ctx, callerID, chatID)} +} + +func (_c *MockChatService_Get_Call) Run(run func(ctx context.Context, callerID uuid.UUID, chatID uuid.UUID)) *MockChatService_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 uuid.UUID + if args[2] != nil { + arg2 = args[2].(uuid.UUID) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockChatService_Get_Call) Return(chat domain.Chat, err error) *MockChatService_Get_Call { + _c.Call.Return(chat, err) + return _c +} + +func (_c *MockChatService_Get_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, chatID uuid.UUID) (domain.Chat, error)) *MockChatService_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function for the type MockChatService +func (_mock *MockChatService) List(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error) { + ret := _mock.Called(ctx, callerID, after, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 domain.Page[domain.Chat] + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Chat], error)); ok { + return returnFunc(ctx, callerID, after, limit) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, *domain.Cursor, int) domain.Page[domain.Chat]); ok { + r0 = returnFunc(ctx, callerID, after, limit) + } else { + r0 = ret.Get(0).(domain.Page[domain.Chat]) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, *domain.Cursor, int) error); ok { + r1 = returnFunc(ctx, callerID, after, limit) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockChatService_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockChatService_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - callerID uuid.UUID +// - after *domain.Cursor +// - limit int +func (_e *MockChatService_Expecter) List(ctx any, callerID any, after any, limit any) *MockChatService_List_Call { + return &MockChatService_List_Call{Call: _e.mock.On("List", ctx, callerID, after, limit)} +} + +func (_c *MockChatService_List_Call) Run(run func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int)) *MockChatService_List_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 *domain.Cursor + if args[2] != nil { + arg2 = args[2].(*domain.Cursor) + } + var arg3 int + if args[3] != nil { + arg3 = args[3].(int) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockChatService_List_Call) Return(page domain.Page[domain.Chat], err error) *MockChatService_List_Call { + _c.Call.Return(page, err) + return _c +} + +func (_c *MockChatService_List_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Chat], error)) *MockChatService_List_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/HealthChecker.go b/internal/transport/rest/mocks/HealthChecker.go new file mode 100644 index 00000000..a68e0f8f --- /dev/null +++ b/internal/transport/rest/mocks/HealthChecker.go @@ -0,0 +1,98 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockHealthChecker creates a new instance of MockHealthChecker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockHealthChecker(t interface { + mock.TestingT + Cleanup(func()) +}) *MockHealthChecker { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockHealthChecker{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockHealthChecker is an autogenerated mock type for the HealthChecker type +type MockHealthChecker struct { + mock.Mock +} + +type MockHealthChecker_Expecter struct { + mock *mock.Mock +} + +func (_m *MockHealthChecker) EXPECT() *MockHealthChecker_Expecter { + return &MockHealthChecker_Expecter{mock: &_m.Mock} +} + +// Ping provides a mock function for the type MockHealthChecker +func (_mock *MockHealthChecker) Ping(ctx context.Context) error { + ret := _mock.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Ping") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = returnFunc(ctx) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockHealthChecker_Ping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ping' +type MockHealthChecker_Ping_Call struct { + *mock.Call +} + +// Ping is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockHealthChecker_Expecter) Ping(ctx any) *MockHealthChecker_Ping_Call { + return &MockHealthChecker_Ping_Call{Call: _e.mock.On("Ping", ctx)} +} + +func (_c *MockHealthChecker_Ping_Call) Run(run func(ctx context.Context)) *MockHealthChecker_Ping_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockHealthChecker_Ping_Call) Return(err error) *MockHealthChecker_Ping_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockHealthChecker_Ping_Call) RunAndReturn(run func(ctx context.Context) error) *MockHealthChecker_Ping_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/MessageService.go b/internal/transport/rest/mocks/MessageService.go new file mode 100644 index 00000000..83fe84a8 --- /dev/null +++ b/internal/transport/rest/mocks/MessageService.go @@ -0,0 +1,199 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockMessageService creates a new instance of MockMessageService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockMessageService(t interface { + mock.TestingT + Cleanup(func()) +}) *MockMessageService { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockMessageService{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockMessageService is an autogenerated mock type for the MessageService type +type MockMessageService struct { + mock.Mock +} + +type MockMessageService_Expecter struct { + mock *mock.Mock +} + +func (_m *MockMessageService) EXPECT() *MockMessageService_Expecter { + return &MockMessageService_Expecter{mock: &_m.Mock} +} + +// History provides a mock function for the type MockMessageService +func (_mock *MockMessageService) History(ctx context.Context, callerID uuid.UUID, chatID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Message], error) { + ret := _mock.Called(ctx, callerID, chatID, after, limit) + + if len(ret) == 0 { + panic("no return value specified for History") + } + + var r0 domain.Page[domain.Message] + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, *domain.Cursor, int) (domain.Page[domain.Message], error)); ok { + return returnFunc(ctx, callerID, chatID, after, limit) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, *domain.Cursor, int) domain.Page[domain.Message]); ok { + r0 = returnFunc(ctx, callerID, chatID, after, limit) + } else { + r0 = ret.Get(0).(domain.Page[domain.Message]) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, *domain.Cursor, int) error); ok { + r1 = returnFunc(ctx, callerID, chatID, after, limit) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockMessageService_History_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'History' +type MockMessageService_History_Call struct { + *mock.Call +} + +// History is a helper method to define mock.On call +// - ctx context.Context +// - callerID uuid.UUID +// - chatID uuid.UUID +// - after *domain.Cursor +// - limit int +func (_e *MockMessageService_Expecter) History(ctx any, callerID any, chatID any, after any, limit any) *MockMessageService_History_Call { + return &MockMessageService_History_Call{Call: _e.mock.On("History", ctx, callerID, chatID, after, limit)} +} + +func (_c *MockMessageService_History_Call) Run(run func(ctx context.Context, callerID uuid.UUID, chatID uuid.UUID, after *domain.Cursor, limit int)) *MockMessageService_History_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 uuid.UUID + if args[2] != nil { + arg2 = args[2].(uuid.UUID) + } + var arg3 *domain.Cursor + if args[3] != nil { + arg3 = args[3].(*domain.Cursor) + } + var arg4 int + if args[4] != nil { + arg4 = args[4].(int) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) + }) + return _c +} + +func (_c *MockMessageService_History_Call) Return(page domain.Page[domain.Message], err error) *MockMessageService_History_Call { + _c.Call.Return(page, err) + return _c +} + +func (_c *MockMessageService_History_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, chatID uuid.UUID, after *domain.Cursor, limit int) (domain.Page[domain.Message], error)) *MockMessageService_History_Call { + _c.Call.Return(run) + return _c +} + +// Send provides a mock function for the type MockMessageService +func (_mock *MockMessageService) Send(ctx context.Context, draft domain.MessageDraft) (domain.Message, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Send") + } + + var r0 domain.Message + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.MessageDraft) (domain.Message, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.MessageDraft) domain.Message); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.Message) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.MessageDraft) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockMessageService_Send_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Send' +type MockMessageService_Send_Call struct { + *mock.Call +} + +// Send is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.MessageDraft +func (_e *MockMessageService_Expecter) Send(ctx any, draft any) *MockMessageService_Send_Call { + return &MockMessageService_Send_Call{Call: _e.mock.On("Send", ctx, draft)} +} + +func (_c *MockMessageService_Send_Call) Run(run func(ctx context.Context, draft domain.MessageDraft)) *MockMessageService_Send_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.MessageDraft + if args[1] != nil { + arg1 = args[1].(domain.MessageDraft) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockMessageService_Send_Call) Return(message domain.Message, err error) *MockMessageService_Send_Call { + _c.Call.Return(message, err) + return _c +} + +func (_c *MockMessageService_Send_Call) RunAndReturn(run func(ctx context.Context, draft domain.MessageDraft) (domain.Message, error)) *MockMessageService_Send_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/SecSessionService.go b/internal/transport/rest/mocks/SecSessionService.go new file mode 100644 index 00000000..ad322499 --- /dev/null +++ b/internal/transport/rest/mocks/SecSessionService.go @@ -0,0 +1,186 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockSecSessionService creates a new instance of MockSecSessionService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockSecSessionService(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSecSessionService { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockSecSessionService{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockSecSessionService is an autogenerated mock type for the SecSessionService type +type MockSecSessionService struct { + mock.Mock +} + +type MockSecSessionService_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSecSessionService) EXPECT() *MockSecSessionService_Expecter { + return &MockSecSessionService_Expecter{mock: &_m.Mock} +} + +// Authenticate provides a mock function for the type MockSecSessionService +func (_mock *MockSecSessionService) Authenticate(ctx context.Context, username string, password string) (domain.User, error) { + ret := _mock.Called(ctx, username, password) + + if len(ret) == 0 { + panic("no return value specified for Authenticate") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (domain.User, error)); ok { + return returnFunc(ctx, username, password) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) domain.User); ok { + r0 = returnFunc(ctx, username, password) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = returnFunc(ctx, username, password) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSecSessionService_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate' +type MockSecSessionService_Authenticate_Call struct { + *mock.Call +} + +// Authenticate is a helper method to define mock.On call +// - ctx context.Context +// - username string +// - password string +func (_e *MockSecSessionService_Expecter) Authenticate(ctx any, username any, password any) *MockSecSessionService_Authenticate_Call { + return &MockSecSessionService_Authenticate_Call{Call: _e.mock.On("Authenticate", ctx, username, password)} +} + +func (_c *MockSecSessionService_Authenticate_Call) Run(run func(ctx context.Context, username string, password string)) *MockSecSessionService_Authenticate_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockSecSessionService_Authenticate_Call) Return(user domain.User, err error) *MockSecSessionService_Authenticate_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockSecSessionService_Authenticate_Call) RunAndReturn(run func(ctx context.Context, username string, password string) (domain.User, error)) *MockSecSessionService_Authenticate_Call { + _c.Call.Return(run) + return _c +} + +// Resolve provides a mock function for the type MockSecSessionService +func (_mock *MockSecSessionService) Resolve(ctx context.Context, token string) (domain.User, error) { + ret := _mock.Called(ctx, token) + + if len(ret) == 0 { + panic("no return value specified for Resolve") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) (domain.User, error)); ok { + return returnFunc(ctx, token) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) domain.User); ok { + r0 = returnFunc(ctx, token) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, token) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSecSessionService_Resolve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resolve' +type MockSecSessionService_Resolve_Call struct { + *mock.Call +} + +// Resolve is a helper method to define mock.On call +// - ctx context.Context +// - token string +func (_e *MockSecSessionService_Expecter) Resolve(ctx any, token any) *MockSecSessionService_Resolve_Call { + return &MockSecSessionService_Resolve_Call{Call: _e.mock.On("Resolve", ctx, token)} +} + +func (_c *MockSecSessionService_Resolve_Call) Run(run func(ctx context.Context, token string)) *MockSecSessionService_Resolve_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSecSessionService_Resolve_Call) Return(user domain.User, err error) *MockSecSessionService_Resolve_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockSecSessionService_Resolve_Call) RunAndReturn(run func(ctx context.Context, token string) (domain.User, error)) *MockSecSessionService_Resolve_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/SessionActions.go b/internal/transport/rest/mocks/SessionActions.go new file mode 100644 index 00000000..54571202 --- /dev/null +++ b/internal/transport/rest/mocks/SessionActions.go @@ -0,0 +1,316 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockSessionActions creates a new instance of MockSessionActions. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockSessionActions(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSessionActions { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockSessionActions{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockSessionActions is an autogenerated mock type for the SessionActions type +type MockSessionActions struct { + mock.Mock +} + +type MockSessionActions_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSessionActions) EXPECT() *MockSessionActions_Expecter { + return &MockSessionActions_Expecter{mock: &_m.Mock} +} + +// Authenticate provides a mock function for the type MockSessionActions +func (_mock *MockSessionActions) Authenticate(ctx context.Context, username string, password string) (domain.User, error) { + ret := _mock.Called(ctx, username, password) + + if len(ret) == 0 { + panic("no return value specified for Authenticate") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (domain.User, error)); ok { + return returnFunc(ctx, username, password) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) domain.User); ok { + r0 = returnFunc(ctx, username, password) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = returnFunc(ctx, username, password) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSessionActions_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate' +type MockSessionActions_Authenticate_Call struct { + *mock.Call +} + +// Authenticate is a helper method to define mock.On call +// - ctx context.Context +// - username string +// - password string +func (_e *MockSessionActions_Expecter) Authenticate(ctx any, username any, password any) *MockSessionActions_Authenticate_Call { + return &MockSessionActions_Authenticate_Call{Call: _e.mock.On("Authenticate", ctx, username, password)} +} + +func (_c *MockSessionActions_Authenticate_Call) Run(run func(ctx context.Context, username string, password string)) *MockSessionActions_Authenticate_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockSessionActions_Authenticate_Call) Return(user domain.User, err error) *MockSessionActions_Authenticate_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockSessionActions_Authenticate_Call) RunAndReturn(run func(ctx context.Context, username string, password string) (domain.User, error)) *MockSessionActions_Authenticate_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function for the type MockSessionActions +func (_mock *MockSessionActions) Create(ctx context.Context, user domain.User) (domain.Session, error) { + ret := _mock.Called(ctx, user) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Session + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.User) (domain.Session, error)); ok { + return returnFunc(ctx, user) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.User) domain.Session); ok { + r0 = returnFunc(ctx, user) + } else { + r0 = ret.Get(0).(domain.Session) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.User) error); ok { + r1 = returnFunc(ctx, user) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSessionActions_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockSessionActions_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - user domain.User +func (_e *MockSessionActions_Expecter) Create(ctx any, user any) *MockSessionActions_Create_Call { + return &MockSessionActions_Create_Call{Call: _e.mock.On("Create", ctx, user)} +} + +func (_c *MockSessionActions_Create_Call) Run(run func(ctx context.Context, user domain.User)) *MockSessionActions_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.User + if args[1] != nil { + arg1 = args[1].(domain.User) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSessionActions_Create_Call) Return(session domain.Session, err error) *MockSessionActions_Create_Call { + _c.Call.Return(session, err) + return _c +} + +func (_c *MockSessionActions_Create_Call) RunAndReturn(run func(ctx context.Context, user domain.User) (domain.Session, error)) *MockSessionActions_Create_Call { + _c.Call.Return(run) + return _c +} + +// Resolve provides a mock function for the type MockSessionActions +func (_mock *MockSessionActions) Resolve(ctx context.Context, token string) (domain.User, error) { + ret := _mock.Called(ctx, token) + + if len(ret) == 0 { + panic("no return value specified for Resolve") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) (domain.User, error)); ok { + return returnFunc(ctx, token) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) domain.User); ok { + r0 = returnFunc(ctx, token) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, token) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSessionActions_Resolve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resolve' +type MockSessionActions_Resolve_Call struct { + *mock.Call +} + +// Resolve is a helper method to define mock.On call +// - ctx context.Context +// - token string +func (_e *MockSessionActions_Expecter) Resolve(ctx any, token any) *MockSessionActions_Resolve_Call { + return &MockSessionActions_Resolve_Call{Call: _e.mock.On("Resolve", ctx, token)} +} + +func (_c *MockSessionActions_Resolve_Call) Run(run func(ctx context.Context, token string)) *MockSessionActions_Resolve_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSessionActions_Resolve_Call) Return(user domain.User, err error) *MockSessionActions_Resolve_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockSessionActions_Resolve_Call) RunAndReturn(run func(ctx context.Context, token string) (domain.User, error)) *MockSessionActions_Resolve_Call { + _c.Call.Return(run) + return _c +} + +// Revoke provides a mock function for the type MockSessionActions +func (_mock *MockSessionActions) Revoke(ctx context.Context, userID uuid.UUID, token string) error { + ret := _mock.Called(ctx, userID, token) + + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, string) error); ok { + r0 = returnFunc(ctx, userID, token) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockSessionActions_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke' +type MockSessionActions_Revoke_Call struct { + *mock.Call +} + +// Revoke is a helper method to define mock.On call +// - ctx context.Context +// - userID uuid.UUID +// - token string +func (_e *MockSessionActions_Expecter) Revoke(ctx any, userID any, token any) *MockSessionActions_Revoke_Call { + return &MockSessionActions_Revoke_Call{Call: _e.mock.On("Revoke", ctx, userID, token)} +} + +func (_c *MockSessionActions_Revoke_Call) Run(run func(ctx context.Context, userID uuid.UUID, token string)) *MockSessionActions_Revoke_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockSessionActions_Revoke_Call) Return(err error) *MockSessionActions_Revoke_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockSessionActions_Revoke_Call) RunAndReturn(run func(ctx context.Context, userID uuid.UUID, token string) error) *MockSessionActions_Revoke_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/SessionService.go b/internal/transport/rest/mocks/SessionService.go new file mode 100644 index 00000000..62d6d433 --- /dev/null +++ b/internal/transport/rest/mocks/SessionService.go @@ -0,0 +1,178 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockSessionService creates a new instance of MockSessionService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockSessionService(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSessionService { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockSessionService{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockSessionService is an autogenerated mock type for the SessionService type +type MockSessionService struct { + mock.Mock +} + +type MockSessionService_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSessionService) EXPECT() *MockSessionService_Expecter { + return &MockSessionService_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockSessionService +func (_mock *MockSessionService) Create(ctx context.Context, user domain.User) (domain.Session, error) { + ret := _mock.Called(ctx, user) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 domain.Session + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.User) (domain.Session, error)); ok { + return returnFunc(ctx, user) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.User) domain.Session); ok { + r0 = returnFunc(ctx, user) + } else { + r0 = ret.Get(0).(domain.Session) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.User) error); ok { + r1 = returnFunc(ctx, user) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSessionService_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockSessionService_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - user domain.User +func (_e *MockSessionService_Expecter) Create(ctx any, user any) *MockSessionService_Create_Call { + return &MockSessionService_Create_Call{Call: _e.mock.On("Create", ctx, user)} +} + +func (_c *MockSessionService_Create_Call) Run(run func(ctx context.Context, user domain.User)) *MockSessionService_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.User + if args[1] != nil { + arg1 = args[1].(domain.User) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockSessionService_Create_Call) Return(session domain.Session, err error) *MockSessionService_Create_Call { + _c.Call.Return(session, err) + return _c +} + +func (_c *MockSessionService_Create_Call) RunAndReturn(run func(ctx context.Context, user domain.User) (domain.Session, error)) *MockSessionService_Create_Call { + _c.Call.Return(run) + return _c +} + +// Revoke provides a mock function for the type MockSessionService +func (_mock *MockSessionService) Revoke(ctx context.Context, userID uuid.UUID, token string) error { + ret := _mock.Called(ctx, userID, token) + + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, string) error); ok { + r0 = returnFunc(ctx, userID, token) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockSessionService_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke' +type MockSessionService_Revoke_Call struct { + *mock.Call +} + +// Revoke is a helper method to define mock.On call +// - ctx context.Context +// - userID uuid.UUID +// - token string +func (_e *MockSessionService_Expecter) Revoke(ctx any, userID any, token any) *MockSessionService_Revoke_Call { + return &MockSessionService_Revoke_Call{Call: _e.mock.On("Revoke", ctx, userID, token)} +} + +func (_c *MockSessionService_Revoke_Call) Run(run func(ctx context.Context, userID uuid.UUID, token string)) *MockSessionService_Revoke_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockSessionService_Revoke_Call) Return(err error) *MockSessionService_Revoke_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockSessionService_Revoke_Call) RunAndReturn(run func(ctx context.Context, userID uuid.UUID, token string) error) *MockSessionService_Revoke_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/UserLookup.go b/internal/transport/rest/mocks/UserLookup.go new file mode 100644 index 00000000..8268fe44 --- /dev/null +++ b/internal/transport/rest/mocks/UserLookup.go @@ -0,0 +1,115 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockUserLookup creates a new instance of MockUserLookup. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockUserLookup(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUserLookup { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockUserLookup{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockUserLookup is an autogenerated mock type for the UserLookup type +type MockUserLookup struct { + mock.Mock +} + +type MockUserLookup_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUserLookup) EXPECT() *MockUserLookup_Expecter { + return &MockUserLookup_Expecter{mock: &_m.Mock} +} + +// GetByID provides a mock function for the type MockUserLookup +func (_mock *MockUserLookup) GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) { + ret := _mock.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for GetByID") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) (domain.User, error)); ok { + return returnFunc(ctx, id) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) domain.User); ok { + r0 = returnFunc(ctx, id) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok { + r1 = returnFunc(ctx, id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockUserLookup_GetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByID' +type MockUserLookup_GetByID_Call struct { + *mock.Call +} + +// GetByID is a helper method to define mock.On call +// - ctx context.Context +// - id uuid.UUID +func (_e *MockUserLookup_Expecter) GetByID(ctx any, id any) *MockUserLookup_GetByID_Call { + return &MockUserLookup_GetByID_Call{Call: _e.mock.On("GetByID", ctx, id)} +} + +func (_c *MockUserLookup_GetByID_Call) Run(run func(ctx context.Context, id uuid.UUID)) *MockUserLookup_GetByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockUserLookup_GetByID_Call) Return(user domain.User, err error) *MockUserLookup_GetByID_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockUserLookup_GetByID_Call) RunAndReturn(run func(ctx context.Context, id uuid.UUID) (domain.User, error)) *MockUserLookup_GetByID_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/mocks/UserService.go b/internal/transport/rest/mocks/UserService.go new file mode 100644 index 00000000..a2dd6c1b --- /dev/null +++ b/internal/transport/rest/mocks/UserService.go @@ -0,0 +1,181 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + "mtusi-messenger/internal/domain" + + "github.com/google/uuid" + mock "github.com/stretchr/testify/mock" +) + +// NewMockUserService creates a new instance of MockUserService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockUserService(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUserService { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + + mock := &MockUserService{} + mock.Mock.Test(t) + + t.Cleanup(func() { + if helper, ok := t.(interface{ Helper() }); ok { + helper.Helper() + } + mock.AssertExpectations(t) + }) + + return mock +} + +// MockUserService is an autogenerated mock type for the UserService type +type MockUserService struct { + mock.Mock +} + +type MockUserService_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUserService) EXPECT() *MockUserService_Expecter { + return &MockUserService_Expecter{mock: &_m.Mock} +} + +// GetByID provides a mock function for the type MockUserService +func (_mock *MockUserService) GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) { + ret := _mock.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for GetByID") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) (domain.User, error)); ok { + return returnFunc(ctx, id) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) domain.User); ok { + r0 = returnFunc(ctx, id) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok { + r1 = returnFunc(ctx, id) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockUserService_GetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByID' +type MockUserService_GetByID_Call struct { + *mock.Call +} + +// GetByID is a helper method to define mock.On call +// - ctx context.Context +// - id uuid.UUID +func (_e *MockUserService_Expecter) GetByID(ctx any, id any) *MockUserService_GetByID_Call { + return &MockUserService_GetByID_Call{Call: _e.mock.On("GetByID", ctx, id)} +} + +func (_c *MockUserService_GetByID_Call) Run(run func(ctx context.Context, id uuid.UUID)) *MockUserService_GetByID_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 uuid.UUID + if args[1] != nil { + arg1 = args[1].(uuid.UUID) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockUserService_GetByID_Call) Return(user domain.User, err error) *MockUserService_GetByID_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockUserService_GetByID_Call) RunAndReturn(run func(ctx context.Context, id uuid.UUID) (domain.User, error)) *MockUserService_GetByID_Call { + _c.Call.Return(run) + return _c +} + +// Register provides a mock function for the type MockUserService +func (_mock *MockUserService) Register(ctx context.Context, draft domain.UserDraft) (domain.User, error) { + ret := _mock.Called(ctx, draft) + + if len(ret) == 0 { + panic("no return value specified for Register") + } + + var r0 domain.User + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.UserDraft) (domain.User, error)); ok { + return returnFunc(ctx, draft) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, domain.UserDraft) domain.User); ok { + r0 = returnFunc(ctx, draft) + } else { + r0 = ret.Get(0).(domain.User) + } + if returnFunc, ok := ret.Get(1).(func(context.Context, domain.UserDraft) error); ok { + r1 = returnFunc(ctx, draft) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockUserService_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register' +type MockUserService_Register_Call struct { + *mock.Call +} + +// Register is a helper method to define mock.On call +// - ctx context.Context +// - draft domain.UserDraft +func (_e *MockUserService_Expecter) Register(ctx any, draft any) *MockUserService_Register_Call { + return &MockUserService_Register_Call{Call: _e.mock.On("Register", ctx, draft)} +} + +func (_c *MockUserService_Register_Call) Run(run func(ctx context.Context, draft domain.UserDraft)) *MockUserService_Register_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 domain.UserDraft + if args[1] != nil { + arg1 = args[1].(domain.UserDraft) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockUserService_Register_Call) Return(user domain.User, err error) *MockUserService_Register_Call { + _c.Call.Return(user, err) + return _c +} + +func (_c *MockUserService_Register_Call) RunAndReturn(run func(ctx context.Context, draft domain.UserDraft) (domain.User, error)) *MockUserService_Register_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/transport/rest/requestid.go b/internal/transport/rest/requestid.go new file mode 100644 index 00000000..05bec608 --- /dev/null +++ b/internal/transport/rest/requestid.go @@ -0,0 +1,35 @@ +package rest + +import ( + "context" + "net/http" + + "github.com/google/uuid" +) + +const requestIDHeader = "X-Request-ID" + +type requestIDKey struct{} + +func requestIDFromContext(ctx context.Context) string { + id, _ := ctx.Value(requestIDKey{}).(string) + + return id +} + +func withRequestID(ctx context.Context, id string) context.Context { + return context.WithValue(ctx, requestIDKey{}, id) +} + +func requestIDMiddleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + id := r.Header.Get(requestIDHeader) + if id == "" { + id = uuid.NewString() + } + + w.Header().Set(requestIDHeader, id) + + next.ServeHTTP(w, r.WithContext(withRequestID(r.Context(), id))) + }) +} diff --git a/internal/transport/rest/router.go b/internal/transport/rest/router.go new file mode 100644 index 00000000..cfa2833a --- /dev/null +++ b/internal/transport/rest/router.go @@ -0,0 +1,31 @@ +package rest + +import ( + "log/slog" + "net/http" + + "mtusi-messenger/internal/transport/rest/internal/oas" +) + +func NewRouter( + handler oas.Handler, + security oas.SecurityHandler, + log *slog.Logger, + maxBodyBytes int64, +) (http.Handler, error) { + server, err := oas.NewServer( + handler, + security, + oas.WithErrorHandler(newErrorHandler(log)), + oas.WithNotFound(newNotFoundHandler(log)), + oas.WithMethodNotAllowed(newMethodNotAllowedHandler(log)), + oas.WithMiddleware(loggingMiddleware(log)), + ) + if err != nil { + return nil, err + } + + return requestIDMiddleware( + instanceIDMiddleware(InstanceID(), bodyLimitMiddleware(maxBodyBytes, log, server)), + ), nil +} diff --git a/internal/transport/rest/router_test.go b/internal/transport/rest/router_test.go new file mode 100644 index 00000000..4419ada4 --- /dev/null +++ b/internal/transport/rest/router_test.go @@ -0,0 +1,472 @@ +package rest_test + +import ( + "bytes" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "errors" + "io" + "log/slog" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/logger" + "mtusi-messenger/internal/transport/rest" + "mtusi-messenger/internal/transport/rest/mocks" +) + +const ( + requestIDHeader = "X-Request-ID" + instanceIDHeader = "X-Instance-Id" +) + +func basic(username, password string) string { + return base64.StdEncoding.EncodeToString([]byte(username + ":" + password)) +} + +func assertError(message string) error { + return errors.New(message) +} + +type httpResult struct { + status int + header http.Header + body []byte +} + +type routerFixture struct { + users *mocks.MockUserService + chats *mocks.MockChatService + messages *mocks.MockMessageService + health *mocks.MockHealthChecker + sessions *mocks.MockSessionActions + + server *httptest.Server +} + +// testMaxBodyBytes is small on purpose: the limit test does not need a 256 KiB body. +const testMaxBodyBytes = 64 << 10 + +func newRouterFixture(t *testing.T) *routerFixture { + t.Helper() + + fixture := &routerFixture{ + users: mocks.NewMockUserService(t), + chats: mocks.NewMockChatService(t), + messages: mocks.NewMockMessageService(t), + health: mocks.NewMockHealthChecker(t), + sessions: mocks.NewMockSessionActions(t), + } + + router, err := rest.NewRouter( + rest.NewHandler(fixture.users, fixture.chats, fixture.messages, fixture.health, fixture.sessions), + rest.NewSecurityHandler(fixture.sessions), + logger.New(logger.WithLevel(slog.LevelError)), + testMaxBodyBytes, + ) + require.NoError(t, err) + + fixture.server = httptest.NewServer(router) + t.Cleanup(fixture.server.Close) + + return fixture +} + +func (f *routerFixture) do(t *testing.T, method, path string, body []byte, headers map[string]string) httpResult { + t.Helper() + + var reader io.Reader + if body != nil { + reader = bytes.NewReader(body) + } + + req, err := http.NewRequestWithContext(t.Context(), method, f.server.URL+path, reader) + require.NoError(t, err) + + if body != nil { + req.Header.Set("Content-Type", "application/json") + } + + for key, value := range headers { + req.Header.Set(key, value) + } + + resp, err := f.server.Client().Do(req) + require.NoError(t, err) + + defer func() { _ = resp.Body.Close() }() + + payload, err := io.ReadAll(resp.Body) + require.NoError(t, err) + + return httpResult{status: resp.StatusCode, header: resp.Header, body: payload} +} + +func TestHealthEndpoints(t *testing.T) { + fixture := newRouterFixture(t) + fixture.health.EXPECT().Ping(mock.Anything).Return(nil).Maybe() + + result := fixture.do(t, http.MethodGet, "/health/live", nil, nil) + require.Equal(t, http.StatusOK, result.status) + require.NotEmpty(t, result.header.Get(requestIDHeader)) + require.JSONEq(t, `{"status":"ok"}`, string(result.body)) + + result = fixture.do(t, http.MethodGet, "/health/ready", nil, nil) + require.Equal(t, http.StatusOK, result.status) +} + +func TestReadinessReturns503WhenDependencyDown(t *testing.T) { + fixture := newRouterFixture(t) + fixture.health.EXPECT().Ping(mock.Anything).Return(assertError("down")).Maybe() + + result := fixture.do(t, http.MethodGet, "/health/ready", nil, nil) + require.Equal(t, http.StatusServiceUnavailable, result.status) + + var body struct { + Error struct { + Code string `json:"code"` + } `json:"error"` + } + require.NoError(t, json.Unmarshal(result.body, &body)) + require.Equal(t, "unavailable", body.Error.Code) +} + +func TestRequestIDEchoedFromClient(t *testing.T) { + fixture := newRouterFixture(t) + + result := fixture.do(t, http.MethodGet, "/health/live", nil, map[string]string{requestIDHeader: "from-client"}) + require.Equal(t, "from-client", result.header.Get(requestIDHeader)) +} + +func TestProtectedEndpointRequiresBearer(t *testing.T) { + tests := map[string]map[string]string{ + "без заголовка": nil, + "только X-User-Id": {"X-User-Id": uuid.NewString()}, + "basic вместо bearer": {"Authorization": "Basic dXNlcjpwYXNz"}, + } + + for name, headers := range tests { + t.Run(name, func(t *testing.T) { + fixture := newRouterFixture(t) + + result := fixture.do(t, http.MethodGet, "/api/v1/users/me", nil, headers) + require.Equal(t, http.StatusUnauthorized, result.status) + require.Contains(t, result.header.Get("WWW-Authenticate"), "Bearer") + }) + } +} + +func TestBearerSessionIsResolvedToCaller(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Once() + fixture.users.EXPECT().GetByID(mock.Anything, user.ID).Return(user, nil).Once() + + result := fixture.do(t, http.MethodGet, "/api/v1/users/me", nil, map[string]string{"Authorization": "Bearer opaque-token"}) + require.Equal(t, http.StatusOK, result.status) + + var body map[string]any + require.NoError(t, json.Unmarshal(result.body, &body)) + require.Equal(t, user.ID.String(), body["id"]) +} + +func TestUnknownBearerIsRejected(t *testing.T) { + fixture := newRouterFixture(t) + fixture.sessions.EXPECT().Resolve(mock.Anything, "unknown").Return(domain.User{}, domain.ErrUnauthenticated).Once() + + result := fixture.do(t, http.MethodGet, "/api/v1/chats", nil, map[string]string{"Authorization": "Bearer unknown"}) + require.Equal(t, http.StatusUnauthorized, result.status) + require.Contains(t, result.header.Get("WWW-Authenticate"), "Bearer") +} + +func TestRegisterUserReturnsContractShape(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + draft := domain.UserDraft{Username: "alice", DisplayName: "Алиса", Password: "very-secret-password"} + fixture.users.EXPECT().Register(mock.Anything, draft).Return(user, nil).Once() + + body, err := json.Marshal(map[string]string{"username": "alice", "display_name": "Алиса", "password": draft.Password}) + require.NoError(t, err) + + result := fixture.do(t, http.MethodPost, "/api/v1/users", body, nil) + require.Equal(t, http.StatusCreated, result.status) + require.NotContains(t, string(result.body), "password") + + var decoded map[string]any + require.NoError(t, json.Unmarshal(result.body, &decoded)) + require.Equal(t, user.ID.String(), decoded["id"]) + require.Len(t, decoded, 4) +} + +func TestRegisterDuplicateUsernameConflicts(t *testing.T) { + fixture := newRouterFixture(t) + fixture.users.EXPECT().Register(mock.Anything, mock.Anything).Return(domain.User{}, domain.ErrUsernameTaken).Once() + + body, err := json.Marshal(map[string]string{"username": "alice", "display_name": "Алиса", "password": "very-secret-password"}) + require.NoError(t, err) + + result := fixture.do(t, http.MethodPost, "/api/v1/users", body, nil) + require.Equal(t, http.StatusConflict, result.status) +} + +func TestCreateSessionFromBasicAuth(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + session := domain.Session{Token: "opaque-token", ExpiresAt: time.Now().UTC().Add(time.Hour), User: user} + + fixture.sessions.EXPECT().Authenticate(mock.Anything, "alice", "very-secret-password").Return(user, nil).Once() + fixture.sessions.EXPECT().Create(mock.Anything, user).Return(session, nil).Once() + + result := fixture.do(t, http.MethodPost, "/api/v1/auth/sessions", nil, map[string]string{ + "Authorization": "Basic " + basic("alice", "very-secret-password"), + }) + require.Equal(t, http.StatusCreated, result.status) + + var body struct { + Token string `json:"token"` + TokenType string `json:"token_type"` + } + require.NoError(t, json.Unmarshal(result.body, &body)) + require.Equal(t, "opaque-token", body.Token) + require.Equal(t, "Bearer", body.TokenType) +} + +func TestCreateSessionRejectsBadCredentials(t *testing.T) { + fixture := newRouterFixture(t) + fixture.sessions.EXPECT().Authenticate(mock.Anything, mock.Anything, mock.Anything).Return(domain.User{}, domain.ErrUnauthenticated).Once() + + result := fixture.do(t, http.MethodPost, "/api/v1/auth/sessions", nil, map[string]string{ + "Authorization": "Basic " + basic("alice", "wrong-password-value"), + }) + require.Equal(t, http.StatusUnauthorized, result.status) + require.Contains(t, result.header.Get("WWW-Authenticate"), "Basic") +} + +func TestRevokeSession(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Once() + fixture.sessions.EXPECT().Revoke(mock.Anything, user.ID, "opaque-token").Return(nil).Once() + + result := fixture.do(t, http.MethodDelete, "/api/v1/auth/sessions/current", nil, map[string]string{"Authorization": "Bearer opaque-token"}) + require.Equal(t, http.StatusNoContent, result.status) + require.Empty(t, result.body) +} + +func TestCursorRoundTrip(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + chatID := uuid.New() + message := domain.Message{ID: uuid.New(), ChatID: chatID, SenderID: user.ID, Text: "первое", CreatedAt: time.Now().UTC()} + + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Maybe() + fixture.messages.EXPECT(). + History(mock.Anything, user.ID, chatID, (*domain.Cursor)(nil), 1). + Return(domain.Page[domain.Message]{ + Items: []domain.Message{message}, + Next: &domain.Cursor{Scope: chatID, CreatedAt: message.CreatedAt, ID: message.ID}, + }, nil). + Once() + + result := fixture.do(t, http.MethodGet, "/api/v1/chats/"+chatID.String()+"/messages?limit=1", nil, map[string]string{"Authorization": "Bearer opaque-token"}) + require.Equal(t, http.StatusOK, result.status) + + var body struct { + Items []json.RawMessage `json:"items"` + NextCursor *string `json:"next_cursor"` + } + require.NoError(t, json.Unmarshal(result.body, &body)) + require.Len(t, body.Items, 1) + require.NotNil(t, body.NextCursor) + + fixture.messages.EXPECT(). + History(mock.Anything, user.ID, chatID, mock.Anything, 1). + Return(domain.Page[domain.Message]{Items: []domain.Message{}}, nil). + Once() + + result = fixture.do( + t, + http.MethodGet, + "/api/v1/chats/"+chatID.String()+"/messages?limit=1&cursor="+*body.NextCursor, + nil, + map[string]string{"Authorization": "Bearer opaque-token"}, + ) + require.Equal(t, http.StatusOK, result.status) +} + +func TestInvalidCursorIsRejected(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, mock.Anything).Return(user, nil).Maybe() + + result := fixture.do( + t, + http.MethodGet, + "/api/v1/chats/"+uuid.NewString()+"/messages?cursor=not-a-cursor", + nil, + map[string]string{"Authorization": "Bearer opaque-token"}, + ) + require.Equal(t, http.StatusBadRequest, result.status) +} + +func TestNotFoundAndMethodNotAllowed(t *testing.T) { + fixture := newRouterFixture(t) + + result := fixture.do(t, http.MethodGet, "/nope", nil, nil) + require.Equal(t, http.StatusNotFound, result.status) + + result = fixture.do(t, http.MethodDelete, "/health/live", nil, nil) + require.Equal(t, http.StatusMethodNotAllowed, result.status) +} + +func TestOversizedBodyIsRejectedWithPayloadTooLarge(t *testing.T) { + fixture := newRouterFixture(t) + + // Тело больше лимита не читается и не декодируется: отказ приходит сразу, + // до обращения к сервисам. + body, err := json.Marshal(map[string]string{ + "username": "alice", + "display_name": "Алиса", + "password": strings.Repeat("x", testMaxBodyBytes+1), + }) + require.NoError(t, err) + + result := fixture.do(t, http.MethodPost, "/api/v1/users", body, nil) + require.Equal(t, http.StatusRequestEntityTooLarge, result.status) + require.NotEmpty(t, result.header.Get(instanceIDHeader), "ответ об ошибке тоже помечен репликой") + require.NotEmpty(t, result.header.Get(requestIDHeader)) + + var decoded struct { + Error struct { + Code string `json:"code"` + } `json:"error"` + } + require.NoError(t, json.Unmarshal(result.body, &decoded)) + require.Equal(t, "payload_too_large", decoded.Error.Code) +} + +func TestCreateMessageRequiresIdempotencyKey(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Maybe() + + result := fixture.do( + t, + http.MethodPost, + "/api/v1/chats/"+uuid.NewString()+"/messages", + []byte(`{"text":"привет"}`), + map[string]string{"Authorization": "Bearer opaque-token"}, + ) + require.Equal(t, http.StatusBadRequest, result.status) + require.NotEmpty(t, result.header.Get(instanceIDHeader), "ответ об ошибке тоже помечен репликой") +} + +func TestCreateMessageFingerprintIgnoresJSONFormatting(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + chatID := uuid.New() + message := domain.Message{ID: uuid.New(), ChatID: chatID, SenderID: user.ID, Text: "привет", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Maybe() + + var fingerprints [][sha256.Size]byte + + fixture.messages.EXPECT(). + Send(mock.Anything, mock.MatchedBy(func(draft domain.MessageDraft) bool { + if draft.ChatID != chatID || draft.SenderID != user.ID || draft.Idempotency.Key != "key-1" { + return false + } + + fingerprints = append(fingerprints, draft.Idempotency.RequestHash) + + return true + })). + Return(message, nil) + + headers := map[string]string{"Authorization": "Bearer opaque-token", "Idempotency-Key": "key-1"} + path := "/api/v1/chats/" + chatID.String() + "/messages" + + first := fixture.do(t, http.MethodPost, path, []byte(`{"text":"привет"}`), headers) + replay := fixture.do(t, http.MethodPost, path, []byte(`{ "text" : "привет" }`), headers) + other := fixture.do(t, http.MethodPost, path, []byte(`{"text":"другое"}`), headers) + + require.Equal(t, http.StatusCreated, first.status) + require.Equal(t, http.StatusCreated, replay.status) + require.Equal(t, http.StatusCreated, other.status) + require.NotEmpty(t, first.header.Get(instanceIDHeader)) + require.Len(t, fingerprints, 3) + require.Equal(t, fingerprints[0], fingerprints[1], + "порядок ключей и пробелы в JSON не меняют отпечаток payload") + require.NotEqual(t, fingerprints[0], fingerprints[2], + "другой payload с тем же ключом — это конфликт, отпечатки обязаны различаться") +} + +func TestCreateMessageReplayConflictIsReportedAsConflict(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Maybe() + fixture.messages.EXPECT(). + Send(mock.Anything, mock.Anything). + Return(domain.Message{}, domain.ErrIdempotency). + Once() + + result := fixture.do( + t, + http.MethodPost, + "/api/v1/chats/"+uuid.NewString()+"/messages", + []byte(`{"text":"другой"}`), + map[string]string{"Authorization": "Bearer opaque-token", "Idempotency-Key": "key-1"}, + ) + require.Equal(t, http.StatusConflict, result.status) + + var body struct { + Error struct { + Code string `json:"code"` + } `json:"error"` + } + require.NoError(t, json.Unmarshal(result.body, &body)) + require.Equal(t, "conflict", body.Error.Code) +} + +func TestEveryResponseCarriesInstanceID(t *testing.T) { + fixture := newRouterFixture(t) + + user := domain.User{ID: uuid.New(), Username: "alice", DisplayName: "Алиса", CreatedAt: time.Now().UTC()} + fixture.sessions.EXPECT().Resolve(mock.Anything, "opaque-token").Return(user, nil).Maybe() + + tests := map[string]httpResult{ + "успешный ответ": fixture.do(t, http.MethodGet, "/health/live", nil, nil), + "неизвестный маршрут": fixture.do(t, http.MethodGet, "/nope", nil, nil), + "неподдерживаемый метод": fixture.do(t, http.MethodDelete, "/health/live", nil, nil), + "ошибка валидации схемы": fixture.do( + t, + http.MethodPost, + "/api/v1/chats/"+uuid.NewString()+"/messages", + []byte(`{"text":"привет"}`), + map[string]string{"Authorization": "Bearer opaque-token"}, + ), + } + + for name, result := range tests { + t.Run(name, func(t *testing.T) { + require.NotEmpty(t, result.header.Get(instanceIDHeader)) + }) + } +} diff --git a/internal/transport/rest/security.go b/internal/transport/rest/security.go new file mode 100644 index 00000000..939ff1c3 --- /dev/null +++ b/internal/transport/rest/security.go @@ -0,0 +1,60 @@ +package rest + +import ( + "context" + "errors" + + "github.com/google/uuid" + + "mtusi-messenger/internal/domain" + "mtusi-messenger/internal/transport/rest/internal/oas" +) + +var ErrUnauthenticated = errors.New("caller is not identified") + +type ( + callerKey struct{} + tokenKey struct{} + credentialsKey struct{} +) + +func CallerFromContext(ctx context.Context) (uuid.UUID, bool) { + id, ok := ctx.Value(callerKey{}).(uuid.UUID) + return id, ok +} + +func caller(ctx context.Context) uuid.UUID { + id, _ := CallerFromContext(ctx) + return id +} + +type SecSessionService interface { + Authenticate(ctx context.Context, username, password string) (domain.User, error) + Resolve(ctx context.Context, token string) (domain.User, error) +} + +type SecurityHandler struct { + sessions SecSessionService +} + +func NewSecurityHandler(sessions SecSessionService) *SecurityHandler { + return &SecurityHandler{sessions: sessions} +} + +func (h *SecurityHandler) HandleBasicAuth(ctx context.Context, _ oas.OperationName, auth oas.BasicAuth) (context.Context, error) { + user, err := h.sessions.Authenticate(ctx, auth.Username, auth.Password) + if err != nil { + return ctx, err + } + ctx = context.WithValue(ctx, callerKey{}, user.ID) + return context.WithValue(ctx, credentialsKey{}, user), nil +} + +func (h *SecurityHandler) HandleBearerAuth(ctx context.Context, _ oas.OperationName, auth oas.BearerAuth) (context.Context, error) { + user, err := h.sessions.Resolve(ctx, auth.Token) + if err != nil { + return ctx, err + } + ctx = context.WithValue(ctx, callerKey{}, user.ID) + return context.WithValue(ctx, tokenKey{}, auth.Token), nil +} diff --git a/scripts/api_cache_performance.sh b/scripts/api_cache_performance.sh new file mode 100644 index 00000000..10c03544 --- /dev/null +++ b/scripts/api_cache_performance.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +mkdir -p evidence/cache + +{ + echo "# API cache performance experiment" + echo "# generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" + 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/cache_api_performance.py +} > evidence/cache/api-performance.txt 2>&1 +cat evidence/cache/api-performance.txt diff --git a/scripts/cache_evidence.sh b/scripts/cache_evidence.sh new file mode 100644 index 00000000..b3f76283 --- /dev/null +++ b/scripts/cache_evidence.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +OUT="$ROOT/evidence/cache" +GO="${GO:-go}" + +cd "$ROOT" +mkdir -p "$OUT" + +{ + echo "# Cache consistency evidence (track 1)" + echo "# generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" + echo "# redis: ${TEST_REDIS_HOST:-localhost}:${TEST_REDIS_PORT:-6379} db=${TEST_REDIS_DB:-1}" + echo + "$GO" test -tags=integration -count=1 -v -timeout=5m \ + -run 'TestChatRepositorySuite|TestSessionRepositorySuite' \ + ./internal/storage/redis/... +} | tee "$OUT/consistency.txt" + +echo "wrote $OUT/consistency.txt" diff --git a/scripts/cache_latency_experiment.sh b/scripts/cache_latency_experiment.sh new file mode 100644 index 00000000..52438a39 --- /dev/null +++ b/scripts/cache_latency_experiment.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +mkdir -p evidence/cache + +{ + echo "# Cache latency experiment" + echo "# generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" + go version + uname -sm + go test -tags=integration -count=3 -timeout=5m -v \ + -run '^TestCacheLatencyExperiment$' ./internal/storage/postgres/... +} > evidence/cache/latency.txt 2>&1 +cat evidence/cache/latency.txt diff --git a/scripts/cache_performance_experiment.sh b/scripts/cache_performance_experiment.sh new file mode 100644 index 00000000..b431bb66 --- /dev/null +++ b/scripts/cache_performance_experiment.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +mkdir -p evidence/cache + +{ + echo "# Cache performance experiment" + echo "# generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" + go version + uname -sm + go test -tags=integration -count=3 -timeout=5m -v \ + -run '^TestCachePerformanceExperiment$' ./internal/storage/postgres/... +} > evidence/cache/performance.txt 2>&1 +cat evidence/cache/performance.txt diff --git a/scripts/lb_readiness_check.sh b/scripts/lb_readiness_check.sh new file mode 100755 index 00000000..23628a8c --- /dev/null +++ b/scripts/lb_readiness_check.sh @@ -0,0 +1,194 @@ +#!/bin/sh +# Проверка критерия «LB исключает неготовую реплику» (lab3). +# +# Рядом с рабочими репликами поднимается третья с тем же сетевым alias, но её +# доступ к БД идёт через временный TCP-прокси. Пока прокси жив, реплика готова и +# получает трафик через LB. После остановки прокси реплика остаётся доступной по +# сети (процесс жив, порт открыт), но /health/ready отвечает 503 — и балансировщик +# обязан убрать её из ротации и не отправлять ей ни одного запроса. +# +# scripts/lb_readiness_check.sh # стенд поднят (make up) +# OUT=evidence/lb-readiness.txt scripts/lb_readiness_check.sh +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +# .env определяет, на каком порту публикуется LB (compose.yaml) и какие креды у +# хранилищ, поэтому значения берём оттуда же, а не из окружения вызывающего. +if [ -f .env ]; then + set -a + # shellcheck disable=SC1091 + . ./.env + set +a +fi + +OUT=${OUT:-evidence/lb-readiness.txt} +PROJECT=${COMPOSE_PROJECT_NAME:-mtusi-messenger-lab3} +NET=${PROJECT}_default +IMAGE=${IMAGE:-mtusi-messenger:lab3} +STATS=${STATS:-http://127.0.0.1:8404/stats;csv} +BASE_URL=${BASE_URL:-http://localhost:8080} +CANDIDATE=lb-readiness-candidate +PROXY=lb-readiness-pgproxy +REQUESTS=${REQUESTS:-40} + +NO_PROXY_ENV="env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy" +NO_PROXY_ENV="$NO_PROXY_ENV NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1" + +cleanup() { + docker rm -f "$CANDIDATE" "$PROXY" >/dev/null 2>&1 || true +} + +trap cleanup EXIT INT TERM +cleanup + +instances() { + tries=${1:-$REQUESTS} + i=0 + + while [ "$i" -lt "$tries" ]; do + curl -fsS --noproxy '*' -D - -o /dev/null "$BASE_URL/health/live" 2>/dev/null \ + | awk 'tolower($1) == "x-instance-id:" { print $2 }' + i=$((i + 1)) + done | sort | uniq -c +} + +stats() { + curl -s --noproxy '*' "$STATS" | awk -F, '$1 ~ /^api/ { printf "%s=%s ", $2, $18 }' +} + +readiness() { + docker exec "$CANDIDATE" wget -qO- -S -T 3 http://127.0.0.1:8080/health/ready 2>&1 \ + | awk '/^ HTTP\//{print $2; exit}' +} + +wait_readiness() { + want=$1 + attempt=0 + + while [ "$attempt" -lt 30 ]; do + [ "$(readiness)" = "$want" ] && return 0 + attempt=$((attempt + 1)) + sleep 1 + done + + return 1 +} + +up_slots() { + curl -s --noproxy '*' "$STATS" | awk -F, '$1 ~ /^api/ && $18 == "UP" && $2 != "BACKEND" { printf "%s ", $2 }' +} + +wait_new_up_slot() { + before=$1 + attempt=0 + + while [ "$attempt" -lt 30 ]; do + for slot in $(up_slots); do + case " $before " in + *" $slot "*) ;; + *) echo "$slot"; return 0 ;; + esac + done + + attempt=$((attempt + 1)) + sleep 1 + done + + return 1 +} + +wait_slot_status() { + slot=$1 + want=$2 + attempt=0 + + while [ "$attempt" -lt 60 ]; do + status=$(curl -s --noproxy '*' "$STATS" | awk -F, -v s="$slot" '$1 ~ /^api/ && $2 == s { print $18; exit }') + + if [ "$status" = "$want" ]; then + SWAIT_SECONDS=$((attempt / 2)) + return 0 + fi + + attempt=$((attempt + 1)) + sleep 0.5 + done + + return 1 +} + +{ + echo "# LB excludes a not-ready but reachable replica (lab3)" + echo "# generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" + echo "# lb: $(docker inspect -f '{{.Config.Image}}' "$(docker ps -q --filter label=com.docker.compose.service=lb)" 2>/dev/null)" + echo + echo "## 1. baseline: requests through LB by replica" + instances + baseline_slots=$(up_slots) + echo " stats: $(stats)" + echo + echo "## 2. start a temporary TCP proxy to postgres and a candidate replica behind the same network alias" + docker run -d --name "$PROXY" --network "$NET" alpine/socat@sha256:fb3862c949af7c79996d0e514ee96128644d840835ed5368eeecb14a869de361 \ + tcp-listen:5432,fork,reuseaddr tcp-connect:postgres:5432 >/dev/null + docker run -d --name "$CANDIDATE" --network "$NET" --network-alias api-replica \ + -e APP_CONFIG=/etc/messenger/dev/config.yaml \ + -e POSTGRES_HOST="$PROXY" -e POSTGRES_PORT=5432 \ + -e POSTGRES_DATABASE="${POSTGRES_DATABASE:-messenger}" \ + -e POSTGRES_USER="${POSTGRES_USER:-messenger}" \ + -e POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-messenger}" -e POSTGRES_SSL_MODE=disable \ + -e REDIS_ENABLED=true -e REDIS_HOST=redis -e CACHE_ENABLED=true \ + "$IMAGE" >/dev/null + + if ! wait_readiness 200; then + echo " candidate did not become ready" >&2 + exit 1 + fi + + echo " instance-id: $(docker inspect -f '{{.Config.Hostname}}' "$CANDIDATE"), readiness while its database is reachable: 200" + + slot=$(wait_new_up_slot "$baseline_slots" || true) + if [ -z "$slot" ]; then + echo " candidate did not appear UP in the load balancer" >&2 + exit 1 + fi + + echo " load balancer slot for the candidate: $slot, stats: $(stats)" + echo + echo "## 3. cut the candidate's database access (stop only the TCP proxy)" + docker stop "$PROXY" >/dev/null + + if ! wait_readiness 503; then + echo " candidate readiness did not become 503" >&2 + exit 1 + fi + + echo " candidate is still running: $(docker inspect -f '{{.State.Status}}' "$CANDIDATE"), readiness: 503" + echo " waiting for the load balancer to mark $slot DOWN" + + if wait_slot_status "$slot" DOWN; then + echo " $slot went DOWN ${SWAIT_SECONDS}s after its database was cut (check: inter 2s fall 2)" + else + echo " WARNING: $slot is still not DOWN" >&2 + fi + + echo " stats after failure: $(stats)" + echo + echo "## 4. ${REQUESTS} requests through LB while the candidate is not ready" + instances + echo " (the candidate must not appear above)" + echo + echo "## 5. business writes through LB during the exclusion" + # shellcheck disable=SC2086 + $NO_PROXY_ENV python3 tests/load.py --base-url "$BASE_URL" --duration 5 --concurrency 2 \ + | grep -E '"successful_rps"|"failed_requests"|"error_ratio"' + echo + echo "## 6. cleanup" + cleanup + sleep 5 + echo " stats after cleanup: $(stats)" +} > "$OUT" 2>&1 + +cat "$OUT" +printf 'lb_readiness_check.sh: evidence in %s\n' "$OUT" diff --git a/scripts/memory_experiment.py b/scripts/memory_experiment.py new file mode 100644 index 00000000..6e370cc9 --- /dev/null +++ b/scripts/memory_experiment.py @@ -0,0 +1,271 @@ +import argparse +import json +import os +import subprocess +import threading +import time +import urllib.error +import urllib.request +import uuid + +import matplotlib + +matplotlib.use("Agg") +import matplotlib.pyplot as plt + + +def request(base_url, method, path, body=None, user_id=None): + payload = json.dumps(body, ensure_ascii=False).encode() if body is not None else None + headers = {"Content-Type": "application/json"} if payload else {} + if user_id: + headers["X-User-Id"] = user_id + request = urllib.request.Request( + base_url + path, + data=payload, + headers=headers, + method=method, + ) + with urllib.request.urlopen(request, timeout=3) as response: + return json.loads(response.read()) + + +def wait_ready(base_url): + deadline = time.monotonic() + 20 + while time.monotonic() < deadline: + try: + request(base_url, "GET", "/health/live") + return + except OSError: + time.sleep(0.1) + raise RuntimeError("container did not become ready") + + +def process_alive(container): + result = subprocess.run( + ["docker", "inspect", "--format", "{{.State.Running}}", container], + capture_output=True, + text=True, + check=False, + ) + return result.stdout.strip() == "true" + + +def sample_stats(container, samples, stop): + while not stop.is_set(): + result = subprocess.run( + ["docker", "stats", "--no-stream", "--format", "{{json .}}", container], + capture_output=True, + text=True, + check=False, + ) + if result.returncode == 0 and result.stdout.strip(): + try: + value = json.loads(result.stdout) + memory = value.get("MemUsage", "").split("/")[0].strip() + if memory == "0B" or not process_alive(container): + continue + samples.append({ + "time_seconds": time.monotonic(), + "memory": memory, + "memory_mib": parse_memory(memory), + }) + except (ValueError, IndexError): + pass + stop.wait(0.1) + + +def parse_memory(value): + units = {"B": 1 / 1024 / 1024, "KiB": 1 / 1024, "MiB": 1, "GiB": 1024} + for unit, factor in sorted(units.items(), key=lambda item: -len(item[0])): + if value.endswith(unit): + return float(value[:-len(unit)].strip()) * factor + raise ValueError(value) + + +def make_plot(data, output): + samples = [sample for sample in data["memory_samples"] if sample["memory_mib"] > 0] + start = samples[0]["time_seconds"] if samples else 0 + x = [sample["time_seconds"] - start for sample in samples] + memory = [sample["memory_mib"] for sample in samples] + + fig, memory_axis = plt.subplots(figsize=(11, 6)) + memory_axis.plot(x, memory, color="tab:red", label="RSS / container memory") + memory_axis.axhline(data["memory_limit_mib"], color="black", linestyle="--", label="memory limit") + memory_axis.set_xlabel("Time, seconds") + memory_axis.set_ylabel("Memory, MiB") + memory_axis.grid(True, alpha=0.25) + + message_axis = memory_axis.twinx() + message_axis.plot( + data["message_points_x"], + data["message_points_y"], + color="tab:blue", + label="successful messages", + ) + message_axis.set_ylabel("Successful messages") + + lines, labels = memory_axis.get_legend_handles_labels() + other_lines, other_labels = message_axis.get_legend_handles_labels() + memory_axis.legend(lines + other_lines, labels + other_labels, loc="upper left") + memory_axis.set_title("In-memory messenger: memory exhaustion point") + if data["oom_killed"] and data["failure_time_seconds"] is not None: + memory_axis.axvline( + data["failure_time_seconds"], + color="tab:purple", + linestyle=":", + label="container OOMKilled", + ) + memory_axis.annotate( + "OOMKilled", + (data["failure_time_seconds"], data["memory_limit_mib"]), + xytext=(8, -18), + textcoords="offset points", + color="tab:purple", + ) + fig.tight_layout() + fig.savefig(output, dpi=160) + plt.close(fig) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--image", required=True) + parser.add_argument("--memory", default="32m") + parser.add_argument("--output", default="evidence/memory-experiment.json") + parser.add_argument("--plot", default="evidence/memory-experiment.png") + parser.add_argument("--max-messages", type=int, default=100000) + args = parser.parse_args() + + container = "mtusi-memory-experiment-" + uuid.uuid4().hex[:8] + port = 18081 + base_url = f"http://127.0.0.1:{port}" + subprocess.run( + [ + "docker", "run", "-d", "--name", container, + "--memory", args.memory, "--memory-swap", args.memory, + "-p", f"127.0.0.1:{port}:8080", args.image, + ], + check=True, + capture_output=True, + text=True, + ) + + samples = [] + stop_sampling = threading.Event() + sampler = threading.Thread(target=sample_stats, args=(container, samples, stop_sampling)) + successful = 0 + failures = 0 + fatal_error = None + started = time.monotonic() + message_points_x = [] + message_points_y = [] + failure_time = None + oom_killed = False + last_error = None + last_state = {} + logs = "" + + try: + wait_ready(base_url) + user = request(base_url, "POST", "/api/v1/users", { + "username": "memory_" + uuid.uuid4().hex[:16], + "display_name": "Memory experiment", + }) + chat = request(base_url, "POST", "/api/v1/chats", { + "title": "Memory experiment", + "member_ids": [user["id"]], + }, user["id"]) + sampler.start() + time.sleep(0.5) + + body = "x" * 4000 + for index in range(args.max_messages): + try: + request( + base_url, + "POST", + f"/api/v1/chats/{chat['id']}/messages", + {"text": body}, + user["id"], + ) + successful += 1 + message_points_x.append(time.monotonic() - started) + message_points_y.append(successful) + except (OSError, urllib.error.HTTPError, ValueError) as exc: + last_error = type(exc).__name__ + ": " + str(exc) + failures += 1 + failure_time = time.monotonic() - started + break + + time.sleep(0.5) + if not process_alive(container): + failure_time = failure_time or (time.monotonic() - started) + inspect = subprocess.run( + ["docker", "inspect", "--format", "{{json .State}}", container], + capture_output=True, + text=True, + check=False, + ) + state = json.loads(inspect.stdout) if inspect.stdout.strip() else {} + if not state: + state_result = subprocess.run( + ["docker", "inspect", "--format", "{{json .State}}", container], + capture_output=True, + text=True, + check=False, + ) + state = json.loads(state_result.stdout) if state_result.stdout.strip() else {} + last_state = state + logs_result = subprocess.run(["docker", "logs", container], capture_output=True, text=True, check=False) + logs = logs_result.stdout + logs_result.stderr + oom_killed = bool(state.get("OOMKilled")) + if failure_time is None and failures: + failure_time = time.monotonic() - started + except Exception as exc: + fatal_error = type(exc).__name__ + ": " + str(exc) + failure_time = failure_time or (time.monotonic() - started) + finally: + stop_sampling.set() + if sampler.is_alive(): + sampler.join(timeout=2) + + memory_limit_mib = float(args.memory.rstrip("mM")) if args.memory.lower().endswith("m") else 0 + if not oom_killed: + inspect = subprocess.run( + ["docker", "inspect", "--format", "{{json .State}}", container], + capture_output=True, + text=True, + check=False, + ) + state = json.loads(inspect.stdout) if inspect.stdout.strip() else {} + last_state = state + oom_killed = bool(state.get("OOMKilled")) + + result = { + "image": args.image, + "memory_limit": args.memory, + "memory_limit_mib": memory_limit_mib, + "successful_messages": successful, + "failed_requests": failures, + "oom_killed": oom_killed, + "last_error": last_error, + "fatal_error": fatal_error, + "container_state": last_state, + "container_logs_tail": logs[-20000:], + "failure_time_seconds": failure_time, + "memory_samples": samples, + "message_points_x": message_points_x, + "message_points_y": message_points_y, + "reason": "process stopped after the container memory limit was reached" if oom_killed else "request processing did not reach the memory limit", + } + with open(args.output, "w", encoding="utf-8") as output: + json.dump(result, output, ensure_ascii=False, indent=2) + make_plot(result, args.plot) + print(json.dumps({key: result[key] for key in ( + "memory_limit", "successful_messages", "failed_requests", "oom_killed", "failure_time_seconds", "reason", + )}, ensure_ascii=False, indent=2)) + subprocess.run(["docker", "rm", "-f", container], capture_output=True, check=False) + + +if __name__ == "__main__": + main() diff --git a/scripts/path_overhead_check.sh b/scripts/path_overhead_check.sh new file mode 100755 index 00000000..a9538c4f --- /dev/null +++ b/scripts/path_overhead_check.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# Контроль пути «хост -> Colima VM -> LB»: тот же генератор и тот же профиль +# запускаются дважды — с хоста через опубликованный порт и изнутри VM, где +# клиент говорит с балансировщиком напрямую по docker-сети. Разница показывает +# вклад этого пути в потолок closed-loop профиля, а не приписывает его по +# догадке. Стенд должен быть поднят (`make up`). +# +# scripts/path_overhead_check.sh +# +# Артефакт: evidence/path-overhead/{inside,outside}.txt + summary.txt +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +COMPOSE_BIN=${COMPOSE_BIN:-docker compose} +OUT=${OUT:-evidence/path-overhead} +DURATION=${DURATION:-60} +CONCURRENCY=${CONCURRENCY:-8} +WARMUP=${WARMUP:-15} +CLIENT_IMAGE=${CLIENT_IMAGE:-python:3.12-alpine} + +compose() { + # shellcheck disable=SC2086 + $COMPOSE_BIN --env-file .env -f compose.yaml "$@" +} + +NO_PROXY_ENV="env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy" +NO_PROXY_ENV="$NO_PROXY_ENV NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1" + +mkdir -p "$OUT" + +network=$(docker inspect "$(compose ps -q api | head -1)" \ + --format '{{range $name, $network := .NetworkSettings.Networks}}{{$name}}{{end}}') + +printf '# Контроль пути к балансировщику\n' > "$OUT/summary.txt" +{ + printf '# generated: %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" + printf '# profile: tests/load.py duration=%s concurrency=%s warmup=%s\n' "$DURATION" "$CONCURRENCY" "$WARMUP" + printf '# docker network: %s\n' "$network" + printf '# клиент в VM: %s\n\n' "$CLIENT_IMAGE" +} >> "$OUT/summary.txt" + +# Клиент с хоста: путь «хост -> проброс порта -> VM -> LB». +printf '=== извне: клиент на хосте, http://127.0.0.1:8080 ===\n' | tee -a "$OUT/summary.txt" +# shellcheck disable=SC2086 +$NO_PROXY_ENV python3 tests/load.py --base-url http://127.0.0.1:8080 \ + --duration "$WARMUP" --concurrency "$CONCURRENCY" >/dev/null +# shellcheck disable=SC2086 +$NO_PROXY_ENV python3 tests/load.py --base-url http://127.0.0.1:8080 \ + --duration "$DURATION" --concurrency "$CONCURRENCY" \ + --output "$OUT/load-outside.json" | tee "$OUT/outside.txt" | tail -12 + +# Клиент внутри VM: тот же генератор и профиль, но без проброса порта и без +# сетевого стека хоста. Генератор делит 2 vCPU VM со стендом, поэтому его +# результат — нижняя оценка, а не потолок. +printf '\n=== изнутри: клиент в VM, http://lb ===\n' | tee -a "$OUT/summary.txt" +docker run --rm -i --network "$network" -v "$ROOT_DIR:/repo:ro" -v "$ROOT_DIR/$OUT:/out" \ + -e NO_PROXY='lb,localhost,127.0.0.1' -e no_proxy='lb,localhost,127.0.0.1' \ + "$CLIENT_IMAGE" python /repo/tests/load.py --base-url http://lb \ + --duration "$WARMUP" --concurrency "$CONCURRENCY" >/dev/null +docker run --rm -i --network "$network" -v "$ROOT_DIR:/repo:ro" -v "$ROOT_DIR/$OUT:/out" \ + -e NO_PROXY='lb,localhost,127.0.0.1' -e no_proxy='lb,localhost,127.0.0.1' \ + "$CLIENT_IMAGE" python /repo/tests/load.py --base-url http://lb \ + --duration "$DURATION" --concurrency "$CONCURRENCY" \ + --output /out/load-inside.json | tee "$OUT/inside.txt" | tail -12 + +printf 'path_overhead_check.sh: артефакты в %s\n' "$OUT" diff --git a/scripts/redis_outage_check.py b/scripts/redis_outage_check.py new file mode 100644 index 00000000..966dcc94 --- /dev/null +++ b/scripts/redis_outage_check.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 +"""Reproducible Redis-outage check: stop and pause, latency budget, create-during-outage. + +Exit code is non-zero when any assertion fails. Always unpauses/starts Redis. +""" +import concurrent.futures +import json +import os +import statistics +import subprocess +import sys +import time +import urllib.error +import urllib.request +import uuid +import base64 + +for proxy in ('HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY', 'http_proxy', 'https_proxy', 'all_proxy'): + os.environ.pop(proxy, None) +os.environ['NO_PROXY'] = 'localhost,127.0.0.1,::1' +os.environ['no_proxy'] = os.environ['NO_PROXY'] + +BASE_URL = os.environ.get('BASE_URL', 'http://localhost:8080') +COMPOSE = os.environ.get('COMPOSE_BIN', 'docker-compose') +COMPOSE_FILE = 'docker-compose.local.yaml' +BUDGET_MS = int(os.environ.get('OUTAGE_BUDGET_MS', '2000')) +PARALLEL = int(os.environ.get('OUTAGE_PARALLEL', '30')) + + +def compose(*args): + subprocess.run([COMPOSE, '-f', COMPOSE_FILE, *args], check=True, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + +def call(method, path, body=None, headers=None): + data = json.dumps(body).encode() if body is not None else None + h = {'Accept': 'application/json'} + if body is not None: + h['Content-Type'] = 'application/json' + h.update(headers or {}) + req = urllib.request.Request(BASE_URL + path, data=data, headers=h, method=method) + started = time.monotonic() + try: + resp = urllib.request.urlopen(req, timeout=10) + return resp.status, resp.read(), (time.monotonic() - started) * 1000 + except urllib.error.HTTPError as exc: + return exc.code, exc.read(), (time.monotonic() - started) * 1000 + + +def user(label): + username = label + '_' + uuid.uuid4().hex[:8] + password = 'T3st-' + uuid.uuid4().hex + call('POST', '/api/v1/users', {'username': username, 'display_name': label, 'password': password}) + credential = base64.b64encode((username + ':' + password).encode()).decode() + _, body, _ = call('POST', '/api/v1/auth/sessions', headers={'Authorization': 'Basic ' + credential}) + return json.loads(body) + + +def list_chats(actor): + status, body, ms = call('GET', '/api/v1/chats?limit=50', headers={'Authorization': 'Bearer ' + actor['token']}) + assert status == 200, 'GET /chats expected 200, got %d' % status + return json.loads(body)['items'], ms + + +def assert_budget(label, samples): + worst = max(samples) + p95 = sorted(samples)[max(0, (len(samples) * 95 + 99) // 100 - 1)] + print(' %s: n=%d max=%.0fms p95=%.0fms budget=%dms' % (label, len(samples), worst, p95, BUDGET_MS)) + assert worst <= BUDGET_MS, '%s exceeded budget: %.0fms > %dms' % (label, worst, BUDGET_MS) + + +def main(): + alice = user('alice') + bob = user('bob') + ah = {'Authorization': 'Bearer ' + alice['token']} + + try: + _, ms = list_chats(alice) + print('baseline: %.0fms' % ms) + + compose('stop', 'redis') + _, ms = list_chats(alice) + print('after stop: %.0fms' % ms) + assert_budget('stop', [ms]) + + compose('start', 'redis') + time.sleep(2) + compose('pause', 'redis') + + with concurrent.futures.ThreadPoolExecutor(max_workers=PARALLEL) as pool: + results = [f for f in pool.map(lambda _: list_chats(alice), range(PARALLEL))] + assert_budget('pause parallel', [ms for _, ms in results]) + + title = 'during-outage-' + uuid.uuid4().hex[:8] + status, _, _ = call('POST', '/api/v1/chats', { + 'title': title, + 'member_ids': [alice['user']['id'], bob['user']['id']], + }, headers=ah) + assert status == 201, 'chat create during pause expected 201, got %d' % status + print('create during pause: 201') + + compose('unpause', 'redis') + time.sleep(2) + + chats, ms = list_chats(alice) + assert any(c['title'] == title for c in chats), 'new chat missing after recovery (stale cache)' + print('after recovery: new chat visible, %.0fms' % ms) + + stuck = subprocess.run( + [COMPOSE, '-f', COMPOSE_FILE, 'exec', '-T', 'redis', 'redis-cli', '--scan', '--pattern', 'lock:*'], + check=True, capture_output=True, text=True, + ).stdout.split() + for key in stuck: + ttl = subprocess.run( + [COMPOSE, '-f', COMPOSE_FILE, 'exec', '-T', 'redis', 'redis-cli', 'ttl', key], + check=True, capture_output=True, text=True, + ).stdout.strip() + assert ttl != '-1', 'stuck lock without TTL: %s' % key + print('lock keys without TTL: 0') + print('PASS: redis outage handled within budget') + finally: + for action in ('unpause', 'start'): + subprocess.run([COMPOSE, '-f', COMPOSE_FILE, action, 'redis'], + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + +if __name__ == '__main__': + try: + main() + except AssertionError as exc: + print('FAIL: %s' % exc) + sys.exit(1) diff --git a/scripts/restart.sh b/scripts/restart.sh new file mode 100755 index 00000000..c8ce6dc6 --- /dev/null +++ b/scripts/restart.sh @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu +# Restart hook: bounce API replicas and every state store of the lab3 stand. +# +# scripts/restart.sh +# +# Persistent volumes are kept: no `down -v`, no flush, no re-seed. The one-shot +# `migrate` service is not re-run (schema stays as it is, data and sessions +# survive). The script exits 0 only after /health/ready answers through the LB. +# No credentials are printed. +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +# .env определяет, на каком порту публикуется LB (compose.yaml) и какие креды у +# хранилищ, поэтому значения берём оттуда же, а не из окружения вызывающего. +if [ -f .env ]; then + set -a + # shellcheck disable=SC1091 + . ./.env + set +a +fi + +COMPOSE_BIN=${COMPOSE_BIN:-docker compose} +PORT=${SERVER_PORT:-8080} + +# shellcheck disable=SC2086 +compose() { + # shellcheck disable=SC2086 + $COMPOSE_BIN --env-file .env -f compose.yaml "$@" +} + +# 1. State stores: restart the running ones, then make sure they are healthy. +# Volumes are attached as before, nothing is dropped or re-seeded. +compose up -d --wait postgres redis +compose restart postgres redis +compose up -d --wait postgres redis + +# 2. API replicas: restart in place (same containers, same addresses) and bring +# back any replica that was stopped by the fault-injection hook. +compose restart api +compose up -d --wait --no-deps api + +# 3. Load balancer keeps its upstream; re-resolve in case addresses changed. +compose restart lb + +# 4. Wait for readiness through the public entry point. +attempt=0 +while [ "$attempt" -lt 60 ]; do + if curl -fsS --noproxy '*' -o /dev/null "http://127.0.0.1:${PORT}/health/ready"; then + printf 'restart.sh: stack restarted, http://127.0.0.1:%s/health/ready is ready\n' "$PORT" + exit 0 + fi + attempt=$((attempt + 1)) + sleep 1 +done + +printf 'restart.sh: /health/ready did not become ready through the LB\n' >&2 +exit 1 diff --git a/scripts/rolling_update.sh b/scripts/rolling_update.sh new file mode 100755 index 00000000..6d664a83 --- /dev/null +++ b/scripts/rolling_update.sh @@ -0,0 +1,231 @@ +#!/bin/sh +# Rolling update of the API replicas under load (lab3, level 4). +# +# Замена идёт «наплывом» и строго по одной реплике: сначала рядом поднимается +# контейнер новой ревизии с тем же сетевым alias, затем снимается ОДИН старый. +# Каждый шаг гейтится состоянием балансировщика: новый слот должен стать UP +# (активная проверка /health/ready), снятый — перестать быть UP. Гейт по +# статистике LB, а не по наблюдению X-Instance-Id в ответах, потому что HAProxy +# переиспользует keepalive-соединения к уже работающим репликам и свежая реплика +# может какое-то время не получать трафик, оставаясь при этом готовой. +# +# В конце стенд возвращается под управление compose: поднимаются штатные реплики +# из новой ревизии, затем по одной снимаются временные контейнеры наплыва. +# +# scripts/rolling_update.sh # профиль лимитов берётся из .env/compose.yaml +# DURATION=60 CONCURRENCY=8 scripts/rolling_update.sh +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +COMPOSE_BIN=${COMPOSE_BIN:-docker compose} +PYTHON=${PYTHON:-python3} +DURATION=${DURATION:-60} +CONCURRENCY=${CONCURRENCY:-8} +BASE_URL=${BASE_URL:-http://localhost:8080} +OUT=${OUT:-evidence/rolling-update} +IMAGE=${IMAGE:-mtusi-messenger:lab3} +PROJECT=${COMPOSE_PROJECT_NAME:-mtusi-messenger-lab3} +NET=${PROJECT}_default +STATS=${STATS:-http://127.0.0.1:8404/stats;csv} +PREFIX=lb-rollout + +NO_PROXY_ENV="env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy" +NO_PROXY_ENV="$NO_PROXY_ENV NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1" + +mkdir -p "$OUT" +rm -f "$OUT/load.json" "$OUT/load.txt" + +compose() { + # shellcheck disable=SC2086 + $COMPOSE_BIN --env-file .env -f compose.yaml "$@" +} + +api_containers() { + docker ps -q \ + --filter "label=com.docker.compose.project=$PROJECT" \ + --filter 'label=com.docker.compose.service=api' +} + +rollout_containers() { + docker ps -q --filter "name=^$PREFIX" +} + +restarts() { + for container in $(api_containers) $(rollout_containers); do + printf '%s=%s ' "$(docker inspect --format '{{.Name}}' "$container" | sed 's|^/||')" \ + "$(docker inspect --format '{{.RestartCount}}' "$container")" + done +} + +stats_rows() { + curl -s --noproxy '*' "$STATS" +} + +# В CSV-выгрузке HAProxy колонка addr приходит пустой, поэтому привязка слота к +# конкретному контейнеру идёт по двум наблюдаемым фактам: контейнер отвечает на +# /health/ready, а число UP-слотов соответствует ожидаемому. +container_ready() { + docker exec "$1" wget -qO- -T 3 http://127.0.0.1:8080/health/ready 2>/dev/null | grep -q '"status":"ok"' +} + +wait_container_ready() { + name=$1 + attempt=0 + + while [ "$attempt" -lt 45 ]; do + container_ready "$name" && return 0 + attempt=$((attempt + 1)) + sleep 1 + done + + return 1 +} + +up_slots() { + stats_rows | awk -F, ' + NR == 1 { for (i = 1; i <= NF; i++) if ($i == "status") s = i; next } + $1 ~ /^api/ && $s == "UP" { count++ } END { print count + 0 }' +} + +wait_up_slots() { + want=$1 + attempt=0 + + while [ "$attempt" -lt 45 ]; do + [ "$(up_slots)" -ge "$want" ] && return 0 + attempt=$((attempt + 1)) + sleep 1 + done + + return 1 +} + +lb_5xx() { + stats_rows | awk -F, ' + NR == 1 { for (i = 1; i <= NF; i++) if ($i == "hrsp_5xx") column = i; next } + $1 == "http_front" && $2 == "FRONTEND" && column { print $column; exit }' +} + +{ + echo "# Rolling update under load (surge, one replica at a time)" + echo "# generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" + echo "# load: tolerant loader, duration=${DURATION}s concurrency=${CONCURRENCY}" + echo "# проверки готовности LB: httpchk /health/ready, inter 2s fall 2 rise 2, timeout check 1s" + echo + + # Сборка пишет много строк; в артефакт они не нужны. + compose build api >/dev/null 2>&1 || compose build api + + before_containers=$(api_containers) + replicas=$(printf '%s\n' "$before_containers" | wc -l | tr -d ' ') + [ "$replicas" -ge 2 ] || { echo "нужно не менее двух API-реплик" >&2; exit 1; } + + old_image=$(docker inspect --format '{{.Image}}' "$(printf '%s\n' "$before_containers" | head -1)") + new_image=$(docker image inspect --format '{{.Id}}' "$IMAGE") + echo "реплик до обновления: ${replicas}" + echo "образ старых реплик: ${old_image}" + echo "образ новой ревизии: ${new_image}" + echo "ревизия меняется: $([ "$old_image" = "$new_image" ] && echo 'нет (образ не изменился)' || echo 'да')" + echo "слотов UP до: $(up_slots); restarts до: $(restarts)" + echo + + envfile=$(mktemp) + trap 'rm -f "$envfile"; docker rm -f $(rollout_containers) >/dev/null 2>&1 || true' EXIT INT TERM + docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' \ + "$(printf '%s\n' "$before_containers" | head -1)" > "$envfile" + + # Перед измерением убеждаемся, что все ожидаемые реплики видит сам LB: после + # экспериментов с отказом хранилищ слоты могут быть в переходном состоянии. + if ! wait_up_slots "$replicas"; then + echo "перед обновлением LB видит меньше ${replicas} реплик" >&2 + exit 1 + fi + + five_before=$(lb_5xx) + # shellcheck disable=SC2086 + $NO_PROXY_ENV $PYTHON student-tests/rolling_update_load.py --base-url "$BASE_URL" \ + --duration "$DURATION" --concurrency "$CONCURRENCY" \ + --output "$OUT/load.json" > "$OUT/load.txt" 2>&1 & + load_pid=$! + + step=0 + for container in $before_containers; do + step=$((step + 1)) + name="$PREFIX-$step" + old_instance=$(docker inspect --format '{{.Config.Hostname}}' "$container") + started=$(date -u +%Y-%m-%dT%H:%M:%SZ) + + # 1. поднять реплику новой ревизии рядом со старыми; дождаться, что она + # сама готова и что LB видит на один слот больше + docker run -d --name "$name" --network "$NET" --network-alias api-replica \ + --env-file "$envfile" "$IMAGE" >/dev/null + new_instance=$(docker inspect --format '{{.Config.Hostname}}' "$name") + new_container_image=$(docker inspect --format '{{.Image}}' "$name") + + if ! wait_container_ready "$name"; then + echo " step ${step}: реплика ${name} не стала готова" >&2 + echo " diagnostics: status=$(docker inspect --format '{{.State.Status}}' "$name" 2>&1); stats: $(stats_rows | awk -F, '$1 ~ /^api/ { printf "%s=%s ", $2, $18 }')" >&2 + docker logs --tail 20 "$name" >&2 2>&1 || true + + exit 1 + fi + + if ! wait_up_slots "$((replicas + step))"; then + echo " step ${step}: UP-слотов меньше ожидаемого ($(up_slots) вместо $((replicas + step)))" >&2 + exit 1 + fi + + # 2. снять одну старую реплику и дождаться, что UP-слотов снова ровно + # столько, сколько реплик должно остаться + docker rm -f "$container" >/dev/null + + if ! wait_up_slots "$((replicas + step - 1))"; then + echo " step ${step}: после снятия UP-слотов больше ожидаемого" >&2 + exit 1 + fi + + printf ' step %s: %s обслуживает (образ %s, instance %s), старый контейнер %s (%s) снят; UP-слотов %s; 5xx накоплено %s; старт шага %s\n' \ + "$step" "$name" "${new_container_image#sha256:}" "$new_instance" \ + "${container:0:12}" "$old_instance" "$(up_slots)" "$(lb_5xx)" "$started" + done + + wait "$load_pid" || true + + five_after=$(lb_5xx) + echo + echo "load summary (tolerant generator):" + cat "$OUT/load.txt" + echo + echo "5xx от LB за время обновления (hrsp_5xx frontend): $((${five_after:-0} - ${five_before:-0}))" + echo "restarts после: $(restarts)" + + # 3. вернуть стенд под управление compose и убрать временные контейнеры + echo + echo "возврат стенда под управление compose:" + compose up -d --no-deps api + wait_up_slots "$replicas" || true + + remaining=$(printf '%s\n' $(rollout_containers) | wc -l | tr -d ' ') + for container in $(rollout_containers); do + docker rm -f "$container" >/dev/null + remaining=$((remaining - 1)) + + if ! wait_up_slots "$((replicas + remaining))"; then + echo " после снятия ${container} UP-слотов больше ожидаемого" >&2 + exit 1 + fi + done + + echo "снято временных контейнеров наплыва: проверено" + + echo "UP-слотов после: $(up_slots); restarts в конце: $(restarts)" + echo "API containers после обновления:" + docker ps --format '{{.Names}} {{.Status}}' \ + --filter "label=com.docker.compose.project=$PROJECT" \ + --filter 'label=com.docker.compose.service=api' +} > "$OUT/rolling-update.txt" 2>&1 + +cat "$OUT/rolling-update.txt" +printf 'rolling_update.sh: evidence in %s\n' "$OUT" diff --git a/scripts/stop-one.sh b/scripts/stop-one.sh new file mode 100755 index 00000000..3d7ff430 --- /dev/null +++ b/scripts/stop-one.sh @@ -0,0 +1,72 @@ +#!/bin/sh +set -eu +# Fault-injection hook: stop exactly ONE api replica of the lab3 stand. +# +# TARGET_INSTANCE_ID= scripts/stop-one.sh +# +# The task value is the instance alias the API reports in X-Instance-Id, i.e. +# the container hostname (docker's default = short container id). Container +# names of the api service are matched too. The container is only stopped +# (docker stop); databases, the load balancer and volumes are left untouched, +# and the replica stays down until it is started again explicitly, e.g. +# docker compose --env-file .env up -d --no-deps api +# No credentials are printed. +: "${TARGET_INSTANCE_ID:?test provides target API instance alias}" + +PROJECT=${COMPOSE_PROJECT_NAME:-mtusi-messenger-lab3} + +candidates=$(docker ps -q \ + --filter "label=com.docker.compose.project=${PROJECT}" \ + --filter "label=com.docker.compose.service=api") + +if [ -z "$candidates" ]; then + printf 'stop-one.sh: no api containers of project %s are running\n' "$PROJECT" >&2 + exit 1 +fi + +# Matches the requested alias against every reasonable identifier of a replica: +# container hostname (= X-Instance-Id), full/short container id, full container +# name (mtusi-messenger-lab3-api-1) and the service-local suffix (api-1). +match_replica() { + target=$1 + full_id=$2 + short_id=$3 + name=$4 + hostname=$5 + suffix=${name#${PROJECT}-} + + [ "$target" = "$hostname" ] && return 0 + [ "$target" = "$full_id" ] && return 0 + [ "$target" = "$short_id" ] && return 0 + [ "$target" = "$name" ] && return 0 + [ "$target" = "$suffix" ] && return 0 + return 1 +} + +matched="" +matched_names="" +for id in $candidates; do + info=$(docker inspect --format '{{.Id}} {{.Name}} {{.Config.Hostname}}' "$id") + full_id=$(printf '%s' "$info" | cut -d' ' -f1) + name=$(printf '%s' "$info" | cut -d' ' -f2 | sed 's|^/||') + hostname=$(printf '%s' "$info" | cut -d' ' -f3) + short_id=$(printf '%s' "$full_id" | cut -c1-12) + + if match_replica "$TARGET_INSTANCE_ID" "$full_id" "$short_id" "$name" "$hostname"; then + matched="$matched $id" + matched_names="$matched_names $name" + fi +done + +if [ -z "$matched" ]; then + printf 'stop-one.sh: no api replica matches TARGET_INSTANCE_ID=%s\n' "$TARGET_INSTANCE_ID" >&2 + exit 1 +fi + +# Shut down cleanly (SIGTERM) but never hang the caller for long. +for id in $matched; do + docker stop --time 5 "$id" >/dev/null +done + +printf 'stop-one.sh: stopped api replica(s):%s\n' "$matched_names" +exit 0 diff --git a/scripts/track1_controls.sh b/scripts/track1_controls.sh new file mode 100755 index 00000000..829bfd50 --- /dev/null +++ b/scripts/track1_controls.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# Контроль бюджетов БД и балансировщика, перемежённый с эталоном. +# +# По ходу серии пропускная способность дрейфует: таблица сообщений растёт +# (~95 тыс. строк на профиль), а вместе с ней и стоимость записи. Поэтому +# сравнивать профиль с бюджетом БД 1.00 CPU с эталоном, снятым четверть часа +# назад, нельзя — разница бюджетов утонет в дрейфе. Здесь эталон (2 реплики, +# PostgreSQL 0.50 CPU, LB 0.25 CPU) повторяется дважды, а каждая контролируемая +# ручка меняется ровно в одном профиле рядом с эталоном: +# +# ctl1base -> ctl2pg (БД 1.00) -> ctl3base -> ctl4lb (LB 1.00) +# +# Пара ctl1base/ctl3base даёт масштаб дрейфа за два профиля. +# +# scripts/track1_controls.sh +# rm evidence/track1/{load,stats,profile}-ctl*.{json,csv} # перемерить +set -eu + +ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT_DIR" + +SCALING=scripts/track1_scaling.sh +OUT=${OUT:-evidence/track1} +export OUT + +export CLIENT=${CLIENT:-vm} +export TOTAL_CPU=1.0 TOTAL_MEM_MB=768 DURATION=60 CONCURRENCY=8 WARMUP=15 +export POSTGRES_CPU_LIMIT=0.50 POSTGRES_MEM_LIMIT=384M POSTGRES_MAX_CONNS=10 LB_CPU_LIMIT=0.25 + +run() { + label=$1 + shift + + if [ -f "$OUT/profile-$label.json" ] && [ -f "$OUT/load-$label.json" ]; then + printf 'track1_controls.sh: профиль %s пропущен — артефакты уже есть\n' "$label" + + return 0 + fi + + LABEL="$label" env "$@" "$SCALING" +} + +run ctl1base REPLICAS=2 +run ctl2pg REPLICAS=2 POSTGRES_CPU_LIMIT=1.00 +run ctl3base REPLICAS=2 +run ctl4lb REPLICAS=2 LB_CPU_LIMIT=1.00 + +printf 'track1_controls.sh: готово, сводка — python3 scripts/track1_report.py\n' diff --git a/scripts/track1_report.py b/scripts/track1_report.py new file mode 100755 index 00000000..867f2e12 --- /dev/null +++ b/scripts/track1_report.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python3 +"""Сводка трека 1: артефакты `evidence/track1/*` -> таблица и графики. + +Читает `load-