-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Kafka introduced the DescribeCluster API (API Key 60) in KIP-700, starting from Kafka 2.8.0.
The protocol definition is documented in the official spec
This API exposes cluster-level metadata directly and avoids the overhead of issuing a full MetadataRequest.
The Java client (AdminClient) already uses this API when supported by the broker, as seen in the related PR:
apache/kafka#9905
Current Situation in Sarama
ClusterAdmin.DescribeCluster() currently:
- Sends a full
MetadataRequest(including all topics) - Extracts only limited cluster-level fields from the response
This approach is heavier than necessary and scales poorly on clusters with many topics.
Proposal
- Add protocol support for API Key 60 (DescribeCluster)
- Make
DescribeCluster()prefer this API when broker support is advertised - Fallback to
MetadataRequestautomatically based onApiVersionsnegotiation
Compatibility
This change is naturally backward-compatible.
Older brokers simply do not advertise API Key 60, so Sarama can continue using existing logic without behavior changes.
Supporting DescribeCluster allows Sarama to align with Kafka’s protocol evolution, match the Java client’s behavior, and reduce unnecessary metadata overhead.
If this feature request is acceptable, I’m willing to help with the implementation when time permits.
Anyone interested is also welcome to take this issue directly.