File tree 1 file changed +3
-2
lines changed 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) {
156
156
157
157
storageLastUpdate := r .KVClient .LastUpdateTime (r .key )
158
158
var ingesters []ingesterDesc
159
+ numTokens , ownedByAz := r .countTokensByAz ()
160
+ _ , owned := r .countTokens ()
161
+
159
162
for _ , id := range ingesterIDs {
160
163
ing := r .ringDesc .Ingesters [id ]
161
164
heartbeatTimestamp := time .Unix (ing .Timestamp , 0 )
@@ -174,12 +177,10 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) {
174
177
var deltaOwnership float64
175
178
176
179
if r .cfg .ZoneAwarenessEnabled {
177
- numTokens , ownedByAz := r .countTokensByAz ()
178
180
ownership = (float64 (ownedByAz [id ]) / float64 (math .MaxUint32 + 1 )) * 100
179
181
expectedOwnership := 1 / float64 (len (numTokens [ing .Zone ])) * 100
180
182
deltaOwnership = (1 - expectedOwnership / ownership ) * 100
181
183
} else {
182
- _ , owned := r .countTokens ()
183
184
ownership = (float64 (owned [id ]) / float64 (math .MaxUint32 + 1 )) * 100
184
185
expectedOwnership := 1 / float64 (len (owned )) * 100
185
186
deltaOwnership = (1 - expectedOwnership / ownership ) * 100
You can’t perform that action at this time.
0 commit comments