Skip to content

Cluster/broker throughput shows 0 B/s despite per-topic rates being populated #1874

Description

@Sangyong-Jeon

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

  1. Connect kafka-ui to a cp-kafka broker over JMX with live traffic.
  2. Open the cluster dashboard / brokers list.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/internalInternal app components. Will be excluded from the changelog.scope/backendRelated to backend changestype/bugSomething isn't working
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions