Skip to content

Commit

Permalink
fix: legacy label endpoint route (grafana#14933)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney authored and thevops committed Nov 21, 2024
1 parent 87de00f commit e3b00ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/lokifrontend/frontend/v1/frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/queryrange/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/querier/queryrange/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ func Test_getOperation(t *testing.T) {
},
{
name: "range_query_prom",
path: "/prom/query",
path: "/api/prom/query",
expectedOp: QueryRangeOp,
},
{
Expand All @@ -1228,7 +1228,7 @@ func Test_getOperation(t *testing.T) {
},
{
name: "series_query_prom",
path: "/prom/series",
path: "/api/prom/series",
expectedOp: SeriesOp,
},
{
Expand All @@ -1238,7 +1238,7 @@ func Test_getOperation(t *testing.T) {
},
{
name: "labels_query_prom",
path: "/prom/labels",
path: "/api/prom/labels",
expectedOp: LabelNamesOp,
},
{
Expand All @@ -1248,7 +1248,7 @@ func Test_getOperation(t *testing.T) {
},
{
name: "labels_query_prom",
path: "/prom/label",
path: "/api/prom/label",
expectedOp: LabelNamesOp,
},
{
Expand All @@ -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,
},
{
Expand Down

0 comments on commit e3b00ee

Please sign in to comment.