Skip to content

Commit 663311f

Browse files
authored
Add prometheus to playground (#3752)
# Description Currently the playground's `grafana` container is only there to support `tempo` but you can't actually test any new metrics or queries with it. This PR makes it so that `grafana` actually gets access to all the metrics. # Changes - exposes separate `metrics` ports on containers where it's necessary - adds a `prometheus` container that scrapes all the services pods - configures `prometheus` as the default data source in `grafana` ## How to test I manually checked that `grafana` gets access to metrics from all the different pods and I built a new dashboard with it. <img width="1257" height="673" alt="Screenshot 2025-10-08 at 09 45 30" src="https://github.com/user-attachments/assets/bb297bac-39ad-4df7-b0a5-525cfea44d56" /> As a follow up we could consider somehow replicating our actual dashboards but that goes beyond the scope of the PR (and probably isn't that helpful anyway because the metrics reported by a locally running instance are very far from what our actual deployments would look like).
1 parent 8b4a0d5 commit 663311f

File tree

4 files changed

+73
-6
lines changed

4 files changed

+73
-6
lines changed

playground/docker-compose.fork.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ services:
9393
depends_on:
9494
- db-migrations
9595
ports:
96-
- 8080:80
96+
- 8080:80 # API
97+
- 9586:9586 # metrics
9798

9899
autopilot:
99100
build:
@@ -132,6 +133,8 @@ services:
132133
condition: service_started
133134
chain:
134135
condition: service_healthy
136+
ports:
137+
- 9589:9589 # metrics
135138

136139
driver:
137140
build:
@@ -155,7 +158,7 @@ services:
155158
volumes:
156159
- ../:/src
157160
ports:
158-
- 9000:80
161+
- 9000:80 # API & metrics
159162
depends_on:
160163
chain:
161164
condition: service_healthy
@@ -182,7 +185,7 @@ services:
182185
volumes:
183186
- ../:/src
184187
ports:
185-
- 9001:80
188+
- 9001:80 # API & metrics
186189

187190
frontend:
188191
build:
@@ -220,6 +223,17 @@ services:
220223
- GF_AUTH_ANONYMOUS_ENABLED=true
221224
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
222225
- GF_AUTH_DISABLE_LOGIN_FORM=true
226+
volumes:
227+
- ./grafana-prometheus.yml:/etc/grafana/provisioning/datasources/prometheus.yml
228+
229+
prometheus:
230+
image: prom/prometheus:latest
231+
container_name: prometheus
232+
restart: always
233+
ports:
234+
- "9090:9090"
235+
volumes:
236+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
223237

224238
volumes:
225239
postgres:

playground/docker-compose.non-interactive.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ services:
9595
depends_on:
9696
- db-migrations
9797
ports:
98-
- 8080:80
98+
- 8080:80 # API
99+
- 9586:9586 # metrics
99100

100101
autopilot:
101102
build:
@@ -133,6 +134,8 @@ services:
133134
condition: service_started
134135
chain:
135136
condition: service_healthy
137+
ports:
138+
- 9589:9589 # metrics
136139

137140
driver:
138141
build:
@@ -150,7 +153,7 @@ services:
150153
volumes:
151154
- ./driver.toml:/driver.toml
152155
ports:
153-
- 9000:80
156+
- 9000:80 # API & metrics
154157
depends_on:
155158
chain:
156159
condition: service_healthy
@@ -171,7 +174,7 @@ services:
171174
volumes:
172175
- ./baseline.toml:/baseline.toml
173176
ports:
174-
- 9001:80
177+
- 9001:80 # API & metrics
175178

176179
frontend:
177180
build:
@@ -209,6 +212,18 @@ services:
209212
- GF_AUTH_ANONYMOUS_ENABLED=true
210213
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
211214
- GF_AUTH_DISABLE_LOGIN_FORM=true
215+
volumes:
216+
- ./grafana-prometheus.yml:/etc/grafana/provisioning/datasources/prometheus.yml
217+
218+
219+
prometheus:
220+
image: prom/prometheus:latest
221+
container_name: prometheus
222+
restart: always
223+
ports:
224+
- "9090:9090"
225+
volumes:
226+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
212227

213228
volumes:
214229
postgres:

playground/grafana-prometheus.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
datasources:
2+
- name: Prometheus
3+
url: http://prometheus:9090
4+
type: prometheus
5+
access: proxy
6+
jsonData:
7+
httpMethod: POST
8+
manageAlerts: true
9+
allowAsRecordingRulesTarget: true
10+
prometheusType: Prometheus
11+
prometheusVersion: 3.3.0
12+
cacheLevel: 'High'
13+
disableRecordingRules: false
14+
timeInterval: 10s # Prometheus scrape interval
15+
incrementalQueryOverlapWindow: 10m

playground/prometheus.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
global:
2+
scrape_interval: 5s
3+
4+
scrape_configs:
5+
- job_name: "prometheus"
6+
static_configs:
7+
- targets: ["prometheus:9090"]
8+
9+
- job_name: "orderbook"
10+
static_configs:
11+
- targets: ["orderbook:9586"]
12+
13+
- job_name: "autopilot"
14+
static_configs:
15+
- targets: ["autopilot:9589"]
16+
17+
- job_name: "driver"
18+
static_configs:
19+
- targets: ["driver:80"]
20+
21+
- job_name: "baseline"
22+
static_configs:
23+
- targets: ["baseline:80"]

0 commit comments

Comments
 (0)