diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-06-18 21:54:46 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-06-18 21:54:46 +0200 |
commit | 2c22315866a0a2366c95b952e3d2750582543545 (patch) | |
tree | 2053cf937cb34912a2930cd443c05ba3c26b8e27 | |
parent | f27580a1b0db23197140dc397688c510acd2b45b (diff) |
Could failures correctly
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java | 18 |
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() { |