Complete the code to print the total number of messages produced to the broker.
total_messages = broker_metrics.[1]The messages_in_total metric shows the total number of messages produced to the broker.
Complete the code to get the current rate of bytes sent out by the broker per second.
bytes_out_rate = broker_metrics.[1]The bytes_out_per_sec metric gives the current rate of bytes sent out by the broker each second.
Fix the error in accessing the broker's request handler average idle percent.
idle_percent = broker_metrics.[1]The correct metric name is request_handler_avg_idle_percent which shows the average idle percent of request handlers.
Fill both blanks to create a dictionary comprehension that maps each topic to its total bytes in.
topic_bytes_in = {topic: broker_metrics[topic][1] for topic in topics if broker_metrics[topic][1] [2] 0}The first blank accesses the bytes_in_total metric for each topic. The second blank filters topics with bytes in greater than zero.
Fill all three blanks to create a filtered dictionary of topics with messages in per second greater than 1000, mapping topic to that rate.
high_rate_topics = { [1] : broker_metrics[[2]][3] for [2] in topics if broker_metrics[[2]][3] > 1000 }The dictionary maps each topic to its messages_in_per_sec metric value. The metric is accessed with square brackets and the string key.