kirktrue commented on code in PR #20631:
URL: https://github.com/apache/kafka/pull/20631#discussion_r2458209358
##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -389,6 +389,19 @@ public void
testMetricsReporterAutoGeneratedClientId(GroupProtocol groupProtocol
consumer.close(CloseOptions.timeout(Duration.ZERO));
}
+ @ParameterizedTest
+ @EnumSource(GroupProtocol.class)
+ public void testMetricsRemovedOnClose(GroupProtocol groupProtocol) {
+ Properties props = new Properties();
+ props.setProperty(ConsumerConfig.GROUP_PROTOCOL_CONFIG,
groupProtocol.name());
+ props.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
"localhost:9999");
+ consumer = newConsumer(props, new StringDeserializer(), new
StringDeserializer());
+
+ assertTrue(consumer.metrics().size() > 1, "The consumer should have
created many metrics");
+ consumer.close(CloseOptions.timeout(Duration.ZERO));
+ assertTrue(consumer.metrics().size() <= 1, "The consumer should have
removed all of its metrics");
Review Comment:
Thanks for the review @LiamClarkeNZ.
Yes, there's this meta metric named `count` that is present by default. I've
updated the test to hopefully be more clear about that.
--
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]