Skip to content

Commit c2ec8db

Browse files
committed
Stub a heap usage field on ClusterInfo
1 parent 16c63ff commit c2ec8db

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/src/main/java/org/elasticsearch/cluster/ClusterInfo.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ public class ClusterInfo implements ChunkedToXContent, Writeable {
5757
final Map<ShardId, Long> shardDataSetSizes;
5858
final Map<NodeAndShard, String> dataPath;
5959
final Map<NodeAndPath, ReservedSpace> reservedSpace;
60+
private final Map<String, NodeHeapUsage> nodeHeapUsages = Map.of();
61+
62+
public record NodeHeapUsage(String nodeId, long usedInBytes, long totalInBytes) {
63+
public double usedPercentage() {
64+
return (usedInBytes * 100.0d) / totalInBytes;
65+
}
66+
}
6067

6168
protected ClusterInfo() {
6269
this(Map.of(), Map.of(), Map.of(), Map.of(), Map.of(), Map.of());
@@ -211,6 +218,10 @@ public Map<String, DiskUsage> getNodeMostAvailableDiskUsages() {
211218
return this.mostAvailableSpaceUsage;
212219
}
213220

221+
public Map<String, NodeHeapUsage> getNodeHeapUsages() {
222+
return nodeHeapUsages;
223+
}
224+
214225
/**
215226
* Returns the shard size for the given shardId or <code>null</code> if that metric is not available.
216227
*/

0 commit comments

Comments
 (0)