Repository navigation
feat(kafka): add rackId for kafka consumers - #4872
Conversation
📝 WalkthroughWalkthroughKafka configuration now supports an optional client rack. The setting maps to ChangesKafka client rack configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
config.example.yaml (1)
213-215: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDocument the broker-side prerequisites.
clientRackmust match the brokerbroker.rack. Follower selection depends on the brokerreplica.selector.class, and rack-aware assignment is best effort with compatible Kafka versions. SettingclientRack: use1-az1alone does not guarantee same-rack fetching. Add a short prerequisite note here. (cwiki.apache.org)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@config.example.yaml` around lines 213 - 215, Update the clientRack configuration comments to add a concise prerequisite note: clientRack must match broker.rack, follower selection requires the broker replica.selector.class configuration, and rack-aware assignment is best effort with compatible Kafka versions.Source: MCP tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/kafka/config_test.go`:
- Around line 41-42: Add a test case in the existing Kafka config test covering
ClientRack set to an empty string, and explicitly assert that the resulting
configuration does not contain the client.rack key. Retain the current
configured-rack assertions and ensure the new case verifies unexpected keys are
absent.
---
Nitpick comments:
In `@config.example.yaml`:
- Around line 213-215: Update the clientRack configuration comments to add a
concise prerequisite note: clientRack must match broker.rack, follower selection
requires the broker replica.selector.class configuration, and rack-aware
assignment is best effort with compatible Kafka versions.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7125471c-877b-4d14-b181-d09cc9ecec61
📒 Files selected for processing (6)
app/config/config_test.goapp/config/kafka.goapp/config/testdata/complete.yamlconfig.example.yamlpkg/kafka/config.gopkg/kafka/config_test.go
8dfd6ce to
a83d5e4
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Summary
Adds clientRack config option, mapped to librdkafka's client.rack setting.
Why
Enables rack-aware consumer group assignment and lets consumers fetch from replicas in the same rack/AZ, reducing cross-AZ network traffic and cost.
Changes
Compatibility
Backward compatible. Field defaults to empty, so client.rack is only set when explicitly configured.
Summary by CodeRabbit
New Features
Bug Fixes
Greptile Summary
The PR adds an optional Kafka client rack setting and maps it to librdkafka’s
client.rackproperty.kafka.clientRackconfiguration default.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
ClientRackfield and conditionally maps it to librdkafka’sclient.rackproperty.ClientRack.Reviews (2): Last reviewed commit: "feat(kafka): add rackId for kafka consum..." | Re-trigger Greptile