Spring kafka consumer lag metric is always 0

Viewed 925

we're building a monitoring system for our Spring Boot application using micrometer. Metrics gathered are published to an Elasticsearch instance through micrometer-registry-elastic. Everything is fine, except for:

  • kafka_consumer_fetch_manager_records_lag is always 0, even when I'm sure there's lag on the consumer group
  • kafka_consumer_fetch_manager_records_lag_avg is always 0, even when I'm sure there's lag on the consumer group
  • kafka_consumer_fetch_manager_records_lag_max has a value different from 0 only on the first measurement exposed.

All other metrics such as kafka_consumer_fetch_manager_records_lead are correctly set.

Versions involved:

  • spring-boot:2.5.4
  • micrometer:1.7.3
  • micrometer-registry-elastic:1.7.3
  • spring-kafka:2.7.6
  • kafka-clients:2.7.1
  • Kafka broker: 2.7.0

I debugged the entire setup and there's no evidence of error, MicrometerConsumerListener is correctly created, even KafkaClientMetricsand all the Sensorinstances. I have no idea what's the problem, we haven't any particular customization and no error logging message. It seems like there aren't samples with value different from 0 for the metrics above, but I'm pretty sure there's lag on the broker because I verified that through command line tool directly on the broker.

Any thoughts? Thanks a lot

0 Answers
Related