io.vertx.core.VertxOptions.setMetricsOptions()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中io.vertx.core.VertxOptions.setMetricsOptions()方法的一些代码示例,展示了VertxOptions.setMetricsOptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.setMetricsOptions()方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:setMetricsOptions

VertxOptions.setMetricsOptions介绍

[英]Set the metrics options
[中]设置度量选项

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testFactory() throws Exception {
 AtomicReference<Thread> metricsThread = new AtomicReference<>();
 AtomicReference<Context> metricsContext = new AtomicReference<>();
 VertxMetricsFactory factory = (options) -> {
  metricsThread.set(Thread.currentThread());
  metricsContext.set(Vertx.currentContext());
  return DummyVertxMetrics.INSTANCE;
 };
 vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
 assertSame(Thread.currentThread(), metricsThread.get());
 assertNull(metricsContext.get());
}

代码示例来源:origin: eclipse-vertx/vert.x

options = new VertxOptions().setMetricsOptions(metricsOptions);
configureFromSystemProperties(options, VERTX_OPTIONS_PROP_PREFIX);
if (clustered) {

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected VertxOptions getOptions() {
 return new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(false)); // Just to be explicit
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testFactoryInCluster() throws Exception {
 AtomicReference<Thread> metricsThread = new AtomicReference<>();
 AtomicReference<Context> metricsContext = new AtomicReference<>();
 Thread testThread = Thread.currentThread();
 VertxMetricsFactory factory = (options) -> {
  metricsThread.set(Thread.currentThread());
  metricsContext.set(Vertx.currentContext());
  return DummyVertxMetrics.INSTANCE;
 };
 clusteredVertx(new VertxOptions().setClustered(true).setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)), onSuccess(vertx -> {
  assertSame(testThread, metricsThread.get());
  assertNull(metricsContext.get());
  testComplete();
 }));
 await();
}

代码示例来源:origin: eclipse-vertx/vert.x

if (optionsJson == null) {
 MetricsOptions metricsOptions = getMetricsOptions();
 options = new VertxOptions().setMetricsOptions(metricsOptions);
} else {
 MetricsOptions metricsOptions = getMetricsOptions(optionsJson.getJsonObject("metricsOptions"));
 options = new VertxOptions(optionsJson).setMetricsOptions(metricsOptions);

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected VertxOptions getOptions() {
 VertxOptions options = super.getOptions();
 options.setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new FakeMetricsFactory()));
 return options;
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected VertxOptions getOptions() {
 VertxOptions options = super.getOptions();
 options.setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new FakeMetricsFactory()));
 return options;
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testMetricsEnabledWithoutConfig() {
 vertx.close();
 vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true)));
 VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
 assertNull(metrics);
}

代码示例来源:origin: eclipse-vertx/vert.x

Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
Context ctx = contextFactory.apply(vertx);
ctx.runOnContext(v1 -> {

代码示例来源:origin: eclipse-vertx/vert.x

Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
vertx.deployVerticle(new AbstractVerticle() {
 @Override

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testSetMetricsInstance() {
 DummyVertxMetrics metrics = DummyVertxMetrics.INSTANCE;
 vertx.close();
 vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new SimpleVertxMetricsFactory<>(metrics))));
 assertSame(metrics, ((VertxInternal) vertx).metricsSPI());
}

代码示例来源:origin: eclipse-vertx/vert.x

Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
Context ctx = contextFactory.apply(vertx);
ctx.runOnContext(v1 -> {

代码示例来源:origin: eclipse-vertx/vert.x

Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
EventBus eb = vertx.eventBus();
runOnContext.accept(vertx, v -> {

代码示例来源:origin: eclipse-vertx/vert.x

Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
Context ctx = contextFactory.apply(vertx);
ctx.runOnContext(v1 -> {

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testThreadPoolMetricsWithNamedExecuteBlocking() {
 vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(new FakeMetricsFactory())));

代码示例来源:origin: eclipse-vertx/vert.x

Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
Context ctx = contextFactory.apply(vertx);
NetServer server = vertx.createNetServer().connectHandler(so -> {

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testMetricsFromServiceLoader() {
 vertx.close();
 VertxOptions options = new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true));
 vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
 VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
 assertNotNull(metrics);
 assertTrue(metrics instanceof FakeVertxMetrics);
}

代码示例来源:origin: eclipse-vertx/vert.x

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

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testEventBusLifecycle() {
 AtomicBoolean closeCalled = new AtomicBoolean();
 VertxMetricsFactory factory = (options) -> new DummyVertxMetrics() {
  @Override
  public EventBusMetrics createEventBusMetrics() {
   return new DummyEventBusMetrics() {
    @Override
    public boolean isEnabled() {
     return true;
    }
    @Override
    public void close() {
     closeCalled.set(true);
    }
   };
  }
 };
 Vertx vertx = vertx(new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true).setFactory(factory)));
 vertx.eventBus();
 executeInVanillaThread(() -> {
  vertx.close(onSuccess(v -> {
   assertTrue(closeCalled.get());
   testComplete();
  }));
 });
 await();
}

代码示例来源:origin: eclipse-vertx/vert.x

options.setQuorumSize(quorumSize);
options.setHAGroup(haGroup);
options.setMetricsOptions(
  new MetricsOptions().
    setEnabled(metricsEnabled));

相关文章

VertxOptions类方法