Phase 2: Add OTel env vars and telemetry network to docker-compose

Wires the budget container to the OTel Collector via the shared external
telemetry network. Endpoint, protocol, and service name come from env vars
so the collector address is not baked into application code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Spencer Twaddle
2026-05-04 17:29:30 -05:00
parent 389446ee21
commit bfd5880b9c
+6
View File
@@ -7,6 +7,9 @@ services:
- VIRTUAL_PORT=8080 - VIRTUAL_PORT=8080
- ASPNETCORE_ENVIRONMENT=${ASPNETCORE_ENVIRONMENT:-Production} - ASPNETCORE_ENVIRONMENT=${ASPNETCORE_ENVIRONMENT:-Production}
- ConnectionStrings__DefaultConnection=Host=apps-db;Port=5432;Database=${POSTGRES_DB:-budget};Username=${POSTGRES_USER:-budget};Password=${POSTGRES_PASSWORD} - ConnectionStrings__DefaultConnection=Host=apps-db;Port=5432;Database=${POSTGRES_DB:-budget};Username=${POSTGRES_USER:-budget};Password=${POSTGRES_PASSWORD}
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
- OTEL_SERVICE_NAME=budget
depends_on: depends_on:
- apps-db - apps-db
- auth - auth
@@ -14,6 +17,7 @@ services:
- web - web
- apps-internal - apps-internal
- auth-public - auth-public
- telemetry
restart: unless-stopped restart: unless-stopped
apps-db: apps-db:
@@ -35,6 +39,8 @@ networks:
external: true external: true
auth-public: auth-public:
external: true external: true
telemetry:
external: true
volumes: volumes:
apps-db-data: apps-db-data: