|
| 1 | +# Observability |
| 2 | + |
| 3 | +Set up Prometheus + Grafana locally with the existing Docker Compose in this repo. The router already exposes Prometheus metrics and ships a ready-to-use Grafana dashboard, so you mainly need to run the services and ensure Prometheus points at the metrics endpoint. |
| 4 | + |
| 5 | +## What’s included |
| 6 | + |
| 7 | +- Router metrics server: `/metrics` on port `9190` (override with `--metrics-port`). |
| 8 | +- Classification API health check: `GET /health` on `8080` (`--api-port`). |
| 9 | +- Envoy (optional): admin on `19000`, Prometheus metrics at `/stats/prometheus`. |
| 10 | +- Docker Compose services: `semantic-router`, `envoy`, `prometheus`, `grafana` on the same `semantic-network`. |
| 11 | +- Grafana dashboard: `deploy/llm-router-dashboard.json` (auto-provisioned). |
| 12 | + |
| 13 | +Code reference: `src/semantic-router/cmd/main.go` uses `promhttp` to expose `/metrics` (default `:9190`). |
| 14 | + |
| 15 | +## Files to know |
| 16 | + |
| 17 | +- Prometheus config: `config/prometheus.yaml`. Ensure the path matches the volume mount in `docker-compose.yml`. |
| 18 | +- Grafana provisioning: |
| 19 | + - Datasource: `config/grafana/datasource.yaml` |
| 20 | + - Dashboards: `config/grafana/dashboards.yaml` |
| 21 | +- Dashboard JSON: `deploy/llm-router-dashboard.json` |
| 22 | + |
| 23 | +These files are already referenced by `docker-compose.yml` so you typically don’t need to edit them unless you’re changing targets or credentials. |
| 24 | + |
| 25 | +## How it works (local) |
| 26 | + |
| 27 | +- Prometheus runs in the same Docker network and scrapes `semantic-router:9190/metrics`. No host port needs to be published for metrics. |
| 28 | +- Grafana connects to Prometheus via the internal URL `http://prometheus:9090` and auto-loads the bundled dashboard. |
| 29 | +- Envoy (if enabled) can also be scraped by Prometheus at `envoy-proxy:19000/stats/prometheus`. |
| 30 | + |
| 31 | +## Start and access |
| 32 | + |
| 33 | +1) From the project root, start Compose (Prometheus and Grafana are included in the provided file). |
| 34 | + |
| 35 | +```bash |
| 36 | +# try it out with mock-vllm |
| 37 | +CONFIG_FILE=/app/config/config.testing.yaml docker compose --profile testing up --build |
| 38 | +``` |
| 39 | + |
| 40 | +2) Open the UIs: |
| 41 | + - Prometheus: http://localhost:9090 |
| 42 | + - Grafana: http://localhost:3000 (default admin/admin — change on first login) |
| 43 | +3) In Grafana, the “LLM Router” dashboard is pre-provisioned. If needed, import `deploy/llm-router-dashboard.json` manually. |
| 44 | + |
| 45 | +## Minimal expectations |
| 46 | + |
| 47 | +- Prometheus should list targets for: |
| 48 | + - `semantic-router:9190` (required) |
| 49 | + - `envoy-proxy:19000` (optional) |
| 50 | +- Grafana’s datasource should point to `http://prometheus:9090` inside the Docker network. |
| 51 | + |
| 52 | +That’s it—run the stack, and you’ll have Prometheus scraping the router plus a prebuilt Grafana dashboard out of the box. |
0 commit comments