diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-03-11 19:29:51 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-03-11 19:29:51 +0100 |
commit | 6ab57da8811f8b361b7abaf29d8ee6e2ec183f51 (patch) | |
tree | 705a368b9462773666ebdbeeb1e4b26ecbf1b9c6 /controller-server | |
parent | d3c80d38bab48b77b64cb5529e08136fe796aca6 (diff) |
Add more cluster data to node repo client and application/v4
Diffstat (limited to 'controller-server')
4 files changed, 39 insertions, 8 deletions
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 6aeb30c3f09..19db1bb0eb6 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 @@ -811,6 +811,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { Cursor clustersObject = slime.setObject().setObject("clusters"); for (Cluster cluster : application.clusters().values()) { Cursor clusterObject = clustersObject.setObject(cluster.id().value()); + clusterObject.setString("type", cluster.type().name()); toSlime(cluster.min(), clusterObject.setObject("min")); toSlime(cluster.max(), clusterObject.setObject("max")); toSlime(cluster.current(), clusterObject.setObject("current")); @@ -821,6 +822,9 @@ public class ApplicationApiHandler extends LoggingRequestHandler { utilizationToSlime(cluster.utilization(), clusterObject.setObject("utilization")); scalingEventsToSlime(cluster.scalingEvents(), clusterObject.setArray("scalingEvents")); clusterObject.setString("autoscalingStatus", cluster.autoscalingStatus()); + clusterObject.setLong("scalingDuration", cluster.scalingDuration().toMillis()); + clusterObject.setDouble("maxQueryGrowthRate", cluster.maxQueryGrowthRate()); + clusterObject.setDouble("currentQueryFractionOfMax", cluster.currentQueryFractionOfMax()); } return new SlimeJsonResponse(slime); } @@ -2069,8 +2073,11 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private void utilizationToSlime(Cluster.Utilization utilization, Cursor utilizationObject) { utilizationObject.setDouble("cpu", utilization.cpu()); + utilizationObject.setDouble("idealCpu", utilization.idealCpu()); utilizationObject.setDouble("memory", utilization.memory()); + utilizationObject.setDouble("idealMemory", utilization.idealMemory()); utilizationObject.setDouble("disk", utilization.disk()); + utilizationObject.setDouble("idealDisk", utilization.idealDisk()); } private void scalingEventsToSlime(List<Cluster.ScalingEvent> scalingEvents, Cursor scalingEventsArray) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/response/application.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/response/application.json index ccfb6af1635..928fabd621e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/response/application.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/response/application.json @@ -3,6 +3,7 @@ "id": "vespa.album-recommendation.default", "clusters": { "default": { + "type": "container", "min": { "nodes": 2, "groups": 1, @@ -50,9 +51,13 @@ "diskSpeed": "fast", "storageType": "local" } - } + }, + "scalingDuration": 400000, + "maxQueryGrowthRate": 0.7, + "currentQueryFractionOfMax": 0.3 }, "logserver": { + "type": "admin", "min": { "nodes": 1, "groups": 1, @@ -100,9 +105,13 @@ "diskSpeed": "fast", "storageType": "local" } - } + }, + "scalingDuration": 90000, + "maxQueryGrowthRate": 0.7, + "currentQueryFractionOfMax": 0.3 }, "music": { + "type": "content", "min": { "nodes": 2, "groups": 1, @@ -150,7 +159,10 @@ "diskSpeed": "fast", "storageType": "local" } - } + }, + "scalingDuration": 1000000, + "maxQueryGrowthRate": 0.7, + "currentQueryFractionOfMax": 0.3 } } }
\ No newline at end of file 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 b219ee7ee9f..a7a99f286df 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 @@ -50,6 +50,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.net.URI; import java.nio.charset.StandardCharsets; +import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.Collection; @@ -112,16 +113,20 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer public void provision(ZoneId zone, ApplicationId application, ClusterSpec.Id clusterId) { var current = new ClusterResources(2, 1, new NodeResources(2, 8, 50, 1, slow, remote)); Cluster cluster = new Cluster(clusterId, + ClusterSpec.Type.container, new ClusterResources(2, 1, new NodeResources(1, 4, 20, 1, slow, remote)), new ClusterResources(2, 1, new NodeResources(4, 16, 90, 1, slow, remote)), 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), + new Cluster.Utilization(0.1, 0.2, 0.3, 0.4, 0.5, 0.6), List.of(new Cluster.ScalingEvent(new ClusterResources(0, 0, NodeResources.unspecified()), current, Instant.ofEpochMilli(1234))), - "the autoscaling status"); + "the autoscaling status", + Duration.ofMinutes(6), + 0.7, + 0.3); nodeRepository.putApplication(zone, new com.yahoo.vespa.hosted.controller.api.integration.configserver.Application(application, List.of(cluster))); 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 2c208359f1b..499a425087d 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 @@ -1,6 +1,7 @@ { "clusters": { "default": { + "type":"container", "min": { "nodes": 2, "groups": 1, @@ -55,8 +56,11 @@ }, "utilization": { "cpu": 0.1, - "memory": 0.2, - "disk": 0.3 + "idealCpu": 0.2, + "memory": 0.3, + "idealMemory": 0.4, + "disk": 0.5, + "idealDisk": 0.6 }, "scalingEvents": [ { @@ -89,7 +93,10 @@ "at": 1234 } ], - "autoscalingStatus": "the autoscaling status" + "autoscalingStatus": "the autoscaling status", + "scalingDuration": 360000, + "maxQueryGrowthRate": 0.7, + "currentQueryFractionOfMax":0.3 } } }
\ No newline at end of file |