summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java16
1 files changed, 10 insertions, 6 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 44bcae3e838..90eda96d445 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
@@ -638,12 +638,16 @@ public class NodeAgentImpl implements NodeAgent {
private long deltaThrottledPeriods;
private void updateCpuDeltas(ContainerStats.CpuStats cpuStats) {
- deltaSystemUsage = totalSystemUsage == 0 ? 0 : (cpuStats.getSystemCpuUsage() - totalSystemUsage);
- deltaContainerUsage = cpuStats.getTotalUsage() - totalContainerUsage;
- deltaContainerKernelUsage = cpuStats.getUsageInKernelMode() - containerKernelUsage;
- deltaThrottledTime = cpuStats.getThrottledTime() - throttledTime;
- deltaThrottlingActivePeriods = cpuStats.getThrottlingActivePeriods() - throttlingActivePeriods;
- deltaThrottledPeriods = cpuStats.getThrottledPeriods() - throttledPeriods;
+ // Do not calculate delta during the first tick - that will result in a metric value that is
+ // average since container start
+ if (totalSystemUsage != 0) {
+ deltaSystemUsage = cpuStats.getSystemCpuUsage() - totalSystemUsage;
+ deltaContainerUsage = cpuStats.getTotalUsage() - totalContainerUsage;
+ deltaContainerKernelUsage = cpuStats.getUsageInKernelMode() - containerKernelUsage;
+ deltaThrottledTime = cpuStats.getThrottledTime() - throttledTime;
+ deltaThrottlingActivePeriods = cpuStats.getThrottlingActivePeriods() - throttlingActivePeriods;
+ deltaThrottledPeriods = cpuStats.getThrottledPeriods() - throttledPeriods;
+ }
totalSystemUsage = cpuStats.getSystemCpuUsage();
totalContainerUsage = cpuStats.getTotalUsage();