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);
}
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());
}
Aggregations