Challenge - 5 Problems
Kafka Broker Metrics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Kafka broker metric query
Given the following Kafka broker metrics query snippet, what is the output when querying the metric
kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=TestTopic?Kafka
kafka-run-class kafka.tools.JmxTool --jmx-url service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi --object-name kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=TestTopic
Attempts:
2 left
💡 Hint
Check the metric name and topic parameter carefully.
✗ Incorrect
The metric kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=TestTopic returns the count and rates of messages received per second for the topic 'TestTopic'. The output shows actual metric values.
🧠 Conceptual
intermediate1:30remaining
Understanding Kafka broker metric 'UnderReplicatedPartitions'
What does the Kafka broker metric
UnderReplicatedPartitions indicate?Attempts:
2 left
💡 Hint
Think about replication health and data safety.
✗ Incorrect
UnderReplicatedPartitions counts partitions where some replicas are not in sync, indicating potential data loss risk if the leader fails.
🔧 Debug
advanced2:00remaining
Identify the error in Kafka broker metric retrieval code
What error will the following code produce when trying to fetch the broker metric
kafka.network:type=RequestMetrics,name=RequestsPerSec,request=Produce?
from kafka import KafkaAdminClient
admin_client = KafkaAdminClient(bootstrap_servers='localhost:9092')
metric = admin_client.get_metric('kafka.network:type=RequestMetrics,name=RequestsPerSec,request=Produce')
print(metric)Attempts:
2 left
💡 Hint
Check if KafkaAdminClient supports metric retrieval directly.
✗ Incorrect
KafkaAdminClient does not have a method named get_metric. Metrics are accessed via JMX or other monitoring tools, not via this client.
📝 Syntax
advanced1:30remaining
Correct syntax for filtering Kafka broker metrics by topic
Which of the following JMX object names correctly filters the Kafka broker metric
BytesInPerSec for the topic myTopic?Attempts:
2 left
💡 Hint
JMX object names use commas to separate key-value pairs.
✗ Incorrect
JMX object names separate key-value pairs with commas. The correct syntax uses commas, not semicolons, slashes, or question marks.
🚀 Application
expert2:00remaining
Calculate total messages in per second across all topics
You have the following metrics for two topics on a Kafka broker:
- kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=TopicA: Count=1000, MeanRate=15.0
- kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=TopicB: Count=2000, MeanRate=25.0
What is the total MeanRate of messages in per second across both topics?
Attempts:
2 left
💡 Hint
Add the MeanRate values for both topics.
✗ Incorrect
MeanRate is the average messages per second. Adding 15.0 and 25.0 gives 40.0 total messages per second.