Search in sources :

Example 1 with SimpleConfig

use of io.micrometer.core.instrument.simple.SimpleConfig 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)

Example 2 with SimpleConfig

use of io.micrometer.core.instrument.simple.SimpleConfig in project spring-boot by spring-projects.

the class SimplePropertiesTests method defaultValuesAreConsistent.

@Test
void defaultValuesAreConsistent() {
    SimpleProperties properties = new SimpleProperties();
    SimpleConfig config = SimpleConfig.DEFAULT;
    assertThat(properties.getStep()).isEqualTo(config.step());
    assertThat(properties.getMode()).isEqualTo(config.mode());
}
Also used : SimpleConfig(io.micrometer.core.instrument.simple.SimpleConfig) Test(org.junit.jupiter.api.Test)

Aggregations

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