Skip to content

Commit

Permalink
feat: allow configuring client.id for rust capture (#24662)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankh authored Aug 29, 2024
1 parent f061c47 commit 102f65b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rust/capture/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@ pub struct KafkaConfig {
pub kafka_heatmaps_topic: String,
#[envconfig(default = "false")]
pub kafka_tls: bool,
#[envconfig(default = "")]
pub kafka_client_id: String,
}
5 changes: 5 additions & 0 deletions rust/capture/src/sinks/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ impl KafkaSink {
(config.kafka_producer_queue_mib * 1024).to_string(),
);

if !&config.kafka_client_id.is_empty() {
client_config.set("client.id", &config.kafka_client_id);
}

if config.kafka_tls {
client_config
.set("security.protocol", "ssl")
Expand Down Expand Up @@ -358,6 +362,7 @@ mod tests {
kafka_exceptions_topic: "events_plugin_ingestion".to_string(),
kafka_heatmaps_topic: "events_plugin_ingestion".to_string(),
kafka_tls: false,
kafka_client_id: "".to_string(),
};
let sink = KafkaSink::new(config, handle, limiter).expect("failed to create sink");
(cluster, sink)
Expand Down
1 change: 1 addition & 0 deletions rust/capture/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub static DEFAULT_CONFIG: Lazy<Config> = Lazy::new(|| Config {
kafka_exceptions_topic: "events_plugin_ingestion".to_string(),
kafka_heatmaps_topic: "events_plugin_ingestion".to_string(),
kafka_tls: false,
kafka_client_id: "".to_string(),
},
otel_url: None,
otel_sampling_rate: 0.0,
Expand Down

0 comments on commit 102f65b

Please sign in to comment.