chiacyu commented on code in PR #15863: URL: https://github.com/apache/kafka/pull/15863#discussion_r1606776333
########## core/src/main/scala/kafka/log/LogCleaner.scala: ########## @@ -126,29 +126,34 @@ class LogCleaner(initialConfig: CleanerConfig, private def maxOverCleanerThreads(f: CleanerThread => Double): Int = cleaners.foldLeft(0.0d)((max: Double, thread: CleanerThread) => math.max(max, f(thread))).toInt - /* a metric to track the maximum utilization of any thread's buffer in the last cleaning */ - metricsGroup.newGauge(MaxBufferUtilizationPercentMetricName, - () => maxOverCleanerThreads(_.lastStats.bufferUtilization) * 100) - - /* a metric to track the recopy rate of each thread's last cleaning */ - metricsGroup.newGauge(CleanerRecopyPercentMetricName, () => { - val stats = cleaners.map(_.lastStats) - val recopyRate = stats.iterator.map(_.bytesWritten).sum.toDouble / math.max(stats.iterator.map(_.bytesRead).sum, 1) - (100 * recopyRate).toInt - }) - - /* a metric to track the maximum cleaning time for the last cleaning from each thread */ - metricsGroup.newGauge(MaxCleanTimeMetricName, () => maxOverCleanerThreads(_.lastStats.elapsedSecs)) - - // a metric to track delay between the time when a log is required to be compacted - // as determined by max compaction lag and the time of last cleaner run. - metricsGroup.newGauge(MaxCompactionDelayMetricsName, - () => maxOverCleanerThreads(_.lastPreCleanStats.maxCompactionDelayMs.toDouble) / 1000) - - metricsGroup.newGauge(DeadThreadCountMetricName, () => deadThreadCount) - private[log] def deadThreadCount: Int = cleaners.count(_.isThreadFailed) + /** + * Activate metrics + */ + private def activateMetrics(): Unit = { Review Comment: Thanks for the reminder. Would remove the function and restore back to constructor. -- 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