From 29a309d93f953c803b4ee8d78b16b660b5d106cf Mon Sep 17 00:00:00 2001 From: Ankit Goel Date: Mon, 11 Nov 2019 22:53:13 +0530 Subject: [PATCH 1/2] Show ingester tokens after button click in ring status page Signed-off-by: Ankit Goel --- pkg/ring/http.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/ring/http.go b/pkg/ring/http.go index 465f908f54..4ddd33b740 100644 --- a/pkg/ring/http.go +++ b/pkg/ring/http.go @@ -21,6 +21,12 @@ const tpl = ` Cortex Ring Status +

Cortex Ring Status

@@ -57,7 +63,11 @@ const tpl = ` {{ end }} +
+ + ` From ed142a1d3a1b3b46496151457d1d1e0c8e54077e Mon Sep 17 00:00:00 2001 From: Ankit Goel Date: Wed, 20 Nov 2019 03:10:57 +0530 Subject: [PATCH 2/2] Load ingester tokens only when needed in ring status page Signed-off-by: Ankit Goel --- pkg/ring/http.go | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/pkg/ring/http.go b/pkg/ring/http.go index 4ddd33b740..36587c2572 100644 --- a/pkg/ring/http.go +++ b/pkg/ring/http.go @@ -21,12 +21,6 @@ const tpl = ` Cortex Ring Status -

Cortex Ring Status

@@ -64,10 +58,12 @@ const tpl = `
- - ` @@ -139,14 +135,23 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) { }) } + tokensParam := req.URL.Query().Get("tokens") + var ringDescString string + showTokens := false + if tokensParam == "true" { + ringDescString = proto.MarshalTextString(r.ringDesc) + showTokens = true + } if err := tmpl.Execute(w, struct { - Ingesters []interface{} - Now time.Time - Ring string + Ingesters []interface{} + Now time.Time + Ring string + ShowTokens bool }{ - Ingesters: ingesters, - Now: time.Now(), - Ring: proto.MarshalTextString(r.ringDesc), + Ingesters: ingesters, + Now: time.Now(), + Ring: ringDescString, + ShowTokens: showTokens, }); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return