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(flags): add posthog-rs to SDK User-Agent allowlist (#62594)

Phil Haack2e6eaf8313a1
diff --git a/posthog/test/test_feature_flag_analytics.py b/posthog/test/test_feature_flag_analytics.py
index 23f33f7f7bb6..f4b3c677d50b 100644
--- a/posthog/test/test_feature_flag_analytics.py
+++ b/posthog/test/test_feature_flag_analytics.py
@@ -611,6 +611,7 @@ class TestSdkBreakdown(BaseTest):
"posthog-java",
"posthog-dotnet",
"posthog-elixir",
+ "posthog-rs",
"posthog-android",
"posthog-ios",
"posthog-react-native",
diff --git a/products/feature_flags/backend/flag_analytics.py b/products/feature_flags/backend/flag_analytics.py
index 3b2a5083d836..a9fec11da6e0 100644
--- a/products/feature_flags/backend/flag_analytics.py
+++ b/products/feature_flags/backend/flag_analytics.py
@@ -35,6 +35,7 @@ SDK_LIBRARIES = [
"posthog-java",
"posthog-dotnet",
"posthog-elixir",
+ "posthog-rs",
"posthog-android",
"posthog-ios",
"posthog-react-native",
diff --git a/rust/feature-flags/src/handler/decoding.rs b/rust/feature-flags/src/handler/decoding.rs
index e4342aa667b4..920192f5a373 100644
--- a/rust/feature-flags/src/handler/decoding.rs
+++ b/rust/feature-flags/src/handler/decoding.rs
@@ -575,6 +575,7 @@ mod tests {
#[case(Some("posthog-node/2.2.0"), "posthog-node")]
#[case(Some("posthog-dotnet/1.0.0"), "posthog-dotnet")]
#[case(Some("posthog-elixir/0.2.0"), "posthog-elixir")]
+ #[case(Some("posthog-rs/0.10.0"), "posthog-rs")]
#[case(
Some("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"),
"browser"
diff --git a/rust/feature-flags/src/handler/flags.rs b/rust/feature-flags/src/handler/flags.rs
index a8a1969fa748..3f72ede749ec 100644
--- a/rust/feature-flags/src/handler/flags.rs
+++ b/rust/feature-flags/src/handler/flags.rs
@@ -636,6 +636,7 @@ mod tests {
"posthog-node/2.2.0",
"posthog-dotnet/1.0.0",
"posthog-elixir/0.2.0",
+ "posthog-rs/0.10.0",
];
for sdk in server_sdks {
diff --git a/rust/feature-flags/src/handler/types.rs b/rust/feature-flags/src/handler/types.rs
index 9cfaf4ceaac9..4553c776a4b7 100644
--- a/rust/feature-flags/src/handler/types.rs
+++ b/rust/feature-flags/src/handler/types.rs
@@ -122,6 +122,8 @@ pub enum Library {
PosthogDotnet,
/// posthog-elixir SDK
PosthogElixir,
+ /// posthog-rs SDK
+ PosthogRs,
/// posthog-android SDK
PosthogAndroid,
/// posthog-ios SDK
@@ -152,6 +154,7 @@ impl Library {
Library::PosthogJava => "posthog-java",
Library::PosthogDotnet => "posthog-dotnet",
Library::PosthogElixir => "posthog-elixir",
+ Library::PosthogRs => "posthog-rs",
Library::PosthogAndroid => "posthog-android",
Library::PosthogIos => "posthog-ios",
Library::PosthogReactNative => "posthog-react-native",
@@ -174,6 +177,7 @@ impl Library {
Library::PosthogJava,
Library::PosthogDotnet,
Library::PosthogElixir,
+ Library::PosthogRs,
Library::PosthogAndroid,
Library::PosthogIos,
Library::PosthogReactNative,
@@ -274,6 +278,7 @@ mod tests {
#[case("posthog-java/1.2.0", Library::PosthogJava)]
#[case("posthog-dotnet/1.0.0", Library::PosthogDotnet)]
#[case("posthog-elixir/0.2.0", Library::PosthogElixir)]
+ #[case("posthog-rs/0.10.0", Library::PosthogRs)]
#[case("posthog-server/1.0.0", Library::PosthogServer)]
#[case("posthog-server/3.2.1 (Android SDK)", Library::PosthogServer)]
// Client-side SDKs
@@ -358,6 +363,7 @@ mod tests {
#[case(Library::PosthogJava, "posthog-java")]
#[case(Library::PosthogDotnet, "posthog-dotnet")]
#[case(Library::PosthogElixir, "posthog-elixir")]
+ #[case(Library::PosthogRs, "posthog-rs")]
#[case(Library::PosthogAndroid, "posthog-android")]
#[case(Library::PosthogIos, "posthog-ios")]
#[case(Library::PosthogReactNative, "posthog-react-native")]
@@ -378,6 +384,7 @@ mod tests {
#[case(Library::PosthogJava, "\"posthog-java\"")]
#[case(Library::PosthogDotnet, "\"posthog-dotnet\"")]
#[case(Library::PosthogElixir, "\"posthog-elixir\"")]
+ #[case(Library::PosthogRs, "\"posthog-rs\"")]
#[case(Library::PosthogAndroid, "\"posthog-android\"")]
#[case(Library::PosthogIos, "\"posthog-ios\"")]
#[case(Library::PosthogReactNative, "\"posthog-react-native\"")]
diff --git a/rust/feature-flags/src/utils/user_agent.rs b/rust/feature-flags/src/utils/user_agent.rs
index 4add0852aa6f..6a61cbf1aa14 100644
--- a/rust/feature-flags/src/utils/user_agent.rs
+++ b/rust/feature-flags/src/utils/user_agent.rs
@@ -98,6 +98,7 @@ impl UserAgentInfo {
"node" => ("posthog-node", RuntimeType::Server),
"dotnet" => ("posthog-dotnet", RuntimeType::Server),
"elixir" => ("posthog-elixir", RuntimeType::Server),
+ "rs" => ("posthog-rs", RuntimeType::Server),
// Deprecated: posthog-server users are migrating to posthog-java
"server" => ("posthog-server", RuntimeType::Server),
// Client-side SDKs (mobile and browser)
@@ -233,6 +234,12 @@ mod tests {
Some("0.2.0"),
RuntimeType::Server
)]
+ #[case(
+ "posthog-rs/0.10.0",
+ Some("posthog-rs"),
+ Some("0.10.0"),
+ RuntimeType::Server
+ )]
#[case(
"posthog-server/1.0.0",
Some("posthog-server"),
@@ -355,6 +362,7 @@ mod tests {
#[case(Some("posthog-node/2.2.0"), "posthog-node")]
#[case(Some("posthog-dotnet/1.0.0"), "posthog-dotnet")]
#[case(Some("posthog-elixir/0.2.0"), "posthog-elixir")]
+ #[case(Some("posthog-rs/0.10.0"), "posthog-rs")]
#[case(Some("posthog-server/1.0.0"), "posthog-server")]
#[case(
Some("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"),
@@ -380,6 +388,7 @@ mod tests {
#[rstest]
#[case("posthog-python/3.0.0", Some("posthog-python"))]
#[case("posthog-node/1.2.3", Some("posthog-node"))]
+ #[case("posthog-rs/0.10.0", Some("posthog-rs"))]
#[case("posthog-android/3.0.0", Some("posthog-android"))]
#[case("posthog-server/1.0.0", Some("posthog-server"))]
#[case("Mozilla/5.0 (Windows NT 10.0; Win64; x64)", Some("web"))]