|
@@ -24,6 +24,7 @@ import org.elasticsearch.common.unit.ByteSizeValue;
|
|
|
import org.elasticsearch.core.TimeValue;
|
|
|
import org.elasticsearch.core.Tuple;
|
|
|
import org.elasticsearch.discovery.DiscoveryModule;
|
|
|
+import org.elasticsearch.index.stats.IndexingPressureStats;
|
|
|
import org.elasticsearch.monitor.fs.FsInfo;
|
|
|
import org.elasticsearch.monitor.jvm.JvmInfo;
|
|
|
import org.elasticsearch.monitor.os.OsInfo;
|
|
@@ -59,6 +60,7 @@ public class ClusterStatsNodes implements ToXContentFragment {
|
|
|
private final DiscoveryTypes discoveryTypes;
|
|
|
private final PackagingTypes packagingTypes;
|
|
|
private final IngestStats ingestStats;
|
|
|
+ private final IndexPressureStats indexPressureStats;
|
|
|
|
|
|
ClusterStatsNodes(List<ClusterStatsNodeResponse> nodeResponses) {
|
|
|
this.versions = new HashSet<>();
|
|
@@ -92,6 +94,7 @@ public class ClusterStatsNodes implements ToXContentFragment {
|
|
|
this.discoveryTypes = new DiscoveryTypes(nodeInfos);
|
|
|
this.packagingTypes = new PackagingTypes(nodeInfos);
|
|
|
this.ingestStats = new IngestStats(nodeStats);
|
|
|
+ this.indexPressureStats = new IndexPressureStats(nodeStats);
|
|
|
}
|
|
|
|
|
|
public Counts getCounts() {
|
|
@@ -176,6 +179,8 @@ public class ClusterStatsNodes implements ToXContentFragment {
|
|
|
|
|
|
ingestStats.toXContent(builder, params);
|
|
|
|
|
|
+ indexPressureStats.toXContent(builder, params);
|
|
|
+
|
|
|
return builder;
|
|
|
}
|
|
|
|
|
@@ -769,4 +774,81 @@ public class ClusterStatsNodes implements ToXContentFragment {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ static class IndexPressureStats implements ToXContentFragment {
|
|
|
+
|
|
|
+ private final IndexingPressureStats indexingPressureStats;
|
|
|
+
|
|
|
+ IndexPressureStats(final List<NodeStats> nodeStats) {
|
|
|
+ long totalCombinedCoordinatingAndPrimaryBytes = 0;
|
|
|
+ long totalCoordinatingBytes = 0;
|
|
|
+ long totalPrimaryBytes = 0;
|
|
|
+ long totalReplicaBytes = 0;
|
|
|
+
|
|
|
+ long currentCombinedCoordinatingAndPrimaryBytes = 0;
|
|
|
+ long currentCoordinatingBytes = 0;
|
|
|
+ long currentPrimaryBytes = 0;
|
|
|
+ long currentReplicaBytes = 0;
|
|
|
+ long coordinatingRejections = 0;
|
|
|
+ long primaryRejections = 0;
|
|
|
+ long replicaRejections = 0;
|
|
|
+ long memoryLimit = 0;
|
|
|
+
|
|
|
+ long totalCoordinatingOps = 0;
|
|
|
+ long totalPrimaryOps = 0;
|
|
|
+ long totalReplicaOps = 0;
|
|
|
+ long currentCoordinatingOps = 0;
|
|
|
+ long currentPrimaryOps = 0;
|
|
|
+ long currentReplicaOps = 0;
|
|
|
+ for (NodeStats nodeStat : nodeStats) {
|
|
|
+ IndexingPressureStats nodeStatIndexingPressureStats = nodeStat.getIndexingPressureStats();
|
|
|
+ if (nodeStatIndexingPressureStats != null) {
|
|
|
+ totalCombinedCoordinatingAndPrimaryBytes += nodeStatIndexingPressureStats.getTotalCombinedCoordinatingAndPrimaryBytes();
|
|
|
+ totalCoordinatingBytes += nodeStatIndexingPressureStats.getTotalCoordinatingBytes();
|
|
|
+ totalPrimaryBytes += nodeStatIndexingPressureStats.getTotalPrimaryBytes();
|
|
|
+ totalReplicaBytes += nodeStatIndexingPressureStats.getTotalReplicaBytes();
|
|
|
+ currentCombinedCoordinatingAndPrimaryBytes += nodeStatIndexingPressureStats
|
|
|
+ .getCurrentCombinedCoordinatingAndPrimaryBytes();
|
|
|
+ currentCoordinatingBytes += nodeStatIndexingPressureStats.getCurrentCoordinatingBytes();
|
|
|
+ currentPrimaryBytes += nodeStatIndexingPressureStats.getCurrentPrimaryBytes();
|
|
|
+ currentReplicaBytes += nodeStatIndexingPressureStats.getCurrentReplicaBytes();
|
|
|
+ coordinatingRejections += nodeStatIndexingPressureStats.getCoordinatingRejections();
|
|
|
+ primaryRejections += nodeStatIndexingPressureStats.getPrimaryRejections();
|
|
|
+ replicaRejections += nodeStatIndexingPressureStats.getReplicaRejections();
|
|
|
+ memoryLimit += nodeStatIndexingPressureStats.getMemoryLimit();
|
|
|
+ totalCoordinatingOps += nodeStatIndexingPressureStats.getTotalCoordinatingOps();
|
|
|
+ totalReplicaOps += nodeStatIndexingPressureStats.getTotalReplicaOps();
|
|
|
+ currentCoordinatingOps += nodeStatIndexingPressureStats.getCurrentCoordinatingOps();
|
|
|
+ currentPrimaryOps += nodeStatIndexingPressureStats.getCurrentPrimaryOps();
|
|
|
+ currentReplicaOps += nodeStatIndexingPressureStats.getCurrentReplicaOps();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ indexingPressureStats = new IndexingPressureStats(
|
|
|
+ totalCombinedCoordinatingAndPrimaryBytes,
|
|
|
+ totalCoordinatingBytes,
|
|
|
+ totalPrimaryBytes,
|
|
|
+ totalReplicaBytes,
|
|
|
+ currentCombinedCoordinatingAndPrimaryBytes,
|
|
|
+ currentCoordinatingBytes,
|
|
|
+ currentPrimaryBytes,
|
|
|
+ currentReplicaBytes,
|
|
|
+ coordinatingRejections,
|
|
|
+ primaryRejections,
|
|
|
+ replicaRejections,
|
|
|
+ memoryLimit,
|
|
|
+ totalCoordinatingOps,
|
|
|
+ totalPrimaryOps,
|
|
|
+ totalReplicaOps,
|
|
|
+ currentCoordinatingOps,
|
|
|
+ currentPrimaryOps,
|
|
|
+ currentReplicaOps
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public XContentBuilder toXContent(final XContentBuilder builder, final Params params) throws IOException {
|
|
|
+ return indexingPressureStats.toXContent(builder, params);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|