use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class JvmMemoryMetricsTest method memoryMetrics.
@Test
void memoryMetrics() {
MeterRegistry registry = new SimpleMeterRegistry();
new JvmMemoryMetrics().bindTo(registry);
assertJvmBufferMetrics(registry, "direct");
assertJvmBufferMetrics(registry, "mapped");
assertJvmMemoryMetrics(registry, "heap");
assertJvmMemoryMetrics(registry, "nonheap");
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class CompositeCounterTest method increment.
@Test
@Issue("#119")
void increment() {
SimpleMeterRegistry simple = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());
CompositeMeterRegistry registry = new CompositeMeterRegistry();
registry.add(simple);
registry.counter("counter").increment(2.0);
assertThat(simple.get("counter").counter().count()).isEqualTo(2.0);
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class MetricsRequestEventListenerTest method configure.
@Override
protected Application configure() {
registry = new SimpleMeterRegistry();
final MetricsApplicationEventListener listener = new MetricsApplicationEventListener(registry, new DefaultJerseyTagsProvider(), METRIC_NAME, true);
final ResourceConfig config = new ResourceConfig();
config.register(listener);
config.register(TestResource.class);
return config;
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry 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));
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class MeterRegistryTest method histogramConfigTransformingMeterFilter.
@Test
void histogramConfigTransformingMeterFilter() {
MeterRegistry registry = new SimpleMeterRegistry() {
@Override
protected Timer newTimer(@Nonnull Meter.Id id, DistributionStatisticConfig histogramConfig, PauseDetector pauseDetector) {
assertThat(histogramConfig.isPublishingHistogram()).isTrue();
return super.newTimer(id, histogramConfig, pauseDetector);
}
};
registry.config().meterFilter(new MeterFilter() {
@Override
public DistributionStatisticConfig configure(Meter.Id mappedId, DistributionStatisticConfig config) {
return DistributionStatisticConfig.builder().percentiles(0.95).percentilesHistogram(true).build().merge(config);
}
});
registry.timer("my.timer");
}
Aggregations