@@ -38,6 +38,7 @@ const pageContent = `
38
38
<th>Last Heartbeat</th>
39
39
<th>Tokens</th>
40
40
<th>Ownership</th>
41
+ <th>Ownership Diff From Expected</th>
41
42
<th>Actions</th>
42
43
</tr>
43
44
</thead>
@@ -56,6 +57,7 @@ const pageContent = `
56
57
<td>{{ .HeartbeatTimestamp }}</td>
57
58
<td>{{ .NumTokens }}</td>
58
59
<td>{{ .Ownership }}%</td>
60
+ <td>{{ .DiffOwnership }}%</td>
59
61
<td><button name="forget" value="{{ .ID }}" type="submit">Forget</button></td>
60
62
</tr>
61
63
{{ end }}
@@ -114,6 +116,7 @@ type ingesterDesc struct {
114
116
Tokens []uint32 `json:"tokens"`
115
117
NumTokens int `json:"-"`
116
118
Ownership float64 `json:"-"`
119
+ DiffOwnership float64 `json:"-"`
117
120
}
118
121
119
122
type httpResponse struct {
@@ -154,6 +157,7 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) {
154
157
storageLastUpdate := r .KVClient .LastUpdateTime (r .key )
155
158
var ingesters []ingesterDesc
156
159
_ , owned := r .countTokens ()
160
+ numTokens , ownedByAz := r .countTokensByAz ()
157
161
for _ , id := range ingesterIDs {
158
162
ing := r .ringDesc .Ingesters [id ]
159
163
heartbeatTimestamp := time .Unix (ing .Timestamp , 0 )
@@ -168,6 +172,19 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) {
168
172
registeredTimestamp = ing .GetRegisteredAt ().String ()
169
173
}
170
174
175
+ var ownership float64
176
+ var deltaOwnership float64
177
+
178
+ if r .cfg .ZoneAwarenessEnabled {
179
+ ownership = (float64 (ownedByAz [id ]) / float64 (math .MaxUint32 )) * 100
180
+ expectedOwnership := 1 / float64 (len (numTokens [ing .Zone ])) * 100
181
+ deltaOwnership = (1 - expectedOwnership / ownership ) * 100
182
+ } else {
183
+ ownership = (float64 (owned [id ]) / float64 (math .MaxUint32 )) * 100
184
+ expectedOwnership := 1 / float64 (len (owned )) * 100
185
+ deltaOwnership = (1 - expectedOwnership / ownership ) * 100
186
+ }
187
+
171
188
ingesters = append (ingesters , ingesterDesc {
172
189
ID : id ,
173
190
State : state ,
@@ -177,7 +194,8 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) {
177
194
Tokens : ing .Tokens ,
178
195
Zone : ing .Zone ,
179
196
NumTokens : len (ing .Tokens ),
180
- Ownership : (float64 (owned [id ]) / float64 (math .MaxUint32 )) * 100 ,
197
+ Ownership : ownership ,
198
+ DiffOwnership : deltaOwnership ,
181
199
})
182
200
}
183
201
0 commit comments