лабораторная работа 7

This commit is contained in:
2026-11-18 01:02:09 +03:00
parent 20afc2c790
commit b035b50dbd
298 changed files with 28830 additions and 109 deletions
+113
View File
@@ -0,0 +1,113 @@
# OpenTelemetry Collector (contrib 0.115.1) — получатель/обработчик/экспортёр, НЕ хранилище.
#
# lab7: все входы Collector слушают ТОЛЬКО 127.0.0.1 своего сетевого namespace. Снаружи
# они доступны лишь через otel-gate (HAProxy в том же namespace, infra/haproxy/otel-gate.cfg):
# api/worker --mTLS (CN api|worker)--> gate :4318 --loopback--> receivers.otlp 127.0.0.1:14318
# prometheus --mTLS (CN prometheus)--> gate :8889 --loopback--> exporters.prometheus 127.0.0.1:18889
# prometheus --mTLS (CN prometheus)--> gate :8888 --loopback--> self-метрики 127.0.0.1:18888
# Выходы Collector — TLS с проверкой сервера (CA стенда + имя) и клиентским сертификатом
# otel-collector (mTLS) к Tempo (OTLP gRPC) и Loki (OTLP HTTP).
#
# Ограничение памяти и буферов (как в lab6): memory_limiter, sending_queue ограничена,
# retry_on_failure с max_elapsed_time — бесконечного накопления нет.
#
# Утечки: SDK не экспортирует заголовки Authorization/Cookie и тела; processor
# attributes/scrub дополнительно удаляет атрибуты с потенциальными секретами.
receivers:
otlp:
protocols:
http:
endpoint: 127.0.0.1:14318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 180
spike_limit_mib: 40
batch:
send_batch_size: 512
send_batch_max_size: 1024
timeout: 2s
# lab7: страховка от утечки credentials в telemetry (основная защита — в приложении).
attributes/scrub:
actions:
- key: http.request.header.authorization
action: delete
- key: http.request.header.cookie
action: delete
- key: db.user
action: delete
- key: url.query
action: delete
- key: http.url
action: delete
exporters:
otlp/tempo:
endpoint: tempo:4317
tls:
ca_file: /run/secrets/ca_crt
cert_file: /run/secrets/otel_collector_crt
key_file: /run/secrets/otel_collector_key
min_version: "1.2"
timeout: 5s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 20
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 10s
max_elapsed_time: 60s
otlphttp/loki:
endpoint: https://loki:3100/otlp
tls:
ca_file: /run/secrets/ca_crt
cert_file: /run/secrets/otel_collector_crt
key_file: /run/secrets/otel_collector_key
min_version: "1.2"
timeout: 5s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 20
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 10s
max_elapsed_time: 60s
prometheus:
endpoint: 127.0.0.1:18889
resource_to_telemetry_conversion:
enabled: false
metric_expiration: 5m
extensions:
health_check:
endpoint: 127.0.0.1:13133
service:
extensions: [health_check]
telemetry:
logs:
level: info
metrics:
level: normal
address: 127.0.0.1:18888
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlp/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlphttp/loki]