diff --git a/go.mod b/go.mod index 3fd0c3cd2f9..dba493af1e5 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/golang/snappy v0.0.4 github.com/google/gopacket v1.1.19 github.com/gorilla/mux v1.8.1 - github.com/grafana/dskit v0.0.0-20250103192458-b54518d1a463 + github.com/grafana/dskit v0.0.0-20250106205746-3702098cbd0c github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/json-iterator/go v1.1.12 diff --git a/go.sum b/go.sum index 7ffb8dc6703..973ab8a936b 100644 --- a/go.sum +++ b/go.sum @@ -1271,8 +1271,8 @@ github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc h1:PXZQA2WCxe85T github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4= github.com/grafana/alerting v0.0.0-20241211182001-0f317eb6b2f7 h1:VGLUQ2mwzlF1NGwTxpSfv1RnuOsDlNh/NT5KRvhZ0sQ= github.com/grafana/alerting v0.0.0-20241211182001-0f317eb6b2f7/go.mod h1:QsnoKX/iYZxA4Cv+H+wC7uxutBD8qi8ZW5UJvD2TYmU= -github.com/grafana/dskit v0.0.0-20250103192458-b54518d1a463 h1:H6DzXDDyoqnLIH5CPSxx3zDd9FY8D8SyeVbzlRfCipI= -github.com/grafana/dskit v0.0.0-20250103192458-b54518d1a463/go.mod h1:SPLNCARd4xdjCkue0O6hvuoveuS1dGJjDnfxYe405YQ= +github.com/grafana/dskit v0.0.0-20250106205746-3702098cbd0c h1:zixK7kthU3M9Wo0tIxdKmM0X2DHDQeqwvfrhRqRXQbk= +github.com/grafana/dskit v0.0.0-20250106205746-3702098cbd0c/go.mod h1:SPLNCARd4xdjCkue0O6hvuoveuS1dGJjDnfxYe405YQ= github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc h1:BW+LjKJDz0So5LI8UZfW5neWeKpSkWqhmGjQFzcFfLM= github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc/go.mod h1:JVmqPBe8A/pZWwRoJW5ZjyALeY5OXMzPl7LrVXOdZAI= github.com/grafana/franz-go v0.0.0-20241009100846-782ba1442937 h1:fwwnG/NcygoS6XbAaEyK2QzMXI/BZIEJvQ3CD+7XZm8= diff --git a/vendor/github.com/grafana/dskit/ring/basic_lifecycler.go b/vendor/github.com/grafana/dskit/ring/basic_lifecycler.go index c0860d682b6..1a2e103806c 100644 --- a/vendor/github.com/grafana/dskit/ring/basic_lifecycler.go +++ b/vendor/github.com/grafana/dskit/ring/basic_lifecycler.go @@ -53,6 +53,8 @@ type BasicLifecyclerConfig struct { HeartbeatTimeout time.Duration TokensObservePeriod time.Duration NumTokens int + // HideTokensInStatusPage allows tokens to be hidden from management tools e.g. the status page, for use in contexts which do not utilize tokens. + HideTokensInStatusPage bool // If true lifecycler doesn't unregister instance from the ring when it's stopping. Default value is false, // which means unregistering. @@ -546,5 +548,5 @@ func (l *BasicLifecycler) getRing(ctx context.Context) (*Desc, error) { } func (l *BasicLifecycler) ServeHTTP(w http.ResponseWriter, req *http.Request) { - newRingPageHandler(l, l.cfg.HeartbeatTimeout).handle(w, req) + newRingPageHandler(l, l.cfg.HeartbeatTimeout, l.cfg.HideTokensInStatusPage).handle(w, req) } diff --git a/vendor/github.com/grafana/dskit/ring/lifecycler.go b/vendor/github.com/grafana/dskit/ring/lifecycler.go index 083f112bdf1..bb9f1e8f3dc 100644 --- a/vendor/github.com/grafana/dskit/ring/lifecycler.go +++ b/vendor/github.com/grafana/dskit/ring/lifecycler.go @@ -55,6 +55,8 @@ type LifecyclerConfig struct { // Injected internally ListenPort int `yaml:"-"` + // HideTokensInStatusPage allows tokens to be hidden from management tools e.g. the status page, for use in contexts which do not utilize tokens. + HideTokensInStatusPage bool `yaml:"-"` // If set, specifies the TokenGenerator implementation that will be used for generating tokens. // Default value is nil, which means that RandomTokenGenerator is used. @@ -1088,7 +1090,7 @@ func (i *Lifecycler) getRing(ctx context.Context) (*Desc, error) { } func (i *Lifecycler) ServeHTTP(w http.ResponseWriter, req *http.Request) { - newRingPageHandler(i, i.cfg.HeartbeatTimeout).handle(w, req) + newRingPageHandler(i, i.cfg.HeartbeatTimeout, i.cfg.HideTokensInStatusPage).handle(w, req) } // unregister removes our entry from consul. diff --git a/vendor/github.com/grafana/dskit/ring/ring.go b/vendor/github.com/grafana/dskit/ring/ring.go index d47eb8fe256..62a49a6d81f 100644 --- a/vendor/github.com/grafana/dskit/ring/ring.go +++ b/vendor/github.com/grafana/dskit/ring/ring.go @@ -150,6 +150,9 @@ type Config struct { // Whether the shuffle-sharding subring cache is disabled. This option is set // internally and never exposed to the user. SubringCacheDisabled bool `yaml:"-"` + // HideTokensInStatusPage allows tokens to be hidden from management tools e.g. the status page, for use in contexts which do not utilize tokens. + // This option is set internally and never exposed to the user. + HideTokensInStatusPage bool `yaml:"-"` } // RegisterFlags adds the flags required to config this to the given FlagSet with a specified prefix @@ -1223,7 +1226,7 @@ func (r *Ring) getRing(_ context.Context) (*Desc, error) { } func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) { - newRingPageHandler(r, r.cfg.HeartbeatTimeout).handle(w, req) + newRingPageHandler(r, r.cfg.HeartbeatTimeout, r.cfg.HideTokensInStatusPage).handle(w, req) } // InstancesCount returns the number of instances in the ring. diff --git a/vendor/github.com/grafana/dskit/ring/ring_http.go b/vendor/github.com/grafana/dskit/ring/ring_http.go index 67249e2b496..d961d8b1583 100644 --- a/vendor/github.com/grafana/dskit/ring/ring_http.go +++ b/vendor/github.com/grafana/dskit/ring/ring_http.go @@ -30,9 +30,12 @@ var defaultPageTemplate = template.Must(template.New("webpage").Funcs(template.F }).Parse(defaultPageContent)) type httpResponse struct { - Ingesters []ingesterDesc `json:"shards"` - Now time.Time `json:"now"` - ShowTokens bool `json:"-"` + Ingesters []ingesterDesc `json:"shards"` + Now time.Time `json:"now"` + // ShowTokens indicates whether the Show Tokens button is clicked. + ShowTokens bool `json:"-"` + // DisableTokens hides the concept of tokens entirely in the page, across all elements. + DisableTokens bool `json:"-"` } type ingesterDesc struct { @@ -57,12 +60,14 @@ type ringAccess interface { type ringPageHandler struct { r ringAccess heartbeatTimeout time.Duration + disableTokens bool } -func newRingPageHandler(r ringAccess, heartbeatTimeout time.Duration) *ringPageHandler { +func newRingPageHandler(r ringAccess, heartbeatTimeout time.Duration, disableTokens bool) *ringPageHandler { return &ringPageHandler{ r: r, heartbeatTimeout: heartbeatTimeout, + disableTokens: disableTokens, } } @@ -132,9 +137,10 @@ func (h *ringPageHandler) handle(w http.ResponseWriter, req *http.Request) { tokensParam := req.URL.Query().Get("tokens") renderHTTPResponse(w, httpResponse{ - Ingesters: ingesters, - Now: now, - ShowTokens: tokensParam == "true", + Ingesters: ingesters, + Now: now, + ShowTokens: tokensParam == "true", + DisableTokens: h.disableTokens, }, defaultPageTemplate, req) } diff --git a/vendor/github.com/grafana/dskit/ring/ring_status.gohtml b/vendor/github.com/grafana/dskit/ring/ring_status.gohtml index 157f8d89e63..055873f3b49 100644 --- a/vendor/github.com/grafana/dskit/ring/ring_status.gohtml +++ b/vendor/github.com/grafana/dskit/ring/ring_status.gohtml @@ -21,8 +21,10 @@
- Tokens:
- {{ range $token := .Tokens }}
- {{ $token }}
- {{ end }}
-
+ Tokens:
+ {{ range $token := .Tokens }}
+ {{ $token }}
+ {{ end }}
+