You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by je...@apache.org on 2025/01/22 18:45:03 UTC

(kafka) branch minor-kafka-18610 created (now ad079cfea8d)

This is an automated email from the ASF dual-hosted git repository.

jeffkbkim pushed a change to branch minor-kafka-18610
in repository https://gitbox.apache.org/repos/asf/kafka.git


      at ad079cfea8d move ceiling to histogram

This branch includes the following new commits:

     new ad079cfea8d move ceiling to histogram

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(kafka) 01/01: move ceiling to histogram

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jeffkbkim pushed a commit to branch minor-kafka-18610
in repository https://gitbox.apache.org/repos/asf/kafka.git

commit ad079cfea8dafd6b533494368af807f7e6cf2bf4
Author: Jeff Kim <ki...@gmail.com>
AuthorDate: Wed Jan 22 13:43:38 2025 -0500

    move ceiling to histogram
---
 .../coordinator/common/runtime/CoordinatorRuntimeMetricsImpl.java    | 2 +-
 .../kafka/coordinator/common/runtime/KafkaMetricHistogram.java       | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntimeMetricsImpl.java b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntimeMetricsImpl.java
index 391813250c1..6ea82ac4346 100644
--- a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntimeMetricsImpl.java
+++ b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntimeMetricsImpl.java
@@ -293,7 +293,7 @@ public class CoordinatorRuntimeMetricsImpl implements CoordinatorRuntimeMetrics
 
     @Override
     public void recordEventPurgatoryTime(long purgatoryTimeMs) {
-        eventPurgatoryTimeSensor.record(Math.min(MAX_LATENCY_MS, purgatoryTimeMs));
+        eventPurgatoryTimeSensor.record(purgatoryTimeMs);
     }
 
     @Override
diff --git a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/KafkaMetricHistogram.java b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/KafkaMetricHistogram.java
index 9f9575b5d98..78cccb3ae92 100644
--- a/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/KafkaMetricHistogram.java
+++ b/coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/KafkaMetricHistogram.java
@@ -67,6 +67,7 @@ public final class KafkaMetricHistogram implements CompoundStat {
      */
     private final Function<String, MetricName> metricNameFactory;
     private final HdrHistogram hdrHistogram;
+    private final long highestTrackableValue;
 
     /**
      * Creates a new histogram with the purpose of tracking latency values. As such, the histogram
@@ -105,6 +106,7 @@ public final class KafkaMetricHistogram implements CompoundStat {
     ) {
         this.metricNameFactory = metricNameFactory;
         this.hdrHistogram = new HdrHistogram(highestTrackableValue, numberOfSignificantValueDigits);
+        this.highestTrackableValue = highestTrackableValue;
     }
 
     @Override
@@ -125,6 +127,5 @@ public final class KafkaMetricHistogram implements CompoundStat {
 
     @Override
     public void record(MetricConfig config, double value, long timeMs) {
-        hdrHistogram.record((long) value);
-    }
+        hdrHistogram.record(Math.min(highestTrackableValue, (long) value));    }
 }