Search in sources :

Example 41 with SimpleMeterRegistry

use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project tutorials by eugenp.

the class MicrometerAtlasTest method givenCounter_whenIncrement_thenValueChanged.

@Test
public void givenCounter_whenIncrement_thenValueChanged() {
    SimpleMeterRegistry registry = new SimpleMeterRegistry();
    Counter counter = Counter.builder("objects.instance").description("indicates instance count of the object").tags("dev", "performance").register(registry);
    counter.increment(2.0);
    assertTrue(counter.count() == 2);
    counter.increment(-1);
    assertTrue(counter.count() == 2);
}
Also used : Counter(io.micrometer.core.instrument.Counter) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Test(org.junit.Test)

Example 42 with SimpleMeterRegistry

use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project tutorials by eugenp.

the class MicrometerAtlasTest method givenDistributionSummary_whenRecord_thenSummarized.

@Test
public void givenDistributionSummary_whenRecord_thenSummarized() {
    SimpleMeterRegistry registry = new SimpleMeterRegistry();
    DistributionSummary distributionSummary = DistributionSummary.builder("request.size").baseUnit("bytes").register(registry);
    distributionSummary.record(3);
    distributionSummary.record(4);
    distributionSummary.record(5);
    assertTrue(3 == distributionSummary.count());
    assertTrue(12 == distributionSummary.totalAmount());
}
Also used : DistributionSummary(io.micrometer.core.instrument.DistributionSummary) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Test(org.junit.Test)

Aggregations

SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)42 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)20 Test (org.junit.jupiter.api.Test)20 Test (org.junit.Test)18 Match (io.vertx.micrometer.Match)8 Timer (io.micrometer.core.instrument.Timer)6 LongTaskTimer (io.micrometer.core.instrument.LongTaskTimer)5 MockClock (io.micrometer.core.instrument.MockClock)5 Counter (io.micrometer.core.instrument.Counter)4 DistributionSummary (io.micrometer.core.instrument.DistributionSummary)4 Gauge (io.micrometer.core.instrument.Gauge)4 HystrixPropertiesCommandDefault (com.netflix.hystrix.strategy.properties.HystrixPropertiesCommandDefault)2 Issue (io.micrometer.core.Issue)2 Tag (io.micrometer.core.instrument.Tag)2 MeterFilter (io.micrometer.core.instrument.config.MeterFilter)2 CountAtBucket (io.micrometer.core.instrument.distribution.CountAtBucket)2 SimpleConfig (io.micrometer.core.instrument.simple.SimpleConfig)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 LongAdder (java.util.concurrent.atomic.LongAdder)2 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)2