yihua commented on code in PR #17975:
URL: https://github.com/apache/hudi/pull/17975#discussion_r2775577328
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java:
##########
@@ -313,10 +313,17 @@ public OffsetRange[]
getNextOffsetRanges(Option<Checkpoint> lastCheckpoint, long
} else {
lastCheckpointStr = lastCheckpoint.isPresent() ?
Option.of(lastCheckpoint.get().getCheckpointKey()) : Option.empty();
}
+
+ long kafkaDelayCount = 0L;
+ if (lastCheckpointStr.isPresent() && !lastCheckpointStr.get().isEmpty())
{
+ kafkaDelayCount = delayOffsetCalculation(lastCheckpointStr,
topicPartitions, consumer);
+ }
+ // Always emit the Kafka delay count metric (even when 0)
+ metrics.updateStreamerSourceDelayCount(METRIC_NAME_KAFKA_DELAY_COUNT,
kafkaDelayCount);
+
Review Comment:
nit: do we want to account for `else` branch below to account for `EARLIEST`
and `GROUP` where the delay count should also be calculated?
Another nit: if the check point string does not follow the format
(`checkTopicCheckpoint(lastCheckpointStr)`), after the change it can fail the
calculation.
--
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]