diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-11-14 21:10:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-14 21:10:51 +0100 |
commit | d98de4ad52d9f1c045a19cdfd98ac82fe3a4fee4 (patch) | |
tree | 396eafb8ba56c6a22b7e4a6cd3affd51e55666da /node-admin | |
parent | 2c95834d7273352a1cc89e939a7814b7b4f6be58 (diff) | |
parent | 81b61cf749abda92eb99c13e7a29763f95695a3f (diff) |
Merge pull request #7659 from vespa-engine/freva/add-total-mem-metric
Add mem_total metric
Diffstat (limited to 'node-admin')
3 files changed, 8 insertions, 1 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index 6b9a7d4021a..25ed3ec4b59 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -626,6 +626,7 @@ public class NodeAgentImpl implements NodeAgent { long memoryTotalBytesUsed = memoryTotalBytesUsage - memoryTotalBytesCache; double memoryUsageRatio = (double) memoryTotalBytesUsed / memoryTotalBytes; + double memoryTotalUsageRatio = (double) memoryTotalBytesUsage / memoryTotalBytes; Optional<Double> diskUsageRatio = diskTotalBytesUsed.map(used -> (double) used / diskTotalBytes); List<DimensionMetrics> metrics = new ArrayList<>(); @@ -633,6 +634,8 @@ public class NodeAgentImpl implements NodeAgent { .withMetric("mem.limit", memoryTotalBytes) .withMetric("mem.used", memoryTotalBytesUsed) .withMetric("mem.util", 100 * memoryUsageRatio) + .withMetric("mem_total.used", memoryTotalBytesUsage) + .withMetric("mem_total.util", 100 * memoryTotalUsageRatio) .withMetric("cpu.util", 100 * cpuUsageRatioOfAllocated) .withMetric("cpu.sys.util", 100 * cpuKernelUsageRatioOfAllocated) .withMetric("disk.limit", diskTotalBytes); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java index 83ee9b57918..b6128fc8693 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java @@ -655,7 +655,9 @@ public class NodeAgentImplTest { long calledTimeout = (long) invocation.getArguments()[1]; String[] calledCommand = new String[invocation.getArguments().length - 2]; System.arraycopy(invocation.getArguments(), 2, calledCommand, 0, calledCommand.length); - calledCommand[calledCommand.length - 1] = calledCommand[calledCommand.length - 1].replaceAll("\"timestamp\":\\d+", "\"timestamp\":0"); + calledCommand[calledCommand.length - 1] = calledCommand[calledCommand.length - 1] + .replaceAll("\"timestamp\":\\d+", "\"timestamp\":0") + .replaceAll("([0-9]+\\.[0-9]{1,3})([0-9]*)", "$1"); // Only keep the first 3 decimals assertEquals(context, calledContainerName); assertEquals(5L, calledTimeout); diff --git a/node-admin/src/test/resources/expected.container.system.metrics.txt b/node-admin/src/test/resources/expected.container.system.metrics.txt index fab0f822d19..25de20803c7 100644 --- a/node-admin/src/test/resources/expected.container.system.metrics.txt +++ b/node-admin/src/test/resources/expected.container.system.metrics.txt @@ -10,6 +10,8 @@ s: "metrics": { "mem.limit": 4294967296, "mem.used": 1073741824, + "mem_total.util": 40.808, + "mem_total.used": 1752707072, "disk.used": 39625000000, "cpu.sys.util": 3.402, "disk.util": 15.85, |