From 94865e05a93738ac6004eb0412ed3f7956bd75c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=BE=D0=BB=D0=B8=D0=BA=D0=BE=D0=B2=20Maximillian?= =?UTF-8?q?=20=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Tue, 17 Nov 2026 13:17:42 +0300 Subject: [PATCH] feat(otel): lab6 route OTLP signals through the Collector --- compose.yaml | 21 +++++++++++++++++++++ infra/otel-collector.yaml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 infra/otel-collector.yaml diff --git a/compose.yaml b/compose.yaml index 33e3cbd..234e1db 100644 --- a/compose.yaml +++ b/compose.yaml @@ -171,6 +171,9 @@ services: image: mtusi-messenger-api:lab3 restart: unless-stopped environment: + OTEL_EXPORTER_OTLP_ENDPOINT: "${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}" + OTEL_METRIC_EXPORT_INTERVAL: "${OTEL_METRIC_EXPORT_INTERVAL:-15000}" + OTEL_SDK_DISABLED: "${OTEL_SDK_DISABLED:-false}" APP_HOST: "0.0.0.0" APP_PORT: "8080" DATABASE_URL_FILE: /run/secrets/database_url @@ -234,6 +237,9 @@ services: command: ["/worker"] restart: unless-stopped environment: + OTEL_EXPORTER_OTLP_ENDPOINT: "${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}" + OTEL_METRIC_EXPORT_INTERVAL: "${OTEL_METRIC_EXPORT_INTERVAL:-15000}" + OTEL_SDK_DISABLED: "${OTEL_SDK_DISABLED:-false}" DATABASE_URL_FILE: /run/secrets/database_url S3_ENDPOINT: "http://minio:9000" S3_BUCKET: "${S3_BUCKET:-messenger-attachments}" @@ -273,6 +279,9 @@ services: command: ["/reconciler"] restart: unless-stopped environment: + OTEL_EXPORTER_OTLP_ENDPOINT: "${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}" + OTEL_METRIC_EXPORT_INTERVAL: "${OTEL_METRIC_EXPORT_INTERVAL:-15000}" + OTEL_SDK_DISABLED: "${OTEL_SDK_DISABLED:-false}" DATABASE_URL_FILE: /run/secrets/database_url S3_ENDPOINT: "http://minio:9000" S3_BUCKET: "${S3_BUCKET:-messenger-attachments}" @@ -365,6 +374,18 @@ services: networks: - internal + otel-collector: + image: otel/opentelemetry-collector-contrib:0.135.0 + restart: unless-stopped + command: ["--config=/etc/otelcol-contrib/config.yaml"] + volumes: + - ./infra/otel-collector.yaml:/etc/otelcol-contrib/config.yaml:ro + depends_on: + - jaeger + - opensearch + networks: + - internal + secrets: postgres_password: file: ./secrets/postgres_password diff --git a/infra/otel-collector.yaml b/infra/otel-collector.yaml new file mode 100644 index 0000000..84deb05 --- /dev/null +++ b/infra/otel-collector.yaml @@ -0,0 +1,33 @@ +receivers: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:4317 + http: + endpoint: 0.0.0.0:4318 + +exporters: + prometheus: + endpoint: 0.0.0.0:9464 + resource_to_telemetry_conversion: + enabled: true + opensearch: + http: + endpoint: http://opensearch:9200 + logs_index: messenger-logs + otlp/jaeger: + endpoint: jaeger:4317 + tls: + insecure: true + +service: + pipelines: + metrics: + receivers: [otlp] + exporters: [prometheus] + logs: + receivers: [otlp] + exporters: [opensearch] + traces: + receivers: [otlp] + exporters: [otlp/jaeger]