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.

chore(personhog-replica): use gzip compression (#60114)

Zach Brown6c0bdc449c4b
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 99b844857816..c3f6b7ffdfba 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -10429,6 +10429,7 @@ dependencies = [
"axum 0.7.9",
"base64 0.22.1",
"bytes",
+ "flate2",
"h2 0.4.13",
"http 1.4.0",
"http-body 1.0.1",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index c2a222b0b3ae..3052eac1e26a 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -180,7 +180,7 @@ regex = "1.11.1"
fancy-regex = "0.17"
lz-str = "0.2.1"
opentelemetry-proto = { version = "0.29.0", features = ["with-serde"] }
-tonic = { version = "0.12.3", features = ["zstd"] }
+tonic = { version = "0.12.3", features = ["zstd", "gzip"] }
tonic-build = "0.12"
clickhouse = { version = "0.13.2", features = [
"uuid",
diff --git a/rust/personhog-replica/src/main.rs b/rust/personhog-replica/src/main.rs
index b477f3b92226..a09284843789 100644
--- a/rust/personhog-replica/src/main.rs
+++ b/rust/personhog-replica/src/main.rs
@@ -340,7 +340,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.max_encoding_message_size(max_send)
.max_decoding_message_size(max_recv)
.accept_compressed(CompressionEncoding::Zstd)
- .send_compressed(CompressionEncoding::Zstd),
+ .send_compressed(CompressionEncoding::Zstd)
+ .accept_compressed(CompressionEncoding::Gzip)
+ .send_compressed(CompressionEncoding::Gzip),
)
.serve_with_incoming_shutdown(incoming, grpc_handle.shutdown_signal())
.await
diff --git a/rust/personhog-router/src/main.rs b/rust/personhog-router/src/main.rs
index b5972a571702..4b2b82f634d9 100644
--- a/rust/personhog-router/src/main.rs
+++ b/rust/personhog-router/src/main.rs
@@ -22,6 +22,7 @@ use personhog_router::router::PersonHogRouter;
use personhog_router::service::PersonHogRouterService;
use personhog_router::stash_handler::RouterStashHandler;
use tokio_util::sync::CancellationToken;
+use tonic::codec::CompressionEncoding;
use tonic::transport::Server;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::fmt;
@@ -338,7 +339,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_service(
PersonHogServiceServer::new(service)
.max_encoding_message_size(max_send)
- .max_decoding_message_size(max_recv),
+ .max_decoding_message_size(max_recv)
+ .accept_compressed(CompressionEncoding::Gzip)
+ .send_compressed(CompressionEncoding::Gzip),
)
.serve_with_incoming_shutdown(incoming, grpc_handle.shutdown_signal())
.await