Files
mtusi2026lab7/infra/otel/collector.yaml
T
ilya.tyunin 3418252554 lab7: базовый коммит из lab6 (bf06167)
Перенесена кодовая база и инфраструктура lab6: NestJS-приложение (API +
worker, RabbitMQ, outbox, S3, OpenTelemetry), Dockerfile, compose.yaml,
infra/{grafana,haproxy,loki,minio,otel/collector.yaml,prometheus,
rabbitmq,tempo}, docs/runbooks, стендовые скрипты, scripts/lab{4,5,6} и
contracts/extensions.openapi.json.

Задание lab7 оставлено своим: README, REPORT, COURSE, CONTRIBUTING,
MAINTAINERS, lab.json, contracts/{openapi,infrastructure,jobs.schema,
attachment-states,examples,observability,trust-matrix,README},
security/THREAT_MODEL.md, tests (включая security.py), compose.example.yaml,
infra/{openbao,otel}/README.md, .github/pull_request_template.md.
Не переносились старые evidence/lab4..lab6 (18 МБ трека lab6) и
неотслеживаемый docs/lab6.html.

Адаптации при переносе:
- docker-проект mtusi-lab6 -> mtusi-lab7, тег образа mtusi-messenger:lab7
  и папка Grafana Messenger lab7 (compose.yaml, scripts/stop-one.sh,
  .env.example, infra/README.md, infra/grafana/provisioning/dashboards),
  чтобы тома и контейнеры не пересекались с lab6;
- Makefile: сохранены BASE_URL=https://localhost:8443 и цель test-security
  из skeleton lab7, добавлены стендовые и проверочные цели lab6;
- .env.example: рабочие переменные приложения и стенда lab6 + блок
  переменных lab7 (PUBLIC_BASE_URL, TLS_*, BAO_*, ARGON2_*) из skeleton.
2026-11-26 15:35:57 +03:00

110 lines
3.2 KiB
YAML

# OpenTelemetry Collector (contrib 0.128.0): единственная OTLP-точка входа.
# traces -> Tempo, metrics -> Prometheus OTLP receiver, logs -> Loki OTLP.
# Порт 4318 доступен только внутри compose-сети (наружу не публикуется).
extensions:
health_check:
endpoint: 0.0.0.0:13133
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
processors:
# Бэкпрешер: при приближении к лимиту отказывает приёмнику (SDK ретраит/теряет).
# Для контейнера 256 MiB: limit_mib=floor(256*0.8), spike=floor(limit*0.2).
memory_limiter:
check_interval: 1s
limit_mib: 204
spike_limit_mib: 40
# Второй рубеж: секретные атрибуты. Тело лога защищает redaction приложения.
attributes/scrub:
actions:
- { key: authorization, action: delete }
- { key: Authorization, action: delete }
- { key: http.request.header.authorization, action: delete }
- { key: cookie, action: delete }
- { key: Cookie, action: delete }
- { key: http.request.header.cookie, action: delete }
- { key: password, action: delete }
- { key: token, action: delete }
- { key: session_token, action: delete }
- { key: http.request.body, action: delete }
- { key: http.response.body, action: delete }
- { key: url.full, action: delete }
- { key: http.url, action: delete }
batch:
timeout: 1s
send_batch_size: 512
send_batch_max_size: 1024
exporters:
otlp/tempo:
endpoint: tempo:4317
tls:
insecure: true
timeout: 5s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 128
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
otlphttp/loki:
endpoint: http://loki:3100/otlp
timeout: 5s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 128
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
otlphttp/prometheus:
# Prometheus сам обслуживает /api/v1/otlp/v1/metrics.
endpoint: http://prometheus:9090/api/v1/otlp
timeout: 5s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 128
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
service:
extensions: [health_check]
telemetry:
metrics:
level: detailed
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
without_scope_info: true
without_units: true
without_type_suffix: true
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlp/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlphttp/prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlphttp/loki]