Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ APP_URL=http://localhost:3000
# Service name for logging/monitoring
SERVICE_NAME=teachlink-backend

# OpenTelemetry Jaeger tracing configuration
JAEGER_AGENT_HOST=localhost
JAEGER_AGENT_PORT=6831

# Graceful shutdown timeout in milliseconds (default: 30000 = 30s)
SHUTDOWN_TIMEOUT_MS=30000

Expand Down
2 changes: 2 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
NODE_ENV=staging
JAEGER_AGENT_HOST=jaeger
JAEGER_AGENT_PORT=6831

# ─── Database ────────────────────────────────────────────────────────────────
DATABASE_HOST=staging-db.internal
Expand Down
79 changes: 79 additions & 0 deletions diff_lines.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
--- a/.env.example
+++ b/.env.example
+# OpenTelemetry Jaeger tracing configuration
+JAEGER_AGENT_HOST=localhost
+JAEGER_AGENT_PORT=6831
+
--- a/.env.staging
+++ b/.env.staging
+JAEGER_AGENT_HOST=jaeger
+JAEGER_AGENT_PORT=6831
--- a/docker-compose.staging.yml
+++ b/docker-compose.staging.yml
+ JAEGER_AGENT_HOST: jaeger
+ JAEGER_AGENT_PORT: 6831
+ jaeger:
+ condition: service_started
+ # GöÇGöÇGöÇ Jaeger Tracing GöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇ
+ jaeger:
+ image: jaegertracing/all-in-one:1.48
+ container_name: teachlink-staging-jaeger
+ restart: unless-stopped
+ ports:
+ - '6831:6831/udp'
+ - '16686:16686'
+ networks:
+ - teachlink-staging
+ environment:
+ COLLECTOR_ZIPKIN_HTTP_PORT: 9411
+ healthcheck:
+ test: ['CMD-SHELL', 'curl -f http://localhost:16686/jaeger/api/v1/services || exit 1']
+ interval: 30s
+ timeout: 10s
+ retries: 5
+ start_period: 15s
+ deploy:
+ resources:
+ limits:
+ cpus: '0.25'
+ memory: 128M
+ reservations:
+ cpus: '0.05'
+ memory: 32M
+
--- a/infra/monitoring/docker-compose.yml
+++ b/infra/monitoring/docker-compose.yml
+ JAEGER_AGENT_HOST: jaeger
+ JAEGER_AGENT_PORT: 6831
+ jaeger:
+ condition: service_started
+ # GöÇGöÇGöÇ Jaeger Tracing GöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇGöÇ
+ jaeger:
+ image: jaegertracing/all-in-one:1.48
+ container_name: teachlink-jaeger
+ restart: unless-stopped
+ ports:
+ - '6831:6831/udp'
+ - '16686:16686'
+ networks:
+ - teachlink
+ environment:
+ COLLECTOR_ZIPKIN_HTTP_PORT: 9411
+ healthcheck:
+ test: ['CMD-SHELL', 'curl -f http://localhost:16686/jaeger/api/v1/services || exit 1']
+ interval: 30s
+ timeout: 10s
+ retries: 5
+ start_period: 15s
+ deploy:
+ resources:
+ limits:
+ cpus: '0.25'
+ memory: 128M
+ reservations:
+ cpus: '0.05'
+ memory: 32M
+
--- a/src/main.ts
+++ b/src/main.ts
+import './tracing/opentelemetry';
31 changes: 31 additions & 0 deletions docker-compose.staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ services:
REDIS_HOST: redis
REDIS_PORT: 6379
ELASTICSEARCH_NODE: http://elasticsearch:9200
JAEGER_AGENT_HOST: jaeger
JAEGER_AGENT_PORT: 6831
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
jaeger:
condition: service_started
networks:
- teachlink-staging
security_opt:
Expand Down Expand Up @@ -262,6 +266,33 @@ services:
retries: 3
start_period: 15s

# ─── Jaeger Tracing ─────────────────────────────────────────────────────────
jaeger:
image: jaegertracing/all-in-one:1.48
container_name: teachlink-staging-jaeger
restart: unless-stopped
ports:
- '6831:6831/udp'
- '16686:16686'
networks:
- teachlink-staging
environment:
COLLECTOR_ZIPKIN_HTTP_PORT: 9411
healthcheck:
test: ['CMD-SHELL', 'curl -f http://localhost:16686/jaeger/api/v1/services || exit 1']
interval: 30s
timeout: 10s
retries: 5
start_period: 15s
deploy:
resources:
limits:
cpus: '0.25'
memory: 128M
reservations:
cpus: '0.05'
memory: 32M

# ─── Exporters ───────────────────────────────────────────────────────────────
redis_exporter:
image: oliver006/redis_exporter:latest
Expand Down
31 changes: 31 additions & 0 deletions infra/monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ services:
REDIS_PORT: 6379
ELASTICSEARCH_NODE: http://elasticsearch:9200
NODE_ENV: production
JAEGER_AGENT_HOST: jaeger
JAEGER_AGENT_PORT: 6831
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
jaeger:
condition: service_started
networks:
- teachlink
# ── Runtime security hardening ──────────────────────────────────────────
Expand All @@ -61,6 +65,33 @@ services:
retries: 5
start_period: 30s

# ─── Jaeger Tracing ─────────────────────────────────────────────────────────
jaeger:
image: jaegertracing/all-in-one:1.48
container_name: teachlink-jaeger
restart: unless-stopped
ports:
- '6831:6831/udp'
- '16686:16686'
networks:
- teachlink
environment:
COLLECTOR_ZIPKIN_HTTP_PORT: 9411
healthcheck:
test: ['CMD-SHELL', 'curl -f http://localhost:16686/jaeger/api/v1/services || exit 1']
interval: 30s
timeout: 10s
retries: 5
start_period: 15s
deploy:
resources:
limits:
cpus: '0.25'
memory: 128M
reservations:
cpus: '0.05'
memory: 32M

postgres:
image: postgres:16-alpine
container_name: teachlink-postgres
Expand Down
Loading
Loading