forked from mtusi2026/mtusi2026lab7
63 lines
3.0 KiB
YAML
63 lines
3.0 KiB
YAML
# OpenTelemetry Collector (contrib 0.131.0), lab 7: OTLP/HTTP is mTLS-only and accepts ONLY identities issued by the "workload CA"
|
|
# (api, worker, dispatcher). A certificate signed by the root CA with another identity (grafana, lb, outsider) has no chain to that
|
|
# trust anchor and is rejected in the handshake. Exporters to the backends use TLS with server verification + the collector client cert.
|
|
extensions:
|
|
health_check:
|
|
endpoint: 0.0.0.0:13133 # liveness only, no telemetry data; inside the internal backend network, never published
|
|
|
|
receivers:
|
|
otlp:
|
|
protocols:
|
|
http:
|
|
endpoint: 0.0.0.0:4318
|
|
tls:
|
|
cert_file: /pki/tls.crt
|
|
key_file: /pki/tls.key
|
|
client_ca_file: /ca/workload-ca.crt # trust anchor = workload CA only (not the root CA)
|
|
min_version: "1.2"
|
|
|
|
processors:
|
|
memory_limiter: {check_interval: 1s, limit_mib: 192, spike_limit_mib: 48}
|
|
batch: {timeout: 2s, send_batch_size: 512, send_batch_max_size: 1024}
|
|
attributes/no_secrets: # defence in depth: never forward credentials even if an SDK attached them
|
|
actions:
|
|
- {key: http.request.header.authorization, action: delete}
|
|
- {key: http.request.header.cookie, action: delete}
|
|
- {key: password, action: delete}
|
|
|
|
exporters:
|
|
prometheusremotewrite:
|
|
endpoint: https://prometheus:9090/api/v1/write
|
|
timeout: 5s
|
|
tls: {ca_file: /pki/ca.crt, cert_file: /pki/tls.crt, key_file: /pki/tls.key}
|
|
resource_to_telemetry_conversion: {enabled: true}
|
|
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 10s, max_elapsed_time: 30s}
|
|
remote_write_queue: {enabled: true, queue_size: 200, num_consumers: 2}
|
|
otlphttp/loki:
|
|
endpoint: https://loki:3100/otlp
|
|
timeout: 5s
|
|
tls: {ca_file: /pki/ca.crt, cert_file: /pki/tls.crt, key_file: /pki/tls.key}
|
|
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: {ca_file: /pki/ca.crt, cert_file: /pki/tls.crt, key_file: /pki/tls.key}
|
|
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, attributes/no_secrets, batch], exporters: [prometheusremotewrite]}
|
|
logs: {receivers: [otlp], processors: [memory_limiter, attributes/no_secrets, batch], exporters: [otlphttp/loki]}
|
|
traces: {receivers: [otlp], processors: [memory_limiter, attributes/no_secrets, 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 only; plain HTTP, internal network, no credentials/data
|