You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jy...@apache.org on 2026/08/28 01:01:07 UTC

(kafka) branch trunk updated: MINOR: Remove redundant local variable in KTableSuppressProcessorMetricsTest (#23286)

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

m1a2st pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 165e04eb4d3 MINOR: Remove redundant local variable in KTableSuppressProcessorMetricsTest (#23286)
165e04eb4d3 is described below

commit 165e04eb4d380cb73fb1afc5efb70ce4403532d1
Author: Yu-Chia Ma <79...@users.noreply.github.com>
AuthorDate: Fri Aug 28 09:00:59 2026 +0800

    MINOR: Remove redundant local variable in KTableSuppressProcessorMetricsTest (#23286)
    
    These local variables are unnecessary — they just re-assign the
    class-level `*MetricLatest` fields with no additional logic, so this
    change uses the class-level variables directly instead.
    
    Reviewers: Ken Huang <s7...@gmail.com>, yaodehuang
    <se...@gmail.com>
---
 .../KTableSuppressProcessorMetricsTest.java        | 31 +++++++++-------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/streams/src/test/java/org/apache/kafka/streams/kstream/internals/suppress/KTableSuppressProcessorMetricsTest.java b/streams/src/test/java/org/apache/kafka/streams/kstream/internals/suppress/KTableSuppressProcessorMetricsTest.java
index 728fdd72f83..ae76f87dc4f 100644
--- a/streams/src/test/java/org/apache/kafka/streams/kstream/internals/suppress/KTableSuppressProcessorMetricsTest.java
+++ b/streams/src/test/java/org/apache/kafka/streams/kstream/internals/suppress/KTableSuppressProcessorMetricsTest.java
@@ -166,22 +166,15 @@ public class KTableSuppressProcessorMetricsTest {
         final Change<Long> value = new Change<>(null, ARBITRARY_LONG);
         processor.process(new Record<>(key, value, timestamp));
 
-        final MetricName evictionRateMetric = evictionRateMetricLatest;
-        final MetricName evictionTotalMetric = evictionTotalMetricLatest;
-        final MetricName bufferSizeAvgMetric = bufferSizeAvgMetricLatest;
-        final MetricName bufferSizeMaxMetric = bufferSizeMaxMetricLatest;
-        final MetricName bufferCountAvgMetric = bufferCountAvgMetricLatest;
-        final MetricName bufferCountMaxMetric = bufferCountMaxMetricLatest;
-
         {
             final Map<MetricName, ? extends Metric> metrics = context.metrics().metrics();
 
-            verifyMetric(metrics, evictionRateMetric, is(0.0));
-            verifyMetric(metrics, evictionTotalMetric, is(0.0));
-            verifyMetric(metrics, bufferSizeAvgMetric, is(21.5));
-            verifyMetric(metrics, bufferSizeMaxMetric, is(43.0));
-            verifyMetric(metrics, bufferCountAvgMetric, is(0.5));
-            verifyMetric(metrics, bufferCountMaxMetric, is(1.0));
+            verifyMetric(metrics, evictionRateMetricLatest, is(0.0));
+            verifyMetric(metrics, evictionTotalMetricLatest, is(0.0));
+            verifyMetric(metrics, bufferSizeAvgMetricLatest, is(21.5));
+            verifyMetric(metrics, bufferSizeMaxMetricLatest, is(43.0));
+            verifyMetric(metrics, bufferCountAvgMetricLatest, is(0.5));
+            verifyMetric(metrics, bufferCountMaxMetricLatest, is(1.0));
         }
 
         context.setRecordMetadata("", 0, 1L);
@@ -191,12 +184,12 @@ public class KTableSuppressProcessorMetricsTest {
         {
             final Map<MetricName, ? extends Metric> metrics = context.metrics().metrics();
 
-            verifyMetric(metrics, evictionRateMetric, greaterThan(0.0));
-            verifyMetric(metrics, evictionTotalMetric, is(1.0));
-            verifyMetric(metrics, bufferSizeAvgMetric, is(41.0));
-            verifyMetric(metrics, bufferSizeMaxMetric, is(82.0));
-            verifyMetric(metrics, bufferCountAvgMetric, is(1.0));
-            verifyMetric(metrics, bufferCountMaxMetric, is(2.0));
+            verifyMetric(metrics, evictionRateMetricLatest, greaterThan(0.0));
+            verifyMetric(metrics, evictionTotalMetricLatest, is(1.0));
+            verifyMetric(metrics, bufferSizeAvgMetricLatest, is(41.0));
+            verifyMetric(metrics, bufferSizeMaxMetricLatest, is(82.0));
+            verifyMetric(metrics, bufferCountAvgMetricLatest, is(1.0));
+            verifyMetric(metrics, bufferCountMaxMetricLatest, is(2.0));
         }
     }