0
0
Kafkadevops~10 mins

Key broker metrics in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print the total number of messages produced to the broker.

Kafka
total_messages = broker_metrics.[1]
Drag options to blanks, or click blank then click option'
Amessages_in_per_sec
Bbytes_out_total
Cbytes_in_total
Dmessages_in_total
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a per second rate metric instead of total count.
2fill in blank
medium

Complete the code to get the current rate of bytes sent out by the broker per second.

Kafka
bytes_out_rate = broker_metrics.[1]
Drag options to blanks, or click blank then click option'
Abytes_out_total
Bmessages_out_per_sec
Cbytes_out_per_sec
Dbytes_in_per_sec
Attempts:
3 left
💡 Hint
Common Mistakes
Using total bytes instead of per second rate.
3fill in blank
hard

Fix the error in accessing the broker's request handler average idle percent.

Kafka
idle_percent = broker_metrics.[1]
Drag options to blanks, or click blank then click option'
Arequest_handler_avg_idle_percent
Brequest_handler_idle_avg_percent
Crequest_handler_avg_idle
Drequest_handler_idle_percent_avg
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing the order of words in the metric name.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each topic to its total bytes in.

Kafka
topic_bytes_in = {topic: broker_metrics[topic][1] for topic in topics if broker_metrics[topic][1] [2] 0}
Drag options to blanks, or click blank then click option'
A['bytes_in_total']
B>
C>= 0
D['messages_in_total']
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong metric keys or wrong comparison operators.
5fill in blank
hard

Fill all three blanks to create a filtered dictionary of topics with messages in per second greater than 1000, mapping topic to that rate.

Kafka
high_rate_topics = { [1] : broker_metrics[[2]][3] for [2] in topics if broker_metrics[[2]][3] > 1000 }
Drag options to blanks, or click blank then click option'
Atopic
B'messages_in_per_sec'
C[ 'messages_in_per_sec' ]
Dmessages_in_per_sec
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of string keys for metrics.