diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoService.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoService.java index 3e872d3525a08..13e52b96180c5 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoService.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoService.java @@ -181,7 +181,7 @@ private void retainAliveNodes(Set currentNodes) { private void addNodeStats(ImmutableOpenMap.Builder builder, NodeStats nodeStats) { // we might add nodes that already died here, but those will be removed on next cluster state update anyway and is only a small // waste. - builder.put(nodeStats.getNode().getEphemeralId(), nodeStats.getOs().getMem().getTotal().getBytes()); + builder.put(nodeStats.getNode().getEphemeralId(), nodeStats.getOs().getMem().getAdjustedTotal().getBytes()); } public AutoscalingMemoryInfo snapshot() { diff --git a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoServiceTests.java b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoServiceTests.java index 1c005095854bd..2e8089c2f1986 100644 --- a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoServiceTests.java +++ b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/capacity/memory/AutoscalingMemoryInfoServiceTests.java @@ -331,7 +331,7 @@ public void assertMatchesResponse(Set nodes, NodesStatsResponse r n -> { assertThat( service.snapshot().get(n), - equalTo(response.getNodesMap().get(n.getId()).getOs().getMem().getTotal().getBytes()) + equalTo(response.getNodesMap().get(n.getId()).getOs().getMem().getAdjustedTotal().getBytes()) ); } ); @@ -347,7 +347,7 @@ private static NodeStats statsForNode(DiscoveryNode node, long memory) { OsStats osStats = new OsStats( randomNonNegativeLong(), new OsStats.Cpu(randomShort(), null), - new OsStats.Mem(memory, memory, randomLongBetween(0, memory)), + new OsStats.Mem(memory, randomLongBetween(0, memory), randomLongBetween(0, memory)), new OsStats.Swap(randomNonNegativeLong(), randomNonNegativeLong()), null );