Skip to content

Commit 91a7e91

Browse files
fix: Fix loki ruler generator url left parameter url encoding
1 parent b2f46de commit 91a7e91

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Makefile

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ______ ____ __ __ _
1+
# ______ ____ __ __ _
22
# / ____/________ _/ __/___ _____ ____ _ / / ____ / /__(_)
33
# / / __/ ___/ __ `/ /_/ __ `/ __ \/ __ `/ / / / __ \/ //_/ /
44
# / /_/ / / / /_/ / __/ /_/ / / / / /_/ / / /___/ /_/ / ,< / /
@@ -65,19 +65,19 @@ LOGQL_ANALYZER_IMAGE := $(IMAGE_PREFIX)/logql-analyzer:$(IMAGE_TAG)
6565
OPERATOR_IMAGE := $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG)
6666

6767
# OCI (Docker) setup
68-
OCI_PLATFORMS := --platform=linux/amd64,linux/arm64
68+
OCI_PLATFORMS := --platform=linux/amd64#,linux/arm64
6969
OCI_BUILD_ARGS := --build-arg GO_VERSION=$(GO_VERSION) --build-arg BUILD_IMAGE=$(BUILD_IMAGE)
7070
OCI_PUSH_ARGS := -o type=registry
7171
OCI_PUSH := docker push
7272
OCI_TAG := docker tag
7373

74-
ifeq ($(CI),true)
74+
#ifeq ($(CI),true)
7575
# ensure buildx is set up
76-
_ := $(shell ./tools/ensure-buildx-builder.sh)
77-
OCI_BUILD := DOCKER_BUILDKIT=1 docker buildx build $(OCI_PLATFORMS) $(OCI_BUILD_ARGS)
78-
else
79-
OCI_BUILD := DOCKER_BUILDKIT=1 docker build $(OCI_BUILD_ARGS)
80-
endif
76+
# _ := $(shell ./tools/ensure-buildx-builder.sh)
77+
#OCI_BUILD := DOCKER_BUILDKIT=1 docker buildx build $(OCI_PLATFORMS) $(OCI_BUILD_ARGS)
78+
#else
79+
OCI_BUILD := DOCKER_BUILDKIT=1 docker build $(OCI_BUILD_ARGS) $(OCI_PLATFORMS)
80+
#endif
8181

8282
BUILD_OCI_PUSH := $(OCI_BUILD) $(OCI_PUSH_ARGS)
8383

pkg/ruler/base/ruler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,9 @@ func grafanaLinkForExpression(expr, datasourceUID string) string {
407407
}
408408

409409
marshaledExpression, _ := json.Marshal(exprStruct)
410-
escapedExpression := url.QueryEscape(string(marshaledExpression))
411-
str := `/explore?left={"queries":[%s]}`
412-
return fmt.Sprintf(str, escapedExpression)
410+
params := url.Values{}
411+
params.Set("left", fmt.Sprintf(`{"queries":[%s]}`, marshaledExpression))
412+
return `/explore?` + params.Encode()
413413
}
414414

415415
// SendAlerts implements a rules.NotifyFunc for a Notifier.

pkg/ruler/base/ruler_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ func TestSendAlerts(t *testing.T) {
17331733
Annotations: []labels.Label{{Name: "a2", Value: "v2"}},
17341734
StartsAt: time.Unix(2, 0),
17351735
EndsAt: time.Unix(3, 0),
1736-
GeneratorURL: fmt.Sprintf("http://localhost:8080/explore?left={\"queries\":[%s]}", escapedExpression),
1736+
GeneratorURL: fmt.Sprintf("http://localhost:8080/explore?left=%7B%22queries%22%3A%5B%s%5D%7D", escapedExpression),
17371737
},
17381738
},
17391739
},
@@ -1753,7 +1753,7 @@ func TestSendAlerts(t *testing.T) {
17531753
Annotations: []labels.Label{{Name: "a2", Value: "v2"}},
17541754
StartsAt: time.Unix(2, 0),
17551755
EndsAt: time.Unix(4, 0),
1756-
GeneratorURL: fmt.Sprintf("http://localhost:8080/explore?left={\"queries\":[%s]}", escapedExpression),
1756+
GeneratorURL: fmt.Sprintf("http://localhost:8080/explore?left=%7B%22queries%22%3A%5B%s%5D%7D", escapedExpression),
17571757
},
17581758
},
17591759
},

0 commit comments

Comments
 (0)