[ https://issues.apache.org/jira/browse/KAFKA-2443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14743983#comment-14743983 ]
ASF GitHub Bot commented on KAFKA-2443: --------------------------------------- GitHub user auradkar opened a pull request: https://github.com/apache/kafka/pull/213 KAFKA-2443 Expose windowSize on Rate This is a followup ticket from KAFKA-2084 to improve the windowSize calculation in Quotas. I've made the following changes: 1. Added a windowSize function on Rate 2. Calling Rate.windowSize in ClientQuotaManager to return the exact window size to use when computing the delay time. 3. Changed the window size calculation subtly. The current calculation had a bug wherein, it used the number of elapsed seconds from the "lastWindowSeconds" of the most recent Sample object. However, the lastWindowSeconds is the time when the sample is created.. this causes an issue because it implies that the current window elapsed time is always "0" when the sample is created. This is incorrect as demonstrated in a testcase I added in MetricsTest. I've fixed the calculation to count the elapsed time from the "oldest" sample in the set since that gives us an accurate value of the exact amount of time elapsed You can merge this pull request into a Git repository by running: $ git pull https://github.com/auradkar/kafka K-2443 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/213.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #213 ---- commit 78868c50fd7966d20bf023509b9a444f6cea1443 Author: Aditya Auradkar <aaurad...@linkedin.com> Date: 2015-09-14T17:43:55Z Fixing K-2443 ---- > Expose windowSize on Rate > ------------------------- > > Key: KAFKA-2443 > URL: https://issues.apache.org/jira/browse/KAFKA-2443 > Project: Kafka > Issue Type: Task > Reporter: Aditya Auradkar > Assignee: Aditya Auradkar > Labels: quotas > > Currently, we dont have a means to measure the size of the metric window > since the final sample can be incomplete. > Expose windowSize(now) on Rate -- This message was sent by Atlassian JIRA (v6.3.4#6332)