3
3
* or more contributor license agreements. Licensed under the Elastic License;
4
4
* you may not use this file except in compliance with the Elastic License.
5
5
*/
6
- package org .elasticsearch .xpack .core .rollup . job ;
6
+ package org .elasticsearch .xpack .core .indexing ;
7
7
8
8
import org .elasticsearch .common .ParseField ;
9
9
import org .elasticsearch .common .io .stream .StreamInput ;
13
13
import org .elasticsearch .common .xcontent .ToXContentObject ;
14
14
import org .elasticsearch .common .xcontent .XContentBuilder ;
15
15
import org .elasticsearch .common .xcontent .XContentParser ;
16
-
17
16
import java .io .IOException ;
18
17
import java .util .Objects ;
19
18
24
23
* and are only for external monitoring/reference. Statistics are not persisted with the job, so if the
25
24
* allocated task is shutdown/restarted on a different node all the stats will reset.
26
25
*/
27
- public class RollupJobStats implements ToXContentObject , Writeable {
26
+ public class IndexerJobStats implements ToXContentObject , Writeable {
28
27
29
28
public static final ParseField NAME = new ParseField ("job_stats" );
30
29
31
30
private static ParseField NUM_PAGES = new ParseField ("pages_processed" );
32
- private static ParseField NUM_DOCUMENTS = new ParseField ("documents_processed" );
33
- private static ParseField NUM_ROLLUPS = new ParseField ("rollups_indexed" );
31
+ private static ParseField NUM_INPUT_DOCUMENTS = new ParseField ("documents_processed" );
32
+ // BWC for RollupJobStats
33
+ private static ParseField NUM_OUTPUT_DOCUMENTS = new ParseField ("documents_indexed" ).withDeprecation ("rollups_indexed" );
34
34
private static ParseField NUM_INVOCATIONS = new ParseField ("trigger_count" );
35
35
36
36
private long numPages = 0 ;
37
- private long numDocuments = 0 ;
38
- private long numRollups = 0 ;
37
+ private long numInputDocuments = 0 ;
38
+ private long numOuputDocuments = 0 ;
39
39
private long numInvocations = 0 ;
40
40
41
- public static final ConstructingObjectParser <RollupJobStats , Void > PARSER =
41
+ public static final ConstructingObjectParser <IndexerJobStats , Void > PARSER =
42
42
new ConstructingObjectParser <>(NAME .getPreferredName (),
43
- args -> new RollupJobStats ((long ) args [0 ], (long ) args [1 ], (long ) args [2 ], (long ) args [3 ]));
43
+ args -> new IndexerJobStats ((long ) args [0 ], (long ) args [1 ], (long ) args [2 ], (long ) args [3 ]));
44
44
45
45
static {
46
46
PARSER .declareLong (constructorArg (), NUM_PAGES );
47
- PARSER .declareLong (constructorArg (), NUM_DOCUMENTS );
48
- PARSER .declareLong (constructorArg (), NUM_ROLLUPS );
47
+ PARSER .declareLong (constructorArg (), NUM_INPUT_DOCUMENTS );
48
+ PARSER .declareLong (constructorArg (), NUM_OUTPUT_DOCUMENTS );
49
49
PARSER .declareLong (constructorArg (), NUM_INVOCATIONS );
50
50
}
51
51
52
- public RollupJobStats () {
52
+ public IndexerJobStats () {
53
53
}
54
54
55
- public RollupJobStats (long numPages , long numDocuments , long numRollups , long numInvocations ) {
55
+ public IndexerJobStats (long numPages , long numDocuments , long numOuputDocuments , long numInvocations ) {
56
56
this .numPages = numPages ;
57
- this .numDocuments = numDocuments ;
58
- this .numRollups = numRollups ;
57
+ this .numInputDocuments = numDocuments ;
58
+ this .numOuputDocuments = numOuputDocuments ;
59
59
this .numInvocations = numInvocations ;
60
60
}
61
61
62
- public RollupJobStats (StreamInput in ) throws IOException {
62
+ public IndexerJobStats (StreamInput in ) throws IOException {
63
63
this .numPages = in .readVLong ();
64
- this .numDocuments = in .readVLong ();
65
- this .numRollups = in .readVLong ();
64
+ this .numInputDocuments = in .readVLong ();
65
+ this .numOuputDocuments = in .readVLong ();
66
66
this .numInvocations = in .readVLong ();
67
67
}
68
68
@@ -71,15 +71,15 @@ public long getNumPages() {
71
71
}
72
72
73
73
public long getNumDocuments () {
74
- return numDocuments ;
74
+ return numInputDocuments ;
75
75
}
76
76
77
77
public long getNumInvocations () {
78
78
return numInvocations ;
79
79
}
80
80
81
- public long getNumRollups () {
82
- return numRollups ;
81
+ public long getOutputDocuments () {
82
+ return numOuputDocuments ;
83
83
}
84
84
85
85
public void incrementNumPages (long n ) {
@@ -89,28 +89,28 @@ public void incrementNumPages(long n) {
89
89
90
90
public void incrementNumDocuments (long n ) {
91
91
assert (n >= 0 );
92
- numDocuments += n ;
92
+ numInputDocuments += n ;
93
93
}
94
94
95
95
public void incrementNumInvocations (long n ) {
96
96
assert (n >= 0 );
97
97
numInvocations += n ;
98
98
}
99
99
100
- public void incrementNumRollups (long n ) {
100
+ public void incrementNumOutputDocuments (long n ) {
101
101
assert (n >= 0 );
102
- numRollups += n ;
102
+ numOuputDocuments += n ;
103
103
}
104
104
105
105
@ Override
106
106
public void writeTo (StreamOutput out ) throws IOException {
107
107
out .writeVLong (numPages );
108
- out .writeVLong (numDocuments );
109
- out .writeVLong (numRollups );
108
+ out .writeVLong (numInputDocuments );
109
+ out .writeVLong (numOuputDocuments );
110
110
out .writeVLong (numInvocations );
111
111
}
112
112
113
- public static RollupJobStats fromXContent (XContentParser parser ) {
113
+ public static IndexerJobStats fromXContent (XContentParser parser ) {
114
114
try {
115
115
return PARSER .parse (parser , null );
116
116
} catch (IOException e ) {
@@ -122,8 +122,8 @@ public static RollupJobStats fromXContent(XContentParser parser) {
122
122
public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
123
123
builder .startObject ();
124
124
builder .field (NUM_PAGES .getPreferredName (), numPages );
125
- builder .field (NUM_DOCUMENTS .getPreferredName (), numDocuments );
126
- builder .field (NUM_ROLLUPS .getPreferredName (), numRollups );
125
+ builder .field (NUM_INPUT_DOCUMENTS .getPreferredName (), numInputDocuments );
126
+ builder .field (NUM_OUTPUT_DOCUMENTS .getPreferredName (), numOuputDocuments );
127
127
builder .field (NUM_INVOCATIONS .getPreferredName (), numInvocations );
128
128
builder .endObject ();
129
129
return builder ;
@@ -139,18 +139,16 @@ public boolean equals(Object other) {
139
139
return false ;
140
140
}
141
141
142
- RollupJobStats that = (RollupJobStats ) other ;
142
+ IndexerJobStats that = (IndexerJobStats ) other ;
143
143
144
144
return Objects .equals (this .numPages , that .numPages )
145
- && Objects .equals (this .numDocuments , that .numDocuments )
146
- && Objects .equals (this .numRollups , that .numRollups )
145
+ && Objects .equals (this .numInputDocuments , that .numInputDocuments )
146
+ && Objects .equals (this .numOuputDocuments , that .numOuputDocuments )
147
147
&& Objects .equals (this .numInvocations , that .numInvocations );
148
148
}
149
149
150
150
@ Override
151
151
public int hashCode () {
152
- return Objects .hash (numPages , numDocuments , numRollups , numInvocations );
152
+ return Objects .hash (numPages , numInputDocuments , numOuputDocuments , numInvocations );
153
153
}
154
-
155
154
}
156
-
0 commit comments