26
26
import org .elasticsearch .common .xcontent .XContentParser ;
27
27
28
28
import java .io .IOException ;
29
- import java .util .Objects ;
30
29
import java .util .List ;
31
30
import java .util .Locale ;
32
31
import java .util .Map ;
32
+ import java .util .Objects ;
33
33
34
- import static org .elasticsearch .common .xcontent .ConstructingObjectParser .constructorArg ;
35
- import static org .elasticsearch .common .xcontent .ConstructingObjectParser .optionalConstructorArg ;
36
34
import static java .util .Collections .unmodifiableList ;
37
35
import static java .util .stream .Collectors .joining ;
36
+ import static org .elasticsearch .common .xcontent .ConstructingObjectParser .constructorArg ;
37
+ import static org .elasticsearch .common .xcontent .ConstructingObjectParser .optionalConstructorArg ;
38
38
39
39
/**
40
40
* Response from rollup's get jobs api.
@@ -51,6 +51,12 @@ public class GetRollupJobResponse {
51
51
static final ParseField STATE = new ParseField ("job_state" );
52
52
static final ParseField CURRENT_POSITION = new ParseField ("current_position" );
53
53
static final ParseField UPGRADED_DOC_ID = new ParseField ("upgraded_doc_id" );
54
+ static final ParseField INDEX_TIME_IN_MS = new ParseField ("index_time_in_ms" );
55
+ static final ParseField SEARCH_TIME_IN_MS = new ParseField ("search_time_in_ms" );
56
+ static final ParseField INDEX_TOTAL = new ParseField ("index_total" );
57
+ static final ParseField SEARCH_TOTAL = new ParseField ("search_total" );
58
+ static final ParseField SEARCH_FAILURES = new ParseField ("search_failures" );
59
+ static final ParseField INDEX_FAILURES = new ParseField ("index_failures" );
54
60
55
61
private List <JobWrapper > jobs ;
56
62
@@ -181,12 +187,25 @@ public static class RollupIndexerJobStats {
181
187
private final long numInputDocuments ;
182
188
private final long numOuputDocuments ;
183
189
private final long numInvocations ;
184
-
185
- RollupIndexerJobStats (long numPages , long numInputDocuments , long numOuputDocuments , long numInvocations ) {
190
+ private long indexTime ;
191
+ private long indexTotal ;
192
+ private long searchTime ;
193
+ private long searchTotal ;
194
+ private long indexFailures ;
195
+ private long searchFailures ;
196
+
197
+ RollupIndexerJobStats (long numPages , long numInputDocuments , long numOuputDocuments , long numInvocations ,
198
+ long indexTime , long indexTotal , long searchTime , long searchTotal , long indexFailures , long searchFailures ) {
186
199
this .numPages = numPages ;
187
200
this .numInputDocuments = numInputDocuments ;
188
201
this .numOuputDocuments = numOuputDocuments ;
189
202
this .numInvocations = numInvocations ;
203
+ this .indexTime = indexTime ;
204
+ this .indexTotal = indexTotal ;
205
+ this .searchTime = searchTime ;
206
+ this .searchTotal = searchTotal ;
207
+ this .indexFailures = indexFailures ;
208
+ this .searchFailures = searchFailures ;
190
209
}
191
210
192
211
/**
@@ -217,15 +236,65 @@ public long getOutputDocuments() {
217
236
return numOuputDocuments ;
218
237
}
219
238
239
+ /**
240
+ * Number of failures that have occurred during the bulk indexing phase of Rollup
241
+ */
242
+ public long getIndexFailures () {
243
+ return indexFailures ;
244
+ }
245
+
246
+ /**
247
+ * Number of failures that have occurred during the search phase of Rollup
248
+ */
249
+ public long getSearchFailures () {
250
+ return searchFailures ;
251
+ }
252
+
253
+ /**
254
+ * Returns the time spent indexing (cumulative) in milliseconds
255
+ */
256
+ public long getIndexTime () {
257
+ return indexTime ;
258
+ }
259
+
260
+ /**
261
+ * Returns the time spent searching (cumulative) in milliseconds
262
+ */
263
+ public long getSearchTime () {
264
+ return searchTime ;
265
+ }
266
+
267
+ /**
268
+ * Returns the total number of indexing requests that have been sent by the rollup job
269
+ * (Note: this is not the number of _documents_ that have been indexed)
270
+ */
271
+ public long getIndexTotal () {
272
+ return indexTotal ;
273
+ }
274
+
275
+ /**
276
+ * Returns the total number of search requests that have been sent by the rollup job
277
+ */
278
+ public long getSearchTotal () {
279
+ return searchTotal ;
280
+ }
281
+
220
282
private static final ConstructingObjectParser <RollupIndexerJobStats , Void > PARSER = new ConstructingObjectParser <>(
221
283
STATS .getPreferredName (),
222
284
true ,
223
- args -> new RollupIndexerJobStats ((long ) args [0 ], (long ) args [1 ], (long ) args [2 ], (long ) args [3 ]));
285
+ args -> new RollupIndexerJobStats ((long ) args [0 ], (long ) args [1 ], (long ) args [2 ], (long ) args [3 ],
286
+ (long ) args [4 ], (long ) args [5 ], (long ) args [6 ], (long ) args [7 ], (long ) args [8 ], (long ) args [9 ]));
224
287
static {
225
288
PARSER .declareLong (constructorArg (), NUM_PAGES );
226
289
PARSER .declareLong (constructorArg (), NUM_INPUT_DOCUMENTS );
227
290
PARSER .declareLong (constructorArg (), NUM_OUTPUT_DOCUMENTS );
228
291
PARSER .declareLong (constructorArg (), NUM_INVOCATIONS );
292
+ PARSER .declareLong (constructorArg (), INDEX_TIME_IN_MS );
293
+ PARSER .declareLong (constructorArg (), INDEX_TOTAL );
294
+ PARSER .declareLong (constructorArg (), SEARCH_TIME_IN_MS );
295
+ PARSER .declareLong (constructorArg (), SEARCH_TOTAL );
296
+ PARSER .declareLong (constructorArg (), INDEX_FAILURES );
297
+ PARSER .declareLong (constructorArg (), SEARCH_FAILURES );
229
298
}
230
299
231
300
@ Override
@@ -234,22 +303,35 @@ public boolean equals(Object other) {
234
303
if (other == null || getClass () != other .getClass ()) return false ;
235
304
RollupIndexerJobStats that = (RollupIndexerJobStats ) other ;
236
305
return Objects .equals (this .numPages , that .numPages )
237
- && Objects .equals (this .numInputDocuments , that .numInputDocuments )
238
- && Objects .equals (this .numOuputDocuments , that .numOuputDocuments )
239
- && Objects .equals (this .numInvocations , that .numInvocations );
306
+ && Objects .equals (this .numInputDocuments , that .numInputDocuments )
307
+ && Objects .equals (this .numOuputDocuments , that .numOuputDocuments )
308
+ && Objects .equals (this .numInvocations , that .numInvocations )
309
+ && Objects .equals (this .indexTime , that .indexTime )
310
+ && Objects .equals (this .searchTime , that .searchTime )
311
+ && Objects .equals (this .indexFailures , that .indexFailures )
312
+ && Objects .equals (this .searchFailures , that .searchFailures )
313
+ && Objects .equals (this .searchTotal , that .searchTotal )
314
+ && Objects .equals (this .indexTotal , that .indexTotal );
240
315
}
241
316
242
317
@ Override
243
318
public int hashCode () {
244
- return Objects .hash (numPages , numInputDocuments , numOuputDocuments , numInvocations );
319
+ return Objects .hash (numPages , numInputDocuments , numOuputDocuments , numInvocations ,
320
+ indexTime , searchTime , indexFailures , searchFailures , searchTotal , indexTotal );
245
321
}
246
322
247
323
@ Override
248
324
public final String toString () {
249
325
return "{pages=" + numPages
250
326
+ ", input_docs=" + numInputDocuments
251
327
+ ", output_docs=" + numOuputDocuments
252
- + ", invocations=" + numInvocations + "}" ;
328
+ + ", invocations=" + numInvocations
329
+ + ", index_failures=" + indexFailures
330
+ + ", search_failures=" + searchFailures
331
+ + ", index_time_in_ms=" + indexTime
332
+ + ", index_total=" + indexTotal
333
+ + ", search_time_in_ms=" + searchTime
334
+ + ", search_total=" + searchTotal + "}" ;
253
335
}
254
336
}
255
337
0 commit comments