summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2020-11-23 17:17:40 +0100
committerGitHub <noreply@github.com>2020-11-23 17:17:40 +0100
commitbb001b8e430b0d85ec8a463d92940c843f0facea (patch)
tree9bdb0851491d885d05acc36b46f3b14ae294d796 /controller-api
parent3e47c04e90374152274efd6c06df4155c7fe6ec6 (diff)
parent6cfcb42e3a3b8945c0f34567f1c495248ae7a135 (diff)
Merge pull request #15432 from vespa-engine/bratseth/pass-more-cluster-info
Pass more cluster info
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java29
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java11
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java1
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java31
4 files changed, 70 insertions, 2 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 fd339e3bb43..98b7ffd1d47 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
@@ -4,6 +4,8 @@ package com.yahoo.vespa.hosted.controller.api.integration.configserver;
import com.yahoo.config.provision.ClusterResources;
import com.yahoo.config.provision.ClusterSpec;
+import java.time.Instant;
+import java.util.List;
import java.util.Optional;
/**
@@ -17,19 +19,25 @@ public class Cluster {
private final ClusterResources current;
private final Optional<ClusterResources> target;
private final Optional<ClusterResources> suggested;
+ private final List<ScalingEvent> scalingEvents;
+ private final String autoscalingStatus;
public Cluster(ClusterSpec.Id id,
ClusterResources min,
ClusterResources max,
ClusterResources current,
Optional<ClusterResources> target,
- Optional<ClusterResources> suggested) {
+ Optional<ClusterResources> suggested,
+ List<ScalingEvent> scalingEvents,
+ String autoscalingStatus) {
this.id = id;
this.min = min;
this.max = max;
this.current = current;
this.target = target;
this.suggested = suggested;
+ this.scalingEvents = scalingEvents;
+ this.autoscalingStatus = autoscalingStatus;
}
public ClusterSpec.Id id() { return id; }
@@ -38,10 +46,29 @@ public class Cluster {
public ClusterResources current() { return current; }
public Optional<ClusterResources> target() { return target; }
public Optional<ClusterResources> suggested() { return suggested; }
+ public List<ScalingEvent> scalingEvents() { return scalingEvents; }
+ public String autoscalingStatus() { return autoscalingStatus; }
@Override
public String toString() {
return "cluster '" + id + "'";
}
+ public static class ScalingEvent {
+
+ private final ClusterResources from, to;
+ private final Instant at;
+
+ public ScalingEvent(ClusterResources from, ClusterResources to, Instant at) {
+ this.from = from;
+ this.to = to;
+ this.at = at;
+ }
+
+ public ClusterResources from() { return from; }
+ public ClusterResources to() { return to; }
+ public Instant at() { return at; }
+
+ }
+
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java
index 298928a881d..99a72fbc827 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java
@@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster;
+import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
/**
* @author bratseth
@@ -26,6 +28,10 @@ public class ClusterData {
public ClusterResourcesData suggested;
@JsonProperty("target")
public ClusterResourcesData target;
+ @JsonProperty("scalingEvents")
+ public List<ScalingEventData> scalingEvents;
+ @JsonProperty("autoscalingStatus")
+ public String autoscalingStatus;
public Cluster toCluster(String id) {
return new Cluster(ClusterSpec.Id.from(id),
@@ -33,7 +39,10 @@ public class ClusterData {
max.toClusterResources(),
current.toClusterResources(),
target == null ? Optional.empty() : Optional.of(target.toClusterResources()),
- suggested == null ? Optional.empty() : Optional.of(suggested.toClusterResources()));
+ suggested == null ? Optional.empty() : Optional.of(suggested.toClusterResources()),
+ scalingEvents == null ? List.of()
+ : scalingEvents.stream().map(data -> data.toScalingEvent()).collect(Collectors.toList()),
+ autoscalingStatus);
}
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
index 97e7f2e897a..393814478dd 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
@@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class NodeHistory {
+
@JsonProperty("at")
public Long at;
@JsonProperty("agent")
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java
new file mode 100644
index 00000000000..b33a7436522
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java
@@ -0,0 +1,31 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster;
+
+import java.time.Instant;
+
+/**
+ * @author bratseth
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ScalingEventData {
+
+ @JsonProperty("from")
+ public ClusterResourcesData from;
+
+ @JsonProperty("to")
+ public ClusterResourcesData to;
+
+ @JsonProperty("at")
+ public Long at;
+
+ public Cluster.ScalingEvent toScalingEvent() {
+ return new Cluster.ScalingEvent(from.toClusterResources(), to.toClusterResources(), Instant.ofEpochMilli(at));
+ }
+
+}