Skip to content

Commit 63677ef

Browse files
authored
Merge pull request #5921 from alanprot/ring-page
2 parents 04cc770 + df1712f commit 63677ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/ring/http.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) {
156156

157157
storageLastUpdate := r.KVClient.LastUpdateTime(r.key)
158158
var ingesters []ingesterDesc
159+
numTokens, ownedByAz := r.countTokensByAz()
160+
_, owned := r.countTokens()
161+
159162
for _, id := range ingesterIDs {
160163
ing := r.ringDesc.Ingesters[id]
161164
heartbeatTimestamp := time.Unix(ing.Timestamp, 0)
@@ -174,12 +177,10 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) {
174177
var deltaOwnership float64
175178

176179
if r.cfg.ZoneAwarenessEnabled {
177-
numTokens, ownedByAz := r.countTokensByAz()
178180
ownership = (float64(ownedByAz[id]) / float64(math.MaxUint32+1)) * 100
179181
expectedOwnership := 1 / float64(len(numTokens[ing.Zone])) * 100
180182
deltaOwnership = (1 - expectedOwnership/ownership) * 100
181183
} else {
182-
_, owned := r.countTokens()
183184
ownership = (float64(owned[id]) / float64(math.MaxUint32+1)) * 100
184185
expectedOwnership := 1 / float64(len(owned)) * 100
185186
deltaOwnership = (1 - expectedOwnership/ownership) * 100

0 commit comments

Comments
 (0)