summaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
diff options
context:
space:
mode:
Diffstat (limited to 'clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java')
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
index 3b8cb14e977..ed2ca32dab0 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
@@ -27,6 +27,7 @@ import java.util.*;
public class ClusterStatsAggregator {
private final Set<Integer> distributors;
+ private final Set<Integer> storageNodes;
private final Set<Integer> nonUpdatedDistributors;
// Maps the distributor node index to a map of content node index to the
@@ -40,14 +41,26 @@ public class ClusterStatsAggregator {
ClusterStatsAggregator(Set<Integer> distributors, Set<Integer> storageNodes) {
this.distributors = distributors;
+ this.storageNodes = storageNodes;
nonUpdatedDistributors = new HashSet<>(distributors);
aggregatedStats = new ContentClusterStats(storageNodes);
}
- ContentClusterStats getAggregatedStats() {
+ public ContentClusterStats getAggregatedStats() {
return aggregatedStats;
}
+ public ContentNodeStats getAggregatedStatsForDistributor(int distributorIndex) {
+ ContentNodeStats result = new ContentNodeStats(distributorIndex);
+ ContentClusterStats distributorStats = distributorToStats.get(distributorIndex);
+ if (distributorStats != null) {
+ for (Iterator<ContentNodeStats> itr = distributorStats.iterator(); itr.hasNext(); ) {
+ result.add(itr.next());
+ }
+ }
+ return result;
+ }
+
boolean hasUpdatesFromAllDistributors() {
return nonUpdatedDistributors.isEmpty();
}