Skip to content

Commit 99c4705

Browse files
Optimize Kafka config queries (DataDog#22721)
* Optimize Kafka config queries * add changelog * report schema versions correctly * Address PR comments * fmt * fix tests * Point to Data Streams from readme * Mention Data Streams in enable_cluster_monitoring * Add size limit to schema latest version cache to prevent unbounded disk growth Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Sync conf.yaml.example after rebase Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix misleading docstring in _save_latest_version_cache Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2a97cf5 commit 99c4705

10 files changed

Lines changed: 795 additions & 174 deletions

File tree

kafka_consumer/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ instances:
6060

6161
### Cluster Monitoring (Preview)
6262

63-
In addition to consumer lag metrics, this integration can collect comprehensive cluster metadata when `enable_cluster_monitoring` is enabled:
63+
When `enable_cluster_monitoring` is enabled, the integration collects cluster-wide metrics for [Data Streams Monitoring][18] in addition to consumer lag:
6464

65-
- **Broker information**: Configuration and health metrics
66-
- **Topic and partition details**: Sizes, offsets, replication status
67-
- **Consumer group metadata**: Member details and group state
68-
- **Schema registry**: Schema information (if `schema_registry_url` is provided)
65+
- **Brokers**: Configuration and health metrics
66+
- **Topics and partitions**: Sizes, offsets, and replication status
67+
- **Consumer groups**: Member details and group state
68+
- **Schema registry**: Schema metadata (requires `schema_registry_url`)
6969

70-
All cluster monitoring metrics are tagged with `kafka_cluster_id` for easy filtering.
70+
#### Batched collection
7171

72-
**Note**: This feature is in Preview and may increase Agent resource consumption on large clusters. The integration caches configuration and schema events to reduce volume.
72+
Broker configurations, topic configurations, and schema registry version checks are collected in batches across multiple agent runs rather than all at once. This reduces load on large Kafka clusters but means that not all metrics are emitted in every check run. On a cluster with many brokers, topics, or schema subjects, the integration spreads the work over successive runs so that each run stays fast and does not overload the cluster.
7373

7474
Example configuration:
7575
```yaml

kafka_consumer/assets/configuration/spec.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ files:
310310
type: string
311311
- name: enable_cluster_monitoring
312312
description: |
313-
(PREVIEW) Enable cluster monitoring to collect broker, topic, partition, consumer group,
313+
(PREVIEW) Enable cluster monitoring to collect cluster-wide metrics for Data Streams
314+
Monitoring. Collects broker, topic, partition, consumer group,
314315
and schema registry metadata. Events are cached and tagged with kafka_cluster_id.
315316
May increase resource consumption on large clusters.
316317
@@ -323,6 +324,18 @@ files:
323324
type: boolean
324325
example: false
325326
display_default: false
327+
- name: kafka_configs_refresh_interval
328+
description: |
329+
How often (in seconds) to re-fetch broker configurations, topic configurations,
330+
and schema registry version checks from Kafka. A longer interval reduces load on
331+
the Kafka cluster and Schema Registry. On clusters with many topics or schemas,
332+
the check fetches in batches and gracefully degrades by re-fetching less often if
333+
it cannot keep up within this interval.
334+
fleet_configurable: true
335+
value:
336+
type: integer
337+
example: 180
338+
display_default: 180
326339
- name: schema_registry_url
327340
description: |
328341
Schema Registry URL. When set with enable_cluster_monitoring, collects schema information.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Broker configurations, topic configurations, and schema registry version checks are now collected in batches across multiple agent runs instead of all at once. This reduces load on large clusters but means that not all metrics are emitted in every check run. The batch sizes and refresh interval are controlled by the `kafka_configs_refresh_interval` configuration option.

0 commit comments

Comments
 (0)