Describe the bug
On the cluster dashboard and brokers list, cluster-wide and per-broker "Bytes In/Out" show 0 B/s, even though each topic's throughput is displayed correctly on the topic details page. This happens when the broker is scraped via JMX (default METRICS_TYPE=JMX) and does not surface the topic-less kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec aggregate in the scraped metric set.
Set up
- kafka-ui: latest (also reproduces on current
main)
- Broker: Confluent
cp-kafka 7.9.7 (Kafka 3.9), JMX enabled
METRICS_TYPE: JMX (default)
Steps to Reproduce
- Connect kafka-ui to a
cp-kafka broker over JMX with live traffic.
- Open the cluster dashboard / brokers list.
- Observe cluster & broker "Bytes In/Out" = 0, while topic details show non-zero throughput.
Root cause
IoRatesMetricsScanner#updateBrokerIOrates populates brokerBytes*FifteenMinuteRate only from the topic-less BrokerTopicMetrics metric (labels.size() == 1).
InternalClusterState derives cluster bytesInPerSec/bytesOutPerSec purely as the sum of the per-broker map; when that map is empty → reduce(...).orElse(null) → 0/null in the UI.
- On this broker the topic-less aggregate is absent from the scraped set (only per-topic metrics are present), so the per-broker map stays empty and cluster throughput collapses to 0 — even though
topicBytes*PerSec is fully populated (the topic details page shows correct rates).
- Verified: the broker DOES register
kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec (read via kafka.tools.JmxTool), but it does not appear in the JMX-scraped set kafka-ui builds. Most likely it is dropped during the JMX→Prometheus conversion because the same metric family carries inconsistent label sets: global {name} vs per-topic {name,topic}.
Expected behavior
Cluster/broker throughput should reflect actual traffic. Since per-topic rates are available and bytes in/out are additive across topics, the all-topics aggregate can be computed as their sum.
Proposed fix
Fall back to summing topicBytes*PerSec when the per-broker aggregate map is empty (mathematically equal to the all-topics broker aggregate).
Suggested labels (for triage): scope/backend, type/bug, area/internal
Describe the bug
On the cluster dashboard and brokers list, cluster-wide and per-broker "Bytes In/Out" show 0 B/s, even though each topic's throughput is displayed correctly on the topic details page. This happens when the broker is scraped via JMX (default
METRICS_TYPE=JMX) and does not surface the topic-lesskafka.server:type=BrokerTopicMetrics,name=BytesInPerSecaggregate in the scraped metric set.Set up
main)cp-kafka7.9.7 (Kafka 3.9), JMX enabledMETRICS_TYPE: JMX (default)Steps to Reproduce
cp-kafkabroker over JMX with live traffic.Root cause
IoRatesMetricsScanner#updateBrokerIOratespopulatesbrokerBytes*FifteenMinuteRateonly from the topic-lessBrokerTopicMetricsmetric (labels.size() == 1).InternalClusterStatederives clusterbytesInPerSec/bytesOutPerSecpurely as the sum of the per-broker map; when that map is empty →reduce(...).orElse(null)→ 0/null in the UI.topicBytes*PerSecis fully populated (the topic details page shows correct rates).kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec(read viakafka.tools.JmxTool), but it does not appear in the JMX-scraped set kafka-ui builds. Most likely it is dropped during the JMX→Prometheus conversion because the same metric family carries inconsistent label sets: global{name}vs per-topic{name,topic}.Expected behavior
Cluster/broker throughput should reflect actual traffic. Since per-topic rates are available and bytes in/out are additive across topics, the all-topics aggregate can be computed as their sum.
Proposed fix
Fall back to summing
topicBytes*PerSecwhen the per-broker aggregate map is empty (mathematically equal to the all-topics broker aggregate).Suggested labels (for triage):
scope/backend,type/bug,area/internal