From e3b00eef8e38b7aebdb00f0a592ac9857beee019 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Fri, 15 Nov 2024 09:11:25 -0700 Subject: [PATCH] fix: legacy label endpoint route (#14933) --- pkg/lokifrontend/frontend/v1/frontend_test.go | 2 +- pkg/querier/queryrange/roundtrip.go | 2 +- pkg/querier/queryrange/roundtrip_test.go | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/lokifrontend/frontend/v1/frontend_test.go b/pkg/lokifrontend/frontend/v1/frontend_test.go index 00235af5ce99c..aea3a79f7f105 100644 --- a/pkg/lokifrontend/frontend/v1/frontend_test.go +++ b/pkg/lokifrontend/frontend/v1/frontend_test.go @@ -42,7 +42,7 @@ import ( const ( query = "/loki/api/v1/query_range?end=1536716898&query=sum%28container_memory_rss%29+by+%28namespace%29&start=1536673680&step=120" responseBody = `{"status":"success","data":{"resultType":"Matrix","result":[{"metric":{"foo":"bar"},"values":[[1536673680,"137"],[1536673780,"137"]]}]}}` - labelQuery = `/prom/label/foo/values` + labelQuery = `/api/prom/label/foo/values` ) func TestFrontend(t *testing.T) { diff --git a/pkg/querier/queryrange/roundtrip.go b/pkg/querier/queryrange/roundtrip.go index af0d57f1c0c62..61a9d519b3bac 100644 --- a/pkg/querier/queryrange/roundtrip.go +++ b/pkg/querier/queryrange/roundtrip.go @@ -523,7 +523,7 @@ func getOperation(path string) string { case path == "/loki/api/v1/detected_fields": return DetectedFieldsOp case strings.HasSuffix(path, "/values"): - if strings.HasPrefix(path, "/loki/api/v1/label") || strings.HasPrefix(path, "/prom/label") { + if strings.HasPrefix(path, "/loki/api/v1/label") || strings.HasPrefix(path, "/api/prom/label") { return LabelNamesOp } diff --git a/pkg/querier/queryrange/roundtrip_test.go b/pkg/querier/queryrange/roundtrip_test.go index b6f196832ecdb..ba46bce9c32f3 100644 --- a/pkg/querier/queryrange/roundtrip_test.go +++ b/pkg/querier/queryrange/roundtrip_test.go @@ -1213,7 +1213,7 @@ func Test_getOperation(t *testing.T) { }, { name: "range_query_prom", - path: "/prom/query", + path: "/api/prom/query", expectedOp: QueryRangeOp, }, { @@ -1228,7 +1228,7 @@ func Test_getOperation(t *testing.T) { }, { name: "series_query_prom", - path: "/prom/series", + path: "/api/prom/series", expectedOp: SeriesOp, }, { @@ -1238,7 +1238,7 @@ func Test_getOperation(t *testing.T) { }, { name: "labels_query_prom", - path: "/prom/labels", + path: "/api/prom/labels", expectedOp: LabelNamesOp, }, { @@ -1248,7 +1248,7 @@ func Test_getOperation(t *testing.T) { }, { name: "labels_query_prom", - path: "/prom/label", + path: "/api/prom/label", expectedOp: LabelNamesOp, }, { @@ -1258,7 +1258,7 @@ func Test_getOperation(t *testing.T) { }, { name: "label_values_query_prom", - path: "/prom/label/__name__/values", + path: "/api/prom/label/__name__/values", expectedOp: LabelNamesOp, }, {