@Override
    public long windowSize(MetricConfig config, long now) {
        stat.purgeObsoleteSamples(config, now);
        long elapsed = now - stat.oldest(now).startTimeMs;
        return Math.max(elapsed, config.timeWindowMs());
    }
A simple rate the rate is incrementally calculated
based on the elapsed time between the earliest reading
and now.

An exception is made for the first window, which is
considered of fixed size. This avoids the issue of
an artificially high rate when the gap between readings
is close to 0.
clients/src/main/java/org/apache/kafka/common/metrics/stats/SimpleRate.java