diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/AbstractTimeWindowHistogram.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/AbstractTimeWindowHistogram.java index 40dd19561e..4e954dd99e 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/AbstractTimeWindowHistogram.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/AbstractTimeWindowHistogram.java @@ -74,10 +74,10 @@ abstract class AbstractTimeWindowHistogram implements Histogram { ringBuffer = (T[]) Array.newInstance(bucketType, ageBuckets); - durationBetweenRotatesMillis = distributionStatisticConfig.getExpiry().toMillis() / ageBuckets; + durationBetweenRotatesMillis = distributionStatisticConfig.getExpiry().toMillis(); if (durationBetweenRotatesMillis <= 0) { rejectHistogramConfig("expiry (" + distributionStatisticConfig.getExpiry().toMillis() - + "ms) / bufferLength (" + ageBuckets + ") must be greater than 0."); + + "ms) must be greater than 0."); } currentBucket = 0; diff --git a/micrometer-core/src/test/java/io/micrometer/core/instrument/distribution/TimeWindowPercentileHistogramTest.java b/micrometer-core/src/test/java/io/micrometer/core/instrument/distribution/TimeWindowPercentileHistogramTest.java index 04764c32fd..f59fb7d0bb 100644 --- a/micrometer-core/src/test/java/io/micrometer/core/instrument/distribution/TimeWindowPercentileHistogramTest.java +++ b/micrometer-core/src/test/java/io/micrometer/core/instrument/distribution/TimeWindowPercentileHistogramTest.java @@ -162,7 +162,7 @@ private boolean percentileValueIsApproximately(ValueAtPercentile vp, double perc void timeBasedSlidingWindow() { final DistributionStatisticConfig config = DistributionStatisticConfig.builder() .percentiles(0.0, 0.5, 0.75, 0.9, 0.99, 0.999, 1.0) - .expiry(Duration.ofSeconds(4)) + .expiry(Duration.ofSeconds(1)) .bufferLength(4) .build() .merge(DistributionStatisticConfig.DEFAULT);