use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class JvmThreadMetricsTest method threadMetrics.
@Test
void threadMetrics() {
MeterRegistry registry = new SimpleMeterRegistry();
new JvmThreadMetrics().bindTo(registry);
assertThat(registry.get("jvm.threads.live").gauge().value()).isGreaterThan(0);
assertThat(registry.get("jvm.threads.daemon").gauge().value()).isGreaterThan(0);
assertThat(registry.get("jvm.threads.peak").gauge().value()).isGreaterThan(0);
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class ProcessorMetricsTest method cpuMetrics.
@Test
void cpuMetrics() {
MeterRegistry registry = new SimpleMeterRegistry();
new ProcessorMetrics().bindTo(registry);
assertThat(registry.get("system.cpu.count").gauge().value()).isGreaterThan(0);
if (System.getProperty("os.name").toLowerCase().contains("win")) {
assertThat(registry.find("system.load.average.1m").gauge()).describedAs("Not present on windows").isNull();
} else {
assertThat(registry.get("system.load.average.1m").gauge().value()).isGreaterThanOrEqualTo(0);
}
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class ProcessorMetricsTest method hotspotCpuMetrics.
@Test
void hotspotCpuMetrics() {
assumeTrue(classExists("com.sun.management.OperatingSystemMXBean"));
MeterRegistry registry = new SimpleMeterRegistry();
new ProcessorMetrics().bindTo(registry);
assertThat(registry.get("system.cpu.usage").gauge().value()).isGreaterThanOrEqualTo(0);
assertThat(registry.get("process.cpu.usage").gauge().value()).isGreaterThanOrEqualTo(0);
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class CompositeLongTaskTimerTest method mapIdsToEachLongTaskTimerInComposite.
@Test
void mapIdsToEachLongTaskTimerInComposite() {
MockClock clock = new MockClock();
MeterRegistry s1 = new SimpleMeterRegistry(SimpleConfig.DEFAULT, clock);
LongTaskTimer anotherTimer = s1.more().longTaskTimer("long.task");
LongTaskTimer.Sample anotherSample = anotherTimer.start();
clock.add(10, TimeUnit.NANOSECONDS);
CompositeMeterRegistry registry = new CompositeMeterRegistry(clock);
registry.add(s1);
LongTaskTimer longTaskTimer = registry.more().longTaskTimer("long.task");
LongTaskTimer.Sample sample = longTaskTimer.start();
clock.add(100, TimeUnit.NANOSECONDS);
assertThat(anotherSample.stop()).isEqualTo(110);
// if this fails, the composite is using a timer ID that overlaps with a separate timer in a member
// of the composite rather than mapping the ID to a separate ID in the composite member.
assertThat(sample.stop()).isEqualTo(100);
}
use of io.micrometer.core.instrument.simple.SimpleMeterRegistry in project micrometer by micrometer-metrics.
the class JettyStatisticsMetricsTest method setup.
@BeforeEach
void setup() {
this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());
this.handler = new StatisticsHandler();
JettyStatisticsMetrics.monitor(registry, handler);
}
Aggregations