ЛР6: OTel SDK, Collector, Prometheus/Loki/Tempo, Grafana, alerts, dashboard, тесты инцидентов

This commit is contained in:
2026-11-16 22:14:42 +03:00
commit e617ce2caa
87 changed files with 8695 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
worker_processes auto;
events { worker_connections 1024; }
http {
# Nginx OSS резолвит DNS в upstream один раз при старте.
# Поэтому перечисляем обе реплики явно по DNS-именам контейнеров Compose.
upstream api_pool {
server messenger-lab6-api-1:8080 max_fails=1 fail_timeout=5s;
server messenger-lab6-api-2:8080 max_fails=1 fail_timeout=5s;
keepalive 16;
}
server {
listen 80;
location / {
proxy_pass http://api_pool;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
# Retry только на connection errors/timeouts (backend не ответил).
proxy_next_upstream error timeout;
proxy_next_upstream_tries 2;
proxy_connect_timeout 2s;
# 15s вместо 60s: мёртвый backend помечается быстрее,
# failover укладывается в 10-секундный бюджет.
proxy_send_timeout 15s;
proxy_read_timeout 15s;
# 11m, а не 10m: пропускаем до backend, чтобы он сам вернул 413
# с X-Request-Id и телом ошибки. Верхний лимит 10 MiB — в приложении.
client_max_body_size 11m;
# ВАЖНО: on, а не off. С off nginx стримит тело в backend
# и не может повторить POST на живую реплику, если backend умер
# посреди запроса.
proxy_request_buffering on;
}
}
}