Files
mtusi2026lab7/infra/otel/collector.yaml
T

149 lines
4.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OpenTelemetry Collector (contrib 0.128.0, lab7):
# Слушает строго 127.0.0.1 внутри общего netns с otel-gateway (mTLS + CN/SAN + CRL).
# Экспорт в Tempo/Loki/Prometheus идёт по нативному mTLS (+ Basic Auth в Prometheus).
extensions:
health_check:
endpoint: 127.0.0.1:13134
basicauth/prometheus:
client_auth:
username: otel-collector
password: ${file:/run/secrets/otel_prometheus_password}
receivers:
otlp:
protocols:
http:
endpoint: 127.0.0.1:14318
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: x-vault-token, action: delete }
- { key: X-Vault-Token, action: delete }
- { key: http.request.header.x-vault-token, action: delete }
- { key: x-bao-token, action: delete }
- { key: X-Bao-Token, action: delete }
- { key: http.request.header.x-bao-token, action: delete }
- { key: password, action: delete }
- { key: password_hash, action: delete }
- { key: token, action: delete }
- { key: session_token, action: delete }
- { key: client_token, action: delete }
- { key: metrics_token, action: delete }
- { key: secret_id, action: delete }
- { key: role_id, action: delete }
- { key: wrapping_token, action: delete }
- { key: unseal_key, action: delete }
- { key: private_key, action: delete }
- { key: db_password, action: delete }
- { key: redis_password, action: delete }
- { key: s3_secret_access_key, 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: false
ca_file: /run/certs/ca.crt
cert_file: /run/certs/client.crt
key_file: /run/certs/client.key
server_name_override: tempo
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: https://loki:3100/otlp
tls:
insecure: false
ca_file: /run/certs/ca.crt
cert_file: /run/certs/client.crt
key_file: /run/certs/client.key
server_name_override: loki
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 по HTTPS + mTLS + Basic Auth.
endpoint: https://prometheus:9090/api/v1/otlp
auth:
authenticator: basicauth/prometheus
tls:
insecure: false
ca_file: /run/certs/ca.crt
cert_file: /run/certs/client.crt
key_file: /run/certs/client.key
server_name_override: prometheus
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, basicauth/prometheus]
telemetry:
metrics:
level: detailed
readers:
- pull:
exporter:
prometheus:
host: 127.0.0.1
port: 18888
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]