vert-x3 / vertx-micrometer-metrics

Vert.x metrics implementation for Micrometer.io
Apache License 2.0
47 stars 36 forks source link

Incompatibility with micrometer 1.13.x #222

Closed victornoel closed 2 months ago

victornoel commented 2 months ago

Version

vertx 4.5.8 micrometer 1.13.1

Context

I am using the following to setup vertx:

        BackendRegistries.setupBackend(
            new MicrometerMetricsOptions()
                .setEnabled(true)
                .setPrometheusOptions(new VertxPrometheusOptions().setEnabled(true))
        );

And I get the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: io/micrometer/prometheus/PrometheusMeterRegistry
  at io.vertx.micrometer.backends.BackendRegistries.lambda$setupBackend$0(BackendRegistries.java:75)
  at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
  at io.vertx.micrometer.backends.BackendRegistries.setupBackend(BackendRegistries.java:62)
  at App.enableMetrics(App.java:200)
  at App.main(App.java:69)
Caused by: java.lang.ClassNotFoundException: io.micrometer.prometheus.PrometheusMeterRegistry
  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
  at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
  ... 5 more

Reverting to micrometer 1.12.7 fixes the issue. I highly suspect the problem is related to the change of prometheus client used by micrometer: https://github.com/micrometer-metrics/micrometer/wiki/1.13-Migration-Guide#prometheus-java-client-0x-to-1x-upgrade

Cheers

tsegismont commented 2 months ago

Hi @victornoel , this is not a bug, Vert.x 5 will be compatible with Micrometer 1.13 (see #219) but not Vert.x 4, precisely because of the breaking changes.

victornoel commented 2 months ago

@tsegismont very good, thank you for the explanation!