Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13911

Rate is calculated as NaN for minimum config values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.3.0
    • None
    • None

    Description

      Implementation of connection creation rate quotas in Kafka is dependent on two configurations:

      1. quota.window.num
      2. quota.window.size.seconds

      The minimum possible values of these configuration is 1 as per the documentation. However, 1 as a minimum value for quota.window.num is invalid and leads to failure for calculation of rate as demonstrated below.

      As a proof of the bug, the following unit test fails:

      @Test
      public void testUseWithMinimumPossibleConfiguration() {
          final Rate r = new Rate();
          MetricConfig config = new MetricConfig().samples(1).timeWindow(1, TimeUnit.SECONDS);
          Time elapsed = new MockTime();
          r.record(config, 1.0, elapsed.milliseconds());
          elapsed.sleep(100);
          r.record(config, 1.0, elapsed.milliseconds());
          elapsed.sleep(1000);
          final Double observedRate = r.measure(config, elapsed.milliseconds());
          assertFalse(Double.isNaN(observedRate));
      } 

       

      Attachments

        Issue Links

          Activity

            People

              divijvaidya Divij Vaidya
              divijvaidya Divij Vaidya
              Ismael Juma Ismael Juma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: