use of io.vertx.core.metrics.MetricsOptions in project vert.x by eclipse.
the class VertxFactoryTest method testFactoryMetricsFactoryOverridesOptions.
@Test
public void testFactoryMetricsFactoryOverridesOptions() {
FakeVertxMetrics metrics = new FakeVertxMetrics();
MetricsOptions metricsOptions = new MetricsOptions().setEnabled(true).setFactory(options -> {
throw new AssertionError();
});
VertxBuilder factory = new VertxBuilder(new VertxOptions().setMetricsOptions(metricsOptions));
factory.metrics(metrics);
factory.init();
Vertx vertx = factory.vertx();
assertSame(metrics, ((VertxInternal) vertx).metricsSPI());
}
use of io.vertx.core.metrics.MetricsOptions in project vert.x by eclipse.
the class MetricsTest method getOptions.
@Override
protected VertxOptions getOptions() {
VertxOptions options = super.getOptions();
options.setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new FakeMetricsFactory()));
return options;
}
use of io.vertx.core.metrics.MetricsOptions in project vert.x by eclipse.
the class MetricsOptionsTest method testSetMetricsInstanceTakesPrecedenceOverServiceLoader.
@Test
public void testSetMetricsInstanceTakesPrecedenceOverServiceLoader() {
DummyVertxMetrics metrics = DummyVertxMetrics.INSTANCE;
vertx.close();
VertxOptions options = new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new SimpleVertxMetricsFactory<>(metrics)));
vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
assertSame(metrics, ((VertxInternal) vertx).metricsSPI());
}
use of io.vertx.core.metrics.MetricsOptions in project vertx-micrometer-metrics by vert-x3.
the class VertxMetricsFactoryImpl method metrics.
@Override
public VertxMetrics metrics(VertxOptions vertxOptions) {
MetricsOptions metricsOptions = vertxOptions.getMetricsOptions();
MicrometerMetricsOptions options;
if (metricsOptions instanceof MicrometerMetricsOptions) {
options = (MicrometerMetricsOptions) metricsOptions;
} else {
options = new MicrometerMetricsOptions(metricsOptions.toJson());
}
BackendRegistry backendRegistry = BackendRegistries.setupBackend(options);
VertxMetricsImpl metrics = new VertxMetricsImpl(options, backendRegistry);
metrics.init();
if (options.isJvmMetricsEnabled()) {
new ClassLoaderMetrics().bindTo(backendRegistry.getMeterRegistry());
new JvmMemoryMetrics().bindTo(backendRegistry.getMeterRegistry());
new JvmGcMetrics().bindTo(backendRegistry.getMeterRegistry());
new ProcessorMetrics().bindTo(backendRegistry.getMeterRegistry());
new JvmThreadMetrics().bindTo(backendRegistry.getMeterRegistry());
}
return metrics;
}
Aggregations