Repository navigation
Conversation
b1a5f53 to
f506c7f
Compare
✅ Dispatcher tests: passed
✅ 6 passed · nothing failed Batches · ✅ batch-01 6/6 Dispatcher finished on |
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
ℹ️ Info🎯 Code Coverage (details) Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 44ba95a | Docs | View more details | Give us feedback! |
|
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
|
I have read the CLA Document and I hereby sign the CLA |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Combining sharding with Kafka Console counts each consumer-group membership change once per shard because metadata collection ignores shard ownership.
🤖 Bits Code Review · Commit f506c7f
| in_shard = self.config.in_consumer_groups_shard | ||
| if self.config._monitor_unlisted_consumer_groups: | ||
| return [grp for grp in self.client.list_consumer_groups() if grp] | ||
| return [grp for grp in self.client.list_consumer_groups() if grp and in_shard(grp)] |
There was a problem hiding this comment.
Apply shard ownership to Kafka Console group metadata
With enable_kafka_console enabled across N shard instances, this filter partitions offset collection, but ClusterMetadataCollector independently describes every consumer group on every instance. Each membership change therefore emits kafka.consumer_group.membership_changes once per shard instead of once overall, inflating counts and duplicating membership events. Apply shard ownership to consumer-group metadata collection as well, or reject this configuration combination.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
There was a problem hiding this comment.
Agreed. Fixed in fbb9a231 by rejecting the combination: consumer_groups_shard_count greater than 1 with enable_kafka_console (or enable_cluster_monitoring) now raises a ConfigurationError, with a test for both option names.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f506c7f438
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| in_shard = self.config.in_consumer_groups_shard | ||
| if self.config._monitor_unlisted_consumer_groups: | ||
| return [grp for grp in self.client.list_consumer_groups() if grp] | ||
| return [grp for grp in self.client.list_consumer_groups() if grp and in_shard(grp)] |
There was a problem hiding this comment.
Shard Kafka Console group metadata too
When enable_kafka_console is enabled (which sets _monitor_unlisted_consumer_groups), this filters only the offset-discovery path. The same run invokes ClusterMetadataCollector.collect_all_metadata, and _collect_consumer_group_metadata in cluster_metadata.py:782-858 still lists, describes, and emits metrics/events for every group on every shard. Consequently an N-shard deployment retains the full metadata workload on each runner and can emit consumer_group.membership_changes once per shard with identical tags for a single transition, overcounting that metric; apply the shard predicate to this collector while keeping any truly cluster-wide summary on one shard.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch, thanks. Fixed in fbb9a231 by rejecting the combination: an instance with consumer_groups_shard_count greater than 1 and enable_kafka_console (or enable_cluster_monitoring) now raises a ConfigurationError, and the option docs say so. Sharding the Kafka Console metadata, with the cluster-wide part on a single shard, would be a larger change to ClusterMetadataCollector; I would rather keep it out of this PR.
f506c7f to
fbb9a23
Compare
|
Sharding is currently rejected together with |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fbb9a23158
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
|
|
||
| def sharded_instance(kafka_instance, shard_index, shard_count=3, **options): | ||
| kafka_instance.pop("consumer_groups", None) |
There was a problem hiding this comment.
Add type hints to the new test helper
The newly added sharded_instance helper leaves its arguments and return value unannotated even though it is a regular helper function, so add annotations for the instance mapping, shard values, options, and returned mapping to comply with the root repository requirement that new functions and methods carry type hints.
AGENTS.md reference: AGENTS.md:L33-L35
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 44ba95a: sharded_instance now annotates its arguments and return type.
Add consumer_groups_shard_count and consumer_groups_shard_index so one cluster's consumer groups can be split across several instances, and therefore several cluster check runners. Groups are assigned by a stable crc32 hash of the group ID and dropped before their offsets are fetched.
fbb9a23 to
44ba95a
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
What does this PR do?
Adds two
kafka_consumerinstance options,consumer_groups_shard_countandconsumer_groups_shard_index, to split the consumer groups of one Kafka cluster across several instances.Each group belongs to shard
zlib.crc32(group_id) % consumer_groups_shard_count, so every instance agrees on the assignment across processes and restarts._get_consumer_groupsdrops the groups outside the instance's shard before any offsets are fetched, withmonitor_unlisted_consumer_groups,consumer_groups_regexandconsumer_groupsalike. Highwater offsets follow, as they are only fetched for the partitions the shard's groups consume.consumer_groups_shard_indexis required when the count is above 1: defaulting it to 0 would silently collect only part of the groups. Out-of-range values raiseConfigurationError, and so does sharding together withenable_kafka_console, whose cluster-wide metadata collection would otherwise run on every shard. Without the options nothing changes.Motivation
With
monitor_unlisted_consumer_groups, one check run collects every group of the cluster, and that run can only go to one cluster check runner. On a cluster with about 17k groups (about 1.08M consumer contexts), a single run took about 30s at 1.8 cores and 1.6Gi, and still stopped at the 2M context limit. On a cluster with about 42k groups, runners were OOM-killed at 16Gi.Running this branch against the 17k-group cluster as 3 instances on 3 runners, each instance covered between 5,731 and 5,831 groups with no overlap, ran in 6 to 9s and peaked at about 0.7Gi.
Two Cluster Agent changes build on this: DataDog/datadog-agent#59382 generates the shard instances from a single config, and DataDog/datadog-agent#59381 keeps them on different runners.
QA:
kafka_consumeris only owned by@DataDog/agent-integrations, so this should beqa/skip-qa. I can't set labels from a fork.Checklist before requesting review