forked from mtusi2026/mtusi2026lab7
lab7: TLS ко всем зависимостям и телеметрии; раздельные роли PostgreSQL (GRANT по коду), ACL Valkey, AMQPS, HTTPS S3, mTLS Collector/Prometheus/Loki/Tempo/Grafana
This commit is contained in:
+42
-20
@@ -1,24 +1,29 @@
|
||||
# OpenTelemetry Collector (otel/opentelemetry-collector-contrib 0.165.0), lab 6.
|
||||
# OpenTelemetry Collector (otel/opentelemetry-collector-contrib 0.165.0), labs 6-7.
|
||||
#
|
||||
# API x2 / relay / worker --OTLP/HTTP protobuf :4318--> [receiver otlp]
|
||||
# -> memory_limiter -> batch -> exporters:
|
||||
# traces -> Tempo (otlp_http/tempo, http://tempo:4318/v1/traces)
|
||||
# metrics -> Prometheus (otlp_http/prometheus, http://prometheus:9090/api/v1/otlp/v1/metrics)
|
||||
# logs -> Loki (otlp_http/loki, http://loki:3100/otlp/v1/logs)
|
||||
# API x2 / relay / worker --OTLP/HTTPS (mTLS) :4318--> [receiver otlp]
|
||||
# -> memory_limiter -> batch -> exporters (all HTTPS + client certificate otel-collector):
|
||||
# traces -> Tempo (otlp_http/tempo, https://tempo:4318/v1/traces)
|
||||
# metrics -> Prometheus (otlp_http/prometheus, https://prometheus:9090/api/v1/otlp/v1/metrics)
|
||||
# logs -> Loki (otlp_http/loki, https://loki:3100/otlp/v1/logs)
|
||||
#
|
||||
# Lab 7 (contracts/trust-matrix.md): the receiver speaks TLS only and REQUIRES a client certificate
|
||||
# of the internal CA (client_ca_file): a process on the `telemetry` network without such a
|
||||
# certificate cannot ingest anything. Every exporter verifies the backend (internal CA + hostname)
|
||||
# and authenticates with the Collector's own certificate (SAN otel-collector); Prometheus also
|
||||
# checks that SAN against its allowlist.
|
||||
# The Collector stores nothing for long: it receives, limits, batches and forwards. When a backend
|
||||
# is down, each exporter keeps a BOUNDED queue (sending_queue) and retries for at most
|
||||
# max_elapsed_time; then the data is dropped and counted (otelcol_exporter_send_failed_*,
|
||||
# otelcol_exporter_enqueue_failed_*). memory_limiter refuses new data above its limit (the SDKs
|
||||
# get a retryable error and drop after their own bounded queue) instead of growing until OOM.
|
||||
# Its own metrics: Prometheus scrapes :8888 (otelcol_*). Only on the internal `telemetry` network.
|
||||
# otelcol_exporter_enqueue_failed_*). memory_limiter refuses new data above its limit.
|
||||
# Its own metrics: PUSHED over OTLP/HTTPS to Prometheus (lab 7; the lab 6 pull endpoint :8888 had no
|
||||
# TLS). health_check listens on the container's loopback only.
|
||||
#
|
||||
# Traces pipeline variants (track 1, docs/TRACK1.md): this file keeps EVERY span; the overlay
|
||||
# Traces pipeline variants (lab 6 track 1): this file keeps EVERY span; the overlay
|
||||
# traces-tail.yaml (passed as a second --config, compose OTEL_COLLECTOR_TRACES) adds tail sampling.
|
||||
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 0.0.0.0:13133
|
||||
endpoint: 127.0.0.1:13133
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
@@ -26,11 +31,15 @@ receivers:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
max_request_body_size: 8388608 # 8 MiB per export request
|
||||
tls:
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
client_ca_file: /run/secrets/internal-ca.crt # = RequireAndVerifyClientCert
|
||||
min_version: "1.2"
|
||||
|
||||
processors:
|
||||
# First in every pipeline. Container limit 512 MiB: soft limit = 400 - 80 = 320 MiB (start
|
||||
# refusing + GC), hard limit 400 MiB (forced GC). The contrib binary alone is ~150 MiB RSS;
|
||||
# 256 MiB of container memory left the limiter refusing data at idle. GOMEMLIMIT = 360 MiB.
|
||||
# refusing + GC), hard limit 400 MiB (forced GC). The contrib binary alone is ~150 MiB RSS.
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 400
|
||||
@@ -43,8 +52,13 @@ processors:
|
||||
|
||||
exporters:
|
||||
otlp_http/tempo:
|
||||
endpoint: http://tempo:4318
|
||||
endpoint: https://tempo:4318
|
||||
timeout: 5s
|
||||
tls: &mtls
|
||||
ca_file: /run/secrets/internal-ca.crt
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
min_version: "1.2"
|
||||
sending_queue: &queue
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
@@ -55,29 +69,37 @@ exporters:
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s # then the batch is dropped (counted), never retried forever
|
||||
otlp_http/prometheus:
|
||||
endpoint: http://prometheus:9090/api/v1/otlp
|
||||
endpoint: https://prometheus:9090/api/v1/otlp
|
||||
timeout: 5s
|
||||
tls: *mtls
|
||||
sending_queue: *queue
|
||||
retry_on_failure: *retry
|
||||
otlp_http/loki:
|
||||
endpoint: http://loki:3100/otlp
|
||||
endpoint: https://loki:3100/otlp
|
||||
timeout: 5s
|
||||
tls: *mtls
|
||||
sending_queue: *queue
|
||||
retry_on_failure: *retry
|
||||
|
||||
service:
|
||||
extensions: [health_check]
|
||||
telemetry:
|
||||
resource:
|
||||
service.name: otel-collector
|
||||
logs:
|
||||
level: warn
|
||||
metrics:
|
||||
level: normal
|
||||
readers:
|
||||
- pull:
|
||||
- periodic:
|
||||
interval: 15000
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
otlp:
|
||||
protocol: http/protobuf
|
||||
endpoint: https://prometheus:9090/api/v1/otlp/v1/metrics
|
||||
certificate: /run/secrets/internal-ca.crt
|
||||
client_certificate: /run/secrets/otel-collector.crt
|
||||
client_key: /run/secrets/otel-collector.key
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
|
||||
Reference in New Issue
Block a user