|
59 | 59 | import org.opensearch.monitor.process.ProcessStats;
|
60 | 60 | import org.opensearch.node.AdaptiveSelectionStats;
|
61 | 61 | import org.opensearch.node.NodesResourceUsageStats;
|
| 62 | +import org.opensearch.node.remotestore.RemoteStoreNodeStats; |
62 | 63 | import org.opensearch.ratelimitting.admissioncontrol.stats.AdmissionControlStats;
|
63 | 64 | import org.opensearch.repositories.RepositoriesStats;
|
64 | 65 | import org.opensearch.script.ScriptCacheStats;
|
@@ -162,6 +163,9 @@ public class NodeStats extends BaseNodeResponse implements ToXContentFragment {
|
162 | 163 | @Nullable
|
163 | 164 | private NodeCacheStats nodeCacheStats;
|
164 | 165 |
|
| 166 | + @Nullable |
| 167 | + private RemoteStoreNodeStats remoteStoreNodeStats; |
| 168 | + |
165 | 169 | public NodeStats(StreamInput in) throws IOException {
|
166 | 170 | super(in);
|
167 | 171 | timestamp = in.readVLong();
|
@@ -243,6 +247,12 @@ public NodeStats(StreamInput in) throws IOException {
|
243 | 247 | } else {
|
244 | 248 | nodeCacheStats = null;
|
245 | 249 | }
|
| 250 | + // TODO: change version to V_2_18_0 |
| 251 | + if (in.getVersion().onOrAfter(Version.CURRENT)) { |
| 252 | + remoteStoreNodeStats = in.readOptionalWriteable(RemoteStoreNodeStats::new); |
| 253 | + } else { |
| 254 | + remoteStoreNodeStats = null; |
| 255 | + } |
246 | 256 | }
|
247 | 257 |
|
248 | 258 | public NodeStats(
|
@@ -274,7 +284,8 @@ public NodeStats(
|
274 | 284 | @Nullable SegmentReplicationRejectionStats segmentReplicationRejectionStats,
|
275 | 285 | @Nullable RepositoriesStats repositoriesStats,
|
276 | 286 | @Nullable AdmissionControlStats admissionControlStats,
|
277 |
| - @Nullable NodeCacheStats nodeCacheStats |
| 287 | + @Nullable NodeCacheStats nodeCacheStats, |
| 288 | + @Nullable RemoteStoreNodeStats remoteStoreNodeStats |
278 | 289 | ) {
|
279 | 290 | super(node);
|
280 | 291 | this.timestamp = timestamp;
|
@@ -305,6 +316,7 @@ public NodeStats(
|
305 | 316 | this.repositoriesStats = repositoriesStats;
|
306 | 317 | this.admissionControlStats = admissionControlStats;
|
307 | 318 | this.nodeCacheStats = nodeCacheStats;
|
| 319 | + this.remoteStoreNodeStats = remoteStoreNodeStats; |
308 | 320 | }
|
309 | 321 |
|
310 | 322 | public long getTimestamp() {
|
@@ -467,6 +479,11 @@ public NodeCacheStats getNodeCacheStats() {
|
467 | 479 | return nodeCacheStats;
|
468 | 480 | }
|
469 | 481 |
|
| 482 | + @Nullable |
| 483 | + public RemoteStoreNodeStats getRemoteStoreNodeStats() { |
| 484 | + return remoteStoreNodeStats; |
| 485 | + } |
| 486 | + |
470 | 487 | @Override
|
471 | 488 | public void writeTo(StreamOutput out) throws IOException {
|
472 | 489 | super.writeTo(out);
|
@@ -525,6 +542,10 @@ public void writeTo(StreamOutput out) throws IOException {
|
525 | 542 | if (out.getVersion().onOrAfter(Version.V_2_14_0)) {
|
526 | 543 | out.writeOptionalWriteable(nodeCacheStats);
|
527 | 544 | }
|
| 545 | + // TODO: change version to V_2_18_0 |
| 546 | + if (out.getVersion().onOrAfter(Version.CURRENT)) { |
| 547 | + out.writeOptionalWriteable(remoteStoreNodeStats); |
| 548 | + } |
528 | 549 | }
|
529 | 550 |
|
530 | 551 | @Override
|
@@ -631,6 +652,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
|
631 | 652 | if (getNodeCacheStats() != null) {
|
632 | 653 | getNodeCacheStats().toXContent(builder, params);
|
633 | 654 | }
|
| 655 | + if (getRemoteStoreNodeStats() != null) { |
| 656 | + getRemoteStoreNodeStats().toXContent(builder, params); |
| 657 | + } |
634 | 658 | return builder;
|
635 | 659 | }
|
636 | 660 | }
|
0 commit comments