Current State: Accepted

Discussion Thread: here

JIRA:  KAFKA-5461 - Getting issue details... STATUS

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).


There is currently no metric that captures the total number of topics in a Kafka cluster. It would be useful to maintain a total topic count metric on the Kafka Controller.

Public Interface

There are no programming public interface changes. We are only adding a new metric.

Proposed Changes

The metric name would be:

  • GlobalTopicCount


type: gauge

value: count of all topics within the cluster

GlobalTopicCount is updated when the ControllerEventThread gets a TopicChange and TopicDeletion request and is purged on Controller failover.

  • GlobalPartitionCount


type: gauge

value: count of partitions across all topics in the cluster

GlobalPartitionCount is updated when the ControllerEventThread gets a TopicChange, TopicDeletion, and PartitionReassigment request and is purged on Controller failover.

Compatibility and Migration Plan

The changes are completely backward compatible.

Rejected Alternatives

Aggregate GlobalTopicCount metric from the MetadataCache for each Broker. This approach was rejected because it is not the source of truth (as opposed to the controller metric). This approach nevertheless is potentially useful in identifying delays in metadata propagation to the brokers.

type: gauge
value: count of all topics within a cluster



  • No labels