splett2 commented on a change in pull request #11586: URL: https://github.com/apache/kafka/pull/11586#discussion_r800073769
########## File path: clients/src/main/java/org/apache/kafka/common/network/Selector.java ########## @@ -945,6 +947,8 @@ private void close(KafkaChannel channel, CloseMode closeMode) { if (idleExpiryManager != null) idleExpiryManager.remove(channel.id()); + + sensors.maybeUnregisterConnectionMetrics(channel.id()); Review comment: I don't agree that we should be removing these metrics when closing a connection. The per-connection metrics are only created for client-side users of the Selector. Some of these metrics are meant to be monotonic like the `count` metrics that are instantiated for the Meters. this means we'd be clearing the value any time a client disconnects from a broker. Given that the number of connection meters instantiated per selector is generally small (scales with # of brokers the selector connects to), I think we should not close these metrics on connection close, and only close when the Selector itself is closed. What do you think? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org