Observability stack (Grafana + Alloy)
From onboarding Alloy to importing dashboards, configuring alerts, daily inspection, and rebuild recovery, written in on-call order.
First, distinguish the two kinds of "observability":
| Location | Audience | What it shows |
|---|---|---|
| Console → Observability | Platform users / on-call | Queues, tasks, devices, engine health checks |
| Grafana stack | Operations | Logs, metrics, traces, entry SLO, database connections |
This page covers the Grafana stack. It does not replace task troubleshooting in the console, but it answers "is the system healthy overall, and at which layer did the problem start".
1. Components and data flow
| Component | Default port | Purpose |
|---|---|---|
| Grafana | 3000 | Dashboard and alert entry point |
| Loki | 3100 | Log storage and query |
| Prometheus | 9090 | Metric storage and query |
| Tempo | 3200 / 4317 / 4318 | Trace storage / OTLP gRPC / OTLP HTTP |
| Alloy | Local host | Collects logs, metrics, and traces |
| MySQL | 3306 | Database health data source in dashboards |
Data flow:
Four process logs /tmp/grape-{mgmt,event,worker,insight}.log ─────┐
nginx access/error log ───────────────────────────────────────────┼─► Alloy ─► Loki
node_exporter :9100 ──────────────────────────────────────────────┤
four processes /metrics :39081–39084 ─────────────────────────────┴─► Alloy ─► Prometheus
OTLP :4317/:4318 ──────────────────────────────────────────────────► Alloy ─► Tempo
The metrics of the four processes bind only to 127.0.0.1 and are scraped by the local Alloy; they are not exposed to the public network.
2. Initial onboarding
Step 1: Confirm the components are running
curl -fsS http://127.0.0.1:3000/api/health # Grafana
curl -fsS http://127.0.0.1:3100/ready # Loki
curl -fsS http://127.0.0.1:9090/-/ready # Prometheus
If Grafana does not open, check the container or process and the port first; do not suspect the dashboards first.
Step 2: Deploy Alloy
Use deploy/alloy-config.alloy from the repository and change it for the actual environment:
- Loki address
- Prometheus remote_write address
- Tempo OTLP address
- Log paths
- Metrics ports of the four processes
Do not carry example host addresses into production.
Step 3: Import the dashboards
The dashboard JSON is in deploy/grafana/dashboards/, with fixed uids:
# Defaults to 127.0.0.1:3000; authentication uses the GRAFANA_AUTH environment variable, do not put the password in the command
bash deploy/grafana/import-dashboards.sh
# Point at another Grafana
GRAFANA_URL=http://<grafana-host>:3000 bash deploy/grafana/import-dashboards.sh
# Check only, no writes
GRAFANA_URL=http://<grafana-host>:3000 bash deploy/grafana/import-dashboards.sh --check
The script:
- Probes Grafana
/api/healthand fails immediately if it cannot connect - Adds the
prometheus/loki/tempodata sources, skipping any that already exist - Imports dashboards and alert rules from the repository
The grape-mysql data source contains a database password, so the script deliberately does not create it automatically; create it once by hand.
Step 4: Create the MySQL data source by hand
Create a MySQL data source in Grafana:
- Host: the actual database address
- Database: the business database
- User/Password: a read-only monitoring account, not an administrator
- Name:
grape-mysql
After creating it, confirm that the DB health dashboard has data.
Step 5: Confirm the four dashboards
| Dashboard | uid | Answers |
|---|---|---|
| Grape entry and SLO | grape-entry-slo |
Whether what users see is healthy |
| Grape database connection health | grape-db-health |
Whether the connection layer is healthy |
| Grape task pipeline | grape-task-pipeline |
Which stage a task is stuck in |
| GSB service bus call overview | grape-gsb-bus |
Whether cross-domain calls use the bus or a direct connection |
3. How to read the dashboards
Entry and SLO
Check three numbers first:
- Whether entry QPS has dropped noticeably
- Whether 5xx has increased
- Whether p95 exceeds the acceptable range
The error budget target is 99% over a 7-day window, taken from the insight default SLO configuration, not a separately defined target.
Exclude 503s from /faro/collect: when the RUM reverse proxy is not configured they are always 503 by design, not a failure.
Database connection health
Check:
- Whether the total number of connections is close to the limit
- Whether the share of active connections stays high
- Whether connections are frequently dropped and recreated
DB metrics come from MySQL SHOW GLOBAL STATUS, and all four processes report the same numbers. The dashboards use max() to deduplicate; sum() would inflate them 4x.
Task pipeline
Check:
- Whether enqueue, completion, and failure are balanced
- The success rate and queue wait time
- Stuck tasks
- Whether the Runtime is online
If tasks keep queuing while Workers are online, check engine health checks and scene binding first; if a task fails halfway, check the node log and exit_code.
GSB bus
Most panels currently show No data, which reflects reality: most cross-domain reads go directly to the owner domain, and RemoteProvider is disabled by default. Its role is a baseline, not a fault.
Check the "GSB vs HTTP" comparison to confirm that cross-domain calls are mostly direct; when the numbers change abruptly, check the routing configuration.
4. Alerts
The repository holds two sets of rules; do not maintain them twice:
| Source | Content |
|---|---|
deploy/alerts.yml |
Business metrics: stuck tasks, queue backlog, failure rate, DB connection pool, DB dropped connections, cloud sandbox setup failures and retry exhaustion, unclaimed Chat queue items |
deploy/grafana/alerts/alerts-grape-sre.json |
Three additions: process unreachable (P1), node scrape down (P2), entry 5xx above threshold (P1) |
The "staleness" window that auto-resolves firing alerts is set by GRAPE_OBS_ALERT_STALE_SECONDS: 6 hours by default, minimum 600 seconds (lower values are treated as 600, invalid values fall back to the default). Firing events not refreshed within the window are resolved automatically.
The first response to an alert:
- Identify whether it is entry, task, DB, or node
- Check the matching dashboard to confirm the scope
- Then check tasks and Workers in the console
- Finally check logs and traces
Do not restart immediately. Confirm whether the problem is a single instance, a single task, or global.
5. Recovering after a Grafana rebuild
LGTM containers have no volumes mounted by default, so data sources and dashboards are lost after a rebuild. Dashboard JSON must stay in the repository.
Recovery order:
- Redeploy or start Grafana
- Run
import-dashboards.sh - Add the
grape-mysqldata source by hand - Check the four dashboards
- Check the alert rule groups
GRAFANA_URL=http://<grafana-host>:3000 bash deploy/grafana/import-dashboards.sh
6. Common failures
| Symptom | Most likely cause | Action |
|---|---|---|
| All dashboards are empty | Data source uid is wrong or missing | Rerun the import script; check GRAFANA_DS_*_UID |
| Logs present, metrics missing | Alloy is not scraping metrics | Check whether 39081–39084 are listening |
| DB panel values are doubled | The query uses sum() |
Change it back to the dashboard convention, max() |
| Everything is lost after a Grafana rebuild | The container has no volume | Rerun the import; add the MySQL data source |
| Only the GSB dashboard is empty | RemoteProvider is not enabled | Expected; no fix needed |
/faro/collect always returns 503 |
RUM reverse proxy is not configured | Check the dedicated panel; observe again after configuring the upstream |
| Alerts are not delivered | Alert channels or rules were not imported | Check the Grafana alerting page and the notification channels |
7. Daily inspection (5 minutes)
- [ ] Entry 5xx is not rising continuously
- [ ] The task success rate is normal and there is no large queue
- [ ] Workers are online and engine health checks are not failing broadly
- [ ] DB connections are not close to the limit
- [ ] The Grafana alerting page has no unhandled P1
- [ ] Loki can query logs from the last 15 minutes
- [ ] Tempo can query recent traces
8. Completion criteria
- [ ] Grafana
/api/healthis normal - [ ] The Prometheus / Loki / Tempo data sources are green
- [ ] The
grape-mysqldata source was created by hand - [ ] All four dashboards open and have data
- [ ] The alert rule groups are visible
- [ ] Dashboards can be restored within 10 minutes after a rebuild
- [ ] The on-call engineer knows which dashboard to check first
Related
Architecture and deployment topology | Database backend and official sync | Upgrade, backup, and rollback