Skip to content

Commit b898702

Browse files
committed
Document sample Alloy deployment + config
1 parent 59d7b2e commit b898702

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

docs/installation/advanced/metrics.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,72 @@ docker exec seatable-server curl -sS http://localhost:6000/metrics --user "<user
171171
172172
```
173173
</details>
174+
175+
## Scraping
176+
177+
You can use [Grafana Alloy](https://grafana.com/docs/alloy/latest/) to scrape metrics from SeaTable components and forward them to an existing [Prometheus server](https://prometheus.io/) using Prometheus' [remote-write](https://grafana.com/docs/alloy/latest/reference/components/prometheus/prometheus.remote_write/) functionality.
178+
179+
The following YAML manifest can serve as a starting point to deploy Alloy:
180+
181+
```yaml
182+
services:
183+
alloy:
184+
image: grafana/alloy:v1.12.0
185+
container_name: alloy
186+
restart: unless-stopped
187+
environment:
188+
- PROMETHEUS_URL=${PROMETHEUS_URL:?Variable is not set or empty}
189+
- PROMETHEUS_USERNAME=${PROMETHEUS_USERNAME:?Variable is not set or empty}
190+
- PROMETHEUS_PASSWORD=${PROMETHEUS_PASSWORD:?Variable is not set or empty}
191+
- SEATABLE_METRICS_USERNAME=${SEATABLE_METRICS_USERNAME:?Variable is not set or empty}
192+
- SEATABLE_METRICS_PASSWORD=${SEATABLE_METRICS_PASSWORD:?Variable is not set or empty}
193+
networks:
194+
- o11y-net
195+
volumes:
196+
- ./config.alloy:/etc/alloy/config.alloy:ro
197+
- /opt/alloy-data:/var/lib/alloy/data
198+
command:
199+
- run
200+
- --server.http.listen-addr=0.0.0.0:12345
201+
- --storage.path=/var/lib/alloy/data
202+
- /etc/alloy/config.alloy
203+
204+
# Attach seatable-server container to o11y-net
205+
# This allows Alloy to scrape metrics
206+
seatable-server:
207+
networks:
208+
- o11y-net
209+
210+
networks:
211+
o11y-net:
212+
name: o11y-net
213+
```
214+
215+
The following `config.alloy` config file should be created inside the same directory:
216+
217+
```alloy
218+
prometheus.remote_write "default" {
219+
endpoint {
220+
url = env("PROMETHEUS_URL")
221+
basic_auth {
222+
username = env("PROMETHEUS_USERNAME")
223+
password = env("PROMETHEUS_PASSWORD")
224+
}
225+
}
226+
}
227+
228+
prometheus.scrape "seatable_metrics" {
229+
targets = [
230+
{"__address__" = "seatable-server:7780", "instance" = "api-gateway"},
231+
{"__address__" = "seatable-server:7777", "instance" = "dtable-db"},
232+
]
233+
234+
basic_auth {
235+
username = env("SEATABLE_METRICS_USERNAME")
236+
password = env("SEATABLE_METRICS_PASSWORD")
237+
}
238+
239+
forward_to = [prometheus.remote_write.default.receiver]
240+
scrape_interval = "15s"
241+
}
242+
```

0 commit comments

Comments
 (0)