I'm trying to monitor kafka lag that is exposed via prometheus kafka_consumer_fetch_manager_records_lag_max
, but the value is always either 0
or NaN
Config
factory.addListener(new MicrometerProducerListener<>(meterRegistry));
factory.addListener(new MicrometerConsumerListener<>(meterRegistry));
Producing
public void send(String message) {
createLagTemplate.sendDefault(message);
}
Consuming
@KafkaListener(topics = "create-lag", containerFactory = "lagContainerFactory")
public void listen(String message) throws InterruptedException {
Thread.sleep(5000L);
}
Now when generating a bunch of messages I can see the lag increase via kafka dashboard.
I can see messages being produced and consumed via metrics
kafka_consumer_fetch_manager_records_consumed_total
kafka_producer_topic_record_send_total
I can't see any values from
kafka_consumer_fetch_manager_records_lag_max
Using boot 2.4.5, micrometer 1.6.6
Am I missing any configuration?