19
19
20
20
package org .elasticsearch .client .transform .transforms ;
21
21
22
- import org .elasticsearch .client .core .IndexerJobStats ;
23
22
import org .elasticsearch .common .ParseField ;
24
23
import org .elasticsearch .common .xcontent .ConstructingObjectParser ;
25
24
import org .elasticsearch .common .xcontent .XContentParser ;
29
28
30
29
import static org .elasticsearch .common .xcontent .ConstructingObjectParser .optionalConstructorArg ;
31
30
32
- public class TransformIndexerStats extends IndexerJobStats {
31
+ public class TransformIndexerStats {
32
+ public static final String NAME = "transform_indexer_stats" ;
33
33
34
34
static ParseField EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS = new ParseField ("exponential_avg_checkpoint_duration_ms" );
35
35
static ParseField EXPONENTIAL_AVG_DOCUMENTS_INDEXED = new ParseField ("exponential_avg_documents_indexed" );
36
36
static ParseField EXPONENTIAL_AVG_DOCUMENTS_PROCESSED = new ParseField ("exponential_avg_documents_processed" );
37
+ static ParseField PAGES_PROCESSED = new ParseField ("pages_processed" );
38
+ static ParseField DOCUMENTS_PROCESSED = new ParseField ("documents_processed" );
39
+ static ParseField DOCUMENTS_INDEXED = new ParseField ("documents_indexed" );
40
+ static ParseField TRIGGER_COUNT = new ParseField ("trigger_count" );
41
+ static ParseField INDEX_TIME_IN_MS = new ParseField ("index_time_in_ms" );
42
+ static ParseField SEARCH_TIME_IN_MS = new ParseField ("search_time_in_ms" );
43
+ static ParseField PROCESSING_TIME_IN_MS = new ParseField ("processing_time_in_ms" );
44
+ static ParseField INDEX_TOTAL = new ParseField ("index_total" );
45
+ static ParseField SEARCH_TOTAL = new ParseField ("search_total" );
46
+ static ParseField PROCESSING_TOTAL = new ParseField ("processing_total" );
47
+ static ParseField SEARCH_FAILURES = new ParseField ("search_failures" );
48
+ static ParseField INDEX_FAILURES = new ParseField ("index_failures" );
37
49
38
50
public static final ConstructingObjectParser <TransformIndexerStats , Void > LENIENT_PARSER = new ConstructingObjectParser <>(
39
51
NAME ,
@@ -58,10 +70,10 @@ public class TransformIndexerStats extends IndexerJobStats {
58
70
);
59
71
60
72
static {
61
- LENIENT_PARSER .declareLong (optionalConstructorArg (), NUM_PAGES );
62
- LENIENT_PARSER .declareLong (optionalConstructorArg (), NUM_INPUT_DOCUMENTS );
63
- LENIENT_PARSER .declareLong (optionalConstructorArg (), NUM_OUTPUT_DOCUMENTS );
64
- LENIENT_PARSER .declareLong (optionalConstructorArg (), NUM_INVOCATIONS );
73
+ LENIENT_PARSER .declareLong (optionalConstructorArg (), PAGES_PROCESSED );
74
+ LENIENT_PARSER .declareLong (optionalConstructorArg (), DOCUMENTS_PROCESSED );
75
+ LENIENT_PARSER .declareLong (optionalConstructorArg (), DOCUMENTS_INDEXED );
76
+ LENIENT_PARSER .declareLong (optionalConstructorArg (), TRIGGER_COUNT );
65
77
LENIENT_PARSER .declareLong (optionalConstructorArg (), INDEX_TIME_IN_MS );
66
78
LENIENT_PARSER .declareLong (optionalConstructorArg (), SEARCH_TIME_IN_MS );
67
79
LENIENT_PARSER .declareLong (optionalConstructorArg (), PROCESSING_TIME_IN_MS );
@@ -82,12 +94,24 @@ public static TransformIndexerStats fromXContent(XContentParser parser) throws I
82
94
private final double expAvgCheckpointDurationMs ;
83
95
private final double expAvgDocumentsIndexed ;
84
96
private final double expAvgDocumentsProcessed ;
97
+ private final long pagesProcessed ;
98
+ private final long documentsProcessed ;
99
+ private final long documentsIndexed ;
100
+ private final long triggerCount ;
101
+ private final long indexTime ;
102
+ private final long indexTotal ;
103
+ private final long searchTime ;
104
+ private final long searchTotal ;
105
+ private final long processingTime ;
106
+ private final long processingTotal ;
107
+ private final long indexFailures ;
108
+ private final long searchFailures ;
85
109
86
110
public TransformIndexerStats (
87
- long numPages ,
88
- long numInputDocuments ,
89
- long numOuputDocuments ,
90
- long numInvocations ,
111
+ long pagesProcessed ,
112
+ long documentsProcessed ,
113
+ long documentsIndexed ,
114
+ long triggerCount ,
91
115
long indexTime ,
92
116
long searchTime ,
93
117
long processingTime ,
@@ -100,20 +124,18 @@ public TransformIndexerStats(
100
124
double expAvgDocumentsIndexed ,
101
125
double expAvgDocumentsProcessed
102
126
) {
103
- super (
104
- numPages ,
105
- numInputDocuments ,
106
- numOuputDocuments ,
107
- numInvocations ,
108
- indexTime ,
109
- searchTime ,
110
- processingTime ,
111
- indexTotal ,
112
- searchTotal ,
113
- processingTotal ,
114
- indexFailures ,
115
- searchFailures
116
- );
127
+ this .pagesProcessed = pagesProcessed ;
128
+ this .documentsProcessed = documentsProcessed ;
129
+ this .documentsIndexed = documentsIndexed ;
130
+ this .triggerCount = triggerCount ;
131
+ this .indexTime = indexTime ;
132
+ this .indexTotal = indexTotal ;
133
+ this .searchTime = searchTime ;
134
+ this .searchTotal = searchTotal ;
135
+ this .processingTime = processingTime ;
136
+ this .processingTotal = processingTotal ;
137
+ this .indexFailures = indexFailures ;
138
+ this .searchFailures = searchFailures ;
117
139
this .expAvgCheckpointDurationMs = expAvgCheckpointDurationMs ;
118
140
this .expAvgDocumentsIndexed = expAvgDocumentsIndexed ;
119
141
this .expAvgDocumentsProcessed = expAvgDocumentsProcessed ;
@@ -131,6 +153,127 @@ public double getExpAvgDocumentsProcessed() {
131
153
return expAvgDocumentsProcessed ;
132
154
}
133
155
156
+ /**
157
+ * The number of pages read from the input indices
158
+ */
159
+ public long getPagesProcessed () {
160
+ return pagesProcessed ;
161
+ }
162
+
163
+ /**
164
+ * The number of documents read from the input indices
165
+ */
166
+ public long getDocumentsProcessed () {
167
+ return documentsProcessed ;
168
+ }
169
+
170
+ /**
171
+ * Number of times that the job woke up to write documents
172
+ */
173
+ public long getTriggerCount () {
174
+ return triggerCount ;
175
+ }
176
+
177
+ /**
178
+ * Number of documents written
179
+ */
180
+ public long getDocumentsIndexed () {
181
+ return documentsIndexed ;
182
+ }
183
+
184
+ /**
185
+ * The number of pages read from the input indices
186
+ * Deprecated, use {@link TransformIndexerStats#getPagesProcessed()} instead
187
+ */
188
+ @ Deprecated
189
+ public long getNumPages () {
190
+ return getPagesProcessed ();
191
+ }
192
+
193
+ /**
194
+ * The number of documents read from the input indices
195
+ * Deprecated, use {@link TransformIndexerStats#getDocumentsProcessed()} instead
196
+ */
197
+ @ Deprecated
198
+ public long getNumDocuments () {
199
+ return getDocumentsProcessed ();
200
+ }
201
+
202
+ /**
203
+ * Number of times that the job woke up to write documents
204
+ * Deprecated, use {@link TransformIndexerStats#getTriggerCount()} instead
205
+ */
206
+ @ Deprecated
207
+ public long getNumInvocations () {
208
+ return getTriggerCount ();
209
+ }
210
+
211
+ /**
212
+ * Number of documents written
213
+ * Deprecated, use {@link TransformIndexerStats#getDocumentsIndexed()} instead
214
+ */
215
+ @ Deprecated
216
+ public long getOutputDocuments () {
217
+ return getDocumentsIndexed ();
218
+ }
219
+
220
+ /**
221
+ * Number of index failures that have occurred
222
+ */
223
+ public long getIndexFailures () {
224
+ return indexFailures ;
225
+ }
226
+
227
+ /**
228
+ * Number of failures that have occurred
229
+ */
230
+ public long getSearchFailures () {
231
+ return searchFailures ;
232
+ }
233
+
234
+ /**
235
+ * Returns the time spent indexing (cumulative) in milliseconds
236
+ */
237
+ public long getIndexTime () {
238
+ return indexTime ;
239
+ }
240
+
241
+ /**
242
+ * Returns the time spent searching (cumulative) in milliseconds
243
+ */
244
+ public long getSearchTime () {
245
+ return searchTime ;
246
+ }
247
+
248
+ /**
249
+ * Returns the time spent processing (cumulative) in milliseconds
250
+ */
251
+ public long getProcessingTime () {
252
+ return processingTime ;
253
+ }
254
+
255
+ /**
256
+ * Returns the total number of indexing requests that have been processed
257
+ * (Note: this is not the number of _documents_ that have been indexed)
258
+ */
259
+ public long getIndexTotal () {
260
+ return indexTotal ;
261
+ }
262
+
263
+ /**
264
+ * Returns the total number of search requests that have been made
265
+ */
266
+ public long getSearchTotal () {
267
+ return searchTotal ;
268
+ }
269
+
270
+ /**
271
+ * Returns the total number of processing runs that have been made
272
+ */
273
+ public long getProcessingTotal () {
274
+ return processingTotal ;
275
+ }
276
+
134
277
@ Override
135
278
public boolean equals (Object other ) {
136
279
if (this == other ) {
@@ -143,10 +286,10 @@ public boolean equals(Object other) {
143
286
144
287
TransformIndexerStats that = (TransformIndexerStats ) other ;
145
288
146
- return Objects .equals (this .numPages , that .numPages )
147
- && Objects .equals (this .numInputDocuments , that .numInputDocuments )
148
- && Objects .equals (this .numOuputDocuments , that .numOuputDocuments )
149
- && Objects .equals (this .numInvocations , that .numInvocations )
289
+ return Objects .equals (this .pagesProcessed , that .pagesProcessed )
290
+ && Objects .equals (this .documentsProcessed , that .documentsProcessed )
291
+ && Objects .equals (this .documentsIndexed , that .documentsIndexed )
292
+ && Objects .equals (this .triggerCount , that .triggerCount )
150
293
&& Objects .equals (this .indexTime , that .indexTime )
151
294
&& Objects .equals (this .searchTime , that .searchTime )
152
295
&& Objects .equals (this .processingTime , that .processingTime )
@@ -163,10 +306,10 @@ public boolean equals(Object other) {
163
306
@ Override
164
307
public int hashCode () {
165
308
return Objects .hash (
166
- numPages ,
167
- numInputDocuments ,
168
- numOuputDocuments ,
169
- numInvocations ,
309
+ pagesProcessed ,
310
+ documentsProcessed ,
311
+ documentsIndexed ,
312
+ triggerCount ,
170
313
indexTime ,
171
314
searchTime ,
172
315
processingTime ,
0 commit comments