Attempting to instrument a Vert.x application with Micrometer 1.1.1.
Setting the VertxOptions object via a custom launcher:
@Override
public void beforeStartingVertx(VertxOptions options) {
MicrometerMetricsOptions prometheusOptions = new MicrometerMetricsOptions()
.setPrometheusOptions(new VertxPrometheusOptions().setEnabled(true))
.setEnabled(true);
options.setMetricsOptions(prometheusOptions);
super.beforeStartingVertx(options);
}
leads to the error in $Subject. Full stack trace is as follows:
[INFO] Exception in thread "main" java.lang.NoSuchMethodError: io.micrometer.core.instrument.MeterRegistry$Config.onMeterRemoved(Ljava/util/function/Consumer;)Lio/micrometer/core/instrument/MeterRegistry$Config;
[INFO] at io.micrometer.prometheus.PrometheusMeterRegistry.<init>(PrometheusMeterRegistry.java:65)
[INFO] at io.micrometer.prometheus.PrometheusMeterRegistry.<init>(PrometheusMeterRegistry.java:58)
[INFO] at io.vertx.micrometer.backends.PrometheusBackendRegistry.<init>(PrometheusBackendRegistry.java:45)
[INFO] at io.vertx.micrometer.backends.BackendRegistries.lambda$setupBackend$0(BackendRegistries.java:61)
[INFO] at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
[INFO] at io.vertx.micrometer.backends.BackendRegistries.setupBackend(BackendRegistries.java:56)
[INFO] at io.vertx.micrometer.impl.VertxMetricsFactoryImpl.metrics(VertxMetricsFactoryImpl.java:40)
[INFO] at io.vertx.core.impl.VertxImpl.initialiseMetrics(VertxImpl.java:439)
[INFO] at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:172)
[INFO] at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:145)
[INFO] at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:38)
[INFO] at io.vertx.core.Vertx.vertx(Vertx.java:88)
[INFO] at io.vertx.core.impl.launcher.commands.ClasspathHandler.create(ClasspathHandler.java:113)
[INFO] at io.vertx.core.impl.launcher.commands.BareCommand.startVertx(BareCommand.java:208)
[INFO] at io.vertx.core.impl.launcher.commands.BareCommand.run(BareCommand.java:141)
[INFO] at io.vertx.core.impl.launcher.commands.RunCommand.run(RunCommand.java:249)
[INFO] at io.vertx.core.impl.launcher.VertxCommandLauncher.execute(VertxCommandLauncher.java:226)
[INFO] at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:361)
[INFO] at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:324)
[INFO] at com.mypackage.MyCustomLauncher.main(MyCustomLauncher.java:26)
pom.xml contains the following micrometer references:
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-micrometer-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.1.1</version>
</dependency>
I assume I'm just missing something here, but not sure what...
Make sure that 'vertx-micrometer-metrics' is pulling in the same 'micrometer-core' version as you requested with the 'micrometer-registry-prometheus' dependency. Likely it isn't '1.1.1'. The first dependency wins being nearer to the dependency root.
Yup that was it, thanks. Thought it'd be something simple.
Most helpful comment
Make sure that 'vertx-micrometer-metrics' is pulling in the same 'micrometer-core' version as you requested with the 'micrometer-registry-prometheus' dependency. Likely it isn't '1.1.1'. The first dependency wins being nearer to the dependency root.