summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2021-06-19 07:59:36 +0200
committerGitHub <noreply@github.com>2021-06-19 07:59:36 +0200
commitbe678e756f8b36197a0a3c76e2a249b54b465777 (patch)
tree6dc4ca0ed3afe5ff00f3ccc5523c691ef25c44cf
parent8a45471780e785b498f8e6b3fb5e1a993191ecf3 (diff)
parent2c22315866a0a2366c95b952e3d2750582543545 (diff)
Merge pull request #18323 from vespa-engine/bratseth/scaling-suggestions-successFactor
Could failures correctly
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java
index 888f06a5004..b606e40ef42 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java
@@ -40,19 +40,15 @@ public class ScalingSuggestionsMaintainer extends NodeRepositoryMaintainer {
if ( ! nodeRepository().zone().environment().isProduction()) return 1.0;
int attempts = 0;
- int successes = 0;
+ int failures = 0;
for (var application : activeNodesByApplication().entrySet()) {
- attempts++;
- successes += suggest(application.getKey(), application.getValue());
+ for (var cluster : nodesByCluster(application.getValue()).entrySet()) {
+ attempts++;
+ if ( ! suggest(application.getKey(), cluster.getKey(), cluster.getValue()))
+ failures++;
+ }
}
- return attempts == 0 ? 1.0 : ((double)successes / attempts);
- }
-
- private int suggest(ApplicationId application, NodeList applicationNodes) {
- int successes = 0;
- for (var cluster : nodesByCluster(applicationNodes).entrySet())
- successes += suggest(application, cluster.getKey(), cluster.getValue()) ? 1 : 0;
- return successes;
+ return asSuccessFactor(attempts, failures);
}
private Applications applications() {