Skip to content

Commit 46cf7ff

Browse files
updated readme
1 parent 2d1fedf commit 46cf7ff

1 file changed

Lines changed: 23 additions & 34 deletions

File tree

asap-dropin/README.md

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@ On startup, all queries are forwarded transparently to your upstream Prometheus.
1313
## Architecture
1414

1515
```
16-
Your Prometheus ──remote_write──▸ ASAPQuery (:9091/receive)
17-
18-
19-
Your Grafana ◂──query──── ASAPQuery Query Engine (:8088)
20-
21-
▼ (fallback / passthrough)
22-
Your Prometheus
16+
Prometheus ──remote_write──▶ ASAPQuery (:9091)
17+
▲ │
18+
│ unsupported queries ▼ builds sketches
19+
└──────────── ASAPQuery (:8088) ◀── Grafana
2320
```
2421

25-
The query engine embeds the planner and runs it automatically after observing real Grafana queries for one observation window. No separate planner container, no Kafka, no Arroyo.
26-
2722
## Setup
2823

2924
### Step 1 — Configure environment
@@ -34,13 +29,12 @@ Edit `.env` to match your deployment:
3429
|---|---|---|
3530
| `PROMETHEUS_URL` | `http://host.docker.internal:9090` | URL of your Prometheus, reachable from inside the ASAPQuery container |
3631
| `PROMETHEUS_SCRAPE_INTERVAL` | `15` | Your Prometheus scrape interval in seconds |
37-
| `REMOTE_WRITE_PORT` | `9091` | Host port for the remote-write receiver |
38-
| `QUERY_ENGINE_PORT` | `8088` | Host port for the ASAPQuery query engine |
32+
| `REMOTE_WRITE_PORT` | `9091` | ASAPQuery data ingest port — must be free on the host |
33+
| `QUERY_ENGINE_PORT` | `8088` | ASAPQuery query endpoint port — must be free on the host |
3934
| `TRACKER_OBSERVATION_WINDOW_SECS` | `180` | How long to observe queries before planning (see note below) |
4035

4136
**Finding the right `PROMETHEUS_URL`:**
42-
- **Docker Desktop (Mac/Windows):** `http://host.docker.internal:9090` (default)
43-
- **Linux (Prometheus on host):** `http://172.17.0.1:9090` (default Docker bridge gateway)
37+
- **Prometheus on the same host as Docker:** `http://172.17.0.1:9090` (default Docker bridge gateway on Linux)
4438
- **Prometheus in another Docker Compose:** use a shared external Docker network and the Prometheus service name
4539

4640
**Setting `TRACKER_OBSERVATION_WINDOW_SECS`:**
@@ -58,7 +52,7 @@ docker compose up -d
5852
Verify it started:
5953

6054
```bash
61-
docker compose logs -f queryengine
55+
docker compose logs queryengine
6256
```
6357

6458
You should see a line confirming Prometheus is reachable, then the engine waiting for the observation window.
@@ -77,7 +71,7 @@ remote_write:
7771
sample_age_limit: 5m
7872
```
7973
80-
> **Finding the right `remote_write` URL:** The URL is from Prometheus's perspective, not your browser's.
74+
> **Finding the right `remote_write` URL:** The URL is from Prometheus's perspective.
8175
> - **Prometheus on the same host as Docker:** `http://localhost:9091/receive` (default above)
8276
> - **Prometheus in Docker on the same host:** `http://host.docker.internal:9091/receive` (Mac/Windows) or `http://172.17.0.1:9091/receive` (Linux)
8377
> - Change `9091` if you set a different `REMOTE_WRITE_PORT` in `.env`
@@ -89,39 +83,34 @@ If Prometheus was started with `--web.enable-lifecycle`:
8983
curl -X POST http://localhost:9090/-/reload
9084
```
9185

92-
Otherwise, restart your Prometheus process or container:
86+
Otherwise, send SIGHUP to the Prometheus process:
9387
```bash
94-
# systemd
95-
sudo systemctl restart prometheus
96-
97-
# Docker Compose
98-
docker compose restart prometheus
88+
kill -HUP $(pgrep prometheus)
9989
```
10090

101-
**Verify remote_write is active** by checking Prometheus logs for a line like:
102-
```
103-
level=info msg="Remote storage started"
104-
```
91+
See the [Prometheus configuration docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) for more details on reloading.
10592

106-
### Step 4 — Point Grafana at ASAPQuery
93+
### Step 4 — Add an ASAPQuery datasource in Grafana
10794

108-
Grafana needs to send its queries to ASAPQuery instead of directly to Prometheus.
95+
Create a new datasource in Grafana pointing at ASAPQuery, then switch your dashboards to use it.
10996

11097
1. Open Grafana in your browser
111-
2. Go to **Connections → Data Sources** (or **Configuration → Data Sources** in older Grafana)
112-
3. Click on your existing Prometheus datasource
113-
4. Change the **URL** field from your current Prometheus address to:
98+
2. Go to **Connections → Data Sources**
99+
3. Click **Add new data source** and select **Prometheus**
100+
4. Set the **Name** to something like `ASAPQuery`
101+
5. Set the **URL** to:
114102
```
115103
http://localhost:8088
116104
```
117105
(Change the port if you set a different `QUERY_ENGINE_PORT` in `.env`)
118-
5. Click **Save & Test** — you should see "Data source is working"
106+
6. Click **Save & Test** — you should see "Data source is working"
107+
7. Open your dashboards and switch their datasource to `ASAPQuery`
119108

120-
ASAPQuery speaks the Prometheus HTTP API. Grafana does not need any other changes.
109+
ASAPQuery speaks the Prometheus query API. Queries it can accelerate are answered from sketches; all others are transparently forwarded to your upstream Prometheus, so your dashboards continue to work.
121110

122111
### Step 5 — Verify end-to-end
123112

124-
Open your Grafana dashboards and use them normally. During the observation window, all queries pass through to Prometheus transparently — your dashboards continue to work.
113+
Use your Grafana dashboards normally. During the observation window, all queries pass through to Prometheus transparently.
125114

126115
After the observation window elapses, check the ASAPQuery logs:
127116

@@ -134,7 +123,7 @@ You should see lines like:
134123
query_tracker: planner succeeded — streaming aggregations: N, inference queries: M
135124
```
136125

137-
From this point on, queries that ASAPQuery can accelerate are served from sketches. Check the routing in the logs:
126+
From this point on, check the routing in the logs:
138127

139128
```bash
140129
docker compose logs queryengine | grep "destination="

0 commit comments

Comments
 (0)