fapaul commented on a change in pull request #17773:
URL: https://github.com/apache/flink/pull/17773#discussion_r749169850
##########
File path:
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/source/reader/KafkaPartitionSplitReaderTest.java
##########
@@ -162,8 +161,18 @@ public void testNumBytesInCounter() throws Exception {
assertThat(numBytesInCounter.getCount(),
Matchers.greaterThan(latestNumBytesIn));
}
- @Test
- public void testPendingRecordsGauge() throws Exception {
+ @ParameterizedTest
+ @EmptySource
+ @ValueSource(strings = {"_underscore.period-minus"})
+ public void testPendingRecordsGauge(String topicSuffix) throws Throwable {
+ final String topic1Name = TOPIC1 + topicSuffix;
+ final String topic2Name = TOPIC2 + topicSuffix;
+ if (!topicSuffix.isEmpty()) {
+ KafkaSourceTestEnv.setupTopic(
+ topic1Name, true, true,
KafkaSourceTestEnv::getRecordsForTopic);
+ KafkaSourceTestEnv.setupTopic(
+ topic2Name, true, true,
KafkaSourceTestEnv::getRecordsForTopic);
+ }
Review comment:
Yes the test essentially setups two additional topics if the suffix is
specified. `TOPIC1` and `TOPIC2` are already set up in the `setup` method.
##########
File path:
flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/metrics/KafkaSourceReaderMetrics.java
##########
@@ -297,9 +299,9 @@ private void checkTopicPartitionTracked(TopicPartition tp) {
return
metricName.group().equals(CONSUMER_FETCH_MANAGER_GROUP)
&& metricName.name().equals(RECORDS_LAG)
&& tags.containsKey("topic")
- && tags.get("topic").equals(tp.topic())
+ && tags.get("topic").equals(resolvedTopic)
&& tags.containsKey("partition")
- &&
tags.get("partition").equals(String.valueOf(tp.partition()));
+ &&
tags.get("partition").equals(resolvedPartition);
Review comment:
I do not think there is any good reason besides keeping the line a bit
shorter.
--
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]