diff options
author | Geir Storli <geirst@oath.com> | 2018-02-28 17:12:14 +0100 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-02-28 17:12:14 +0100 |
commit | 5428945ee928e6ac2536ebaadb8d35475d00bb10 (patch) | |
tree | 483f90594b16319f5fea1ae5b1b7c872368caaa8 /clustercontroller-core/src/main | |
parent | a35db3bc1005adb1d49335acef98aba1761368b9 (diff) |
Add function to get aggregated node stats per distributor.
Diffstat (limited to 'clustercontroller-core/src/main')
-rw-r--r-- | clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java | 15 |
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(); } |