Add share group consumer#252
Conversation
alexcams
left a comment
There was a problem hiding this comment.
Thanks for this contribution @orangecola! The overall implementation looks nice, just left some nits worth to check.
Could you also update CHANGELOG.md file and bump version in gempspec?
|
Addressed comments and updated version files.
|
There was a problem hiding this comment.
Thanks for addressing the comments @orangecola! I've been testing this feature manually and I can confirm the share group consumer works correctly — records are distributed across threads without specific thread-partition assignment.
While checking the docs, I've seen a recommendation for consumer_threads config that states:
Ideally you should have as many threads as the number of partitions for a perfect balance -- more threads than partitions means that some threads will be idle
in 3 places:
- http://github.com/logstash-plugins/logstash-integration-kafka/blob/main/docs/input-kafka.asciidoc?plain=1#L61
- https://github.com/logstash-plugins/logstash-integration-kafka/blob/main/docs/input-kafka.asciidoc?plain=1#L294
- https://github.com/logstash-plugins/logstash-integration-kafka/blob/main/lib/logstash/inputs/kafka.rb#L103
Would you mind updating this to be consistent with the new share_group consumer mode?
Thanks in advance!
alexcams
left a comment
There was a problem hiding this comment.
Requested changes in last review
|
mb, didn't push changes. |
There was a problem hiding this comment.
I believe this feature will be 🚀. Thank you alot for the contribution.
The implementation details, docs and format look good to me as well (will review docs section with second round).
One critical concern is that when pipeline config contains the params which cannot be used with share_group, I would support raising a config error instead of silently ignoring. For example, the following config looks invalid to me:
input {
kafka {
enable_auto_commit => true
consumer_mode => "share_group"
}
}
| !header.nil? && !header.value.nil? && !header.key.nil? | ||
| end | ||
|
|
||
| def validate_share_group_config! |
There was a problem hiding this comment.
not_allowed_configs_with_share_group = original_params.keys & %w( group_protocol group_instance_id partition_assignment_strategy enable_auto_commit auto_commit_interval_ms)
if not_allowed_configs_with_share_group.size > 1
error_message = "#{not_allowed_configs_with_share_group} options cannot be used together when `consumer_mode => 'share_group'`"
raise LogStash::ConfigurationError, error_message
end
| # Schema Registry (`schema_registry_url`) is also not supported. | ||
| # The following options are silently ignored in `share_group` mode because they do not | ||
| # apply to the Share Group protocol: `heartbeat_interval_ms`, `session_timeout_ms`, | ||
| # `isolation_level`, `enable_auto_commit`, `auto_commit_interval_ms`, `auto_offset_reset`, |
There was a problem hiding this comment.
I will also pull, run on my local and review in detail but I would be really specific and not allow enable_auto_commit, heartbeat_interval_ms, etc... params if pipeline config contains. The original_params.keys provides the pipeline config param keys (I will comment below how it can be used).
|
Combined |
yaauie
left a comment
There was a problem hiding this comment.
Overall, excellent work and a welcome contribution. Thank you!
I've left a few comments in-line, addressing:
- translating the kafka-ish docs to how the settings apply in the context of a logstash pipeline
- validating that
share_group-specific config options aren't used in conjunction with theconsumer_mode => consumer_group(an inversion of the check already added that ensures thatconsumer_group-specific settings aren't used with the newconsumer_mode => share_group)
|
💚 CLA has been signed |
- Move check_crcs and auto_create_topics to build_common_props (both supported by KafkaShareConsumer) - Add CONSUMER_GROUP_ONLY_OPTIONS + validate_consumer_group_config! to raise on share_group_acknowledgement_on_error with consumer_group mode - Release unprocessed records on shutdown in share_group_thread_runner instead of blocking on queue - Replace ternary with if/else for @share_group_ack_error_type assignment - Update consumer_threads docs with clearer partition/thread guidance per mode - Update share group acknowledgement docs to clarify pipeline queue visibility boundary - Update share_group_acknowledgement_on_error docs to frame around pipeline semantics - Add note about broker/group-level equivalents for incompatible share_group options Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove check_crcs from share_group incompatible list in unit test (it's now supported) - Add unit test confirming check_crcs is accepted in share_group mode - Add unit test for validate_consumer_group_config! raising on share_group_acknowledgement_on_error - Add share_group integration tests: config validation + live consumption via Kafka 4.2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com>
Fixes #251
E2E Testing: