aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-03-02 10:08:56 +0100
committerJon Bratseth <bratseth@gmail.com>2023-03-02 10:08:56 +0100
commit44c4f5fdf0353d8f4c5130bbda8df748783094cf (patch)
tree9fffdb2f994dc43c156f7e0f667e945feaa969be
parentc8c4363b6d6a7ee2f89809acc96f5ab4b387db74 (diff)
More detailed description when ending up empty
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java21
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeTimeseries.java8
2 files changed, 17 insertions, 12 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java
index 9efa320cf80..ff9de2fb633 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.provision.autoscale;
import com.yahoo.vespa.hosted.provision.NodeList;
import com.yahoo.vespa.hosted.provision.applications.Cluster;
+import com.yahoo.vespa.hosted.provision.applications.ScalingEvent;
import java.time.Duration;
import java.util.List;
@@ -23,7 +24,7 @@ public class ClusterNodesTimeseries {
/** The measurements for all nodes in this snapshot */
private final List<NodeTimeseries> timeseries;
- private int initialCount, afterWarmupCount, afterStableCount, finalCount;
+ private final String description;
public ClusterNodesTimeseries(Duration period, Cluster cluster, NodeList clusterNodes, MetricsDb db) {
this.clusterNodes = clusterNodes;
@@ -33,32 +34,28 @@ public class ClusterNodesTimeseries {
// If either this is the case, or there is a generation change, we ignore
// the first warmupWindow metrics.
var timeseries = db.getNodeTimeseries(period.plus(warmupDuration.multipliedBy(4)), clusterNodes);
- initialCount = totalMeasurementsIn(timeseries);
+ var initialTimeseries = timeseries;
if (cluster.lastScalingEvent().isPresent()) {
long currentGeneration = cluster.lastScalingEvent().get().generation();
timeseries = keepGenerationAfterWarmup(timeseries, currentGeneration);
- afterWarmupCount = totalMeasurementsIn(timeseries);
- }
- else {
- afterWarmupCount = initialCount;
}
timeseries = keep(timeseries, snapshot -> snapshot.inService() && snapshot.stable());
- afterStableCount = totalMeasurementsIn(timeseries);
timeseries = keep(timeseries, snapshot -> ! snapshot.at().isBefore(db.clock().instant().minus(period)));
- finalCount = totalMeasurementsIn(timeseries);
this.timeseries = timeseries;
+ if (isEmpty() && initialTimeseries.size() > 0)
+ description = initialTimeseries.get(0).description(cluster.lastScalingEvent().map(ScalingEvent::generation).orElse(-1L), clusterNodes);
+ else
+ description = "";
}
private ClusterNodesTimeseries(NodeList clusterNodes, List<NodeTimeseries> timeseries) {
this.clusterNodes = clusterNodes;
this.timeseries = timeseries;
+ this.description = "";
}
public String description() {
- return "initial measurements: " + initialCount +
- ", after warmup: " + afterWarmupCount +
- ", after stable: " + afterStableCount +
- ", final measurements: " + finalCount;
+ return description;
}
public boolean isEmpty() {
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeTimeseries.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeTimeseries.java
index 17444ef9d2e..f694070a8db 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeTimeseries.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeTimeseries.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.hosted.provision.autoscale;
import com.yahoo.vespa.hosted.provision.Node;
+import com.yahoo.vespa.hosted.provision.NodeList;
import com.yahoo.vespa.hosted.provision.node.History;
import java.time.Instant;
@@ -110,4 +111,11 @@ public class NodeTimeseries {
return up.isPresent() && snapshot.at().isBefore(up.get().at().plus(warmupDuration));
}
+ String description(long generation, NodeList clusterNodes) {
+ var node = clusterNodes.node(hostname);
+ if (node.isEmpty()) return "(no node " + hostname + ")";
+ return "gen " + generation + " since " + generationChange(generation) + ", up " + node.get().history().event(History.Event.Type.up) +
+ ": " + (snapshots.isEmpty() ? "(no snapshots)" : snapshots.get(snapshots.size()-1));
+ }
+
}