divijvaidya commented on code in PR #13929: URL: https://github.com/apache/kafka/pull/13929#discussion_r1254348749
########## core/src/main/scala/kafka/server/AbstractFetcherManager.scala: ########## @@ -226,6 +240,29 @@ abstract class AbstractFetcherManager[T <: AbstractFetcherThread](val name: Stri fetcherThreadMap.clear() } } + + def shutdown(): Unit = { + info("shutting down") + try { + closeAllFetchers() + } finally { + removeMetrics() + } + info("shutdown completed") + } + + private[server] def removeMetrics(): Unit = { + metricNamesToTags.foreach(metricTags => { Review Comment: perhaps we also want to remove the metric from metricNamesToTags itself, other that map can be an always increasing map. Same comment for other PRs. -- 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