Files
mtusi2026lab6/infra/otel/collector.yaml
T

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]