File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments