我正在使用 Micronaut 框架运行 Kafka Consumer。激活 Prometheus 指标时,应用程序以如下异常开始:
ERROR o.a.kafka.common.metrics.Metrics - Error when registering metric on io.micronaut.configuration.kafka.metrics.KafkaConsumerMetrics$Reporter
java.lang.IllegalArgumentException: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter named 'kafka_response_rate' containing tag keys [client_id]. The meter you are attempting to register has keys [client_id, node_id].
at io.micrometer.prometheus.PrometheusMeterRegistry.lambda$collectorByName$9(PrometheusMeterRegistry.java:372)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1932)
at io.micrometer.prometheus.PrometheusMeterRegistry.collectorByName(PrometheusMeterRegistry.java:359)
at io.micrometer.prometheus.PrometheusMeterRegistry.newGauge(PrometheusMeterRegistry.java:230)
at io.micrometer.core.instrument.MeterRegistry.lambda$gauge$1(MeterRegistry.java:258)
at io.micrometer.core.instrument.MeterRegistry.lambda$registerMeterIfNecessary$5(MeterRegistry.java:528)
at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:580)
at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:543)
at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:528)
at io.micrometer.core.instrument.MeterRegistry.gauge(MeterRegistry.java:258)
at io.micrometer.core.instrument.Gauge$Builder.register(Gauge.java:190)
at io.micrometer.core.instrument.MeterRegistry.gauge(MeterRegistry.java:440)
at io.micronaut.configuration.kafka.metrics.KafkaConsumerMetrics$Reporter.registerMetric(KafkaConsumerMetrics.java:135)
at io.micronaut.configuration.kafka.metrics.KafkaConsumerMetrics$Reporter.metricChange(KafkaConsumerMetrics.java:102)
at org.apache.kafka.common.metrics.Metrics.registerMetric(Metrics.java:563)
at org.apache.kafka.common.metrics.Sensor.add(Sensor.java:240)
at org.apache.kafka.common.metrics.Sensor.add(Sensor.java:221)
at org.apache.kafka.common.network.Selector$SelectorMetrics.maybeRegisterConnectionMetrics(Selector.java:1025)
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:462)
at org.apache.kafka.common.network.Selector.poll(Selector.java:425)
at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:510)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:271)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:242)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:218)
at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureCoordinatorReady(AbstractCoordinator.java:230)
at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:314)
at org.apache.kafka.clients.consumer.KafkaConsumer.updateAssignmentMetadataIfNeeded(KafkaConsumer.java:1218)
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1181)
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1115)
at io.micronaut.configuration.kafka.processor.KafkaConsumerProcessor.lambda$process$7(KafkaConsumerProcessor.java:326)
at io.micrometer.core.instrument.AbstractTimer.record(AbstractTimer.java:160)
at io.micrometer.core.instrument.Timer.lambda$wrap$0(Timer.java:143)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
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)
一些背景信息,我已经使用以下库版本对其进行了测试:
- 卡夫卡客户端 2.0.0、2.1.0
- 微航海 1.0.1
- 千分尺核心和注册表 Prometheus 1.0.6、1.1.1
我没有找到正确的方法,知道该怎么做吗?
谢谢
基督教