Skip to content

Commit b34d485

Browse files
feat(observability): add Prometheus + Grafana compose profile
Opt-in via: docker compose --profile observe up - Prometheus scrapes all 9 services + NATS on /metrics - Grafana auto-provisions Prometheus as default datasource - Grafana runs on :3001 to avoid collision with frontend (:3000) - grafana_data volume persists dashboards across restarts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2f4fa98 commit b34d485

4 files changed

Lines changed: 77 additions & 0 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ ACME_EMAIL=admin@example.com
99
POSTGRES_USER=devops
1010
POSTGRES_PASSWORD=devops
1111

12+
# Observability (docker compose --profile observe up)
13+
GRAFANA_PASSWORD=admin
14+
1215
# GenAI
1316
LLM_API_KEY=

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,31 @@ services:
153153
condition: service_started
154154
restart: unless-stopped
155155

156+
# ── Observability (opt-in: docker compose --profile observe up) ───────────
157+
158+
prometheus:
159+
image: prom/prometheus:v3.3.1
160+
profiles: [observe]
161+
volumes:
162+
- ./infra/monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
163+
ports:
164+
- "9090:9090"
165+
restart: unless-stopped
166+
167+
grafana:
168+
image: grafana/grafana:11.6.1
169+
profiles: [observe]
170+
environment:
171+
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
172+
volumes:
173+
- grafana_data:/var/lib/grafana
174+
- ./infra/monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
175+
ports:
176+
- "3001:3000"
177+
depends_on:
178+
- prometheus
179+
restart: unless-stopped
180+
156181
volumes:
157182
postgres_data:
183+
grafana_data:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Prometheus
5+
type: prometheus
6+
access: proxy
7+
url: http://prometheus:9090
8+
isDefault: true
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
global:
2+
scrape_interval: 15s
3+
evaluation_interval: 15s
4+
5+
scrape_configs:
6+
- job_name: gateway
7+
static_configs:
8+
- targets: ["gateway:8080"]
9+
10+
- job_name: incident-service
11+
static_configs:
12+
- targets: ["incident-service:8081"]
13+
14+
- job_name: event-service
15+
static_configs:
16+
- targets: ["event-service:8082"]
17+
18+
- job_name: rule-engine
19+
static_configs:
20+
- targets: ["rule-engine:8083"]
21+
22+
- job_name: user-service
23+
static_configs:
24+
- targets: ["user-service:8084"]
25+
26+
- job_name: notification-service
27+
static_configs:
28+
- targets: ["notification-service:8085"]
29+
30+
- job_name: webhook-service
31+
static_configs:
32+
- targets: ["webhook-service:8086"]
33+
34+
- job_name: genai-service
35+
static_configs:
36+
- targets: ["genai-service:8087"]
37+
38+
- job_name: nats
39+
static_configs:
40+
- targets: ["nats:7777"]

0 commit comments

Comments
 (0)