Files
mtusi2026lab7/observability/otel-collector/config.yaml
T
2026-11-27 16:42:18 +03:00

123 lines
3.7 KiB
YAML

receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
# Ограничивает RAM Collector-а: при переполнении OTLP-приём отвечает отказом,
# а SDK/клиент ограничивают собственные очереди. Collector не является БД.
memory_limiter:
check_interval: 1s
limit_mib: 320
spike_limit_mib: 64
# Сбалансированный профиль: сохраняем ВСЕ ошибки и медленные trace-ы,
# остальные — вероятностно 10%. Sampling выполняется после получения
# отдельных сигналов, поэтому редкая ошибка не теряется из-за head sampling.
tail_sampling:
decision_wait: 10s
num_traces: 50000
expected_new_traces_per_sec: 200
policies:
- name: errors
type: status_code
status_code:
status_codes: [ERROR]
- name: slow
type: latency
latency:
threshold_ms: 500
# Upload-ы редкие и нужны для сквозной диагностики: сохраняем их целиком,
# чтобы demo/разбор не зависели от 10% baseline.
- name: uploads
type: string_attribute
string_attribute:
key: http.route
values:
- "/api/v1/chats/{chat_id}/attachments"
- name: baseline
type: probabilistic
probabilistic:
sampling_percentage: 10
batch:
send_batch_size: 1024
send_batch_max_size: 2048
timeout: 5s
exporters:
# Prometheus забирает метрики приложения и Collector-а по внутренней сети.
prometheus:
endpoint: 0.0.0.0:8889
resource_to_telemetry_conversion:
enabled: true
otlp/tempo:
# TLS + client certificate к mTLS-шлюзу Tempo. Проверка сервера идёт по
# внутреннему CA и SAN tempo; insecure/plaintext fallback не предусмотрен.
endpoint: tempo-tls:4317
tls:
insecure: false
ca_file: /certs/ca.crt
cert_file: /certs/telemetry-client.crt
key_file: /certs/telemetry-client.key
server_name_override: tempo
timeout: 3s
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 2000
# Loki 3.x принимает OTLP нативно; exporter добавляет /v1/logs.
otlphttp/loki:
endpoint: https://loki-tls:8443/otlp
tls:
insecure: false
ca_file: /certs/ca.crt
cert_file: /certs/telemetry-client.crt
key_file: /certs/telemetry-client.key
server_name_override: loki
timeout: 3s
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 5s
max_elapsed_time: 30s
sending_queue:
enabled: true
num_consumers: 2
queue_size: 2000
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
extensions: [health_check]
telemetry:
logs:
level: info
metrics:
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, tail_sampling, batch]
exporters: [otlp/tempo]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/loki]