@@ -91,16 +91,14 @@ public Map<String, QueryGroupStatsHolder> getStats() {
91
91
* the instance will only be created on demand through stats api
92
92
*/
93
93
public static class QueryGroupStatsHolder implements ToXContentObject , Writeable {
94
- public static final String COMPLETIONS = "completions " ;
95
- public static final String REJECTIONS = "rejections " ;
94
+ public static final String COMPLETIONS = "total_completions " ;
95
+ public static final String REJECTIONS = "total_rejections " ;
96
96
public static final String TOTAL_CANCELLATIONS = "total_cancellations" ;
97
97
public static final String FAILURES = "failures" ;
98
- public static final String SHARD_COMPLETIONS = "shard_completions" ;
99
98
private long completions ;
100
- private long shardCompletions ;
101
99
private long rejections ;
102
100
private long failures ;
103
- private long totalCancellations ;
101
+ private long cancellations ;
104
102
private Map <ResourceType , ResourceStats > resourceStats ;
105
103
106
104
// this is needed to support the factory method
@@ -110,24 +108,21 @@ public QueryGroupStatsHolder(
110
108
long completions ,
111
109
long rejections ,
112
110
long failures ,
113
- long totalCancellations ,
114
- long shardCompletions ,
111
+ long cancellations ,
115
112
Map <ResourceType , ResourceStats > resourceStats
116
113
) {
117
114
this .completions = completions ;
118
115
this .rejections = rejections ;
119
116
this .failures = failures ;
120
- this .shardCompletions = shardCompletions ;
121
- this .totalCancellations = totalCancellations ;
117
+ this .cancellations = cancellations ;
122
118
this .resourceStats = resourceStats ;
123
119
}
124
120
125
121
public QueryGroupStatsHolder (StreamInput in ) throws IOException {
126
122
this .completions = in .readVLong ();
127
123
this .rejections = in .readVLong ();
128
124
this .failures = in .readVLong ();
129
- this .totalCancellations = in .readVLong ();
130
- this .shardCompletions = in .readVLong ();
125
+ this .cancellations = in .readVLong ();
131
126
this .resourceStats = in .readMap ((i ) -> ResourceType .fromName (i .readString ()), ResourceStats ::new );
132
127
}
133
128
@@ -145,11 +140,10 @@ public static QueryGroupStatsHolder from(QueryGroupState queryGroupState) {
145
140
resourceStatsMap .put (resourceTypeStateEntry .getKey (), ResourceStats .from (resourceTypeStateEntry .getValue ()));
146
141
}
147
142
148
- statsHolder .completions = queryGroupState .getCompletions ();
143
+ statsHolder .completions = queryGroupState .getTotalCompletions ();
149
144
statsHolder .rejections = queryGroupState .getTotalRejections ();
150
145
statsHolder .failures = queryGroupState .getFailures ();
151
- statsHolder .totalCancellations = queryGroupState .getTotalCancellations ();
152
- statsHolder .shardCompletions = queryGroupState .getShardCompletions ();
146
+ statsHolder .cancellations = queryGroupState .getTotalCancellations ();
153
147
statsHolder .resourceStats = resourceStatsMap ;
154
148
return statsHolder ;
155
149
}
@@ -164,8 +158,7 @@ public static void writeTo(StreamOutput out, QueryGroupStatsHolder statsHolder)
164
158
out .writeVLong (statsHolder .completions );
165
159
out .writeVLong (statsHolder .rejections );
166
160
out .writeVLong (statsHolder .failures );
167
- out .writeVLong (statsHolder .totalCancellations );
168
- out .writeVLong (statsHolder .shardCompletions );
161
+ out .writeVLong (statsHolder .cancellations );
169
162
out .writeMap (statsHolder .resourceStats , (o , val ) -> o .writeString (val .getName ()), ResourceStats ::writeTo );
170
163
}
171
164
@@ -177,10 +170,10 @@ public void writeTo(StreamOutput out) throws IOException {
177
170
@ Override
178
171
public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
179
172
builder .field (COMPLETIONS , completions );
180
- builder .field (SHARD_COMPLETIONS , shardCompletions );
173
+ // builder.field(SHARD_COMPLETIONS, shardCompletions);
181
174
builder .field (REJECTIONS , rejections );
182
- builder .field (FAILURES , failures );
183
- builder .field (TOTAL_CANCELLATIONS , totalCancellations );
175
+ // builder.field(FAILURES, failures);
176
+ builder .field (TOTAL_CANCELLATIONS , cancellations );
184
177
185
178
for (ResourceType resourceType : ResourceType .getSortedValues ()) {
186
179
ResourceStats resourceStats1 = resourceStats .get (resourceType );
@@ -199,15 +192,14 @@ public boolean equals(Object o) {
199
192
QueryGroupStatsHolder that = (QueryGroupStatsHolder ) o ;
200
193
return completions == that .completions
201
194
&& rejections == that .rejections
202
- && shardCompletions == that .shardCompletions
203
195
&& Objects .equals (resourceStats , that .resourceStats )
204
196
&& failures == that .failures
205
- && totalCancellations == that .totalCancellations ;
197
+ && cancellations == that .cancellations ;
206
198
}
207
199
208
200
@ Override
209
201
public int hashCode () {
210
- return Objects .hash (completions , shardCompletions , rejections , totalCancellations , failures , resourceStats );
202
+ return Objects .hash (completions , rejections , cancellations , failures , resourceStats );
211
203
}
212
204
}
213
205
@@ -217,6 +209,7 @@ public int hashCode() {
217
209
public static class ResourceStats implements ToXContentObject , Writeable {
218
210
public static final String CURRENT_USAGE = "current_usage" ;
219
211
public static final String CANCELLATIONS = "cancellations" ;
212
+ public static final String REJECTIONS = "rejections" ;
220
213
public static final double PRECISION = 1e-9 ;
221
214
private final double currentUsage ;
222
215
private final long cancellations ;
@@ -268,7 +261,7 @@ public void writeTo(StreamOutput out) throws IOException {
268
261
public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
269
262
builder .field (CURRENT_USAGE , currentUsage );
270
263
builder .field (CANCELLATIONS , cancellations );
271
- builder .field (QueryGroupStatsHolder . REJECTIONS , rejections );
264
+ builder .field (REJECTIONS , rejections );
272
265
return builder ;
273
266
}
274
267
0 commit comments