Files
mtusi2026lab6/infra/otel/collector.yaml
T

76 lines
3.3 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). Один пайплайн на сигнал, у каждого — реальный backend:
# traces -> Tempo (OTLP/gRPC)
# metrics -> Prometheus (Prometheus-экспортёр: Prometheus сам забирает /metrics у Collector)
# logs -> Loki (OTLP/HTTP, нативный приём Loki)
# Collector — маршрутизатор/обработчик, не долговременное хранилище. Порты 4317/4318 доступны ТОЛЬКО во внутренней сети backend.
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
# Защита RAM Collector: при приближении к лимиту новые данные отклоняются (клиент SDK получает ошибку и отбрасывает
# пакет, приложение продолжает работать). limit_mib согласован с mem_limit контейнера.
memory_limiter:
check_interval: 1s
limit_mib: 280
spike_limit_mib: 60
batch:
send_batch_size: 1024
send_batch_max_size: 2048
timeout: 2s
# Гарантированное удаление чувствительных атрибутов, даже если приложение их случайно передаст.
attributes/scrub:
actions:
- {key: http.request.header.authorization, action: delete}
- {key: http.request.header.cookie, action: delete}
- {key: http.request.body, action: delete}
- {key: db.statement, action: delete}
- {key: url.query, action: delete}
- {key: http.target, action: delete}
# Tail-sampling (профиль «tail», см. collector-tail.yaml): здесь не используется.
exporters:
otlp_grpc/tempo:
endpoint: tempo:4317
tls: {insecure: true}
# Ограниченная буферизация при недоступном backend: очередь фиксированного размера, повторы до 30 с, затем отбрасывание
# (потери считаются метрикой otelcol_exporter_send_failed_spans / otelcol_exporter_queue_size).
sending_queue: {enabled: true, num_consumers: 2, queue_size: 500}
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 10s, max_elapsed_time: 30s}
otlp_http/loki:
endpoint: http://loki:3100/otlp
sending_queue: {enabled: true, num_consumers: 2, queue_size: 500}
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 10s, max_elapsed_time: 30s}
prometheus:
endpoint: 0.0.0.0:8889
resource_to_telemetry_conversion: {enabled: true}
metric_expiration: 20s
service:
telemetry:
metrics:
level: normal
readers:
- pull:
exporter:
prometheus: {host: 0.0.0.0, port: 8888}
logs:
level: warn
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlp_grpc/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlp_http/loki]