Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micrometer 1.6.x doesn't support the Prometheus client 0.10.x #15485

Closed
vishu184 opened this issue Jun 28, 2021 · 3 comments
Closed

Micrometer 1.6.x doesn't support the Prometheus client 0.10.x #15485

vishu184 opened this issue Jun 28, 2021 · 3 comments
Labels
area: bug 🐛 theme: dependencies Pull requests that update a dependency file
Milestone

Comments

@vishu184
Copy link

Overview of the issue

Microservices depend , (created with Jhipster 7.0.1)

  • package: io.micrometer.micrometer-registry-prometheus version: 1.6.5
  • package: io.prometheus.simpleclient version: 0.10.0

Micrometer 1.6.x (latest) doesn't support the Prometheus client 0.10.x and it causes a runtime error when we are using any other integration which uses prometheus like spring batch , spring cloud stream kafka.

Motivation for or Use Case
Reproduce the error

Create a microservice with Jhipster 7.0.1
Add spring-boot-starter-batch package

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-batch</artifactId>
</dependency>

Or Just Create Add spring cloud stream kafka

Run ./mvnw

for spring batch

The jobs don't run

2021-04-09 04:25:14.299 ERROR 76876 --- [er-scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
java.lang.NoSuchFieldError: UNTYPED
        at io.micrometer.prometheus.MicrometerCollector.describe(MicrometerCollector.java:100)
        at io.prometheus.client.CollectorRegistry.collectorNames(CollectorRegistry.java:98)
        at io.prometheus.client.CollectorRegistry.register(CollectorRegistry.java:50)
        at io.prometheus.client.Collector.register(Collector.java:175)
        at io.micrometer.prometheus.PrometheusMeterRegistry.lambda$applyToCollector$16(PrometheusMeterRegistry.java:412)
        at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1947)
        at io.micrometer.prometheus.PrometheusMeterRegistry.applyToCollector(PrometheusMeterRegistry.java:408)
        at io.micrometer.prometheus.PrometheusMeterRegistry.newLongTaskTimer(PrometheusMeterRegistry.java:221)
        at io.micrometer.core.instrument.MeterRegistry$More.lambda$longTaskTimer$0(MeterRegistry.java:878)
        at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:614)
        at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:568)
        at io.micrometer.core.instrument.MeterRegistry.access$600(MeterRegistry.java:77)
        at io.micrometer.core.instrument.MeterRegistry$More.longTaskTimer(MeterRegistry.java:876)
        at io.micrometer.core.instrument.LongTaskTimer$Builder.register(LongTaskTimer.java:407)
        at io.micrometer.core.instrument.composite.CompositeLongTaskTimer.registerNewMeter(CompositeLongTaskTimer.java:98)
        at io.micrometer.core.instrument.composite.CompositeLongTaskTimer.registerNewMeter(CompositeLongTaskTimer.java:30)
        at io.micrometer.core.instrument.composite.AbstractCompositeMeter.add(AbstractCompositeMeter.java:66)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at java.base/java.util.Collections$SetFromMap.forEach(Collections.java:5581)
        at io.micrometer.core.instrument.composite.CompositeMeterRegistry.lambda$new$0(CompositeMeterRegistry.java:65)
        at io.micrometer.core.instrument.composite.CompositeMeterRegistry.lock(CompositeMeterRegistry.java:184)
        at io.micrometer.core.instrument.composite.CompositeMeterRegistry.lambda$new$1(CompositeMeterRegistry.java:65)
        at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:624)
        at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:568)
        at io.micrometer.core.instrument.MeterRegistry.access$600(MeterRegistry.java:77)
        at io.micrometer.core.instrument.MeterRegistry$More.longTaskTimer(MeterRegistry.java:876)
        at io.micrometer.core.instrument.LongTaskTimer$Builder.register(LongTaskTimer.java:407)
        at org.springframework.batch.core.metrics.BatchMetrics.createLongTaskTimer(BatchMetrics.java:88)
        at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304)
        at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:149)
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
        at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:140)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:128)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
        at com.sun.proxy.$Proxy225.run(Unknown Source)
        at com.vendorlytic.tracker.config.BatchConfiguration.run(BatchConfiguration.java:100)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

And for kafka

