Chia-Ping Tsai created KAFKA-18597:
--------------------------------------

             Summary: max-buffer-utilization-percent is always 0
                 Key: KAFKA-18597
                 URL: https://issues.apache.org/jira/browse/KAFKA-18597
             Project: Kafka
          Issue Type: Bug
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


see 
[https://github.com/apache/kafka/blob/516d5240b98916feb3e51c8a143dede05a4edad1/core/src/main/scala/kafka/log/LogCleaner.scala#L127]

 

  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)

we always round down the double value, so 
`maxOverCleanerThreads(_.lastStats.bufferUtilization)` returns 0 always



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to