srdo commented on PR #17139: URL: https://github.com/apache/kafka/pull/17139#issuecomment-2588501588
> I am having a hard time following along with your example - specifically starting at this point > We can then look at the latest poll and "fill in" the interval, drawing first from polling seconds (since we know poll "comes before" non-poll), and next from non-polling seconds to hit the exact window size. > What I've gleaned is that with a window size of 10s, we are able to calculate the ratio for window 1 (which ends during the 6th second of the third poll) and window 2 is partial and includes everything after that. Yes, exactly. The basic idea is to let each window be flushed to the metric as soon as we know we've accounted for all seconds from that window. So in the example, once we finish the third poll, we have enough seconds to complete window 1, because we have 2 seconds from the first poll, 2 non-polling seconds, and then 6 polling seconds from the third poll. The last second from the third poll then get "saved up" for the next window which isn't complete yet. That window will be flushed once we've gathered up another 9 seconds. In the implementation the point where we account for the latest poll's seconds and consider whether to flush the open window is in `pollStart`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
