Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ingestion-consumer): set metadata.broker.list to match Node config (#57566)

José Sequeira041c68cb1930
diff --git a/rust/ingestion-consumer/src/kafka_config.rs b/rust/ingestion-consumer/src/kafka_config.rs
index 56c09f6c84e7..d786d57f2aa1 100644
--- a/rust/ingestion-consumer/src/kafka_config.rs
+++ b/rust/ingestion-consumer/src/kafka_config.rs
@@ -22,11 +22,18 @@ impl ConsumerConfigBuilder {
///
/// Sets: auto.offset.store=false, auto.commit=false, socket.timeout.ms,
/// session.timeout.ms, heartbeat.interval.ms, max.poll.interval.ms.
+ ///
+ /// Uses `metadata.broker.list` (not `bootstrap.servers`) to match the Node.js
+ /// KafkaConsumer in posthog-app. The two are aliases in librdkafka, but
+ /// rdkafka-rs's HashMap-backed ClientConfig has non-deterministic iteration
+ /// order, so setting both via different `KAFKA_*` env vars caused consumers
+ /// to land on the wrong cluster non-deterministically. Sticking with the
+ /// same key Node uses keeps env-var overrides idempotent.
pub fn for_batch_consumer(bootstrap_servers: &str, group_id: &str) -> Self {
let mut config = ClientConfig::new();
config
- .set("bootstrap.servers", bootstrap_servers)
+ .set("metadata.broker.list", bootstrap_servers)
.set("group.id", group_id);
// Group-consumer defaults