-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Set client.id for Kafka source #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: sekoia
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ use quickwit_actors::{ActorExitStatus, Mailbox}; | |
| use quickwit_config::KafkaSourceParams; | ||
| use quickwit_metastore::checkpoint::{PartitionId, SourceCheckpoint}; | ||
| use quickwit_proto::metastore::SourceType; | ||
| use quickwit_proto::types::{IndexUid, Position}; | ||
| use quickwit_proto::types::{IndexUid, NodeIdRef, Position}; | ||
| use rdkafka::config::{ClientConfig, RDKafkaLogLevel}; | ||
| use rdkafka::consumer::{ | ||
| BaseConsumer, CommitMode, Consumer, ConsumerContext, DefaultConsumerContext, Rebalance, | ||
|
|
@@ -240,6 +240,7 @@ impl KafkaSource { | |
| let (events_tx, events_rx) = mpsc::channel(100); | ||
| let (truncate_tx, truncate_rx) = watch::channel(SourceCheckpoint::default()); | ||
| let (client_config, consumer, group_id) = create_consumer( | ||
| source_runtime.node_id(), | ||
| source_runtime.index_uid(), | ||
| source_runtime.source_id(), | ||
| source_params, | ||
|
|
@@ -654,6 +655,7 @@ pub(super) async fn check_connectivity(params: KafkaSourceParams) -> anyhow::Res | |
|
|
||
| /// Creates a new `KafkaSourceConsumer`. | ||
| fn create_consumer( | ||
| node_id: &NodeIdRef, | ||
| index_uid: &IndexUid, | ||
| source_id: &str, | ||
| params: KafkaSourceParams, | ||
|
|
@@ -676,6 +678,7 @@ fn create_consumer( | |
| params.enable_backfill_mode.to_string(), | ||
| ) | ||
| .set("group.id", &group_id) | ||
| .set("client.id", node_id.as_str()) | ||
| .set_log_level(log_level) | ||
|
Comment on lines
680
to
682
|
||
| .create_with_context(RdKafkaContext { | ||
| topic: params.topic, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client.idis being set unconditionally, which will override anyclient.idprovided by users viaparams.client_params. That’s a behavioral change that can break existing Kafka quota/monitoring setups. Consider only setting a defaultclient.idwhen it is not already present inclient_params, and leaving the user-specified value intact when provided.