From d51c73f0425584b92b7c062d134cff819d7c75f9 Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Fri, 29 Apr 2022 14:19:55 +0200 Subject: [PATCH] Upgrade dskit Signed-off-by: Marco Pracucci --- CHANGELOG.md | 5 +++ go.mod | 2 +- go.sum | 4 +- vendor/github.com/grafana/dskit/ring/http.go | 2 +- .../grafana/dskit/ring/lifecycler.go | 4 -- .../grafana/dskit/ring/lifecycler_metrics.go | 12 ------ vendor/github.com/grafana/dskit/ring/ring.go | 40 ++----------------- vendor/modules.txt | 2 +- 8 files changed, 14 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85cde8a4882..baf484088c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ * [CHANGE] Store-gateway: enabled attributes in-memory cache by default. New default configuration is `-blocks-storage.bucket-store.chunks-cache.attributes-in-memory-max-items=50000`. #1727 * [CHANGE] Compactor: Removed the metric `cortex_compactor_garbage_collected_blocks_total` since it duplicates `cortex_compactor_blocks_marked_for_deletion_total`. #1728 * [CHANGE] All: Logs that used the`org_id` label now use `user` label. #1634 #1758 +* [CHANGE] Removed the following metrics exposed by the Mimir hash rings: #1791 + * `cortex_member_ring_tokens_owned` + * `cortex_member_ring_tokens_to_own` + * `cortex_ring_tokens_owned` + * `cortex_ring_member_ownership_percent` * [FEATURE] Querier: Added support for [streaming remote read](https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/). Should be noted that benefits of chunking the response are partial here, since in a typical `query-frontend` setup responses will be buffered until they've been completed. #1735 * [FEATURE] Ruler: Allow setting `evaluation_delay` for each rule group via rules group configuration file. #1474 * [FEATURE] Ruler: Added support for expression remote evaluation. #1536 diff --git a/go.mod b/go.mod index 02946117380..023700bda78 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/golang/snappy v0.0.4 github.com/google/gopacket v1.1.19 github.com/gorilla/mux v1.8.0 - github.com/grafana/dskit v0.0.0-20220426141700-ec983e9d5345 + github.com/grafana/dskit v0.0.0-20220429121553-25baa36b7a6f github.com/grafana/e2e v0.1.0 github.com/hashicorp/golang-lru v0.5.4 github.com/json-iterator/go v1.1.12 diff --git a/go.sum b/go.sum index 0a3d27f41ba..9c56e148f00 100644 --- a/go.sum +++ b/go.sum @@ -1047,8 +1047,8 @@ github.com/grafana-tools/sdk v0.0.0-20211220201350-966b3088eec9 h1:LQAhgcUPnzdjU github.com/grafana-tools/sdk v0.0.0-20211220201350-966b3088eec9/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4= github.com/grafana/dskit v0.0.0-20211021180445-3bd016e9d7f1/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM= github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d/go.mod h1:M0/dlftwBvH7+hdNNpjMa/CUXD7gsew67mbkCuDlFXE= -github.com/grafana/dskit v0.0.0-20220426141700-ec983e9d5345 h1:AAXGMQeVpdl6rvhmhWn+UL9Y5ICLZNgffdfvz2Yo6UE= -github.com/grafana/dskit v0.0.0-20220426141700-ec983e9d5345/go.mod h1:9It/K30QPyj/FuTqBb/SYnaS4/BJCP5YL4SRfXB7dG0= +github.com/grafana/dskit v0.0.0-20220429121553-25baa36b7a6f h1:mficjnlkWLMWtQzvkCvHcPZhtRbcYx/1NwBcztR400w= +github.com/grafana/dskit v0.0.0-20220429121553-25baa36b7a6f/go.mod h1:9It/K30QPyj/FuTqBb/SYnaS4/BJCP5YL4SRfXB7dG0= github.com/grafana/e2e v0.1.0 h1:nThd0U0TjUqyOOupSb+qDd4BOdhqwhR/oYbjoqiMlZk= github.com/grafana/e2e v0.1.0/go.mod h1:+26VJWpczg2OU3D0537acnHSHzhJORpxOs6F+M27tZo= github.com/grafana/memberlist v0.3.1-0.20220425183535-6b97a09b7167 h1:PgEQkGHR4YimSCEGT5IoswN9gJKZDVskf+he6UClCLw= diff --git a/vendor/github.com/grafana/dskit/ring/http.go b/vendor/github.com/grafana/dskit/ring/http.go index 18a56177cbf..bcf3d1cc89a 100644 --- a/vendor/github.com/grafana/dskit/ring/http.go +++ b/vendor/github.com/grafana/dskit/ring/http.go @@ -93,7 +93,7 @@ func (h *ringPageHandler) handle(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } - _, ownedTokens := ringDesc.countTokens() + ownedTokens := ringDesc.countTokens() var ingesterIDs []string for id := range ringDesc.Ingesters { diff --git a/vendor/github.com/grafana/dskit/ring/lifecycler.go b/vendor/github.com/grafana/dskit/ring/lifecycler.go index 602e1fdb58a..42c59d6c67f 100644 --- a/vendor/github.com/grafana/dskit/ring/lifecycler.go +++ b/vendor/github.com/grafana/dskit/ring/lifecycler.go @@ -176,8 +176,6 @@ func NewLifecycler(cfg LifecyclerConfig, flushTransferer FlushTransferer, ringNa logger: logger, } - l.lifecyclerMetrics.tokensToOwn.Set(float64(cfg.NumTokens)) - l.BasicService = services. NewBasicService(nil, l.loop, l.stopping). WithName(fmt.Sprintf("%s ring lifecycler", ringName)) @@ -304,8 +302,6 @@ func (i *Lifecycler) getTokens() Tokens { } func (i *Lifecycler) setTokens(tokens Tokens) { - i.lifecyclerMetrics.tokensOwned.Set(float64(len(tokens))) - i.stateMtx.Lock() defer i.stateMtx.Unlock() diff --git a/vendor/github.com/grafana/dskit/ring/lifecycler_metrics.go b/vendor/github.com/grafana/dskit/ring/lifecycler_metrics.go index 422a564c18b..fe29cdfd5fc 100644 --- a/vendor/github.com/grafana/dskit/ring/lifecycler_metrics.go +++ b/vendor/github.com/grafana/dskit/ring/lifecycler_metrics.go @@ -7,8 +7,6 @@ import ( type LifecyclerMetrics struct { consulHeartbeats prometheus.Counter - tokensOwned prometheus.Gauge - tokensToOwn prometheus.Gauge shutdownDuration *prometheus.HistogramVec } @@ -19,16 +17,6 @@ func NewLifecyclerMetrics(ringName string, reg prometheus.Registerer) *Lifecycle Help: "The total number of heartbeats sent to consul.", ConstLabels: prometheus.Labels{"name": ringName}, }), - tokensOwned: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Name: "member_ring_tokens_owned", - Help: "The number of tokens owned in the ring.", - ConstLabels: prometheus.Labels{"name": ringName}, - }), - tokensToOwn: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Name: "member_ring_tokens_to_own", - Help: "The number of tokens to own in the ring.", - ConstLabels: prometheus.Labels{"name": ringName}, - }), shutdownDuration: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ Name: "shutdown_duration_seconds", Help: "Duration (in seconds) of shutdown procedure (ie transfer or flush).", diff --git a/vendor/github.com/grafana/dskit/ring/ring.go b/vendor/github.com/grafana/dskit/ring/ring.go index 6c7e4a49fc0..be78fee5980 100644 --- a/vendor/github.com/grafana/dskit/ring/ring.go +++ b/vendor/github.com/grafana/dskit/ring/ring.go @@ -183,12 +183,9 @@ type Ring struct { // If set to nil, no caching is done (used by tests, and subrings). shuffledSubringCache map[subringCacheKey]*Ring - memberOwnershipGaugeVec *prometheus.GaugeVec numMembersGaugeVec *prometheus.GaugeVec totalTokensGauge prometheus.Gauge - numTokensGaugeVec *prometheus.GaugeVec oldestTimestampGaugeVec *prometheus.GaugeVec - reportedOwners map[string]struct{} logger log.Logger } @@ -227,11 +224,6 @@ func NewWithStoreClientAndStrategy(cfg Config, name, key string, store kv.Client strategy: strategy, ringDesc: &Desc{}, shuffledSubringCache: map[subringCacheKey]*Ring{}, - memberOwnershipGaugeVec: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{ - Name: "ring_member_ownership_percent", - Help: "The percent ownership of the ring by member", - ConstLabels: map[string]string{"name": name}}, - []string{"member"}), numMembersGaugeVec: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{ Name: "ring_members", Help: "Number of members in the ring", @@ -241,11 +233,6 @@ func NewWithStoreClientAndStrategy(cfg Config, name, key string, store kv.Client Name: "ring_tokens_total", Help: "Number of tokens in the ring", ConstLabels: map[string]string{"name": name}}), - numTokensGaugeVec: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{ - Name: "ring_tokens_owned", - Help: "The number of tokens in the ring owned by the member", - ConstLabels: map[string]string{"name": name}}, - []string{"member"}), oldestTimestampGaugeVec: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{ Name: "ring_oldest_member_timestamp", Help: "Timestamp of the oldest member in the ring.", @@ -514,12 +501,10 @@ func (r *Ring) GetReplicationSetForOperation(op Operation) (ReplicationSet, erro }, nil } -// countTokens returns the number of tokens and tokens within the range for each instance. -func (r *Desc) countTokens() (map[string]uint32, map[string]uint32) { +// countTokens returns the number tokens within the range for each instance. +func (r *Desc) countTokens() map[string]uint32 { var ( - owned = map[string]uint32{} - numTokens = map[string]uint32{} - + owned = map[string]uint32{} ringTokens = r.GetTokens() ringInstanceByToken = r.getTokensInfo() ) @@ -535,7 +520,6 @@ func (r *Desc) countTokens() (map[string]uint32, map[string]uint32) { } info := ringInstanceByToken[token] - numTokens[info.InstanceID] = numTokens[info.InstanceID] + 1 owned[info.InstanceID] = owned[info.InstanceID] + diff } @@ -543,11 +527,10 @@ func (r *Desc) countTokens() (map[string]uint32, map[string]uint32) { for id := range r.Ingesters { if _, ok := owned[id]; !ok { owned[id] = 0 - numTokens[id] = 0 } } - return numTokens, owned + return owned } // updateRingMetrics updates ring metrics. Caller must be holding the Write lock! @@ -587,21 +570,6 @@ func (r *Ring) updateRingMetrics(compareResult CompareResult) { return } - prevOwners := r.reportedOwners - r.reportedOwners = make(map[string]struct{}) - numTokens, ownedRange := r.ringDesc.countTokens() - for id, totalOwned := range ownedRange { - r.memberOwnershipGaugeVec.WithLabelValues(id).Set(float64(totalOwned) / float64(math.MaxUint32)) - r.numTokensGaugeVec.WithLabelValues(id).Set(float64(numTokens[id])) - delete(prevOwners, id) - r.reportedOwners[id] = struct{}{} - } - - for k := range prevOwners { - r.memberOwnershipGaugeVec.DeleteLabelValues(k) - r.numTokensGaugeVec.DeleteLabelValues(k) - } - r.totalTokensGauge.Set(float64(len(r.ringTokens))) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 52176bd5949..aebb076f478 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -434,7 +434,7 @@ github.com/gosimple/slug # github.com/grafana-tools/sdk v0.0.0-20211220201350-966b3088eec9 ## explicit; go 1.13 github.com/grafana-tools/sdk -# github.com/grafana/dskit v0.0.0-20220426141700-ec983e9d5345 +# github.com/grafana/dskit v0.0.0-20220429121553-25baa36b7a6f ## explicit; go 1.17 github.com/grafana/dskit/backoff github.com/grafana/dskit/concurrency