@Override
    public double combine(List<Sample> samples, MetricConfig config, long now) {
        double max = Double.NEGATIVE_INFINITY;
        long count = 0;
        for (Sample sample : samples) {
            max = Math.max(max, sample.value);
            count += sample.eventCount;
        }
        return count == 0 ? Double.NaN : max;
    }
A {@link SampledStat} that gives the max over its samples.
clients/src/main/java/org/apache/kafka/common/metrics/stats/Max.java