0
0
Kafkadevops~20 mins

Consumer lag monitoring in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka Consumer Lag Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2: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-group
A
GROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                    HOST            CLIENT-ID
my-group        my-topic        0          150             100             -50             consumer-1-12345                               /127.0.0.1      consumer-1
BError: Unknown group 'my-group' not found
C
GROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                    HOST            CLIENT-ID
my-group        my-topic        0          100             150             50              consumer-1-12345                               /127.0.0.1      consumer-1
D
GROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                    HOST            CLIENT-ID
my-group        my-topic        0          0               0               0               consumer-1-12345                               /127.0.0.1      consumer-1
Attempts:
2 left
💡 Hint
Lag is the difference between log end offset and current offset.
🧠 Conceptual
intermediate
1:30remaining
Understanding consumer lag causes
Which of the following is the most common cause of increasing consumer lag in Kafka?
AThe consumer group ID is changed frequently
BThe Kafka broker is down
CThe topic has no partitions
DThe consumer is processing messages slower than the producer is producing them
Attempts:
2 left
💡 Hint
Lag grows when consumption speed is less than production speed.
🔀 Workflow
advanced
2: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?
A1,2,3,4
B2,1,4,3
C4,3,2,1
D1,3,2,4
Attempts:
2 left
💡 Hint
Start by collecting metrics, then scrape, visualize, and alert.
Troubleshoot
advanced
2: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?
AKafka Exporter is not configured with the correct Kafka bootstrap servers
BPrometheus is scraping metrics too frequently
CGrafana dashboard is not refreshed
DKafka topic has zero partitions
Attempts:
2 left
💡 Hint
Check Kafka Exporter connection settings first.
Best Practice
expert
3:00remaining
Best practice for alerting on consumer lag
Which alerting strategy is best to avoid false alarms when monitoring Kafka consumer lag?
AAlert immediately when lag is greater than zero
BAlert only if lag exceeds a threshold for a sustained period
CAlert based on consumer group ID changes
DAlert only during business hours regardless of lag
Attempts:
2 left
💡 Hint
Consider lag spikes that resolve quickly.