33 * or more contributor license agreements. Licensed under the Elastic License;
44 * you may not use this file except in compliance with the Elastic License.
55 */
6- package org .elasticsearch .xpack .core .rollup . job ;
6+ package org .elasticsearch .xpack .core .indexing ;
77
88import org .elasticsearch .common .ParseField ;
99import org .elasticsearch .common .io .stream .StreamInput ;
1313import org .elasticsearch .common .xcontent .ToXContentObject ;
1414import org .elasticsearch .common .xcontent .XContentBuilder ;
1515import org .elasticsearch .common .xcontent .XContentParser ;
16-
1716import java .io .IOException ;
1817import java .util .Objects ;
1918
2423 * and are only for external monitoring/reference. Statistics are not persisted with the job, so if the
2524 * allocated task is shutdown/restarted on a different node all the stats will reset.
2625 */
27- public class RollupJobStats implements ToXContentObject , Writeable {
26+ public class IndexerJobStats implements ToXContentObject , Writeable {
2827
2928 public static final ParseField NAME = new ParseField ("job_stats" );
3029
3130 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" );
3434 private static ParseField NUM_INVOCATIONS = new ParseField ("trigger_count" );
3535
3636 private long numPages = 0 ;
37- private long numDocuments = 0 ;
38- private long numRollups = 0 ;
37+ private long numInputDocuments = 0 ;
38+ private long numOuputDocuments = 0 ;
3939 private long numInvocations = 0 ;
4040
41- public static final ConstructingObjectParser <RollupJobStats , Void > PARSER =
41+ public static final ConstructingObjectParser <IndexerJobStats , Void > PARSER =
4242 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 ]));
4444
4545 static {
4646 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 );
4949 PARSER .declareLong (constructorArg (), NUM_INVOCATIONS );
5050 }
5151
52- public RollupJobStats () {
52+ public IndexerJobStats () {
5353 }
5454
55- public RollupJobStats (long numPages , long numDocuments , long numRollups , long numInvocations ) {
55+ public IndexerJobStats (long numPages , long numDocuments , long numOuputDocuments , long numInvocations ) {
5656 this .numPages = numPages ;
57- this .numDocuments = numDocuments ;
58- this .numRollups = numRollups ;
57+ this .numInputDocuments = numDocuments ;
58+ this .numOuputDocuments = numOuputDocuments ;
5959 this .numInvocations = numInvocations ;
6060 }
6161
62- public RollupJobStats (StreamInput in ) throws IOException {
62+ public IndexerJobStats (StreamInput in ) throws IOException {
6363 this .numPages = in .readVLong ();
64- this .numDocuments = in .readVLong ();
65- this .numRollups = in .readVLong ();
64+ this .numInputDocuments = in .readVLong ();
65+ this .numOuputDocuments = in .readVLong ();
6666 this .numInvocations = in .readVLong ();
6767 }
6868
@@ -71,15 +71,15 @@ public long getNumPages() {
7171 }
7272
7373 public long getNumDocuments () {
74- return numDocuments ;
74+ return numInputDocuments ;
7575 }
7676
7777 public long getNumInvocations () {
7878 return numInvocations ;
7979 }
8080
81- public long getNumRollups () {
82- return numRollups ;
81+ public long getOutputDocuments () {
82+ return numOuputDocuments ;
8383 }
8484
8585 public void incrementNumPages (long n ) {
@@ -89,28 +89,28 @@ public void incrementNumPages(long n) {
8989
9090 public void incrementNumDocuments (long n ) {
9191 assert (n >= 0 );
92- numDocuments += n ;
92+ numInputDocuments += n ;
9393 }
9494
9595 public void incrementNumInvocations (long n ) {
9696 assert (n >= 0 );
9797 numInvocations += n ;
9898 }
9999
100- public void incrementNumRollups (long n ) {
100+ public void incrementNumOutputDocuments (long n ) {
101101 assert (n >= 0 );
102- numRollups += n ;
102+ numOuputDocuments += n ;
103103 }
104104
105105 @ Override
106106 public void writeTo (StreamOutput out ) throws IOException {
107107 out .writeVLong (numPages );
108- out .writeVLong (numDocuments );
109- out .writeVLong (numRollups );
108+ out .writeVLong (numInputDocuments );
109+ out .writeVLong (numOuputDocuments );
110110 out .writeVLong (numInvocations );
111111 }
112112
113- public static RollupJobStats fromXContent (XContentParser parser ) {
113+ public static IndexerJobStats fromXContent (XContentParser parser ) {
114114 try {
115115 return PARSER .parse (parser , null );
116116 } catch (IOException e ) {
@@ -122,8 +122,8 @@ public static RollupJobStats fromXContent(XContentParser parser) {
122122 public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
123123 builder .startObject ();
124124 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 );
127127 builder .field (NUM_INVOCATIONS .getPreferredName (), numInvocations );
128128 builder .endObject ();
129129 return builder ;
@@ -139,18 +139,16 @@ public boolean equals(Object other) {
139139 return false ;
140140 }
141141
142- RollupJobStats that = (RollupJobStats ) other ;
142+ IndexerJobStats that = (IndexerJobStats ) other ;
143143
144144 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 )
147147 && Objects .equals (this .numInvocations , that .numInvocations );
148148 }
149149
150150 @ Override
151151 public int hashCode () {
152- return Objects .hash (numPages , numDocuments , numRollups , numInvocations );
152+ return Objects .hash (numPages , numInputDocuments , numOuputDocuments , numInvocations );
153153 }
154-
155154}
156-
0 commit comments