: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(usage-ingestion): install a rustls provider for the Valkey counters (#95896)
Ben Whitecab2e7ddca85
diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 202ecda22e9b..53943a4b38fe 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -13895,6 +13895,7 @@ dependencies = ["rdkafka","redis","reqwest 0.12.28",+ "rustls 0.23.37","serde","serde_json","sqlx",diff --git a/rust/usage-ingestion/Cargo.toml b/rust/usage-ingestion/Cargo.tomlindex 5d7a25742664..7f6b1d20d06c 100644--- a/rust/usage-ingestion/Cargo.toml+++ b/rust/usage-ingestion/Cargo.toml@@ -20,6 +20,8 @@ metrics-exporter-prometheus = { workspace = true }moka = { workspace = true }rdkafka = { workspace = true }redis = { workspace = true }+# redis leaves the rustls provider to the binary, so `rediss://` needs one installed here.+rustls = { workspace = true }serde = { workspace = true }serde_json = { workspace = true }sqlx = { workspace = true }diff --git a/rust/usage-ingestion/src/counters.rs b/rust/usage-ingestion/src/counters.rsindex 2d064efcd4f1..239214b2491c 100644--- a/rust/usage-ingestion/src/counters.rs+++ b/rust/usage-ingestion/src/counters.rs@@ -398,6 +398,9 @@ pub fn spawn_flush_task(config: CounterConfig,) {tokio::spawn(async move {+ // Publish the series before the first connect, so a flush loop that dies reads as+ // disconnected rather than as a projection nobody enabled.+ metrics::gauge!("usage_ingestion_redis_counter_connected").set(0.0);let mut ticker = tokio::time::interval(interval);let mut store: Option<Arc<dyn CounterStore>> = None;loop {diff --git a/rust/usage-ingestion/src/main.rs b/rust/usage-ingestion/src/main.rsindex f1d206f5a81e..070ecb2a7847 100644--- a/rust/usage-ingestion/src/main.rs+++ b/rust/usage-ingestion/src/main.rs@@ -22,6 +22,12 @@ use usage_ingestion_proto::usage_ingestion::v1::usage_ingestion_server::UsageIng#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> {+ // Without this, the first TLS handshake to Valkey panics the task that made it, which+ // takes the counter flush loop down before it reports anything.+ rustls::crypto::aws_lc_rs::default_provider()+ .install_default()+ .expect("failed to install rustls CryptoProvider");+let log_layer = {let base = tracing_subscriber::fmt::layer().with_target(true)