seglo / kafka-lag-exporter

Monitor Kafka Consumer Group Latency with Kafka Lag Exporter
Apache License 2.0
640 stars 189 forks source link

Reporting old metrics if topic is re-created within poll interval #197

Open seruman opened 3 years ago

seruman commented 3 years ago

Describe the bug If a topic is deleted then re-created within poll interval, exporter reports kafka_partition_latest_offset as the value before deletion. This also causes lag metrics to be wrong since they're derived from it.

To Reproduce Logs: https://gist.github.com/seruman/6f9a6718e29760af41683a4b45bd5ef2 Config:

kafka-lag-exporter {
  port = 8000
  client-group-id = "kafkalagexporter"
  kafka-client-timeout = 30 seconds
  clusters = [
    {
     name = "local"
     bootstrap-brokers = "kafka:9092"
    }
  ]
}

Environment

Additional context screencapture-localhost-19090-graph-2021-03-03-15_59_45

seglo commented 3 years ago

Interesting. Will the latest offset ever reset on its own (perhaps after 2 intervals?) or does it remain in this state indefinitely?

seruman commented 3 years ago

It stays in that state. Previous logs I've shared only had a single poll before shutting the exporter down. It still reports old state even after multiple intervals;

Lately we experienced this again, it was still reporting the old latest offset even after an hour the topic recreated;

seruman commented 2 years ago

Hi @seglo, Since there were new releases, I tried to re-produce the issue with the 0.7.1 and I can confirm it is still re-producable even after multiple poll intervals.