Search in sources :

Example 1 with CountingMode

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));
}
Also used : SimpleConfig(io.micrometer.core.instrument.simple.SimpleConfig) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) CountingMode(io.micrometer.core.instrument.simple.CountingMode) CountAtBucket(io.micrometer.core.instrument.distribution.CountAtBucket) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Test(org.junit.jupiter.api.Test)

Aggregations

CountAtBucket (io.micrometer.core.instrument.distribution.CountAtBucket)1 CountingMode (io.micrometer.core.instrument.simple.CountingMode)1 SimpleConfig (io.micrometer.core.instrument.simple.SimpleConfig)1 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)1 Test (org.junit.jupiter.api.Test)1