Skip to content

Commit

Permalink
Fixed NaN on empty cluster (no topics)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoutanov committed Jun 10, 2019
1 parent 601cd16 commit c678866
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.obsidiandynamics.kafdrop</groupId>
<artifactId>kafdrop</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>

<description>For when you have a Kafka cluster to monitor</description>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kafdrop/service/CuratorKafkaMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public ClusterSummaryVO getClusterSummary(Collection<TopicVO> topics) {
})
.orElseGet(ClusterSummaryVO::new);
topicSummary.setTopicCount(topics.size());
topicSummary.setPreferredReplicaPercent(topicSummary.getPreferredReplicaPercent() / topics.size());
topicSummary.setPreferredReplicaPercent(topics.isEmpty() ? 0 : topicSummary.getPreferredReplicaPercent() / topics.size());
return topicSummary;
}

Expand Down

0 comments on commit c678866

Please sign in to comment.