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.

feat(personhog): open several router channels from identity (#100009)

José Sequeirac081fec5dfb2
diff --git a/rust/personhog-identity/src/config.rs b/rust/personhog-identity/src/config.rs
index d96f33b0b504..f1fba2ffb794 100644
--- a/rust/personhog-identity/src/config.rs
+++ b/rust/personhog-identity/src/config.rs
@@ -82,6 +82,14 @@ pub struct Config {
#[envconfig(default = "http://127.0.0.1:50054")]
pub router_url: String,
+ /// HTTP/2 connections to open to the router, used round-robin per
+ /// request. Each connection lands on one router pod for its lifetime,
+ /// so a single connection pins every leader call of this pod to one
+ /// router and serializes the lifecycle fan-out onto one socket
+ /// (0 acts as 1).
+ #[envconfig(default = "4")]
+ pub router_channels: usize,
+
/// Per-call timeout for leader-routed property writes (ms).
#[envconfig(default = "5000")]
pub leader_request_timeout_ms: u64,
diff --git a/rust/personhog-identity/src/main.rs b/rust/personhog-identity/src/main.rs
index c386e5fc09ec..b2d424b69661 100644
--- a/rust/personhog-identity/src/main.rs
+++ b/rust/personhog-identity/src/main.rs
@@ -79,6 +79,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing::info!(
property_write_concurrency = config.property_write_concurrency,
leader_call_concurrency = config.lifecycle_leader_call_concurrency,
+ router_channels = config.router_channels,
"Leader fan-out concurrency"
);
tracing::info!("Tables: {:?}", config.tables());
@@ -218,9 +219,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);
let property_writer = Arc::new(
- RouterClient::new(&config.router_url, config.leader_request_timeout())
- .expect("Invalid router URL")
- .with_client_name("personhog-identity"),
+ RouterClient::with_channels(
+ &config.router_url,
+ config.leader_request_timeout(),
+ config.router_channels,
+ )
+ .expect("Invalid router URL")
+ .with_client_name("personhog-identity"),
);
// Both sagas' leader surface, reached through the router like the
// property writes.