lab6: Collector, Prometheus/Loki/Tempo/Grafana, alerts, incidents, track 1 (cost of observability)

This commit is contained in:
lab6
2026-11-10 01:57:47 +03:00
parent 63dba7627c
commit d558148d0d
142 changed files with 94773 additions and 88 deletions
@@ -0,0 +1,6 @@
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.
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
+46
View File
@@ -0,0 +1,46 @@
python3 scripts/lab5/worker_down_demo.py --base-url "http://localhost:8080"
[1] compose ps
SERVICE STATUS
api Up Less than a second (health: starting)
api Up 24 seconds (healthy)
broker Up 27 seconds (healthy)
grafana Up 28 seconds
haproxy Up 28 seconds
loki Up 27 seconds
otel-collector Up 28 seconds
postgres Up 28 seconds (healthy)
prometheus Up 28 seconds
redis Up 28 seconds (healthy)
s3 Up 28 seconds (healthy)
tempo Up 28 seconds
worker Up 28 seconds (healthy)
[2] stop worker
[3] upload while worker is down (expect 202 queued)
attachment=38d64985-29ef-4e80-a385-169bbcb65060 status=queued
[4] content and thumbnail must answer 409 before ready
[5] link the queued attachment to messages
message=38265a3d-2654-4c38-9615-19c32c013019
[6] wait for outbox publish and a message in the queue
queue={'messages': 1, 'type': 'quorum'}
[7] restart broker and API with volumes
[8] the quorum message survived the broker restart
queue={'messages': 1, 'type': 'quorum'}
[9] start worker
[10] wait ready and verify the thumbnail
ready attachment=38d64985-29ef-4e80-a385-169bbcb65060 thumbnail=256x160 sha256=a18bfc29cd931180...
[11] compose ps
SERVICE STATUS
api Up 22 seconds (healthy)
api Up 22 seconds (healthy)
broker Up 24 seconds (healthy)
grafana Up About a minute
haproxy Up About a minute
loki Up About a minute
otel-collector Up About a minute
postgres Up About a minute (healthy)
prometheus Up About a minute
redis Up About a minute (healthy)
s3 Up About a minute (healthy)
tempo Up About a minute
worker Up 1 second (health: starting)
PASS: worker-down durability demo
+2
View File
@@ -0,0 +1,2 @@
Test Files 23 passed (23)
Tests 89 passed (89)
@@ -0,0 +1,15 @@
cd app && E2E_COMPOSE_DIR="/home/tomato/Projects/VP/mtusi2026lab6" E2E_COMPOSE_ENV_FILE=".env" npm run test:dependencies
> app@0.0.1 test:dependencies
> E2E_DEPENDENCY_FAULTS=1 vitest run --config ./vitest.config.e2e.ts dependency-failures
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab6/app
Test Files 1 passed (1)
Tests 7 passed (7)
Start at 01:54:04
Duration 140.88s (transform 61ms, setup 0ms, import 95ms, tests 140.67s, environment 0ms)
+15
View File
@@ -0,0 +1,15 @@
scripts/app-e2e.sh
> app@0.0.1 test:e2e
> vitest run --config ./vitest.config.e2e.ts
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab6/app
Test Files 3 passed | 1 skipped (4)
Tests 44 passed | 9 skipped (53)
Start at 01:51:01
Duration 11.99s (transform 315ms, setup 0ms, import 922ms, tests 18.77s, environment 1ms)
@@ -0,0 +1,4 @@
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": 142, "failed_attempts": 0, "first_recovery_seconds": 3.306}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
@@ -0,0 +1,3 @@
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.