Skip to content

Commit b45e562

Browse files
updated docs
1 parent 01ddff7 commit b45e562

File tree

2 files changed

+16
-39
lines changed

2 files changed

+16
-39
lines changed

app/vlselect/main.go

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,17 @@ func decRequestConcurrency() {
217217
func processSelectRequest(ctx context.Context, w http.ResponseWriter, r *http.Request, path string) bool {
218218
httpserver.EnableCORS(w, r)
219219
startTime := time.Now()
220+
if strings.HasPrefix(path, "/select/vmalert/") {
221+
vmalertRequests.Inc()
222+
if len(*vmalertProxyURL) == 0 {
223+
w.WriteHeader(http.StatusBadRequest)
224+
w.Header().Set("Content-Type", "application/json")
225+
fmt.Fprintf(w, "%s", `{"status":"error","msg":"for accessing vmalert flag '-vmalert.proxyURL' must be configured"}`)
226+
return true
227+
}
228+
proxyVMAlertRequests(w, r)
229+
return true
230+
}
220231
switch path {
221232
case "/select/logsql/facets":
222233
logsqlFacetsRequests.Inc()
@@ -273,36 +284,6 @@ func processSelectRequest(ctx context.Context, w http.ResponseWriter, r *http.Re
273284
logsql.ProcessStreamsRequest(ctx, w, r)
274285
logsqlStreamsDuration.UpdateDuration(startTime)
275286
return true
276-
case "/select/api/v1/notifiers":
277-
notifiersRequests.Inc()
278-
if len(*vmalertProxyURL) > 0 {
279-
r.URL.Path = path[len("/select"):]
280-
proxyVMAlertRequests(w, r)
281-
return true
282-
}
283-
w.Header().Set("Content-Type", "application/json")
284-
fmt.Fprint(w, `{"status":"success","data":{"notifiers":[]}}`)
285-
return true
286-
case "/select/api/v1/alerts":
287-
alertsRequests.Inc()
288-
if len(*vmalertProxyURL) > 0 {
289-
r.URL.Path = path[len("/select"):]
290-
proxyVMAlertRequests(w, r)
291-
return true
292-
}
293-
w.Header().Set("Content-Type", "application/json")
294-
fmt.Fprint(w, `{"status":"success","data":{"alerts":[]}}`)
295-
return true
296-
case "/select/api/v1/rules":
297-
rulesRequests.Inc()
298-
if len(*vmalertProxyURL) > 0 {
299-
r.URL.Path = path[len("/select"):]
300-
proxyVMAlertRequests(w, r)
301-
return true
302-
}
303-
w.Header().Set("Content-Type", "application/json")
304-
fmt.Fprint(w, `{"status":"success","data":{"rules":[]}}`)
305-
return true
306287
default:
307288
return false
308289
}
@@ -332,6 +313,7 @@ func proxyVMAlertRequests(w http.ResponseWriter, r *http.Request) {
332313
// Forward other panics to the caller.
333314
panic(err)
334315
}()
316+
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/select")
335317
r.Host = vmalertProxyHost
336318
vmalertProxy.ServeHTTP(w, r)
337319
}
@@ -391,7 +373,5 @@ var (
391373
// no need to track duration for tail requests, as they usually take long time
392374
logsqlTailRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/logsql/tail"}`)
393375

394-
rulesRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/api/v1/rules"}`)
395-
alertsRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/api/v1/alerts"}`)
396-
notifiersRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/api/v1/notifiers"}`)
376+
vmalertRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/vmalert"}`)
397377
)

docs/victorialogs/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,10 @@ cloud provider, or third-party tools. Note that the snapshot must be **consisten
263263

264264
## vmalert
265265

266-
VictoriaLogs is capable of proxying requests to [vmalert](https://docs.victoriametrics.com/victoriametrics/vmalert/)
267-
when `-vmalert.proxyURL` flag is set. Use this feature for the following cases:
268-
* for proxying requests from [Grafana Alerting UI](https://grafana.com/docs/grafana/latest/alerting/);
269-
* for accessing vmalerts UI through VictoriaLogs Web interface.
266+
VictoriaLogs is capable of proxying requests to [VMAlert](https://docs.victoriametrics.com/victoriametrics/vmalert/)
267+
when `-vmalert.proxyURL` flag is set. Use this feature for accessing VMAlert API through VictoriaLogs Web interface.
270268

271-
For accessing vmalerts UI through VictoriaLogs configure `-vmalert.proxyURL` flag and visit
272-
`http://<victorialogs-addr>:9428/vmalert/` link.
269+
For accessing VMAlert API through VictoriaLogs configure `-vmalert.proxyURL` flag. All VMAlert endpoints become available at `http://<victorialogs-addr>:9428/select/vmalert`.
273270

274271
## Multitenancy
275272

0 commit comments

Comments
 (0)