summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2023-01-04 13:33:36 +0100
committerGitHub <noreply@github.com>2023-01-04 13:33:36 +0100
commitc5ef90a13114197b3119b2ec9d2cda8e3a233985 (patch)
treeb61a4630c90aa026356d6c7995cba2d5e1e63402 /controller-server
parent5267d4415bdc912abc550d50384578122e8598f3 (diff)
parent679652383a8e2461be0af85c3a46d77db2bfbda5 (diff)
Merge pull request #25390 from vespa-engine/bratseth/autoscaling-status
Bratseth/autoscaling status
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java50
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/response/application.json47
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java20
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-clusters.json47
4 files changed, 113 insertions, 51 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 2fffdc25875..c8597cff405 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
@@ -64,6 +64,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.DeploymentResult;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.DeploymentResult.LogEntry;
+import com.yahoo.vespa.hosted.controller.api.integration.configserver.Load;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.LoadBalancer;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeFilter;
@@ -74,7 +75,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.SourceRevision;
-import com.yahoo.vespa.hosted.controller.api.integration.dns.VpcEndpointService.VpcEndpoint;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartFilter;
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
import com.yahoo.vespa.hosted.controller.api.role.Role;
@@ -1348,17 +1348,13 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
toSlime(cluster.min(), clusterObject.setObject("min"));
toSlime(cluster.max(), clusterObject.setObject("max"));
toSlime(cluster.current(), clusterObject.setObject("current"));
- if (cluster.target().isPresent()
- && ! cluster.target().get().justNumbers().equals(cluster.current().justNumbers()))
- toSlime(cluster.target().get(), clusterObject.setObject("target"));
- cluster.suggested().ifPresent(suggested -> toSlime(suggested, clusterObject.setObject("suggested")));
- utilizationToSlime(cluster.utilization(), clusterObject.setObject("utilization"));
+ toSlime(cluster.target(), cluster, clusterObject.setObject("target"));
+ toSlime(cluster.suggested(), cluster, clusterObject.setObject("suggested"));
+ legacyUtilizationToSlime(cluster.target().peak(), cluster.target().ideal(), clusterObject.setObject("utilization")); // TODO: Remove after January 2023
scalingEventsToSlime(cluster.scalingEvents(), clusterObject.setArray("scalingEvents"));
- clusterObject.setString("autoscalingStatusCode", cluster.autoscalingStatusCode());
- clusterObject.setString("autoscalingStatus", cluster.autoscalingStatus());
+ clusterObject.setString("autoscalingStatusCode", cluster.target().status()); // TODO: Remove after January 2023
+ clusterObject.setString("autoscalingStatus", cluster.target().description()); // TODO: Remove after January 2023
clusterObject.setLong("scalingDuration", cluster.scalingDuration().toMillis());
- clusterObject.setDouble("maxQueryGrowthRate", cluster.maxQueryGrowthRate());
- clusterObject.setDouble("currentQueryFractionOfMax", cluster.currentQueryFractionOfMax());
}
return new SlimeJsonResponse(slime);
}
@@ -2704,15 +2700,35 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
object.setDouble("cost", cost);
}
- private void utilizationToSlime(Cluster.Utilization utilization, Cursor utilizationObject) {
- utilizationObject.setDouble("idealCpu", utilization.idealCpu());
- utilizationObject.setDouble("peakCpu", utilization.peakCpu());
+ private void toSlime(Cluster.Autoscaling autoscaling, Cluster cluster, Cursor autoscalingObject) {
+ // TODO: Remove after January 2023
+ if (autoscaling.resources().isPresent()
+ && ! autoscaling.resources().get().justNumbers().equals(cluster.current().justNumbers()))
+ toSlime(autoscaling.resources().get(), autoscalingObject);
- utilizationObject.setDouble("idealMemory", utilization.idealMemory());
- utilizationObject.setDouble("peakMemory", utilization.peakMemory());
+ autoscalingObject.setString("status", autoscaling.status());
+ autoscalingObject.setString("description", autoscaling.description());
+ autoscaling.resources().ifPresent(resources -> toSlime(resources, autoscalingObject.setObject("resources")));
+ autoscalingObject.setLong("at", autoscaling.at().toEpochMilli());
+ toSlime(autoscaling.peak(), autoscalingObject.setObject("peak"));
+ toSlime(autoscaling.ideal(), autoscalingObject.setObject("ideal"));
+ }
+
+ private void toSlime(Load load, Cursor loadObject) {
+ loadObject.setDouble("cpu", load.cpu());
+ loadObject.setDouble("memory", load.memory());
+ loadObject.setDouble("disk", load.disk());
+ }
+
+ private void legacyUtilizationToSlime(Load peak, Load ideal, Cursor utilizationObject) {
+ utilizationObject.setDouble("idealCpu", ideal.cpu());
+ utilizationObject.setDouble("peakCpu", peak.cpu());
+
+ utilizationObject.setDouble("idealMemory", ideal.memory());
+ utilizationObject.setDouble("peakMemory", peak.memory());
- utilizationObject.setDouble("idealDisk", utilization.idealDisk());
- utilizationObject.setDouble("peakDisk", utilization.peakDisk());
+ utilizationObject.setDouble("idealDisk", ideal.disk());
+ utilizationObject.setDouble("peakDisk", peak.disk());
}
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 e4d0de9eb9f..37da498b6ec 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
@@ -56,9 +56,7 @@
"architecture": "x86_64"
}
},
- "scalingDuration": 400000,
- "maxQueryGrowthRate": 0.7,
- "currentQueryFractionOfMax": 0.3
+ "scalingDuration": 400000
},
"logserver": {
"type": "admin",
@@ -102,21 +100,34 @@
}
},
"suggested": {
- "nodes": 2,
- "groups": 1,
- "resources": {
- "vcpu": 2.0,
- "memoryGb": 4.0,
- "diskGb": 50.0,
- "bandwidthGbps": 0.3,
- "diskSpeed": "fast",
- "storageType": "local",
- "architecture": "x86_64"
+ "status" : "unavailable",
+ "description" : "",
+ "resources" : {
+ "nodes": 2,
+ "groups": 1,
+ "resources": {
+ "vcpu": 2.0,
+ "memoryGb": 4.0,
+ "diskGb": 50.0,
+ "bandwidthGbps": 0.3,
+ "diskSpeed": "fast",
+ "storageType": "local",
+ "architecture": "x86_64"
+ },
+ "at" : 123,
+ "peak" : {
+ "cpu" : 0.1,
+ "memory" : 0.2,
+ "disk" : 0.3
+ },
+ "ideal" : {
+ "cpu" : 0.4,
+ "memory" : 0.5,
+ "disk" : 0.6
+ }
}
},
- "scalingDuration": 90000,
- "maxQueryGrowthRate": 0.7,
- "currentQueryFractionOfMax": 0.3
+ "scalingDuration": 90000
},
"music": {
"type": "content",
@@ -172,9 +183,7 @@
"architecture": "x86_64"
}
},
- "scalingDuration": 1000000,
- "maxQueryGrowthRate": 0.7,
- "currentQueryFractionOfMax": 0.3
+ "scalingDuration": 1000000
}
}
} \ 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 f576c90e195..448bb9ac15f 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
@@ -30,6 +30,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ContainerEndpoint;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.DeploymentResult;
+import com.yahoo.vespa.hosted.controller.api.integration.configserver.Load;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.LoadBalancer;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.LoadBalancer.PrivateServiceInfo;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
@@ -43,7 +44,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartF
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
-import wiremock.org.checkerframework.checker.units.qual.A;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -116,20 +116,18 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
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.2, 0.35,
- 0.5, 0.65,
- 0.8, 1.0),
+ new Cluster.Autoscaling("ideal",
+ "Cluster is ideally scaled",
+ Optional.of(new ClusterResources(2, 1, new NodeResources(3, 8, 50, 1, slow, remote))),
+ Instant.ofEpochMilli(123),
+ new Load(0.35, 0.65, 1.0),
+ new Load(0.2, 0.5, 0.8)),
+ Cluster.Autoscaling.empty(),
List.of(new Cluster.ScalingEvent(new ClusterResources(0, 0, NodeResources.unspecified()),
current,
Instant.ofEpochMilli(1234),
Optional.of(Instant.ofEpochMilli(2234)))),
- "ideal",
- "Cluster is ideally scaled",
- Duration.ofMinutes(6),
- 0.7,
- 0.3);
+ Duration.ofMinutes(6));
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 6527237840e..c013ccb00fe 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
@@ -52,7 +52,48 @@
"diskSpeed": "slow",
"storageType": "remote"
},
- "cost": 0.29
+ "cost": 0.29,
+ "status": "ideal",
+ "description": "Cluster is ideally scaled",
+ "resources": {
+ "nodes": 2,
+ "groups": 1,
+ "nodeResources": {
+ "vcpu": 3.0,
+ "memoryGb": 8.0,
+ "diskGb": 50.0,
+ "bandwidthGbps": 1.0,
+ "diskSpeed": "slow",
+ "storageType": "remote"
+ },
+ "cost": 0.29
+ },
+ "at" : 123,
+ "peak": {
+ "cpu": 0.35,
+ "memory": 0.65,
+ "disk": 1.0
+ },
+ "ideal": {
+ "cpu": 0.2,
+ "memory": 0.5,
+ "disk": 0.8
+ }
+ },
+ "suggested": {
+ "status": "unavailable",
+ "description": "",
+ "at": 0,
+ "peak": {
+ "cpu": 0.0,
+ "memory": 0.0,
+ "disk": 0.0
+ },
+ "ideal": {
+ "cpu": 0.0,
+ "memory": 0.0,
+ "disk": 0.0
+ }
},
"utilization": {
"idealCpu": 0.2,
@@ -96,9 +137,7 @@
],
"autoscalingStatusCode": "ideal",
"autoscalingStatus": "Cluster is ideally scaled",
- "scalingDuration": 360000,
- "maxQueryGrowthRate": 0.7,
- "currentQueryFractionOfMax": 0.3
+ "scalingDuration": 360000
}
}
}