@Override
    public double combine(List<Sample> samples, MetricConfig config, long now) {
        double total = 0.0;
        long count = 0;
        for (Sample s : samples) {
            total += s.value;
            count += s.eventCount;
        }
        return count == 0 ? Double.NaN : total / count;
    }
A {@link SampledStat} that maintains a simple average over its samples.
clients/src/main/java/org/apache/kafka/common/metrics/stats/Avg.java