Caused by: java.lang.NoSuchFieldError: io/prometheus/client/Collector$Type.UNTYPED
	at io.micrometer.prometheus.PrometheusMeterRegistry.newMeter(PrometheusMeterRegistry.java:253)
	at io.micrometer.core.instrument.MeterRegistry.lambda$register$4(MeterRegistry.java:335)
	at io.micrometer.core.instrument.MeterRegistry$$Lambda$2050/00000000FEC23520.apply(Unknown Source)
	at io.micrometer.core.instrument.MeterRegistry.lambda$registerMeterIfNecessary$5(MeterRegistry.java:561)
	at io.micrometer.core.instrument.MeterRegistry$$Lambda$701/0000000000000000.apply(Unknown Source)
	at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:614)
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:568)
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:561)
	at io.micrometer.core.instrument.MeterRegistry.register(MeterRegistry.java:335)
	at io.micrometer.core.instrument.Meter$Builder.register(Meter.java:468)
	at io.micrometer.core.instrument.binder.kafka.KafkaMetrics.getCommonTags(KafkaMetrics.java:109)
	at io.micrometer.core.instrument.binder.kafka.KafkaMetrics.bindTo(KafkaMetrics.java:101)
	at io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics.bindTo(KafkaClientMetrics.java:39)
	at org.springframework.kafka.core.MicrometerProducerListener.producerAdded(MicrometerProducerListener.java:75)
	at org.springframework.kafka.core.DefaultKafkaProducerFactory.lambda$doCreateProducer$14(DefaultKafkaProducerFactory.java:546)
	at org.springframework.kafka.core.DefaultKafkaProducerFactory$$Lambda$2048/00000000FEC4E920.accept(Unknown Source)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
	at org.springframework.kafka.core.DefaultKafkaProducerFactory.doCreateProducer(DefaultKafkaProducerFactory.java:546)
	at org.springframework.kafka.core.DefaultKafkaProducerFactory.createProducer(DefaultKafkaProducerFactory.java:519)
	at org.springframework.kafka.core.DefaultKafkaProducerFactory.createProducer(DefaultKafkaProducerFactory.java:513)
	at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.lambda$createProducerMessageHandler$0(KafkaMessageChannelBinder.java:396)
	at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder$$Lambda$2042/00000000FC919D80.call(Unknown Source)
	at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.lambda$getPartitionsForTopic$6(KafkaTopicProvisioner.java:535)
	at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner$$Lambda$2043/00000000FEC22980.doWithRetry(Unknown Source)
	at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:329)
	at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:209)
	at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.getPartitionsForTopic(KafkaTopicProvisioner.java:530)
	at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.createProducerMessageHandler(KafkaMessageChannelBinder.java:394)
	at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.createProducerMessageHandler(KafkaMessageChannelBinder.java:158)
	at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:226)
	at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:91)
	at org.springframework.cloud.stream.binder.AbstractBinder.bindProducer(AbstractBinder.java:152)
	at org.springframework.cloud.stream.binding.BindingService.doBindProducer(BindingService.java:320)
	at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:285)
	at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:294)
	at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:298)
	at org.springframework.cloud.stream.binding.AbstractBindableProxyFactory.createAndBindOutputs(AbstractBindableProxyFactory.java:142)
	at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58)
	at org.springframework.cloud.stream.binding.AbstractBindingLifecycle$$Lambda$1280/0000000000000000.accept(Unknown Source)
	at java.base/java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608)
	at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:57)
	at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34)
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
	... 14 common frames omitted

Related issues
Suggest a Fix

Explicitly add the Promethous client with version 0.9.0

<dependency>
    <groupId>io.prometheus</groupId>
     <artifactId>simpleclient</artifactId>
     <version>0.9.0</version>
</dependency>

Or use

<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus -->
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
    <version>1.7.1</version>
</dependency>

Which is Already done By this https://github.com/jhipster/jhipster-bom/pull/262/commits

But This Commit Override that changes
jhipster/jhipster-bom@c0cac0e#diff-0d668ec3c10cccac1406ac2a804514459cae3804b12db7d87956ace40698a874

JHipster Version(s)

Jhipster 7.0.1

JHipster configuration
@pascalgrimaud
Copy link
Member

Cc @DanielFran : should we revert the upgrade?

@pascalgrimaud pascalgrimaud added area: bug 🐛 theme: dependencies Pull requests that update a dependency file and removed area: triage theme: undefined labels Jul 1, 2021
@DanielFran
Copy link
Member

@pascalgrimaud we can rollback and create a new bom version, or finish spring-boot 2.5 migration and stay with current version

@DanielFran
Copy link
Member

Closed by #15633

@pascalgrimaud pascalgrimaud added this to the 7.2.0 milestone Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: bug 🐛 theme: dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

3 participants