Challenge - 5 Problems
Kafka Consumer Lag Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Check consumer lag using kafka-consumer-groups.sh
You run the command
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-group. What output will you see regarding consumer lag?Kafka
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-groupAttempts:
2 left
💡 Hint
Lag is the difference between log end offset and current offset.
✗ Incorrect
The lag is calculated as LOG-END-OFFSET minus CURRENT-OFFSET. It cannot be negative. Option C shows a positive lag of 50, which is correct. Option C shows negative lag, which is invalid. Option C is an error message, and option C shows zero lag.
🧠 Conceptual
intermediate1:30remaining
Understanding consumer lag causes
Which of the following is the most common cause of increasing consumer lag in Kafka?
Attempts:
2 left
💡 Hint
Lag grows when consumption speed is less than production speed.
✗ Incorrect
Consumer lag increases when the consumer cannot keep up with the rate of new messages produced. Broker downtime or topic partitions affect availability but do not directly cause lag to increase steadily. Changing group ID resets offsets but does not cause lag to grow.
🔀 Workflow
advanced2:30remaining
Steps to monitor consumer lag with Prometheus and Kafka Exporter
You want to monitor Kafka consumer lag using Prometheus and Kafka Exporter. Which sequence of steps is correct?
Attempts:
2 left
💡 Hint
Start by collecting metrics, then scrape, visualize, and alert.
✗ Incorrect
First, Kafka Exporter collects metrics. Then Prometheus scrapes those metrics. Next, Grafana visualizes the data. Finally, alert rules notify on high lag.
❓ Troubleshoot
advanced2:00remaining
Troubleshoot missing consumer lag metrics in Prometheus
You notice Prometheus does not show consumer lag metrics after setting up Kafka Exporter. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check Kafka Exporter connection settings first.
✗ Incorrect
If Kafka Exporter cannot connect to Kafka due to wrong bootstrap servers, it cannot collect metrics. Scraping frequency or Grafana refresh do not affect metric availability in Prometheus. Topic partitions do not prevent metrics collection.
✅ Best Practice
expert3:00remaining
Best practice for alerting on consumer lag
Which alerting strategy is best to avoid false alarms when monitoring Kafka consumer lag?
Attempts:
2 left
💡 Hint
Consider lag spikes that resolve quickly.
✗ Incorrect
Lag can spike briefly during normal operation. Alerting only after lag exceeds a threshold for some time reduces noise. Immediate alerts or alerts based on group ID changes cause many false alarms. Limiting alerts to business hours may miss critical issues.