forked from mtusi2026/mtusi2026lab6
82 lines
2.8 KiB
YAML
82 lines
2.8 KiB
YAML
# OpenTelemetry Collector (contrib 0.131.0). It is a receiver/processor/exporter, NOT a database:
|
|
# API/worker/dispatcher -> OTLP -> [memory_limiter -> batch] -> Prometheus (metrics) | Loki (logs) | Tempo (traces).
|
|
extensions:
|
|
health_check:
|
|
endpoint: 0.0.0.0:13133
|
|
|
|
receivers:
|
|
otlp:
|
|
protocols:
|
|
http:
|
|
endpoint: 0.0.0.0:4318 # app SDKs (OTLP/HTTP protobuf); reachable only inside the internal backend network
|
|
grpc:
|
|
endpoint: 0.0.0.0:4317
|
|
|
|
processors:
|
|
# FIRST in every pipeline. Container limit is 256 MiB; soft limit 192 MiB, hard limit = limit_mib (192), spike margin 48.
|
|
# Above the soft limit (limit - spike = 144 MiB) the Collector starts refusing data: SDK exporters retry with bounded queues
|
|
# and then drop => telemetry is lost, the API keeps serving and RAM stays bounded.
|
|
memory_limiter:
|
|
check_interval: 1s
|
|
limit_mib: 192
|
|
spike_limit_mib: 48
|
|
batch:
|
|
timeout: 2s
|
|
send_batch_size: 512
|
|
send_batch_max_size: 1024
|
|
|
|
exporters:
|
|
prometheusremotewrite:
|
|
endpoint: http://prometheus:9090/api/v1/write
|
|
timeout: 5s
|
|
resource_to_telemetry_conversion:
|
|
enabled: true # service.name / service.instance.id become labels (service_name, service_instance_id)
|
|
retry_on_failure:
|
|
enabled: true
|
|
initial_interval: 1s
|
|
max_interval: 10s
|
|
max_elapsed_time: 30s # after 30 s of failures the batch is DROPPED (bounded buffering)
|
|
remote_write_queue:
|
|
enabled: true
|
|
queue_size: 200 # bounded in-memory buffer (batches); full queue => new data is dropped and counted
|
|
num_consumers: 2
|
|
otlphttp/loki:
|
|
endpoint: http://loki:3100/otlp
|
|
timeout: 5s
|
|
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 10s, max_elapsed_time: 30s}
|
|
sending_queue: {enabled: true, num_consumers: 2, queue_size: 200}
|
|
otlp/tempo:
|
|
endpoint: tempo:4317
|
|
timeout: 5s
|
|
tls:
|
|
insecure: true # internal network only; TLS/mTLS is lab 7
|
|
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 10s, max_elapsed_time: 30s}
|
|
sending_queue: {enabled: true, num_consumers: 2, queue_size: 200}
|
|
|
|
service:
|
|
extensions: [health_check]
|
|
pipelines:
|
|
metrics:
|
|
receivers: [otlp]
|
|
processors: [memory_limiter, batch]
|
|
exporters: [prometheusremotewrite]
|
|
logs:
|
|
receivers: [otlp]
|
|
processors: [memory_limiter, batch]
|
|
exporters: [otlphttp/loki]
|
|
traces:
|
|
receivers: [otlp]
|
|
processors: [memory_limiter, batch]
|
|
exporters: [otlp/tempo]
|
|
telemetry:
|
|
logs:
|
|
level: info
|
|
metrics:
|
|
level: normal
|
|
readers:
|
|
- pull:
|
|
exporter:
|
|
prometheus:
|
|
host: 0.0.0.0
|
|
port: 8888 # Collector self-metrics (dropped/refused/failed counters) scraped by Prometheus
|