-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/node page partition #1033
Feature/node page partition #1033
Conversation
Hi thanks for that, really appreciate. I've tested quickly and it don't seems to works, on a multi node cluster, all node have the total count of partitions. I've started an implementation but don't have more time to dig it (that produce the same results but on more modern way: @Get("api/{cluster}/node/partitions")
@Operation(tags = {"topic"}, summary = "partition counts")
public List<NodePartition> nodePartitions(String cluster) throws ExecutionException, InterruptedException {
List<String> topicNames = this.topicRepository.all(cluster, TopicRepository.TopicListView.ALL, Optional.empty());
List<Topic> topics = this.topicRepository.findByName(cluster, topicNames);
long totalPartitions = topics
.stream()
.mapToInt(t -> t.getPartitions().size())
.count();
return topics
.stream()
.flatMap(topic -> topic.getPartitions().stream())
.flatMap(partition -> partition.getNodes()
.stream()
.map(n -> NodePartition.builder()
.id(n.getId())
.countLeader(n.isLeader() ? 1 : 0)
.countInSyncReplicas(n.isInSyncReplicas() ? 1 : 0)
.build()
)
)
.collect(Collectors.groupingBy(NodePartition::getId))
.entrySet()
.stream()
.map(n -> NodePartition.builder()
.id(n.getKey())
.countLeader(n.getValue().stream().mapToInt(NodePartition::getCountLeader).sum())
.countLeader(n.getValue().stream().mapToInt(NodePartition::getCountInSyncReplicas).sum())
.build()
)
.collect(Collectors.toList());
}
@Introspected
@Builder(toBuilder = true)
@Value
public static class NodePartition {
int id;
int countLeader;
int countInSyncReplicas;
}
The logic is wrong also on my side but used this compose to have a multiple node cluster. On the ui side, the browser freeze waiting the 2 requests is done, please can you use the async request that we use on the topic List page (displaying node and fetch in async all the counter please) ? |
…tup docker composer for optional commented second kafka node
I have updated the pull request based on your feedback. |
I've added a minor change on last commit in order to load truly async the partition repartion. Thanks for the contributions ! |
any chance a release with this feature is going to be made anytime soon? |
You can use the dev image to have early access |
#983 - add the total partitions and partitions percentage column