aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <valerij92@gmail.com>2019-06-21 19:39:50 +0200
committerValerij Fredriksen <valerij92@gmail.com>2019-06-21 19:39:50 +0200
commit229e190c6f6bd3602fbbfc8118fbbed7685aeb69 (patch)
treea39c4a080ecbaccfffd9ac427caf1abf712b3856
parent1e55ec0a0e4c42ea9f6b6d0468bb848696b5255a (diff)
Change throttling metrics to rate
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/SystemMetrics.java4
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java21
-rw-r--r--node-admin/src/test/resources/expected.container.system.metrics.txt4
3 files changed, 15 insertions, 14 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/SystemMetrics.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/SystemMetrics.java
index 711fedcfef6..b49fd36da78 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/SystemMetrics.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/SystemMetrics.java
@@ -12,8 +12,8 @@ import java.util.Set;
public class SystemMetrics {
public static final String CPU_UTIL = "cpu.util";
public static final String CPU_SYS_UTIL = "cpu.sys.util";
- public static final String CPU_THROTTLED_TIME = "cpu.throttled_time";
- public static final String CPU_THROTTLED_CPU_TIME = "cpu.throttled_cpu_time";
+ public static final String CPU_THROTTLED_TIME = "cpu.throttled_time.rate";
+ public static final String CPU_THROTTLED_CPU_TIME = "cpu.throttled_cpu_time.rate";
public static final String CPU_VCPUS = "cpu.vcpus";
public static final String DISK_LIMIT = "disk.limit";
public static final String DISK_USED = "disk.used";
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 4bf361e0e56..44bcae3e838 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
@@ -546,8 +546,8 @@ public class NodeAgentImpl implements NodeAgent {
final double allocatedCpuRatio = node.vcpus() / totalNumCpuCores;
double cpuUsageRatioOfAllocated = lastCpuMetric.getCpuUsageRatio() / allocatedCpuRatio;
double cpuKernelUsageRatioOfAllocated = lastCpuMetric.getCpuKernelUsageRatio() / allocatedCpuRatio;
- double cpuThrottledTime = lastCpuMetric.getThrottledTime();
- double cpuThrottledCpuTime = lastCpuMetric.getThrottledCpuTime();
+ double cpuThrottledTimeRate = lastCpuMetric.getThrottledTimeRate();
+ double cpuThrottledCpuTimeRate = lastCpuMetric.getThrottledCpuTimeRate();
long memoryTotalBytesUsed = memoryTotalBytesUsage - memoryTotalBytesCache;
double memoryUsageRatio = (double) memoryTotalBytesUsed / memoryTotalBytes;
@@ -563,8 +563,8 @@ public class NodeAgentImpl implements NodeAgent {
.withMetric("mem_total.util", 100 * memoryTotalUsageRatio)
.withMetric("cpu.util", 100 * cpuUsageRatioOfAllocated)
.withMetric("cpu.sys.util", 100 * cpuKernelUsageRatioOfAllocated)
- .withMetric("cpu.throttled_time", cpuThrottledTime)
- .withMetric("cpu.throttled_cpu_time", cpuThrottledCpuTime)
+ .withMetric("cpu.throttled_time.rate", cpuThrottledTimeRate)
+ .withMetric("cpu.throttled_cpu_time.rate", cpuThrottledCpuTimeRate)
.withMetric("cpu.vcpus", node.vcpus())
.withMetric("disk.limit", diskTotalBytes);
@@ -622,8 +622,7 @@ public class NodeAgentImpl implements NodeAgent {
}
class CpuUsageReporter {
- private static final double BILLION = 1_000_000_000d;
- private static final double PERIOD_IN_SECONDS = ContainerResources.CPU_PERIOD_US / 1_000_000d;
+ private static final double PERIOD_IN_NANOSECONDS = 1_000d * ContainerResources.CPU_PERIOD_US;
private long containerKernelUsage = 0;
private long totalContainerUsage = 0;
private long totalSystemUsage = 0;
@@ -667,12 +666,14 @@ public class NodeAgentImpl implements NodeAgent {
return deltaSystemUsage == 0 ? Double.NaN : (double) deltaContainerKernelUsage / deltaSystemUsage;
}
- double getThrottledTime() {
- return deltaThrottlingActivePeriods == 0 ? Double.NaN : deltaThrottledPeriods * PERIOD_IN_SECONDS;
+ double getThrottledTimeRate() {
+ return deltaThrottlingActivePeriods == 0 ? Double.NaN :
+ (double) deltaThrottledPeriods / deltaThrottlingActivePeriods;
}
- double getThrottledCpuTime() {
- return deltaThrottlingActivePeriods == 0 ? Double.NaN : deltaThrottledTime / BILLION;
+ double getThrottledCpuTimeRate() {
+ return deltaThrottlingActivePeriods == 0 ? Double.NaN :
+ deltaThrottledTime / (PERIOD_IN_NANOSECONDS * deltaThrottlingActivePeriods);
}
}
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 9f32be2a0c9..54d4d36c7d0 100644
--- a/node-admin/src/test/resources/expected.container.system.metrics.txt
+++ b/node-admin/src/test/resources/expected.container.system.metrics.txt
@@ -10,8 +10,8 @@ s:
},
"metrics": {
"cpu.sys.util": 3.402,
- "cpu.throttled_cpu_time": 290.0,
- "cpu.throttled_time": 47.0,
+ "cpu.throttled_cpu_time.rate": 5.087,
+ "cpu.throttled_time.rate": 0.824,
"cpu.util": 5.4,
"cpu.vcpus": 2.0,
"disk.limit": 250000000000,