use of io.vertx.micrometer.VertxJmxMetricsOptions in project vertx-micrometer-metrics by vert-x3.
the class JmxMetricsITest method shouldReportJmx.
@Test
public void shouldReportJmx(TestContext context) throws Exception {
vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(new MicrometerMetricsOptions().setJmxMetricsOptions(new VertxJmxMetricsOptions().setEnabled(true).setStep(1)).setEnabled(true)));
// Send something on the eventbus and wait til it's received
Async asyncEB = context.async();
vertx.eventBus().consumer("test-eb", msg -> asyncEB.complete());
vertx.eventBus().publish("test-eb", "test message");
asyncEB.await(2000);
// Read MBean
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
assertThat(mbs.getDomains()).contains("metrics");
Number result = (Number) mbs.getAttribute(new ObjectName("metrics", "name", "vertxEventbusHandlers.address.test-eb"), "Value");
assertThat(result).isEqualTo(1d);
}
Aggregations