From 9572ab0ba65b5b1446a1cc7e94e4ff9fb3dfb84e Mon Sep 17 00:00:00 2001 From: junot Date: Fri, 2 Feb 2024 11:03:28 +0800 Subject: [PATCH] fix label values api Signed-off-by: junot --- pkg/monitoring-gateway/handler.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/monitoring-gateway/handler.go b/pkg/monitoring-gateway/handler.go index ad3feb21..509968b1 100644 --- a/pkg/monitoring-gateway/handler.go +++ b/pkg/monitoring-gateway/handler.go @@ -31,7 +31,7 @@ const ( epQueryRange = "/query_range" epSeries = "/series" epLabels = "/labels" - epLabelValues = "/label/*" + epLabelValues = "/label/*path" epReceive = "/receive" epRules = "/rules" epAlerts = "/alerts" @@ -102,8 +102,12 @@ func (h *Handler) addTenantRemoteWriteHandler() { } func (h *Handler) addGlobalProxyHandler() { - h.router.Path(apiGlobalPrefix + epReceive).HandlerFunc(h.remoteWriteHander.ServeHTTP) - h.router.PathPrefix(apiGlobalPrefix).HandlerFunc(h.queryProxy.ServeHTTP) + if h.remoteWriteHander != nil { + h.router.Path(apiGlobalPrefix + epReceive).HandlerFunc(h.remoteWriteHander.ServeHTTP) + } + if h.queryProxy != nil { + h.router.PathPrefix(apiGlobalPrefix).HandlerFunc(h.queryProxy.ServeHTTP) + } } func (h *Handler) AppendQueryUIHandler(logger log.Logger, reg *prometheus.Registry) {