This short article serves as a Java quickstart for getting Vert.x metrics monitored with Prometheus.

pom.xml

<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-dropwizard-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_dropwizard</artifactId>
<version>0.0.23</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>client</artifactId>
<version>0.0.10</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_vertx</artifactId>
<version>0.0.23</version>
</dependency>

Verticle-Snippet

MetricRegistry metricRegistry = SharedMetricRegistries.getOrCreate("exported");
defaultRegistry.register(new DropwizardExports(metricRegistry));

//Bind metrics handler to /metrics
Router router = Router.router(vertx);
router.get("/metrics").handler(new MetricsHandler());

//Start httpserver on localhost:8080
vertx.createHttpServer().requestHandler(router::accept).listen(8080);

//Increase counter every second
vertx.setPeriodic(1_000L, e -> metricRegistry.counter("testCounter").inc());

Example