32
32
33
33
package org .opensearch .action .admin .indices .stats ;
34
34
35
+ import org .opensearch .Version ;
35
36
import org .opensearch .cluster .routing .ShardRouting ;
36
37
import org .opensearch .common .Nullable ;
37
38
import org .opensearch .common .annotation .PublicApi ;
44
45
import org .opensearch .index .seqno .RetentionLeaseStats ;
45
46
import org .opensearch .index .seqno .SeqNoStats ;
46
47
import org .opensearch .index .shard .ShardPath ;
48
+ import org .opensearch .indices .pollingingest .PollingIngestStats ;
47
49
48
50
import java .io .IOException ;
49
51
@@ -65,6 +67,9 @@ public class ShardStats implements Writeable, ToXContentFragment {
65
67
@ Nullable
66
68
private RetentionLeaseStats retentionLeaseStats ;
67
69
70
+ @ Nullable
71
+ private PollingIngestStats pollingIngestStats ;
72
+
68
73
/**
69
74
* Gets the current retention lease stats.
70
75
*
@@ -87,6 +92,9 @@ public ShardStats(StreamInput in) throws IOException {
87
92
isCustomDataPath = in .readBoolean ();
88
93
seqNoStats = in .readOptionalWriteable (SeqNoStats ::new );
89
94
retentionLeaseStats = in .readOptionalWriteable (RetentionLeaseStats ::new );
95
+ if (in .getVersion ().onOrAfter (Version .V_3_0_0 )) {
96
+ pollingIngestStats = in .readOptionalWriteable (PollingIngestStats ::new );
97
+ }
90
98
}
91
99
92
100
public ShardStats (
@@ -95,7 +103,8 @@ public ShardStats(
95
103
final CommonStats commonStats ,
96
104
final CommitStats commitStats ,
97
105
final SeqNoStats seqNoStats ,
98
- final RetentionLeaseStats retentionLeaseStats
106
+ final RetentionLeaseStats retentionLeaseStats ,
107
+ final PollingIngestStats pollingIngestStats
99
108
) {
100
109
this .shardRouting = routing ;
101
110
this .dataPath = shardPath .getRootDataPath ().toString ();
@@ -105,6 +114,7 @@ public ShardStats(
105
114
this .commonStats = commonStats ;
106
115
this .seqNoStats = seqNoStats ;
107
116
this .retentionLeaseStats = retentionLeaseStats ;
117
+ this .pollingIngestStats = pollingIngestStats ;
108
118
}
109
119
110
120
/**
@@ -128,6 +138,11 @@ public SeqNoStats getSeqNoStats() {
128
138
return this .seqNoStats ;
129
139
}
130
140
141
+ @ Nullable
142
+ public PollingIngestStats getPollingIngestStats () {
143
+ return this .pollingIngestStats ;
144
+ }
145
+
131
146
public String getDataPath () {
132
147
return dataPath ;
133
148
}
@@ -150,6 +165,9 @@ public void writeTo(StreamOutput out) throws IOException {
150
165
out .writeBoolean (isCustomDataPath );
151
166
out .writeOptionalWriteable (seqNoStats );
152
167
out .writeOptionalWriteable (retentionLeaseStats );
168
+ if (out .getVersion ().onOrAfter ((Version .V_3_0_0 ))) {
169
+ out .writeOptionalWriteable (pollingIngestStats );
170
+ }
153
171
}
154
172
155
173
@ Override
@@ -171,6 +189,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
171
189
if (retentionLeaseStats != null ) {
172
190
retentionLeaseStats .toXContent (builder , params );
173
191
}
192
+ if (pollingIngestStats != null ) {
193
+ pollingIngestStats .toXContent (builder , params );
194
+ }
174
195
builder .startObject (Fields .SHARD_PATH );
175
196
builder .field (Fields .STATE_PATH , statePath );
176
197
builder .field (Fields .DATA_PATH , dataPath );
0 commit comments