diff options
8 files changed, 52 insertions, 10 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java index b500cd1c133..08f975fbc29 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java @@ -82,35 +82,47 @@ public class Cluster { public static class Utilization { - private final double cpu, idealCpu, currentCpu, memory, idealMemory, currentMemory, disk, idealDisk, currentDisk; + private final double cpu, idealCpu, currentCpu, peakCpu; + private final double memory, idealMemory, currentMemory, peakMemory; + private final double disk, idealDisk, currentDisk, peakDisk; - public Utilization(double cpu, double idealCpu, double currentCpu, - double memory, double idealMemory, double currentMemory, - double disk, double idealDisk, double currentDisk) { + public Utilization(double cpu, double idealCpu, double currentCpu, double peakCpu, + double memory, double idealMemory, double currentMemory, double peakMemory, + double disk, double idealDisk, double currentDisk, double peakDisk) { this.cpu = cpu; this.idealCpu = idealCpu; this.currentCpu = currentCpu; + this.peakCpu = peakCpu; + this.memory = memory; this.idealMemory = idealMemory; this.currentMemory = currentMemory; + this.peakMemory = peakMemory; + this.disk = disk; this.idealDisk = idealDisk; this.currentDisk = currentDisk; + this.peakDisk = peakDisk; } public double cpu() { return cpu; } public double idealCpu() { return idealCpu; } public double currentCpu() { return currentCpu; } + public double peakCpu() { return peakCpu; } public double memory() { return memory; } public double idealMemory() { return idealMemory; } public double currentMemory() { return currentMemory; } + public double peakMemory() { return peakMemory; } public double disk() { return disk; } public double idealDisk() { return idealDisk; } public double currentDisk() { return currentDisk; } + public double peakDisk() { return peakDisk; } - public static Utilization empty() { return new Utilization(0, 0, 0, 0, 0, 0, 0, 0, 0); } + public static Utilization empty() { return new Utilization(0, 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, 0); } } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterUtilizationData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterUtilizationData.java index 803daf6a8c6..6632ba47b7b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterUtilizationData.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterUtilizationData.java @@ -21,6 +21,8 @@ public class ClusterUtilizationData { public Double idealCpu; @JsonProperty("currentCpu") public Double currentCpu; + @JsonProperty("peakCpu") + public Double peakCpu; @JsonProperty("memory") public Double memory; @@ -28,6 +30,8 @@ public class ClusterUtilizationData { public Double idealMemory; @JsonProperty("currentMemory") public Double currentMemory; + @JsonProperty("peakMemory") + public Double peakMemory; @JsonProperty("disk") public Double disk; @@ -35,9 +39,13 @@ public class ClusterUtilizationData { public Double idealDisk; @JsonProperty("currentDisk") public Double currentDisk; + @JsonProperty("peakDisk") + public Double peakDisk; public Cluster.Utilization toClusterUtilization() { - return new Cluster.Utilization(cpu, idealCpu, currentCpu, memory, idealMemory, currentMemory, disk, idealDisk, currentDisk); + return new Cluster.Utilization(cpu, idealCpu, currentCpu, peakCpu, + memory, idealMemory, currentMemory, peakMemory, + disk, idealDisk, currentDisk, peakDisk); } } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index 159bfb08b33..cc58e863bd3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -2630,12 +2630,17 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { utilizationObject.setDouble("cpu", utilization.cpu()); utilizationObject.setDouble("idealCpu", utilization.idealCpu()); utilizationObject.setDouble("currentCpu", utilization.currentCpu()); + utilizationObject.setDouble("peakCpu", utilization.peakCpu()); + utilizationObject.setDouble("memory", utilization.memory()); utilizationObject.setDouble("idealMemory", utilization.idealMemory()); utilizationObject.setDouble("currentMemory", utilization.currentMemory()); + utilizationObject.setDouble("peakMemory", utilization.peakMemory()); + utilizationObject.setDouble("disk", utilization.disk()); utilizationObject.setDouble("idealDisk", utilization.idealDisk()); utilizationObject.setDouble("currentDisk", utilization.currentDisk()); + utilizationObject.setDouble("peakDisk", utilization.peakDisk()); } private void scalingEventsToSlime(List<Cluster.ScalingEvent> scalingEvents, Cursor scalingEventsArray) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index 35a12f4b6d4..d7f83979054 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -115,7 +115,9 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer current, Optional.of(new ClusterResources(2, 1, new NodeResources(3, 8, 50, 1, slow, remote))), Optional.empty(), - new Cluster.Utilization(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9), + new Cluster.Utilization(0.1, 0.2, 0.3, 0.35, + 0.4, 0.5, 0.6, 0.65, + 0.7, 0.8, 0.9, 1.0), List.of(new Cluster.ScalingEvent(new ClusterResources(0, 0, NodeResources.unspecified()), current, Instant.ofEpochMilli(1234), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json index 3eff2ab781a..137ea64eba7 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json @@ -58,12 +58,15 @@ "cpu": 0.1, "idealCpu": 0.2, "currentCpu": 0.3, + "peakCpu": 0.35, "memory": 0.4, "idealMemory": 0.5, "currentMemory": 0.6, + "peakMemory": 0.65, "disk": 0.7, "idealDisk": 0.8, - "currentDisk": 0.9 + "currentDisk": 0.9, + "peakDisk": 1.0 }, "scalingEvents": [ { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java index 1c10de8498a..3615b9afa97 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationSerializer.java @@ -90,16 +90,22 @@ public class ApplicationSerializer { Load idealLoad = clusterModel.idealLoad(); Load averageLoad = clusterModel.averageLoad(); Load currentLoad = clusterModel.currentLoad(); + Load peakLoad = clusterModel.peakLoad(); utilizationObject.setDouble("cpu", averageLoad.cpu()); utilizationObject.setDouble("idealCpu", idealLoad.cpu()); utilizationObject.setDouble("currentCpu", currentLoad.cpu()); + utilizationObject.setDouble("peakCpu", peakLoad.cpu()); + utilizationObject.setDouble("memory", averageLoad.memory()); utilizationObject.setDouble("idealMemory", idealLoad.memory()); utilizationObject.setDouble("currentMemory", currentLoad.memory()); + utilizationObject.setDouble("peakMemory", peakLoad.memory()); + utilizationObject.setDouble("disk", averageLoad.disk()); utilizationObject.setDouble("idealDisk", idealLoad.disk()); utilizationObject.setDouble("currentDisk", currentLoad.disk()); + utilizationObject.setDouble("peakDisk", peakLoad.disk()); } private static void scalingEventsToSlime(List<ScalingEvent> scalingEvents, Cursor scalingEventsArray) { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json index 40719153b9e..9ae495a7396 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json @@ -73,12 +73,15 @@ "cpu" : 0.0, "idealCpu": 0.1375, "currentCpu": 0.0, + "peakCpu": 0.0, "memory" : 0.0, "idealMemory": 0.65, "currentMemory": 0.0, + "peakMemory": 0.0, "disk" : 0.0, "idealDisk": 0.95, - "currentDisk": 0.0 + "currentDisk": 0.0, + "peakDisk": 0.0 }, "scalingEvents" : [ { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json index 41aa4257c00..5babf5fc843 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json @@ -47,12 +47,15 @@ "cpu" : 0.0, "idealCpu": 0.1394913986537023, "currentCpu": 0.0, + "peakCpu": 0.0, "memory" : 0.0, "idealMemory": 0.325, "currentMemory": 0.0, + "peakMemory": 0.0, "disk" : 0.0, "idealDisk": 0.3, - "currentDisk": 0.0 + "currentDisk": 0.0, + "peakDisk": 0.0 }, "scalingEvents" : [ { |