Files
mtusi2026lab6-fork/infra/otel/collector.yaml
T

97 lines
3.1 KiB
YAML

# OpenTelemetry Collector (contrib 0.115.1) — получатель/обработчик/экспортёр, НЕ хранилище.
#
# API/worker --OTLP/HTTP :4318--> receivers.otlp
# traces -> memory_limiter -> batch -> otlp/tempo (Tempo, OTLP gRPC)
# metrics -> memory_limiter -> batch -> prometheus (pull: Prometheus скрейпит :8889)
# logs -> memory_limiter -> batch -> otlphttp/loki (Loki native OTLP /otlp)
#
# Ограничение памяти и буферов (поведение при недоступном backend):
# * memory_limiter: при > limit_mib collector отказывает новым данным (SDK получает
# ошибку и отбрасывает свой батч), принудительный GC; контейнер ограничен 256M.
# * sending_queue: в памяти, не больше queue_size батчей на exporter; при
# переполнении новые батчи отбрасываются (otelcol_exporter_enqueue_failed_*).
# * retry_on_failure: повтор не дольше max_elapsed_time, затем батч отбрасывается
# (otelcol_exporter_send_failed_*). Бесконечного накопления нет.
# Порты наружу не публикуются: 4317/4318/8888/8889 доступны только в сети telemetry.
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
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
exporters:
otlp/tempo:
endpoint: tempo:4317
tls:
insecure: true
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: http://loki:3100/otlp
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: 0.0.0.0:8889
# job = service.name, instance = service.instance.id; прочие resource-атрибуты — в target_info.
resource_to_telemetry_conversion:
enabled: false
# Серии остановленной реплики исчезают через 5 минут (а не висят вечно).
metric_expiration: 5m
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
extensions: [health_check]
telemetry:
logs:
level: info
metrics:
level: normal
address: 0.0.0.0:8888
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/loki]