DiogoP98 commented on code in PR #8589:
URL: https://github.com/apache/storm/pull/8589#discussion_r3204731246
##########
external/storm-kafka-monitor/src/main/java/org/apache/storm/kafka/monitor/KafkaOffsetLagUtil.java:
##########
@@ -172,12 +172,13 @@ public static List<KafkaOffsetLagResult>
getOffsetLags(NewKafkaSpoutOffsetQuery
}
}
consumer.assign(topicPartitionList);
+ Map<TopicPartition, OffsetAndMetadata> committedOffsets =
consumer.committed(new HashSet<>(topicPartitionList));
+ consumer.seekToEnd(topicPartitionList);
for (TopicPartition topicPartition : topicPartitionList) {
- Map<TopicPartition, OffsetAndMetadata> offsetAndMetadata =
consumer.committed(Collections.singleton(topicPartition));
- long committedOffset = offsetAndMetadata != null ?
offsetAndMetadata.get(topicPartition).offset() : -1;
- consumer.seekToEnd(toArrayList(topicPartition));
+ OffsetAndMetadata partitionOffset =
committedOffsets.get(topicPartition);
+ long committedOffset = partitionOffset != null ?
partitionOffset.offset() : -1;
result.add(new KafkaOffsetLagResult(topicPartition.topic(),
topicPartition.partition(), committedOffset,
-
consumer.position(topicPartition)));
+ consumer.position(topicPartition)));
Review Comment:
Addressed. I've removed the the formatting touches on the rest of the file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]