# OpenTelemetry Collector (contrib 0.163.2) — получатель, обработчик и экспортёр, не хранилище. # receivers: otlp (loopback HTTP :14318 за mTLS ingress :4318) от api и worker; prometheus — скрейп метрик RabbitMQ (очередь), HAProxy и самого # Collector (otelcol_*: принятые/отправленные/потерянные данные, очередь экспортёров, RSS). # processors: memory_limiter (первым: при 200 MiB отказывает в приёме, а не растёт до OOM), redaction # (страховка: маскирует значения, похожие на секреты), batch. # exporters: traces → Tempo (OTLP gRPC), logs → Loki (OTLP HTTP /otlp), metrics → Prometheus (OTLP receiver). # Недоступный backend: данные ждут в ограниченной очереди в памяти (20 000 элементов на экспортёр), повтор с # backoff до 60 с, затем отбрасываются и считаются (otelcol_exporter_send_failed_*, otelcol_exporter_enqueue_failed_*). # Приложение от Collector не зависит: SDK отбрасывает данные при недоступности, запросы не ждут. extensions: health_check: endpoint: 127.0.0.1:13133 receivers: otlp: protocols: http: endpoint: 127.0.0.1:14318 prometheus: config: global: scrape_interval: 10s scrape_timeout: 5s scrape_configs: # Очередь attachments.process: messages_ready/unacked и число consumers (per-object метрики vhost messenger). - job_name: rabbitmq scheme: https tls_config: &scrape_tls ca_file: /run/tls/ca.crt cert_file: /run/client/tls.crt key_file: /run/client/tls.key metrics_path: /metrics/detailed params: family: [queue_coarse_metrics, queue_consumer_count] vhost: [messenger] static_configs: - targets: [rabbitmq:15691] - job_name: haproxy scheme: https tls_config: *scrape_tls static_configs: - targets: [lb:8404] - job_name: otelcol static_configs: - targets: [127.0.0.1:8888] processors: memory_limiter: check_interval: 1s limit_mib: 200 # контейнер 256m, GOMEMLIMIT 180MiB spike_limit_mib: 40 redaction: allow_all_keys: true blocked_key_patterns: ['(?i).*(authorization|password|passwd|secret|token|cookie).*'] blocked_values: - '(?i)bearer\s+[a-z0-9._~+/=-]{8,}' - '(?i)basic\s+[a-z0-9+/=]{8,}' summary: silent batch: send_batch_size: 1024 send_batch_max_size: 2048 timeout: 2s exporters: otlp_grpc/tempo: endpoint: tempo:4317 tls: ca_file: /run/tls/ca.crt cert_file: /run/client/tls.crt key_file: /run/client/tls.key sending_queue: &queue enabled: true sizer: items queue_size: 20000 num_consumers: 2 retry_on_failure: &retry enabled: true initial_interval: 1s max_interval: 10s max_elapsed_time: 60s otlp_http/loki: endpoint: https://loki:3100/otlp tls: &backend_tls ca_file: /run/tls/ca.crt cert_file: /run/client/tls.crt key_file: /run/client/tls.key sending_queue: *queue retry_on_failure: *retry otlp_http/prometheus: endpoint: https://prometheus:9090/api/v1/otlp tls: *backend_tls sending_queue: *queue retry_on_failure: *retry service: extensions: [health_check] telemetry: # Постоянные job/instance для otelcol_* (по умолчанию instance — новый UUID при каждом старте). resource: service.name: otel-collector service.instance.id: otel-collector logs: level: info metrics: level: normal readers: - pull: exporter: prometheus: host: 127.0.0.1 # только для собственного скрейпа (job otelcol выше) port: 8888 pipelines: traces: receivers: [otlp] processors: [memory_limiter, redaction, batch] exporters: [otlp_grpc/tempo] logs: receivers: [otlp] processors: [memory_limiter, redaction, batch] exporters: [otlp_http/loki] metrics: receivers: [otlp, prometheus] processors: [memory_limiter, batch] exporters: [otlp_http/prometheus]