You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: asap-dropin/README.md
+23-34Lines changed: 23 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,12 @@ On startup, all queries are forwarded transparently to your upstream Prometheus.
13
13
## Architecture
14
14
15
15
```
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
23
20
```
24
21
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
-
27
22
## Setup
28
23
29
24
### Step 1 — Configure environment
@@ -34,13 +29,12 @@ Edit `.env` to match your deployment:
34
29
|---|---|---|
35
30
|`PROMETHEUS_URL`|`http://host.docker.internal:9090`| URL of your Prometheus, reachable from inside the ASAPQuery container |
36
31
|`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|
39
34
|`TRACKER_OBSERVATION_WINDOW_SECS`|`180`| How long to observe queries before planning (see note below) |
-**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)
44
38
-**Prometheus in another Docker Compose:** use a shared external Docker network and the Prometheus service name
45
39
46
40
**Setting `TRACKER_OBSERVATION_WINDOW_SECS`:**
@@ -58,7 +52,7 @@ docker compose up -d
58
52
Verify it started:
59
53
60
54
```bash
61
-
docker compose logs -f queryengine
55
+
docker compose logs queryengine
62
56
```
63
57
64
58
You should see a line confirming Prometheus is reachable, then the engine waiting for the observation window.
@@ -77,7 +71,7 @@ remote_write:
77
71
sample_age_limit: 5m
78
72
```
79
73
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.
81
75
> - **Prometheus on the same host as Docker:** `http://localhost:9091/receive` (default above)
82
76
> - **Prometheus in Docker on the same host:** `http://host.docker.internal:9091/receive` (Mac/Windows) or `http://172.17.0.1:9091/receive` (Linux)
83
77
> - Change `9091` if you set a different `REMOTE_WRITE_PORT` in `.env`
@@ -89,39 +83,34 @@ If Prometheus was started with `--web.enable-lifecycle`:
89
83
curl -X POST http://localhost:9090/-/reload
90
84
```
91
85
92
-
Otherwise, restart your Prometheus process or container:
86
+
Otherwise, send SIGHUP to the Prometheus process:
93
87
```bash
94
-
# systemd
95
-
sudo systemctl restart prometheus
96
-
97
-
# Docker Compose
98
-
docker compose restart prometheus
88
+
kill -HUP $(pgrep prometheus)
99
89
```
100
90
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.
105
92
106
-
### Step 4 — Point Grafana at ASAPQuery
93
+
### Step 4 — Add an ASAPQuery datasource in Grafana
107
94
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.
109
96
110
97
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:
114
102
```
115
103
http://localhost:8088
116
104
```
117
105
(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`
119
108
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.
121
110
122
111
### Step 5 — Verify end-to-end
123
112
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.
125
114
126
115
After the observation window elapses, check the ASAPQuery logs:
127
116
@@ -134,7 +123,7 @@ You should see lines like:
134
123
query_tracker: planner succeeded — streaming aggregations: N, inference queries: M
135
124
```
136
125
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:
0 commit comments