Skip to content

Commit

Permalink
Verticle metrics deployment removal - closes #99
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed May 29, 2020
1 parent bc0fb40 commit a6fcf6a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 46 deletions.
2 changes: 0 additions & 2 deletions src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ The following metrics are provided:
* `vertx.worker-pool-size` - A <<gauge>> of the number of threads in the worker pool
* `vertx.cluster-host` - A <<gauge>> of the cluster-host setting
* `vertx.cluster-port` - A <<gauge>> of the cluster-port setting
* `vertx.verticles` - A <<counter>> of the number of verticles currently deployed
* `vertx.verticles.<verticle-name>` - A <<counter>> of the number of deployment of a particular verticle

=== Event bus metrics

Expand Down
14 changes: 0 additions & 14 deletions src/main/java/io/vertx/ext/dropwizard/impl/VertxMetricsImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
class VertxMetricsImpl extends AbstractMetrics implements VertxMetrics {

private final DropwizardMetricsOptions options;
private final Counter verticles;
private Handler<Void> doneHandler;
private final boolean shutdown;
private final Map<String, HttpClientReporter> clientReporters = new ConcurrentHashMap<>();
Expand All @@ -51,7 +50,6 @@ class VertxMetricsImpl extends AbstractMetrics implements VertxMetrics {
super(registry, baseName);

this.options = metricsOptions;
this.verticles = counter("verticles");
this.shutdown = shutdown;

gauge(options::getEventLoopPoolSize, "event-loop-size");
Expand All @@ -68,18 +66,6 @@ String projectName(String name) {
return name;
}

@Override
public void verticleDeployed(Verticle verticle) {
verticles.inc();
counter("verticles", verticleName(verticle)).inc();
}

@Override
public void verticleUndeployed(Verticle verticle) {
verticles.dec();
counter("verticles", verticleName(verticle)).dec();
}

@Override
public EventBusMetrics createEventBusMetrics() {
return new EventBusMetricsImpl(this, nameOf("eventbus"), options);
Expand Down
30 changes: 0 additions & 30 deletions src/test/java/io/vertx/ext/dropwizard/MetricsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1052,36 +1052,6 @@ public void testVertxMetrics() throws Exception {
assertNull(metrics.getJsonObject("vertx.cluster-port"));
}

@Test
public void testVerticleMetrics() throws Exception {
int verticles = 5;
CountDownLatch latch = new CountDownLatch(verticles);
AtomicReference<String> ref = new AtomicReference<>();
for (int i = 0; i < 5; i++) {
vertx.deployVerticle(new AbstractVerticle() {}, ar -> {
assertTrue(ar.succeeded());
ref.set(ar.result()); // just use the last deployment id to test undeploy metrics below
latch.countDown();
});
}

awaitLatch(latch);

JsonObject metrics = metricsService.getMetricsSnapshot(vertx);
assertNotNull(metrics);
assertFalse(metrics.isEmpty());

assertCount(metrics.getJsonObject("vertx.verticles"), (long) verticles);

vertx.undeploy(ref.get(), ar -> {
assertTrue(ar.succeeded());
assertCount(metricsService.getMetricsSnapshot(vertx).getJsonObject("vertx.verticles"), (long) verticles - 1);
testComplete();
});

await();
}

@Test
public void testScheduledMetricConsumer() {
int messages = 18;
Expand Down

0 comments on commit a6fcf6a

Please sign in to comment.