feat: core func lab6, loki, prometeus etc

This commit is contained in:
Enterxx2
2026-11-24 10:50:49 +03:00
parent 60a71dc839
commit 0011b3aabb
47 changed files with 2598 additions and 94 deletions
+4
View File
@@ -0,0 +1,4 @@
.venv/bin/python 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.
+1
View File
@@ -0,0 +1 @@
PASS: Grafana loaded 17 panels, Prometheus executed 27 dashboard queries
+35
View File
@@ -0,0 +1,35 @@
python3 scripts/check_observability.py --base-url "http://localhost:8082" --grafana-url "http://localhost:3006" --incidents
SIGNALS trace=4a2dec658965c2c25e0e33c7f357c738 request_id=99d9ad1341dd202e5b6f22975ae3e9b8 spans=22 metrics=16 panels=17
Container messenger-lab6-worker-1 Stopping
Container messenger-lab6-worker-1 Stopped
Container messenger-lab6-postgres-1 Waiting
Container messenger-lab6-s3-1 Waiting
Container messenger-lab6-s3-1 Healthy
Container messenger-lab6-postgres-1 Healthy
Container messenger-lab6-s3-bootstrap-1 Starting
Container messenger-lab6-migrate-1 Starting
Container messenger-lab6-s3-bootstrap-1 Started
Container messenger-lab6-migrate-1 Started
Container messenger-lab6-broker-1 Waiting
Container messenger-lab6-migrate-1 Waiting
Container messenger-lab6-s3-bootstrap-1 Waiting
Container messenger-lab6-broker-1 Healthy
Container messenger-lab6-s3-bootstrap-1 Exited
Container messenger-lab6-migrate-1 Exited
Container messenger-lab6-worker-1 Starting
Container messenger-lab6-worker-1 Started
QUEUE firing → resolved; depth=1 oldest=19.9s trace=2cb55e0cec7f29110c363a2a581ca265 retry linked
Container messenger-lab6-postgres-1 Stopping
Container messenger-lab6-postgres-1 Stopped
Container messenger-lab6-postgres-1 Starting
Container messenger-lab6-postgres-1 Started
DB firing → resolved; 503=44 ratio=73.0% trace=83aa5b76b36831200387fe72ba38c175 failed_span=postgres.pool.acquire
Container messenger-lab6-tempo-1 Stopping
Container messenger-lab6-loki-1 Stopping
Container messenger-lab6-tempo-1 Stopped
Container messenger-lab6-loki-1 Stopped
Container messenger-lab6-loki-1 Starting
Container messenger-lab6-tempo-1 Starting
Container messenger-lab6-tempo-1 Started
Container messenger-lab6-loki-1 Started
STORAGE successful writes=450 dropped logs/spans=2017 peak collector RSS=213.9 MiB; history preserved and new signals ingested
+4
View File
@@ -0,0 +1,4 @@
messenger-lab6-api-1 49.66% 81.23MiB / 512MiB
messenger-lab6-api-2 99.58% 81.36MiB / 512MiB
messenger-lab6-worker-1 0.34% 77.75MiB / 1.75GiB
messenger-lab6-otel-collector-1 3.29% 65.54MiB / 256MiB
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 6,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 30.0,
"elapsed_seconds": 33.104,
"concurrency": 4,
"successful_requests": 3797,
"failed_requests": 4,
"error_ratio": 0.001052,
"successful_rps": 114.697,
"successful_latency_ms": {
"p50": 14.476,
"p95": 63.627,
"p99": 92.915
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+19
View File
@@ -0,0 +1,19 @@
./scripts/check_migrations.sh
2026-11-23 16:54:45.450 | INFO | infrastructure.dependencies.database:create_pool:71 - Установка соединения с базой данных psql
2026-11-23 16:54:45.523 | INFO | infrastructure.dependencies.database:create_pool:101 - Соединение с базой данных psql установлено. DB_NAME: test, pool: 2..10
пустой volume: таблиц в public = 0
API до migrate: В БД не применены миграции [1, 2, 3, 4, 5, 6]: сначала запустите migrate
2026-11-23 16:54:45.540 | INFO | infrastructure.dependencies.database:apply_migrations:154 - Применена миграция 0001_init.sql
2026-11-23 16:54:45.541 | INFO | infrastructure.dependencies.database:apply_migrations:154 - Применена миграция 0002_message_idempotency.sql
2026-11-23 16:54:45.546 | INFO | infrastructure.dependencies.database:apply_migrations:154 - Применена миграция 0003_attachments.sql
2026-11-23 16:54:45.553 | INFO | infrastructure.dependencies.database:apply_migrations:154 - Применена миграция 0004_attachment_jobs.sql
2026-11-23 16:54:45.554 | INFO | infrastructure.dependencies.database:apply_migrations:154 - Применена миграция 0005_job_error_code.sql
2026-11-23 16:54:45.554 | INFO | infrastructure.dependencies.database:apply_migrations:154 - Применена миграция 0006_job_trace_context.sql
2026-11-23 16:54:45.555 | INFO | infrastructure.dependencies.database:apply_migrations:159 - Схема БД в актуальной версии
запуск 1: schema_migrations = [(1, '0001_init'), (2, '0002_message_idempotency'), (3, '0003_attachments'), (4, '0004_attachment_jobs'), (5, '0005_job_error_code'), (6, '0006_job_trace_context')], таблиц = 13
2026-11-23 16:54:45.556 | INFO | infrastructure.dependencies.database:apply_migrations:159 - Схема БД в актуальной версии
запуск 2: schema_migrations = [(1, '0001_init'), (2, '0002_message_idempotency'), (3, '0003_attachments'), (4, '0004_attachment_jobs'), (5, '0005_job_error_code'), (6, '0006_job_trace_context')], таблиц = 13
2026-11-23 16:54:45.556 | INFO | infrastructure.dependencies.database:apply_migrations:159 - Схема БД в актуальной версии
запуск 3: schema_migrations = [(1, '0001_init'), (2, '0002_message_idempotency'), (3, '0003_attachments'), (4, '0004_attachment_jobs'), (5, '0005_job_error_code'), (6, '0006_job_trace_context')], таблиц = 13
2026-11-23 16:54:45.557 | INFO | infrastructure.dependencies.database:check_migrations:181 - Схема БД совместима: версия 6
API после migrate: схема совместима
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8082"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
PASS: historical metrics, logs and spans are still accessible via Grafana after restarting the stack.
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://localhost:8082"
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
+1
View File
@@ -0,0 +1 @@
================== 195 passed, 23 skipped in 61.04s (0:01:01) ==================