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(capture): install rustls CryptoProvider in capture-apm-metrics (#97627)

Frank Hamand39d26a5a4e34
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 4a8d109de85a..a30e0ff2e2e4 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -2243,6 +2243,7 @@ dependencies = [
"metrics",
"opentelemetry-proto 0.29.0",
"prost 0.13.5",
+ "rustls 0.23.37",
"serde",
"serde_json",
"siphasher 1.0.2",
diff --git a/rust/capture-apm-metrics/Cargo.toml b/rust/capture-apm-metrics/Cargo.toml
index f1a9ccbcf915..dbb593a5699f 100644
--- a/rust/capture-apm-metrics/Cargo.toml
+++ b/rust/capture-apm-metrics/Cargo.toml
@@ -17,6 +17,8 @@ capture = { path = "../capture" }
capture-logs = { path = "../capture-logs" }
common-compression = { path = "../common/compression" }
common-redis = { path = "../common/redis" }
+# redis leaves the rustls provider to the binary, so `rediss://` needs one installed here.
+rustls = { workspace = true }
tower-http = { workspace = true }
envconfig = { workspace = true }
bytes = { workspace = true }
diff --git a/rust/capture-apm-metrics/src/main.rs b/rust/capture-apm-metrics/src/main.rs
index 142f8a57c385..887cd7aab7a2 100644
--- a/rust/capture-apm-metrics/src/main.rs
+++ b/rust/capture-apm-metrics/src/main.rs
@@ -132,6 +132,11 @@ async fn start_series_label_gate(config: &Config) -> Arc<SeriesLabelGate> {
#[tokio::main]
async fn main() {
+ // Without this, the first TLS handshake to Valkey panics the task that made it.
+ rustls::crypto::aws_lc_rs::default_provider()
+ .install_default()
+ .expect("failed to install rustls CryptoProvider");
+
setup_tracing();
info!("Starting up...");