use of io.micrometer.core.instrument.simple.CountingMode in project micrometer by micrometer-metrics.
the class DistributionSummaryTest method histogramsInStepMode.
@Test
void histogramsInStepMode() {
MockClock clock = new MockClock();
MeterRegistry registry = new SimpleMeterRegistry(new SimpleConfig() {
@Override
public String get(String key) {
return null;
}
@Override
public CountingMode mode() {
return CountingMode.STEP;
}
}, clock);
DistributionSummary summary = DistributionSummary.builder("my.summary").sla(1).register(registry);
summary.record(1);
assertThat(summary.takeSnapshot().histogramCounts()).containsExactly(new CountAtBucket(1, 1));
clock.add(SimpleConfig.DEFAULT.step());
assertThat(summary.takeSnapshot().histogramCounts()).containsExactly(new CountAtBucket(1, 0));
}
Aggregations