Skip to content

Commit 134811c

Browse files
authored
Fix missing prom query proxy route (#1298)
1 parent 1b90c23 commit 134811c

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/handler/promproxy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ func (h *Handlers) PromProxyRules() func(w http.ResponseWriter, r *http.Request)
1515
return simpleProxy(u, cfg.Timeout.Duration, cfg.SkipTLS, cfg.CAPath, cfg.ForwardUserToken, cfg.TokenPath)
1616
}
1717

18+
func (h *Handlers) PromProxyQuery() func(w http.ResponseWriter, r *http.Request) {
19+
u, _ := url.JoinPath(h.Cfg.Prometheus.URL, "/api/v1/query")
20+
cfg := &h.Cfg.Prometheus
21+
return simpleProxy(u, cfg.Timeout.Duration, cfg.SkipTLS, cfg.CAPath, cfg.ForwardUserToken, cfg.TokenPath)
22+
}
23+
1824
func (h *Handlers) PromProxySilences() func(w http.ResponseWriter, r *http.Request) {
1925
u, _ := url.JoinPath(h.Cfg.Prometheus.AlertManager.URL, "/api/v2/silences")
2026
cfg := &h.Cfg.Prometheus

pkg/server/routes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func setupRoutes(ctx context.Context, cfg *config.Config, authChecker auth.Check
8181
if cfg.Prometheus.AlertManager.URL != "" {
8282
// When AlertManager URL is configured, we don't use the Console proxy; doing our own proxy instead (likely, we're in standalone mode)
8383
api.HandleFunc("/prometheus/api/v1/rules", h.PromProxyRules())
84+
api.HandleFunc("/prometheus/api/v1/query", h.PromProxyQuery())
8485
api.HandleFunc("/alertmanager/api/v2/silences", h.PromProxySilences())
8586
} else if cfg.Loki.UseMocks {
8687
// Add route for alerts (otherwise, the route is provided by the Console itself)

0 commit comments

Comments
 (0)